This module adds labels, i.e. the relative pose of the Duckiebot, to our previously collected data using the duckietown localization system. Only post-processed and optimized data can be labelled.
First, we need the trajectory files generated from the post-processing and optimized data of the duckietown localization system and the image frames from the Duckiebot image stream. These files are stored in the 'trajectoryFiles' folder. The trajectory files can be one or split ‘.yaml’ files, which are named the same way as the folder they are in. For example, if the folder is called ‘autobot04_r2’, the trajectory .yaml files need to be called autobot04_r2_0.yaml, autobot04_r2_1.yaml , etc.. Additionally, a ‘image_timestamps.csv’ file is required containing the frames taken from the Duckiebot video stream bag files and their timestamp. A representation of the folder structure can be seen here:
- trajectoryFiles
- autobot04
- autobot04_0.yaml
- autobot04_1.yaml
- autobot04_2.yaml
- image_timestamps.csv
- autobot05
- autobot05_0.yaml
- autobot05_1.yaml
- autobot05_2.yaml
- image_timestamps.csv
- autobot04
In order to label the data, the Duckietown-World repository has to be downloaded and installed. Clone the folder with
git clone https://github.com/duckietown/duckietown-world.git
Change into the directory into the folder and execute
$ pip install -r requirements.txt
$ python3 setup.py build
$ python3 setup.py install
Check if the installation has been done correctly by executing
$ make tests-clean tests
and look at the figures generated in out-comptests/
The module reads in the pose for every timestamp of the trajectory that was generated by the localization system. Specifically, the Duckiebots relative position and heading. The module then matches the pose timestamps and the image frame timestamps. If the timestamps are not exactly the same, the pose is interpolated to match the timestamp of the image frames.
The trajectory can be visualized with the jupyter notebook TrajectoryVisualization.ipynb
. To start the notebook, open the terminal, execute the command
$ jupyter notebook
and open the notebook.
Depending on the map the recording was made on, change the map name from robotarium2 to the desired map. The available maps can be found in the Duckietown-World repository. Change the name of the desired folders where the trajectory .yaml files are saved in the folderNamesSingle variable. The TrajectoryVisualizaiton notebook provides an animated visualization of the Duckiebot for each timestep.
The labeling happens in the trajectoryAndImage2GroundTruth.py module. As for the TrajectoryVisualization notebook, change the map name link the folders in the folderNamesSingle list.
Execute the module with
$ python3 trajectoryAndImage2GroundTruth.py
. Please note that this can take some time, as there are thousand of datapoints. The labeling is done with the help of the powerful Duckietown-World. Once finished, the module will produce a output_labeled.csv file. In this file, each frame is annotated with the timestamp, the center distance to the middle of the lane (NOT middle of the tile), the relative heading and the tile.