-
Notifications
You must be signed in to change notification settings - Fork 14
Workshop 3 ‐ Experimental data collection
First, synchronise your fork with the main repository on GitHub (Sync fork
) as some structural changes were made and new files were added. Then clone or pull the repository to your local PC and re-open it in the dev container using VSC. Rebuild the updated packages colcon build --symlink-install
, source the repository source install/setup.bash
and then run the simulator (or a real robot) in a new terminal. Test all the functionalities developed in Workshop 2. For example, to run the detector node, in a new terminal source the repository again and then run ros2 run rob2002_tutorial detect_basic.py
.
-
The easiest way to log ROS topics to a text file is through a Unix standard output redirection. For example, to log the output topic from the detector (
/object_polygon
), issue a ROS topic inspection commandros2 topic echo /object_polygon
and add the following redirection to the end of the command> detector_log.txt
. Leave it running for a while and then inspect the content of 'my_log.txt'. This way, you can log every possible ROS topic and any output from the node printed out to the terminal. Try it out for example with the console output of the counting noderos2 run rob2002_tutorial count_basic.py > counter_log.txt
. This general approach is typically useful if a quick solution for data logging is required. In general, such logs would require writing specialised reading parsers so that this information can be easily read and processed. -
A simple solution to store ROS topic data in a format suitable for further analysis is to change the output format to tabular which results in data structures which can be easily imported into other evaluation scripts. Let us take our previous example to illustrate the principle. Run the
ros2 topic echo --csv /odom > odom_log.csv
. Check out the resulting file and discuss how to import such data into Python for further processing. -
It is a good practice to separate the evaluation scripts and data from the ROS package functionality. We will use the
evaluation
folder for that purpose. First, make thedata
subfolder for storing temporary data files:mkdir evaluation/data
. Run one of the mover behaviours and log the odometry data using the following command:ros2 topic echo --csv /odom > evaluation/data/odom_log.csv
. Inspect the files and note where it is located and which columns correspond to x,y coordinates of the robot's position. Then run the data visualisation scriptpython3 evaluation/odom_visualisation.py
demonstrating a simple reading of tabular data and visualising the recorded odometry message (x and y coordinates). The results should be visible in the no-vcn browser window!
For image data, it is common to store the camera and processed images in an image file format rather than as rows of tabular data. The image logging functionality is included in the updated basic_counter.py
node. Check the code first to see how that is implemented. Then integrate that functionality into your own project and run the detector whilst placing the robot in front of the red object. Inspect the saved images.
Instead of running each node every time you work on your project, you can set up a launch file automatically starting all specified nodes. An example launch file detect_count.launch.py is included in the rob2002_tutorial
repository demonstrating how to start both the detection and counting nodes. First, incorporate that launch file into your project, keeping in mind that some changes are required to the setup.py
file (lines 2-3 and line 15 need to be copied over). Once you test that everything runs as required (ros2 launch rob2002_project detect_count.launch.py
), modify the launch file such it also starts the movement node.