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:
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.
# ----- 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)
# 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
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.