Create a "ros-humble-ros1-bridge" package that can be used directly within Ubuntu 22.02 (Jammy) ROS2 Humble. Both amd64 and arm64 architectures are supported.
-
Note1: It takes approximately 10 minutes on my PC, equipped with a 6-core CPU (12 logical cores) and 24GB of memory.
-
Note2: It takes about 1 GB of memory per logical CPU core to compile the ROS1 bridge. So, if your system has only 4 GB of memory but 100 logical CPU cores, it will still use only 4 logical cores for the compilation. Now, why does it take so much memory to compile? Well, you can blame the overuse of C++ templates...
-
Note3: If you are looking for ROS2 Jazzy + Ubuntu 24.04 support, see https://github.com/TommyChangUMD/ros-jazzy-ros1-bridge-builder
This Docker-based setup allows seamless communication between a robot's existing ROS 1 Noetic system (running natively on a base PC) and new software components developed in ROS 2 Humble.
To avoid modifying or risking the stability of the host system (Ego base PC running Ubuntu 20.04 with ROS 1 Noetic), the ROS 1–ROS 2 bridge is deployed inside a Docker container.
The full architecture on the base PC consists of:
-
ROS1 Noetic – Running directly on the host (Ego base PC).
-
Container A – Runs ROS2 Humble (used for developing or testing new software nodes).
-
Container B – Runs both ROS1 and ROS2 along with the ros1_bridge to enable bidirectional communication between the two systems.
This configuration ensures isolation between environments while enabling cross-communication through the bridge.
mkdir Docker_folders
cd Docker_folders
git clone https://github.com/IIT-SoftBots/ros-humble-ros1-bridge-builder.git
cd ros-humble-ros1-bridge-builder
# By default, ros-tutorals support will be built: (bridging the ros-humble-example-interfaces package)
docker build . -t ros-humble-ros1-bridge-builder --network host cd ~/
docker run -it --rm --network host ros-humble-ros1-bridge-builder bash1.) First start ROS1 Noetic node on the host PC that could be Alter-Ego PC or you personal PC with ROS1 Noetic or ROS1 Noetic Docker:
rosrun rospy_tutorials listener source /opt/ros/humble/setup.bash
source /ros-humble-ros1-bridge/install/local_setup.bash
ros2 run ros1_bridge dynamic_bridge
# or try (See Note2):
ros2 run ros1_bridge dynamic_bridge --bridge-all-topicsdocker pull osrf/ros:humble-desktop
docker run -it osrf/ros:humble-desktop
ros2 run demo_nodes_cpp talker4.) Finally, check if the communication is working, check rostopic list from both side ROS1 and ROS2:
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp listenerIn the config folder, there is a file named parameter_bridge_template.yaml, which depends on the ROBOT_NAME variable — a common environment variable typically defined in the robot’s base computer .bashrc file.
docker build . -t ros-humble-ros1-bridge-builder --network host
docker run -it --rm --network host --name ${ROBOT_NAME}_bridge --mount src=~/Docker_folders/ros-humble-ros1-bridge-builder/config/parameter_bridge_template.yaml,target=/parameter_bridge_template.yaml,type=bind --mount src=~/.bashrc,target=/host_bashrc,type=bind -e ROBOT_NAME=$ROBOT_NAME ros-humble-ros1-bridge-builder:latest bashOnce inside the Docker container, run:
parameter_bridgeThis command runs parameter_bridge.sh (which is located in the bin folder of the container’s repository). This script generates the parameter_bridge.yaml file based on the parameter_bridge_template.yaml file. As you can see, the resulting parameter_bridge.yaml inside the container is now configured according to the robot’s name (ROBOT_NAME).
If you want to include topics with custom messages in the parameter_bridge_template.yaml file, you need to enable it in the Dockerfile by setting the variable ARG ADD_alterego_custom_msgs=1. After that, customize the parameter_bridge_template.yaml file again and then run:
docker build . -t ros-humble-ros1-bridge-builder --network host
docker run -it --rm --network host --name ${ROBOT_NAME}_bridge --mount src=~/Docker_folders/ros-humble-ros1-bridge-builder/config/parameter_bridge_template.yaml,target=/parameter_bridge_template.yaml,type=bind --mount src=~/.bashrc,target=/host_bashrc,type=bind -e ROBOT_NAME=$ROBOT_NAME ros-humble-ros1-bridge-builder:latest bash
Once inside the Docker container, run:
parameter_bridgeRemember to start ROS1 on the host PC. In this case, to test the bridge, launch the Alter-Ego simulator by running the following file, as usual:
roslaunch alterego_gazebo main.launch AlterEgoVersion:=3Now, open a new terminal in the Docker container and check if the bridge can see the topics:
docker exec -it container_name bash
source /opt/ros/humble/setup.bash
source /root/ros1_ws/src/alterego_msgs/install/setup.bash
source /root/ros2_ws/src/alterego_msgs/install/setup.bashChoose one of the topics you customized in the parameter_bridge_template.yaml file and check if values are being received.
ros2 topic echo /ROBOT_NAME/alterego_state/lowerbody | grep mobile_base_pos_x