Skip to content

IIT-SoftBots/ros-humble-ros1-bridge-builder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ros-humble-ros1-bridge-builder

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

System Architecture and Bridge Purpose

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.

How to create this builder docker images:

  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

How to create ros-humble-ros1-bridge package:

0.) Running a Temporary Docker Container with Host Networking

    cd ~/
    docker run -it --rm --network host ros-humble-ros1-bridge-builder bash

How to use ros-humble-ros1-bridge:

1.) 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:

simple test:

rosrun rospy_tutorials listener

2.) Then, starts ros1_bridge node inside the ros-humble-ros1-bridge docker container

  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-topics

3.) Now, starts ROS2 Humble system, inside the ROS2 Humble docker container

https://docs.ros.org/en/humble/How-To-Guides/Run-2-nodes-in-single-or-separate-docker-containers.html

docker pull osrf/ros:humble-desktop
docker run -it osrf/ros:humble-desktop
ros2 run demo_nodes_cpp talker

4.) 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 listener

How to use parameter_bridge instead of dynamic_bridge

In 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 bash

Once inside the Docker container, run:

parameter_bridge

This 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).

How to add custom message from ROS1 and ROS2 source code to use it with parameter_bridge

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_bridge

How to check if ros-humble-ros1-bridge is working with parameter_bridge:

Remember 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:=3

Now, 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.bash

Choose 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

About

Create a ros-humble-ros1-bridge package that can be used directly in ROS2 Humble

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Dockerfile 92.2%
  • Shell 7.8%