Skip to main content

ROS

ROS (Robot Operating System) is an open source software development kit for robotics applications.

ROS is supported on Ubuntu Linux, so the best way to run on Palmetto is by using Apptainer.

Downloading and customizing the container image

The base ROS image can be downloaded with the following command:

apptainer pull docker://ros:humble

In most cases, you will need to extend the base ROS distribution. You will need to extend the base image and install the necessary packages. In this example, we are extending the base ROS distribution with the "turtlesim" example packages as described by the Beginner: CLI tools tutorial.

Create the ros-humble-turtlesim.def file with the following contents:

Boostrap: docker
From: ros:humble

%post
apt -y update
apt -y install ros-humble-turtlesim
apt -y install '~nros-humble-rqt*'

Build the container image by running:

apptainer build ros-humble-turtlesim.sif ros-humble-turtlesim.def

Running the turtlesim program on Palmetto Desktop

Turtlesim is a lightweight simulator for learning ROS 2. It illustrates what ROS 2 does at the most basic level to give you an idea of what you will do with a real robot or a robot simulation later on.

To begin, access Open OnDemand and start a Palmetto Desktop job. This is a lightweight example, so only 2 CPUs and 4GB of memory are needed.

Once connected to your desktop session, open a terminal window.

Launching ROS as an Apptainer instance

We will begin by starting turtlesim as an Apptainer instance. This will allow us to open multiple terminal windows and execute commands in the same container.

apptainer instance start /path/to/ros-humble-turtlesim.sif ros

Now that we've started an instance of the container image with the name ros, let's launch turtlesim.

Launch Turtlesim

apptainer run instance://ros ros2 run turtlesim turtlesim_node

Since we are using the apptainer run command inside the instance ros, all required ROS files are sourced before the command ros2 is executed. You should now see the turtlesim window appear.

This command will run in the foreground, so future commands will need to be run in a new terminal window.

Control Turtlesim

In a new terminal window, start a new node to control the turtle.

apptainer run instance://ros ros2 run turtlesim turtle_teleop_key

You can now control the turtle using the arrow keys on your keyboard.

Open rqt

To use rqt, a graphical user interface (GUI) for ROS, run the following command in a new terminal window:

apptainer run instance://ros rqt

In the rqt window, you can now manipulate ROS elements.