Skip to content

Running the Simulation

Brendon Jiang edited this page Sep 13, 2025 · 7 revisions
Top: Home

If you haven't already, visit the Getting Started page to set up your workspace first.

Tasks

1 Starting up docker

From a command-line interface of your choice (command prompt, terminal, etc.), navigate to the docker directory and start up the docker container:

cd onboarding_lab_docker
docker compose up

You should see the headline Welcome to the arcturus docker image! pop up in your terminal. If you don't know what a docker container is, you can imagine the command docker compose up as simply starting up a lightweight virtual machine that runs all of our ROS 2 code. To work with the virtual machine, we can open up a shell to the VM in a separate window with the command:

docker compose exec arcturus bash

We are now in the docker container! Your folder directory should look something like this:

.
└── arcturus
    └── dev_ws
        └── src
            ├── all_seaing_boat
            │   └── all_seaing_lab
            └── ros2-keyboard
                ├── keyboard
                └── keyboard_msgs

2 Building packages using colcon

We need to build our source code before being able to run the lab. ROS 2 provides us with colcon, a command-line tool to build, test, and use ROS 2 packages. Let's build the workspace using colcon:

cd ~/arcturus/dev_ws
colcon build --symlink-install

If you navigate around the directories using cd and ls, you will now see the new folders build, install, log:

Note: colcon build will generate these folders in whatever directory you run the command from, so be sure to be in your workspace before running the build command.

.
└── arcturus
    └── dev_ws
        ├── build
        ├── install
        ├── log
        └── src
            ├── all_seaing_boat
            │   └── all_seaing_lab
            └── ros2-keyboard
                ├── keyboard
                └── keyboard_msgs

These directories are auto-generated by colcon during the build process. You don't have to worry about whats in those folders (and shouldn't touch them unless you know what you are doing).

Now that we have built the ROS 2 workspace, how do we run the ROS 2 code?

3 Sourcing setup.bash

After running colcon build, you ALWAYS need to run the command:

source install/setup.bash

This tells ROS 2 where the generated folders are. This command needs to be ran whenever we open up a new terminal.

4 Running the simulation

Since we are running ROS 2 inside of docker, running GUI applications like RViz becomes a problem. We need to use NoVNC, a program that allows us to access the docker container virtually and run GUI applications.

Go to the link http://localhost:6080/vnc.html?resize=remote and press the connect button.

Open up a new terminal by right clicking the background and selecting Terminal. Since we are opening a new terminal, we need to first source the workspace:

cd ~/arcturus/dev_ws
source install/setup.bash

Now we can run the simulation using the command:

ros2 launch all_seaing_lab sim.launch.py

On top the top left corner of your current window, you should be able to see a small popup window. That's the joystick window. By focusing on the window (click on it), you can maneuver the boat (represented by a red arrow) inside Rviz via the keys QWE (turn left, forward, turn right).

To exit the simulation, click on the x on the Rviz window and press ctrl-C in your terminal.

Screenshot 2025-09-12 at 2 27 07 PM

Reference material: Configuring environment, Using ros2

Back: Getting Started Top: Home Next: Moving the boat

Clone this wiki locally