UserPreferences

PathWinnerVisualization


Visualizing Winning Model Vectors over Path

It is often useful to see how the winning model vector of of the RAVQ changes as the robot is moving around the environment. This script allows the user to create an image which traces the robot's path through the environment, indicating which model vector was the wininer at each timestep. To do this, the program requires four things:

  1. The Python Imaging Library (which I will assume is installed).

  2. Access to font files in *.pil format (the special format of the Python Imaging Library).

  3. Access to the image used in the world file.

  4. A log of the robot's movement and model vectors

Setting Up the Python Imaging Library Fonts

The needed fonts are available in [WWW]this archive. Unzip them (using unzip, not gunzip) and put them someplace convenient. How to point the script to the fonts will be shown later.

Saving Data about the Robot's Activities

Saving the robot's path is relatively straightforward using the Stage truth interface. At each timestep, simply write the tuple returned by get_truth_pose() followed by the index of the current winning model vector to a file. Thus, each line of the file will have the following format: <xposition(mm)> <yposition(mm)> <angle(degrees)> <winner_index>

Using the Script

First, download the script, available [WWW]here. Before running the script, you must define a number of variables at the top the script. These are described below. Note: a version configurable from the command line is now available [WWW]here. The syntax of this new version is as follows: python PathImageGen_cline.py <image> <data>

It takes the following options:

--color displays robot's path in color (default off)
--markers=val 0 indicates robot's path with lines; 1 uses symbols; 2 uses model vector numbers (default 2)
--interval=val determines how frequently datapoints should be plotted (default 1)
--width=val when using line markers, determines line length (default 16)
--resolution=val provides the number of mm/pixel in the simulation (default 10)
--outfile=val provides the filename to which output should be written; note that image format is determined by the filename extension (default "default.ppm")

Settings

worldImageFilename
This should contain the full name and path of the image which defined the world in which the path data was collected.
pathDatatFilename
This should contain the full name and path of the file where the robot's path and winning model vectors were recorded.
fontFilename
This should contain the full name and path of the *.pil font file desired.
symbols
If set, then the symbol used to plot the robot's position indicates the winning model vector. Otherwise, lines are used to indicate the robot's position.
color
If set, then the color used to plot the robot's position indicates the winning model vector.
lineWidth
If lines are used to indicate the robot's position, then this variable sets the length of the line.
resolution
This value indicates the relationship between pixels and distance in the Stage simulator when the data was recorded. Find the resolution in the worldfile. Multiply this value by 1000 and enter it here.
interval
Sometimes successive datapoints are too close together. This indicates how many of the datapoints should be plotted. If interval is set to 1, then every datapoint is plotted. If interval is set to 2, then every other datapoint is plotted. If it is set to 3, then every third datapoint is plotted, and so on.

Running the Script

To run the script, simply type python PathImageGen.py <outputfilename>. The format used for the output file is determined by the extension of <outputfilename>. If no filename is given, then output is written to default.ppm.