This lesson is being piloted (Beta version)

Docker container ROS

Overview

Teaching: 5 min min
Exercises: 0 min
Questions
  • How to run ROS container in Palmetto HPC

Objectives
  • Download ros docker file

  • Open Rviz and Gazebo GUI in container

What is ROS?

The Robot Operating System (ROS) is a set of software libraries and tools that help you build robot applications. From drivers to state-of-the-art algorithms, and with powerful developer tools, ROS has what you need for your next robotics project. And it’s all open source.

What is rviz?

rviz (short for “ROS visualization”) is a 3D visualization software tool for robots, sensors, and algorithms. It enables you to see the robot’s perception of its world (real or simulated).

What is Gazebo?

Gazebo is a 3D robot simulator. Its objective is to simulate a robot, giving you a close substitute to how your robot would behave in a real-world physical environment. It can compute the impact of forces (such as gravity).

Download ROS from dockerhub:

Website: https://hub.docker.com/_/ros

image Let’s download noetic and kinetic ROS version:

Request for a compute node with a gpu and pull the docker images

$ singularity pull docker://osrf/ros:noetic-desktop-full
$ singularity pull docker://osrf/ros:kinetic-desktop-full

2 sif files are created in the same directory:

image

Start the roscore in current terminal using either noetic or kinetic model

singularity exec -p ros_noetic-desktop-full.sif bash -c 'source /opt/ros/noetic/setup.bash; roscore'
singularity exec -p ros_kinetic-desktop-full.sif bash -c 'source /opt/ros/kinetic/setup.bash; roscore'

Here is the sample from using noetic version:

image

Open new terminal, go to login node and ssh -X to current compute node with graphical display, go to the singularity image location

Run any of these command for rviz/gazebo: for either noetic or kinetic model with NVIDIA support (using –nv)

singularity exec --nv -p ros_noetic-desktop-full.sif bash -c 'source /opt/ros/noetic/setup.bash; rviz'
singularity exec --nv -p ros_noetic-desktop-full.sif bash -c 'source /opt/ros/noetic/setup.bash; gazebo'
singularity exec --nv -p ros_kinetic-desktop-full.sif bash -c 'source /opt/ros/kinetic/setup.bash; rviz'
singularity exec --nv -p ros_kinetic-desktop-full.sif bash -c 'source /opt/ros/kinetic/setup.bash; gazebo'

Note: The -p is to make sure all child processes in the container are terminated when the container terminates.

image

The corresponding RVIZ window appears: image

Or Gazebo:

image

Similarly, you can use it without NVIDIA support:

singularity exec -p ros_noetic-desktop-full.sif bash -c 'source /opt/ros/noetic/setup.bash; rviz'
singularity exec -p ros_noetic-desktop-full.sif bash -c 'source /opt/ros/noetic/setup.bash; gazebo'
singularity exec -p ros_kinetic-desktop-full.sif bash -c 'source /opt/ros/kinetic/setup.bash; rviz'
singularity exec -p ros_kinetic-desktop-full.sif bash -c 'source /opt/ros/kinetic/setup.bash; gazebo'

Key Points

  • ROS, container