Draft: May 3, 2000
Modified: Oct. 6, 2003
A simulation environment for the control of the locomotion and reconfiguration for PolyBot robots is designed and implemented. PolyBot is a modular reconfigurable robot consisting of two types of modules: segment or node. A segment has one degree of freedom actuation with two interface plates, and a node is a cube with six interface plates. Modules can be connected in one of the four orientations through the interface plates. This document explains how to use this simulation environment.
The simulation environment is implemented in Java Platform 2 with Java 3D (OpenGL version). There are three modes of operation: stand-alone, applet, and remote server. Fig. C.1 shows the main view of the environment when it runs stand-alone or remote server.

Figure C.1 PolyBot simulation environment
The applet can be directly viewed from web browsers, in addition to the appletviewer. The ability to view through web browsers allows people who are curious about these systems to try it without actually downloading and building the software.
There are two levels of usage for this environment, curious and serious.
This simulation has the following features:
Note that this simulation only works for PolyBot structures with no loops. Structures with loops are over-constrained. The simulation does not solve the constraint satisfaction problem. The simulation does not detect self-collision either.
The 3D canvas displays the 3D modules. The modules can be viewed from any angle by simultaneously clicking and dragging the mouse. The horizontal and vertical sliding bars are used for moving the point of view. In addition, there are zooming and centering buttons for better viewing. When TrackRobot is selected, the point of view is automatically adjusted so that the robot is always in the center of the view.
The Config button pops up a configuration-setting window for selecting four different initial types of configurations, snake0, snake1, snake2, and spider, with various sizes N:
In addition, a file input can be defined for any initial configuration. This can only be used for the stand-alone or remote server mode. Fig. C.2 shows an example of a humanoid configuration and its XML input file.


Figure C.2 An example of an input configuration file
The input file represents a tree structure using a list started from the root. Every module other than the root specifies its parent, connection faces, and connection orientation. The IDs of the modules are generated from the order of the list.
When NMLConfig is selected, the Config button pops up a configuration-setting window for selecting three types of NML Configurations: snake, centipede or K-loop, where N is the number of nodes, M is an array of Booleans, indicating a body fragment in the centipede configuration, and L is an array of Booleans, indicating a leg fragment in the centipede configuration. Configurations of the same NML parameters have fixed reconfiguration sequences. For the loop, K is a parameter for K parallel loops; N has to be a multiplier of K.
A standard configuration can be save as an XML file and input later.
For any configuration, the orientation of the first module can be set as well.
There are four types of floors: flat, step, wall or ditch. A norm can be defined for the flat floor; slop, width and height can be defined for the step, wall or ditch. (Note that ditch is a wall with a negative height). One can also input a floor map from a file.
On the right side of the 3D canvas, there are fields for displaying related information. Use the mouse to pick a module, which will be highlighted in red in the 3D canvas. The module ID, and its 6D position will be displayed on the right side panel. If the module is a segment with joint actuation, the joint angle and its motion factor will be shown. The motion factor is a number from 0 to 1, characterizing which direction the joint is moving: 0 means the green face is fixed and 1 means the yellow face is fixed, 0.5 means both are moving. The 3D position, the joint angle and its motion factor can be set when OK is hit. The Cancel button ignores any change for the module. When Faulty is checked, the faulty module is simulated by equation: aα+br+c where α is the desired angle and r is a random variable ranging from –1 to 1, and a, b and c are constants, which are displayed below the checkbox and can be changed. The Reset button sets all the joint angles to 0. When the SetGoal button is hit, one can set a goal at (x, y), which will be displayed in 3D canvas.
The major difference in the GUI between the applet and stand-alone modes is the middle right side of the 3D canvas. In the applet mode, control status is displayed and in the stand-alone mode, Record checkbox and Replay buttons are shown. When Record is checked, the changes in joint angles will be recorded to a file, specified in the text field below. And Replay will replay the recorded file, specified in the text field below. The recorded file is always put in the directory “PBSim/record” with .rec surfix. For example, “test” in Record to File will generate a file “PBSim/record/test.rec” when Record is checked. And “test” in Replay from File will replay the previous recorded process in “PBSim/record/test.rec” after hitting Replay.
In addition to the applet and stand-alone modes, remote server mode can also be used. This mode is most useful for testing control algorithms, namely controlling the robot via an RMI interface. The details of the interface functions can be found in “PBSim/server”. To run the server, do
java -Djava.security.policy=PBSim/policy PBSim.server.SimImpl
To test it, also run a test client: appletviewer SimTest.html