ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
1

How can I communicate with a ros1 service from ros2 humble?

asked 2022-08-18 11:47:26 -0600

contradict gravatar image

I can get things to work if I stick with galactic, but there does not appear to be a build of ros1_bridge for humble and the build instructions on github don't work on ubuntu jammy (cannot install the required versions of boost). Here is a demonstration of the problem.

First, start a ros1 master and the demo service:

$ docker network create ros
724602ee919cae9c9decc71cfabcc098ecdf07d428df70a789059ea5303ef6d5
$ docker run -it --rm --net ros --name rosmaster osrf/ros:noetic-desktop roscore
...output ommitted...
$ docker run -it --rm --net ros --name server \
   -e ROS_MASTER_URI=http://rosmaster:11311/ \
   -e ROS_HOSTNAME=server \
   osrf/ros:noetic-desktop \
   rosrun roscpp_tutorials add_two_ints_server

Then, configure and create the bridge.

$ cat >bridge.yaml <<EOF
services_2_to_1:
  -
    service: /add_two_ints  # ROS 1 service name
    type: roscpp_tutorials/TwoInts  # The ROS 1 service type name
EOF
$ docker run -it --rm --net ros --name load \
   -e ROS_MASTER_URI=http://rosmaster:11311/ \
   -e ROS_HOSTNAME=interact \
   -v `pwd`/bridge.yaml:/bridge.yaml \
   osrf/ros:noetic-desktop rosparam load bridge.yaml
$ docker run -it --rm --net ros \
   -e ROS_MASTER_URI=http://rosmaster:11311/ \
   ros:galactic-ros1-bridge \
   ros2 run ros1_bridge parameter_bridge
The parameter 'topics' either doesn't exist or isn't an array
The parameter 'services_1_to_2' either doesn't exist or isn't an array
Trying to create bridge for ROS 1 service '/add_two_ints' with type 'roscpp_tutorials/TwoInts'
Created 2 to 1 bridge for service /add_two_ints

This setup works fine if I make the request from galactic

$ docker run -it --rm --net ros osrf/ros:galactic-desktop \
   ros2 service call /add_two_ints example_interfaces/srv/AddTwoInts "{a: 1, b:2}"
requester: making request: example_interfaces.srv.AddTwoInts_Request(a=1, b=2)

response:
example_interfaces.srv.AddTwoInts_Response(sum=3)

But hangs if I make the request from humble:

$ docker run -it --rm --net ros osrf/ros:humble-desktop \
   ros2 service call /add_two_ints example_interfaces/srv/AddTwoInts "{a: 1, b: 2}"
requester: making request: example_interfaces.srv.AddTwoInts_Request(a=1, b=2)

Is there a build of ros1_bridge that can communicate with humble? Are there instructions to create one somewhere?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2022-08-18 15:25:22 -0600

ljaniec gravatar image

Did you check out this tutorial Using ros1_bridge with upstream ROS on Ubuntu 22.04?

It requires using ROS 2 built from source:

The release of ROS 2 Humble (and Rolling) on Ubuntu 22.04 Jammy Jellyfish marks the first ROS 2 release on a platform with no official ROS 1 release. While ROS 1 Noetic will continue to be supported through the duration of its long term support window, it will only target Ubuntu 20.04. Alternatively, there are upstream variants of ROS 1 packages in Debian and Ubuntu that are not maintained as an official distribution by the ROS maintainers.

This guide outlines the current mechanism for bridging ROS 2 releases with these upstream packages on Ubuntu 22.04 Jammy Jellyfish. This provides a migration path for users who still depend on ROS 1, but desire moving to newer ROS 2 and Ubuntu releases.

edit flag offensive delete link more

Comments

2

Thank you! I missed that. The instructions are a bit tricky to follow so I created a Dockerfile demonstrating how I finally got it to work: https://github.com/contradict/ros-hum...

contradict gravatar image contradict  ( 2022-08-19 13:05:32 -0600 )edit
1

I think you could prepare a Pull Request with this Dockerfile there: https://github.com/ros2/ros2_document... - it will be helpful for everyone later!

ljaniec gravatar image ljaniec  ( 2022-08-19 19:10:17 -0600 )edit
0

answered 2022-09-27 06:17:07 -0600

hodnajit67 gravatar image

I think we can make a pull request to the official documentation Using ros1_bridge with upstream ROS on Ubuntu 22.04

with these steps:

RUN rm /etc/apt/sources.list.d/ros2.list &&\
    DEBIAN_FRONTEND=noninteractive apt-get update -y &&\
    DEBIAN_FRONTEND=noninteractive apt remove -y \
        python3-catkin-pkg python3-catkin-pkg-modules &&\
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
        ros-core-dev

I could not reproduce the process with the tutorial yet. Thanks very much for the dockerfile through.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-08-18 11:47:26 -0600

Seen: 215 times

Last updated: Sep 27