S IMULATION S YSTEMS
13.5 EyeSim Environment and Parameter Files
All environments are modeled by 2D line segments and can be loaded from text files. Possible formats are either the world format used in the Saphira robot operating system [Konolige 2001] or the maze format developed by Bräunl following the widely used “Micro Mouse Contest” notation [Bräunl Figure 13.5: Random drive of six robots
Simulation Systems
13
World format The environment in world format is described by a text file. It specifies walls as straight line segments by their start and end points with dimensions in millimeters. An implicit stack allows the specification of a substructure in local coordinates, without having to translate and rotate line segments. Com-ments are allowed following a semicolon until the end of a line.
The world format starts by specifying the total world size in mm, for exam-ple:
width 4680 height 3240
Wall segments are specified as 2D lines [x1,y1, x2,y2], so four integers are required for each line, for example:
;rectangle 0 0 0 1440 0 0 2880 0 0 1440 2880 1440 2880 0 2880 1440
Through an implicit stack, local poses (position and orientation) can be set.
This allows an easier description of an object in object coordinates, which may be offset and rotated in world coordinates. To do so, the definition of an object (a collection of line segments) is enclosed within a push and pop statement, which may be nested. Push requires the pose parameters [x, y, phi], while pop does not have any parameters. For example:
;two lines translated to [100,100] and rotated by 45 deg.
push 100 100 45 0 0 200 0 0 0 200 200 pop
The starting position and orientation of a robot may be specified by its pose [x, y, M], for example:
position 180 1260 -90
Maze format The maze format is a very simple input format for environments with orthogonal walls only, such as the Micro Mouse competitions. We wanted the simulator to be able to read typical natural graphics ASCII maze representa-tions, which are available from the web, like the one below.
Each wall is specified by single characters within a line. A “_” (at odd posi-tions in a line, 1, 3, 5, ..) denotes a wall segment in the y-direction, a “B” (at even positions in a line, 2, 4, 6, ..) is a wall segment in the x-direction. So, each line contains in fact the horizontal walls of its coordinate and the vertical wall segments of the line above it.
EyeSim Environment and Parameter Files
The example below defines a rectangle with two dividing walls:
_ _ _
| _|
|_|_ _|
The following shows the same example in a slightly different notation, which avoids gaps in horizontal lines (in the ASCII representation) and there-fore looks nicer:
_____
| _|
|_|___|
Extra characters may be added to a maze to indicate starting positions of one or multiple robots. Upper-case characters assume a wall below the charac-ter, while lower-case letters do not. The letters U (or S),D,L,R may be used in the maze to indicate a robot’s start position and orientation: up (equal to start), down, left, or right. In the last line of the maze file, the size of a wall segment can be specified in mm (default value 360mm) as a single integer number.
A ball can be inserted by using the symbol “o”, a box can be inserted with the symbol “x”. The robots can then interact with the ball or box by pushing or kicking it (see Figure 13.6).
_____________________________________________________
Simulation Systems
13
A number of parameter files are used for the EyeSim simulator, which determine simulation parameters, physical robot description, and robot sensor layout, as well as the simulation environment and graphical representation:
• myfile.sim
Main simulation description file, contains links to environment and robot application binary.
• myfile.c (or .cpp) and myfile.dll
Robot application source file and compiled binary as dynamic link library (DLL).
The following parameter files can be supplied by the application program-mer, but do not have to be. A number of environment, as well as robot descrip-tion and graphics files are available as a library:
• myenvironment.maz or myenvironment.wld
Environment file in maze or world format (see Section 13.5).
• myrobot.robi
Robot description file, physical dimensions, location of sensors, etc.
• myrobot.ms3d
Milkshape graphics description file for 3D robot shape (graphics rep-resentation only).
SIM parameter file
Program 13.2 shows an example for a “.sim” file. It specifies which envi-ronment file (here: “maze1.maz”) and which robot description file (here:
S4.robi”) are being used.
The robot’s starting position and orientation may be specified in the “robi” line as optional parameters. This is required for environments that do not spec-ify a robot starting position. E.g.:
robi S4.robi DriveDemo.dll 400 400 90
Figure 13.6: Ball simulation
EyeSim Environment and Parameter Files
ROBI parameter file
There is a clear distinction between robot and simulation parameters, which is expressed by using different parameter files. This split allows the use of dif-ferent robots with difdif-ferent physical dimensions and equipped with difdif-ferent sensors in the same simulation.
Program 13.2: EyeSim parameter file “.sim”
1 # world description file (either maze or world) 2 maze maze1.maz
3
4 # robot description file 5 robi S4.robi DriveDemo.dll
Program 13.3: Robot parameter file “.robi” for S4 soccer robot
1 # the name of the robi 2 name S4
3
4 # robot diameter in mm 5 diameter 186
6
7 # max linear velocity in mm/s 8 speed 600
9
10 # max rotational velocity in deg/s 11 turn 300
12
13 # file name of the graphics model used for this robi 14 model S4.ms3d
15
16 # psd sensor definition: (id-number from "hdt_sem.h") 17 # "psd", name, id, relative position to robi center(x,y,z) 18 # in mm, angle in x-y plane in deg
19 psd PSD_FRONT -200 60 20 30 0 20 psd PSD_LEFT -205 56 45 30 90 21 psd PSD_RIGHT -210 56 -45 30 -90 22
23 # color camera sensor definition:
24 # "camera", relative position to robi center (x,y,z), 25 # pan-tilt-angle (pan, tilt), max image resolution 26 camera 62 0 60 0 -5 80 60
27
28 # wheel diameter [mm], max. rotational velocity [deg/s], 29 # encoder ticks/rev., wheel-base distance [mm]
30 wheel 54 3600 1100 90 31
32 # motors and encoders for low level drive routines 33 # Diff.-drive: left motor, l. enc, right motor, r. enc 34 drive DIFFERENTIAL_DRIVE MOTOR_LEFT QUAD_LEFT
35 MOTOR_RIGHT QUAD_RIGHT
Simulation Systems