When porting packages from ROS Humble to ROS Noetic, we may want to test a (newly ported) ROS2 package with the other ROS1 packages to check for compatibility or run both the new ROS1 package and the old ROS2 package separately on the same physical system to check for regressions. The challenge is that ROS Noetic only runs on Ubuntu 22.04 and ROS Humble only runs on Ubuntu 20.04.
Additionally, elec mentioned that it would be inpractical to physically access the SBC frequently, making it hard to swap out SSDs with different OSes to test.
We create a virtual Docker environment with ROS Humble and Ubuntu 22.04. This keeps the current software setup (ROS Noetic, Ubuntu 20.04) on the SBC intact while allowing us to test ROS2 packages. A ros1_bridge is included to receive ROS1 messages from outside the Docker container and pass ROS2 messages to the native environment from within the container.
An alternative approach is to follow the steps in this guide in a Docker container. However, this requires building ROS2 from source, which makes it difficult to maintain. In this case, the same run_dev.sh script can be used to work with the container.
Can consider using VSCode Dev Containers for developing inside VSCode. This repo exists as a standalone solution for situations where we want to run Docker containers without VSCode, e.g., as part of a startup script or in tmux.
There are two Docker containers (ros-humble-ros1-bridge) and (ros-humble-desktop-full).
ros-humble-ros1-bridge allows ROS1 and ROS2 topics to be published and subscribed both ways in both the native and virtual environment. However, it cannot build ROS2 packages.
ros-humble-desktop-full provides a virtual environment to build ROS2 packages. These can then be run in ros-humble-ros1-bridge. However, it cannot bridge ROS1 topics.
This takes ~20 minutes:
git clone https://github.com/TommyChangUMD/ros-humble-ros1-bridge-builder.git
cd ros-humble-ros1-bridge-builder
docker build . -t ros-humble-ros1-bridge-builderdocker pull osrf/ros:humble-desktop-fullSet the configs in environments/.env.
./run_dev.sh
source /opt/ros/humble/setup.bash
source /ros-humble-ros1-bridge/install/local_setup.bash
ros2 run ros1_bridge dynamic_bridge --bridge-all-topicsSee README.md under "environments" folder
build refers to ros-humble-desktop-full. It is meant for building ROS2 packages and working with Ubuntu 22.04.
bridge refers to ros-humble-ros1-bridge.
Both environments have ROS2 with Ubuntu 22.04. However, the container with the ROS bridge sources both ROS1 and ROS2 packages and cause problems with building ROS2 packages. Thus, the separate build container was created for building ROS2 packages.
Dockerfile.base is written to support most containers. It installs essentials like sudo, vim, wget.
Dockerfiles ending with environment names (e.g., Dockerfile.build for the build environment) build specific stuff for that environment.
For now, ROS package dependencies should be handled by rosdep as dependencies are listed in package.xml and should not be replicated in a Dockerfile.