Using the FLAT5 Display

The Flat5 Display is compatible with Flat4 and higher. It features an enhanced environment display and new sensor displays.

For instructions on using the Spot control panel, see the simulated Spot web page.

Running the Flat5 Display

Add /u/robot/flat-root/flat5 to your CLASSPATH.

java flat.Flat [port-number] [environment-file]

Options:

  port-number          defaults to 6688
  environment-file     path to an environment file.
                       See /u/robot/flat-root/flat5/env/*.env

  Command-line arguments can be in any order.
  
  Normally, you give just the port number, which should correspond
  to the DISPLAY_PORT in the ".flat" file read by Flat4 when it starts.

GUI Interface

The buttons on the left side of the display (File, Edit, View, Robot) control the display. The display starts with an environment (if specified) but contains no robots. You must add a robot in order to perform a simulation. The robot is referenced by its name (e.g. Spot-1).

Menu Commands

Menu item Description
FILE
Use environment... Changes the environment in which the robot runs.
Help... Not yet implemented.
Quit Terminates the Flat program.
EDIT
Edit environment... Not yet implemented.
VIEW
Show names Toggles whether a mouse moving over a robot displays the name of the robot.
Set display scale... Changes the display scale of the environment. Options are 1x, 2x and 3x.
ROBOT
Add robot... Adds a new robot to the environment. The user selects a robot type and gives it a name.
Remove robot... Removes a robot from the environment. The user selects a robot by name.
Center all robots Moves all robots to the center of the environment.

Robot Movement and Data display

Mouse operation Description
Move over a robot Rolling the mouse over a robot displays the robot's name in a popup label, if the "Show names" option is turned on.
Left click on the background Moves a robot to that location. If there are multiple robots in the environment, the user selects one from a popup menu.
Right click or Control-Clickon the background Turns a robot to face that location. If there are multiple robots in the environment, the user selects one from a popup menu. This is Command-click on the Macintosh.
Middle click or Alt-Clickon a robot Displays a robot-specific control panel. This is Option-click on the Macintosh.

Controlling the display via a TCP connection

Every menu command and mouse click command can be controlled over a TCP connection. After starting Flat, connect to the correct TCP port and send command strings.

IMPORTANT! Each command is a string (i.e. it is enclosed in double quotes).

To send commands to the Flat Display, the first word in the command should be DISPLAY. The general format of a command is:


  "DISPLAY command optional-arguments"

Example Flat interaction

$ telnet arachne 6123
Trying 128.83.120.71...
Connected to arachne.cs.utexas.edu.
Escape character is '^]'.
"DISPLAY WhatRobots"
(:FLAT-DISPLAY :WHAT-ROBOTS 0)

"DISPLAY AddRobot"
"DISPLAY WhatRobots"
(:FLAT-DISPLAY :WHAT-ROBOTS 1 "Spot-1")

"DISPLAY MoveRobot Spot-1 100 100"
"DISPLAY MoveRobot Spot-1 -100 -100"
"DISPLAY MoveRobotTo Spot-1 100 100"

Remote commands

Optional parameters are surrounded by [brackets].

Commands accepted by the Flat5 Display.
Command Description
UseEnvironment filename Equivalent to the menu command of the same name.
GetEnvironmentSize Returns (:FLAT-DISPLAY :GET-ENVIRONMENT-SIZE <width> <height>)
Help Equivalent to the menu command of the same name.
Quit Equivalent to the menu command of the same name.
EditEnvironment [filename] Equivalent to the menu command of the same name.
ShowNames TRUE|FALSE Equivalent to the menu command of the same name.
SetDisplayScale 1|2|3 Equivalent to the menu command of the same name.
SetEnvironmentScale Sets the ratio of pixels to units in environment files.
AddRobot [robotClassName [robotName]] Equivalent to the menu command of the same name. Currently, the only classes are flat.display.spot.SpotDisplay and flat.display.tinman.TinmanDisplay. Note: TinmanDisplay requires Java2.
HideRobot robotName Hides, but does not delete, the given robot. A hidden robot can still move and leave marks.
ShowRobot robotName Makes a hidden robot visible again.
RobotMessage robotName Message Displays a short message on the fifth line of the Robot Manager for this robot. The message is the portion of the command line after the robot name and its trailing space. There is no need to enclose the message in quotes.
PerformRobotAction robotName [parameters] When the user clicks the middle mouse button on the robot, it currently activates a control panel for the robot, but the user can design robots that have different behavior. This action causes the robot to perform that function or functions. The other whole command string is passed to the command so it can parse any extra arguments.
SetRobotParameter [robotName param=value] Forwards the string "param=value" to the specified robot.
The robot must recognize the given parameter.
Currently, Spot recognizes only the parameters "NumberOfLasers=n",
where n is 1 or 2, and "UseSonar=<boolean>" where <boolean> is true or false.
GetRobotParameter [robotName param] Not yet implemented.
RemoveRobot [robotName] Removes the specified robot from the environment.
SensorData robot-name num-data data-type [COLOR hex-RGB-value] data-values... Sends sensor data to the specified robot. The number of values and their meaning is robot and sensor specific. Values can be integers or doubles. The user can optionally specify the color in which the data will be drawn.

The Spot display currently understands the data types SONAR, LASER-LEFT, LASER-RIGHT, LASER-TOP, LASER-LEFT-OBJECTS, LASER-RIGHT-OBJECTS, LASER-TOP-OBJECTS LASER-LEFT-SEGMENTS, LASER-RIGHT-SEGMENTS, LASER-TOP-SEGMENTS, LASER-LEFT-POINTS, LASER-RIGHT-POINTS, LASER-TOP-POINTS, POINTS-LEFT and POINTS-RIGHT.

Note: LASER-...-SEGMENTS, LASER-...-CIRCLE and LASER-...-POINTS are deprecated. Use the more general LASER-...-OBJECTS instead.

Sonar readings are relative to each individual sonar. The readings start with sonar 0 (facing forward) and proceed in a clockwise direction through sonar 11. The units are millimeters.

Laser readings specify distance r relative to the sensor. The units are millimeters. The drawing program assumes that the readings start at -90 degrees in the sensor coordinate system, and that they are spread equally across a 180-degree span. The display will rotate the readings into the robot's reference frame, but will not translate them to the center of the robot.

LASER-...-OBJECTS specifies that the command contains either segment, point or circle data as described below. It is a generalization of the object-specific commands (which are deprecated, but still functional).

Points-left and Points-right. Note: This and all of the following commands are deprecated. Use LASER-...-OBJECTS instead.

Point signifies a list of x and y values in the robot's coordinate system. The units are millimeters. The points are displayed on the left or right Laser display in the optionally-specified color and remain on the screen until another set of points is sent. To erase the points, send a command specifying 0 points. Since points come in pairs of coordinates, the number of data values should always be a multiple of 2.

Segment data specifies points P1 and P2 which indicate the start and end of the segment in the robot's coordinate system. The units are millimeters. Each point consists of two coordinates, x and y. So the number of data-values sent to the segment display should always be a multiple of 4.

Circle data specifies a center point, radius and thickness which define a circle in the robot's coordinate system. The units for x, y and r are millimeters. The center of the circle is at (x y) relative to the robot. The thickness is in pixels.

The segment and object displays are superimposed on the laser readings, in a different color. When new laser readings arrive, the display is cleared, but when new segments arrive they are superimposed on the existing readings. Sizes with dimension pixel are scaled by the current magnification of the map display.

Examples:
SensorData Spot-1 180 LASER-LEFT 403.9 417.3 425.4 ...
SensorData Spot-1 12 SONAR COLOR 44FF44 3.1 4.7 6.1 7.3 ...
SensorData Spot-1 12 LASER-LEFT-OBJECTS SEGMENT 1000 1200 33000 29700 ...
SensorData Spot-1 3 LASER-LEFT-OBJECTS COLOR FF2222 CIRCLE 1000 1200 5 2 ...
The forms below are deprecated
SensorData Spot-1 12 LASER-RIGHT-SEGMENTS 1000 1200 33000 29700 ...
SensorData Spot-1 4 POINTS-LEFT COLOR FA33EE 130 42 1095 1253

SetDisplayLabel robotName display-name new-label Changes the label on a robot's sensor display. The display-name can be one of: LASER-LEFT, LASER-RIGHT, SONAR, FILTERED-SONAR, LOCAL-NEIGHBORHOOD, CAMERA-LEFT or CAMERA-RIGHT. The camera sensor displays are not yet implemented. The message is the portion of the command line after the robot name and its trailing space. There is no need to enclose the message in quotes.
MoveRobot robotName delta-x delta-y Adjusts the robot's position on the display. This is sent by the simulator. It does not move the robot in the simulator.
MoveRobotTo robotName x y Jumps the robot to the given location. Same as mouse left click. X and Y must be integers. This is sent by the simulator. It does not move the robot in the simulator.
TurnRobot robotName delta-theta Turns the robot by an incremental number of degrees. The angle is integral degrees. This is sent by the simulator. It does not turn the robot in the simulator.
TurnRobotTo robotName theta Turns the robot to face the given angle. Similar to mouse right click. The angle is integral degrees. This is sent by the simulator. It does not turn the robot in the simulator.
CantMoveRobotTo robotName x y The display receives this message when the user tried to move the robot to a place where it would intersect a wall. The display displays an error message to the user.
PositionRobot robotName x y theta This moves and rotates the robot on the display, but also notifies the simulator that the robot has moved. This is equivalent to clicking the mouse to position the robot. The difference between this command and MoveRobotTo is that the latter is received as a message from the simulator, while this command is interpreted the same as a user-generated mouse click.
CenterAllRobots Equivalent to the menu command of the same name.
WhatRobots Returns a list of the robots in the environment.
Example: (:FLAT-DISPLAY :WHAT-ROBOTS 2 "Spot" "Tommy")
RobotMark robotName :CLEAR | :CIRCLE radius hex-RGB-color Either clears all marks for this robot or draws a circle of the specified radius and color on the screen. The units are pixels at 1x view scale. Use a radius of 1 to draw a single point.
This command can be used, for example, to mark the trail of a robot, or to mark distinctive places.
SimulationTime robotName time Used only by Flat. This updates the simulation time on the Robot Manager display.
RobotSpeed robotName linear-velocity rot-velocity Used only by Flat. This updates the robot speed on the Robot Manager display.
Sensors robotName message Used only by Flat. This updates the list of available sensors on the Robot Manager display.

Things to do

The display program should read the same ".flat" file that Flat4 reads. Then the user wouldn't have to specify a port number.

Implement the GetRobotParameter command.


[FLAT home]


Author: Micheal S. Hewett
Email: hewett@cs.utexas.edu
Last Updated: Wednesday, February 24, 1999