next up previous contents
Next: 4.2 Defining new entity Up: 4. The World File Previous: 4. The World File   Contents

4.1 Basic Syntax

A simple world file might look like this:

# This world file creates two robots with lasers.

environment 
( 
  file "cave.pnm" 
  scale 0.03 
)

position 
( 
  name "robot1" port 6665 pose [1 1 0] 
  player ()
  laser ()
)

position 
( 
  name "robot2" port 6666 pose [2 1 0] 
  player ()
  laser ()
)
This example shows the basic syntactic features of the world file format: comments, entities and properties. Comments are indicated by the # symbol; they may be placed anywhere in the file and continue to the end of the line. For example:
# This world file creates two robots with lasers.
Entities are indicated using type ( ... ) entries; each such entry instantiates an entity of type type. For example:
position ( ... )
creates a single position device (a bare-bones mobile robot). Entities may be nested to indicate that one entity is a ``child'' of another; thus:
position ( player () laser() )
creates a single position device with a Player server and laser attached to it. Think of child entities as physically sitting on their parent. Entities have properties, indicated using name value pairs:
position ( name "robot1" port 6665 pose [1 1 0] ... )
This entry creates a position device named ``robot1'' attached to port 6665, with initial position (1, 1) and orientation of 0. Property values can be either numbers (6665), strings (indicated by double quotes "robot1") or tuples (indicated by brackets [1 1 0]).


next up previous contents
Next: 4.2 Defining new entity Up: 4. The World File Previous: 4. The World File   Contents
2003-12-07