Using Robostack for ROS2

RoboFoundry
4 min readAug 11, 2022

--

In 2021 when I attended ROS World 2021 virtually, I was intrigued by one of the session given by Wolf Vollprecht called — RoboStack — cross-platform ROS packages for science, the cloud and Windows. However, I was not very familiar with the Conda/Mamba toolset so it went on the back burner for a while. However, recently I wanted to install Humble Hawksbill on a laptop that was still running Ubuntu 20.04 and the only way to get the Humble installed on it was using a docker. In addition, one of the folks I connected on Twitter mentioned a new plugin for editing URDF using a Jupyter notebook plugin and while trying to figure out how to install that plugin I again came across Robostack. So I figured I would give it another shot. This article is a description of steps I followed to get it up and running.

First some big advantages of using Robostack, this from the original post from Robostack folks on ROS discourse

Believe me Robostack contributors put in a lot of their own time to make this toolset such an amazing and easy to work with ROS and its labor of love for them so kudos to the entire team. If you have any issue or question reach out to them on Gitter or log an issue on their github page and they are super fast in responding. I ran into a problem while installing the Humble after I created the conda environment and I posted the question to them and got an answer in less than an hour and I was able to successfully install Humble after that.

Here are the main steps I followed to install Humble on my 12 year old laptop running Ubuntu 20.04. Again, these are the steps for Linux machine and if you are trying to install it on Windows machine you may have to tweak the steps.

Step 1

Pre-requisite — install mamba via miniforge[I did not have it so I had to install]

### first install mamba by running following command curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"bash Mambaforge-$(uname)-$(uname -m).sh

After installation is complete don’t forget to source your .bashrc file by running following command as the installation will append the location of mamba to PATH in your .bashrc file.

source ~/.bashrc

Step 2 — Install conda

### install condaconda install mamba -c conda-forge

Step 3 — Create new environment and activate it

### now create a new environment and activate [notice it uses python 3.9]mamba create -n ros_env python=3.9mamba activate ros_env### you can leave the env by running deactivate while you are in the env
mamba deactivate

Important Note:

Initially when you install conda, you get default (base) environment created for you automatically. Do not install any ROS packages in (base) environment. First create and activate your new ROS env and then install ROS packages there.

Step 4 — Add channels

### this adds the conda-forge channel to the new created environment configurationconda config --env --add channels conda-forge### add the robostack channelsconda config --env --add channels robostackconda config --env --add channels robostack-humble conda config --env --add channels robostack-experimental

Step 5 — install ROS2 Humble and compilers

mamba install ros-humble-desktop-full# optionally, install some compiler packages if you want to e.g. build packages in a colcon_ws:mamba install compilers cmake pkg-config make ninja colcon-common-extensions

Step 6 — test it out

At this point you should be able to run any standard ros2 commands.

### launch ros2 cli
ros2
### launch rviz2 GUI
rviz2
### launch a demo node talker
ros2 run demo_nodes_cpp talker
### from another terminal activate the conda env and launch a demo listener
ros2 run demo_nodes_cpp listener

Installing ROS2 Foxy side-by-side

Most of the commands and steps are same as for humble except these differences

1. Foxy requires python 3.8 so when you create a new mamba environment specify that like this

mamba create -n ros_foxy python=3.8

2. Activate the environment and add channels like this

### this adds the conda-forge channel to the new created environment configurationconda config --env --add channels conda-forge### and the robostack channels [we don't need to add humble channel]conda config --env --add channels robostackconda config --env --add channels robostack-experimental

3. Install ROS2 foxy like this

### Foxy desktop is not available at present so install the base pkgmamba install ros-foxy-ros-base### while you are in env e.g. ros_foxy you can verify that foxy is running separately by running following command and it should show a path separate from humble like this - /home/username/mambaforge/envs/ros_foxy/bin/ros2which ros2 

Cool thing is Robostack runs without any VMs so you can access the hardware directly as usual.

You can also go ahead and run Jupyter notebook on top of this. I’ll probably cover that topic in future article.

That’s it!! You have both ROS2 Humble and Foxy running in completely separate mamba environment with different versions of python.

Enjoy!!!

References

Robostack Home page

You can ask questions on Gitter here:

You can check Available packages here:

--

--