Flat Environment Specification 1.0


The specifications in this document are compatible with all versions of Flat.
Flat v5 and higher understand additional specifications (such as color) described in the Flat Environment Specification 2.0.

How to Build a FLAT Environment

The 2-D environment in which the simulated robot moves is specified in an environment file. The environment file contains descriptions of geometric objects such as rectangles, polygons and circles that represent objects in the environment. See the files in /u/robot/flat-root/flat3/env/ for examples. This document describes how to construct an environment file.
Programmer's note: the environment file is parsed by the function parsePSGdrawObj in the file "gdrawObj.c", which is called in "xsim.c".

Special note: the sonar simulator does not recognize arcs, circles or points. The robot will not be able to sense obstacles constructed from those objects. When Flat starts running, you will see messages from the sonar simulator stating that those objects are ignored. It also ignores strings, but that is a good thing.

Size and boundaries of the environment

The drawing units are screen pixels and conform to standard drawing geometry, with (0,0) in the upper left corner of the area, the x coordinate increasing to the right and the y coordinate increasing downward. However, angles increase in a counter-clockwise direction, as in mathematical Geometry. Currently, this only matters with Arcs, which are not visible to the sonar anyway. The Simulator window is automatically sized to contain the specified environment. The robot can escape from the visible environment if there is an opening along the edge. Normally, you will place a polygon or rectangle around the entire area so that the robot cannot get out.

Syntax

Each command line must begin with "%_gdraw_ " (note the trailing space). Any other lines are ignored (treated as comments), including any Version 2 extensions.

Example file

The following environment is from /u/robot/flat-root/flat3/env/jagged.env, which generates an environment that looks like this:

%_gdraw_ rect 0 0 300 50           <- the bounding box
%_gdraw_ rect 0 0 50 10            <- the upper left rectangle
%_gdraw_ rect 70 0 30 20          
%_gdraw_ poly 120 0 160 0 160 15 120 10
%_gdraw_ rect 170 0 50 15
%_gdraw_ poly 120 50 160 40 170 50 120 50  <- the triangle at the bottom
%_gdraw_ rect 200 40 100 10

Table of graphics commands

All arguments are integers.

Command Arguments COMMENTS
arc x y width height start-angle sweep-angle Angles are in degrees, 0 is East, and angles increase counter-clockwise
circle x y radius
lines x1 y1 x2 y2 ... Creates a set of lines.
This is equivalent to the poly command, except
that the last point is not connected to the first point.
Do not leave more than one space after the word 'lines'.
Do not leave more than one space between each number.
point x y
poly x y x y ... Any number of points can be specified.
The polygon will automatically be closed by
connecting the last point to the first point.
Do not leave more than one space after the word 'poly'.
Do not leave more than one space between each number.
rect x y width height
string "characters" x y The bottom left edge of the string starts at (x,y).


[FLAT home]


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