Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

External dependencies
The scripts often uses matplotlib to plot graphics and numpy and scipy for advanced numerical routines. If you have problems running the scripts make sure these Python libraries are installed on your system.

Modifying the ca2 debug file format
As you can imagine, the parsing of the debug file is strongly dependent on its format. This means that if you change the name of the attributes written in the file for example, the scripts might not work as expected. The parsing does not depend on the order of the attributes so it is safe to change it.

...

plot_trajectory.py
This script allows to analyze offline the data of an experiment. The program ca2 saves a file in the same folder of the executable called "data_carX.txt" which contains lots of data describing position, speed, heading, etc. of the car in each car cycle. Similarly, the simulator produces a file called "debug_sim.txt" which is integrated by the script with the information in the car's file. The main difference between the two files is that the first one reports values of the physical quantities that are affected by measurement noise while the second one report also the real state of the system. Moreover, the car can records the status of the internal variables which are unknown to the simulator. The script can be used to debug experimental data (not simulated) using the command line option "o" (see below for full description).

Usage

  1. Run a simulation (or an experiment) to obtain the debug files. Do not stop the program with CTRL+C or the debug file will not be terminated correctly.
  2. Open plot_trajectory.py and set the car number and the paths to debug files you want to analyze.
  3. Run the script by typing python plot_trajectory.py on the console.
  4. Focusing the console, use keys (lowercase) 'n' to go to the next step, 'p' to go to the previous one, 'q' to quit.

The script displays four plot. On the top left corner there is the path and the trajectory of the car with some information. The little red cross represents the target point of the path. The other 3 graphics show the evolution of some attribute in time. You can configure which attribute to plot with the following precedure. Open "plot_trajectory.py" and use your editor's search feature (usually CTRL+F) to find the string "TODO". You should find a code section titled "TODO configure which info to plot". You can now assign to variables graphX_vals the arrays containing the info you want to be plotted. The little red crosses show the value of the specified attribute at the current step.

Command line options

  • -o:

util/predictor.py
This is a reimplementation in Python of the supervisor algorithms in "src/car_src/supervisor.c". It is very helpful for testing the supervisor offline instead of running the experiment on the test-bed over and over. This speed up considerably the debugging of the supervisor.

...