Skip to content

Simulation Tools

Simulation is useful for testing and validating models in a controlled environment. It can also be used for training learned models. This document provides setup instructions for the Autonomous Driving Simulator. It also allows you to run ROS2 on your computer for testing. A further advantage of setting up the simulator is to enable you to connect from RVIZ on your local computer to the car.

Setup

There are two main steps required to setup the simulator:

First we will setup the docker container to run ROS2. Then, we will install the Unity game engine and load the simulator project.

Setup ROS2 in Docker

We'll use the docker container to run ROS2 commands. In order to allow graphical programs to run inside the container, we'll use a TurboVNC server inside the container.

./container shell
  1. Install Docker on your computer, if you haven't already.

NOTE: Verify docker is working in your terminal by running docker --version. If you get an error, ensure docker is installed, and if using MacOS or Windows, ensure that the Docker Desktop app is running.

  1. Clone the roboracer_ws repository. To your home directory:
cd ~
git clone https://github.com/ut-av/roboracer_ws.git
  1. Check out the child git projects inside the roboracer_ws directory:
cd ~/roboracer_ws
./scripts/checkout.sh

Note: this will checkout the latest ROS code and download a copy of the simulator binary that will run inside the docker container.

  1. Build the docker container:
./container build
  1. Test the docker container:
./container shell
  1. Launch the turbovnc server inside the container:
vnc
  1. Download and install the TurboVNC viewer on your computer.

  2. Open TurboVNC and connect to the vnc server running locally on your computer, inside the docker container at localhost:5909.

  3. Now launch rviz2 from inside the container.

rviz2

Build the ROS workspace

Enter the container and build the ROS workspace:

./container shell
make

Launch the Simulator

Run the simulator tmux config:

Note: install tmuxinator first, if you haven't already.

cd ~/roboracer_ws/tmux/sim_teleop
tmuxinator

(Optional) Setup Unity

If you want to modify the simulator, you will need to setup Unity.

  1. Install Unity Hub

  2. Create a free Unity account if you do not already have one. Login to Unity Hub

  3. Clone the simulator repo into the ~/roboracer_ws directory.

cd ~/roboracer_ws
git clone https://github.com/ut-av/simulator.git
  1. Open the simulator project in Unity Hub

  2. Click "Add", "Add project from disk", then choose the directory "~/simulator/simulator/unity"

  3. When prompted, Install the latest LTS version of Unity.

  4. Wait for the the unity editor to download and install.

  5. Open the simulator project in Unity Hub by double clicking the project named "unity" in the "Projects" tab of the Unity editor.