ROS 1 Noetic Container for Incus

No more slow VMs for the good old tried and tested

ROS 1 Noetic Container for Incus

ROS1 Noetic is the last of the original communication stack purpose built by the ROS Foundation that uses the master - slave approach. It has be succeeded by the newer ROS2 line but it still has its uses.its prequel its mostly Ubuntu Distro specific but with a few know - hows from the previous Tutorials its possible to have various OS level containers that are just as fast as installing on the host system but are portable enough to not brick your system packages. The previous tutorials are listed below:

Creating a New Container:

ROS2 Humble is recommended to be installed in Ubuntu 20.04 LTS.

Assuming that the name of the Container is ros-noetic

Launching the container

incus exec ros-noetic -- sudo --login --user ubuntu

Launch Shortcut (Optional)

I get it, sometimes that login command looks way too tedious to type (I'm Lazy), so we can create an alias (a.k.a short-cut) to login easily using:

incus alias add ubuntu 'exec @ARGS@ -- su -l ubuntu'
Use this command only once, Its not required for subsequent newly created containers

This will now condense the login method to:

incus ubuntu ros-noetic

Install ROS1 Noetic

This is identical to the instructions available from the Official Documentation:

A shorter and automated install is detailed in the later section but for now,

Long Install Method:

Setup your computer to accept software from packages.ros.org.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Setup your keys

sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

Installation

sudo apt update
sudo apt install ros-noetic-desktop-full python3-rosdep -y

Environment Setup

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Initialize Rosdep

sudo rosdep init
rosdep update

Short Install Method:

Install

wget -c https://raw.githubusercontent.com/qboticslabs/ros_install_noetic/master/ros_install_noetic.sh && chmod +x ./ros_install_noetic.sh && ./ros_install_noetic.sh

Uninstall

wget -c https://raw.githubusercontent.com/qboticslabs/ros_install_noetic/master/ros_uninstall_noetic.sh && chmod +x ./ros_uninstall_noetic.sh && ./ros_uninstall_noetic.sh

Optional Workflows:

GUI Support:

If you have not created the incus prior to this step, follow the instructions here, once the gui profile has been created, it can be added to our container.

incus profile add ros-noetic gui
Reboot the container using incus reboot ros-humble

Validation:

Login to the container:

incus ubuntu ros-noetic

Install x11-apps and check for a gui:

sudo apt install x11-apps -y
xeyes

Nvidia Drivers with CUDA support:

incus config device add ros-noetic gpu gpu gputype=physical
incus config set ros-noetic nvidia.runtime=true
incus config set ros-noetic nvidia.driver.capabilities=all
Reboot the container using incus reboot ros-humble

Validation:

Login to the container:

incus ubuntu ros-noetic

Run nvidia-smi:

nvidia-smi

Output:

Sat Jul 22 05:51:20 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.116.04   Driver Version: 525.116.04   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:07:00.0  On |                  N/A |
| 30%   42C    P8    12W / 170W |    347MiB / 12288MiB |      4%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

Install Conda / Mamba:

This has been covered in the tutorial here:

Follow this part whilst being in the container

Install VS-Code:

This has been covered in the tutorial here:

Follow this part whilst being in the container