Simulator Setup - Docker + ROS2

One of my big projects for Carnegie Mellon Racing - Autonomous in the Spring 2022 Semester was to setup an open-source simulator that would allow our software subteams to test their code in a simulated environment. This allows for rapid testing and iteration of the codebase without needing to deploy code on our expensive hardware.

The simulator was developed by the Edinburgh University Formula Student team and made open-source to help up-and-coming formula student teams test their code. The simulator simulates all aspects of a traditional autonomous formula-style racecar, including a VLP-16 LiDAR and Zed 2 Stereo Camera. Additionally, the simulator supports custom track generation, allowing users to specify the environment and track layout they want to test their system on.



ROS2 Galactic

The simulator is built on the ROS2 Galactic platform, sending out information via a Peer-to-Peer model in which subscriber nodes listen for any data published by the simulator. Throughout this project, I had to learn all of the intricacies related to ROS, including it's backend architecture, how to interface with nodes/topics, and how to visualize incoming data using RVIZ.

To the right is a Python script I wrote using the ROS package to collect time-synchronized LiDAR and Stereo Camera data from the simulator. The simulator output data from the onboard LiDAR and Stereo Camera as well as the ground-truth position for each cone. With this, we could run our algorithmns on the sampled data and compare our estimates to the ground-truth data. This allowed us to quantify the error in our algorithms and characterize what cases our pipeline was failing in.





Docker

One of the issues with the simulator is that it is only compatible with Ubuntu 16.04. Very few people on our team had machines running Linux, and even fewer were willing to dual-boot their Windows/Mac machines with Ubuntu. For this reason, I had to find a way to make the simulator compatible with everyone's machines, regardless of what operating system they were running.

For this reason, I chose to "Docker-ize" the simulator, wrapping it in a Ubuntu 16.04 container that made the code platform-independent. This was my first time using Docker, so I had to learn how to create a Dockerfile (shown to the left) and push it to a publicly-accessible repository on DockerHub. The container also comes with ROS2 Galactic, as well as several other dependencies pre-installed.