Defining Flat Worlds

Related Links


Overview

The 2D map that Flat uses to simulate the world is specified by an environment file. It is useful to be able to change the map when a robot enters a room, another building, or takes an elevator to another floor of a building. The Flat World file allows you to specify these map transition points.

Flat World file specification

For the impatient

# This is a comment # use uppercase keywords WORLD <world-name> <default-map> MAP <map-name> TRANSITION (x y radius [command]) <new-map-name> [(new-x new-y new-theta)] TRANSITION (x y radius [command]) <new-map-name> [(new-x new-y new-theta)] MAP <map-name> TRANSITION ... # Units are mm and degrees

In-depth Specification

When the robot moves to a given location, the map can either automatically change, or change when the user sends a command. For example, when the robot enters a room it may be useful to automatically change the map to a detailed map of the given room.

When the robot enters an elevator to go to another floor of a building, the map can't change automatically because Flat doesn't know which floor the robot is going to. In this case, the map change is described by both a location and a command that is sent to Flat. The example file below uses the commands "CLOSE-DOOR" to switch to a map containing only the elevator, and uses "GOTO-3" to tell Flat to use the 3rd floor map.

The file can contain blank lines and comments (lines starting with a '#' character). The parser is not very flexible, so don't put blank characters at the beginning of a line.

The WORLD command gives a name to this world specification and names a default map to be used in this world. At this time, the information in a WORLD command is not used.

The MAP command specifies the map to which succeeding transitions apply. Several transitions may follow a MAP command. The MAP command contains a map file name. Both Flat and the Flat Display must be able to access this file.

The TRANSITION command specifies where and when to switch to a new map. The format is:

TRANSITION <location/command> <new-map> [<new-location>] location/command ::= (x y radius [command]) new-location ::= (x y theta) Items in brackets are optional.

When the robot is within radius distance of the point (x, y), and there is no command, Flat will automatically switch to the new map. If a command is specified, Flat will only switch to the new map when the robot is at the location and the command is received (see the 't' command in the Flat control description). A command is a case-sensitive string.

The transition may also specify a new location for the robot. If specified, the robot is moved to the new location after the map changes.

The 4 types of transitions

Since there are two optional arguments to a TRANSITION definition, there are four different types of TRANSITION commands. These are shown below. If your maps overlay each other, as in the floors of a building, you will normally use type 2. When moving from building to building, you will probably use a type 1 transition.
   # ----- type 1: all arguments specified
   #MAP  map-1
   #TRANSITION (29800 9700 500 test1) map-1a (1 2 3)
   
   # ----- type 2: no new location for the robot
   #MAP  map-2
   #TRANSITION (29800 9700 500 test2) map-2a
   
   # ----- type 3: automatic, no new location
   #MAP  map-3
   #TRANSITION (29800 9700 500) map-3a
   
   # ----- type 4: automatic, new location
   #MAP  map-4
   #TRANSITION (29800 9700 500) map-4a (1 2 3)

Sample File

# Taylor Hall world generated by Mike Hewett  27 Apr 2000
#
# This file describes transitions between maps
# used by the Flat robot simulator.  

WORLD Taylor-Hall /u/robot/flat-root/flat5/env/taylor-4.env

# ----- ---------  into the elevator  -------------  -------

MAP  /u/robot/flat-root/flat5/env/taylor-5.env
TRANSITION (29800 9700 500 CLOSE-DOOR) /u/robot/flat-root/flat5/env/taylor-elevator.env

MAP  /u/robot/flat-root/flat5/env/taylor-4.env
TRANSITION (29800 9700 500 CLOSE-DOOR) /u/robot/flat-root/flat5/env/taylor-elevator.env

MAP  /u/robot/flat-root/flat5/env/taylor-3.env
TRANSITION (29800 9700 500 CLOSE-DOOR) /u/robot/flat-root/flat5/env/taylor-elevator.env

MAP  /u/robot/flat-root/flat5/env/taylor-2.env
TRANSITION (29800 9700 500 CLOSE-DOOR) /u/robot/flat-root/flat5/env/taylor-elevator.env

MAP  /u/robot/flat-root/flat5/env/taylor-1.env
TRANSITION (29800 9700 500 CLOSE-DOOR) /u/robot/flat-root/flat5/env/taylor-elevator.env


# ----- ---------  out of the elevator  -------------  -------

# ----- Move from the elevator to each floor
MAP  /u/robot/flat-root/flat5/env/taylor-elevator.env
TRANSITION (29800 9700 500 GOTO-1) /u/robot/flat-root/flat5/env/taylor-1.env
TRANSITION (29800 9700 500 GOTO-2) /u/robot/flat-root/flat5/env/taylor-2.env
TRANSITION (29800 9700 500 GOTO-3) /u/robot/flat-root/flat5/env/taylor-3.env
TRANSITION (29800 9700 500 GOTO-4) /u/robot/flat-root/flat5/env/taylor-4.env
TRANSITION (29800 9700 500 GOTO-5) /u/robot/flat-root/flat5/env/taylor-5.env

Using the Flat World file

The automatic map changes are neat, but beware of loops. If you have two automatic transitions specified at the same location, Flat will endlessly switch back and forth between the maps.

If you have a special map for a room, the map should include part of the hallway outside of the room because it can be seen through the open door.

To Do


[FLAT home]


Author: Micheal S. Hewett
Email: hewett@cs.utexas.edu
Last Updated: Friday, April 28, 2000