ros2 / ros1_bridge

ROS 2 package that provides bidirectional communication between ROS 1 and ROS 2
Apache License 2.0
421 stars 274 forks source link

[Humble] No conversion from `rcl_interfaces/msg/Log` and `rosgraph_msgs/Log` #391

Open Timple opened 1 year ago

Timple commented 1 year ago

Bug report

Required Info:

Steps to reproduce issue

git clone https://github.com/contradict/ros-humble-ros1-bridge.git
cd ros-humble-ros1-bridge
docker build . -t bridge

Then run with this docker-compose file:

version: "2.1"
services:
  roscore:
    image: "ros:noetic"
    network_mode: host
    command: roscore
  ros1-bridge:
    image: bridge
    network_mode: host
    command: ros2 run ros1_bridge dynamic_bridge

Expected behavior

Bridging /rosout

Actual behavior

Not bridging /rosout

Additional information

Seems like the mapping is not found: https://github.com/ros2/rcl_interfaces/blob/humble/rcl_interfaces/mapping_rules.yaml

Relevant other issues:

https://github.com/ros2/ros1_bridge/issues/159 Was fixed, is broken again for humble https://github.com/contradict/ros-humble-ros1-bridge/issues/2 (Not the fault of the dockerfile I think)

Timple commented 1 year ago

PS. Also seems to be the case for rolling.

brow1633 commented 1 year ago

Not a fix, but a workaround to enable the use of ROS1 bridge with the above Dockerfile (without logging):

Instead of roscore run rosmaster --core

Timple commented 1 year ago

But that would mean I would need to configure all nodes to run without /rosout right?

faraz7321 commented 1 year ago

Hi! Were you able to resolve the issue? I am also experiencing the same error.

brow1633 commented 1 year ago

I did something similar here, but with the addition of rosbridge_suite: https://github.com/brow1633/ros_docker/blob/main/ros-humble-bridge

I'm not sure about configuring other nodes. I haven't run into issues, but haven't run this extensively to be honest.

Timple commented 1 year ago

@brow1633 because you are using rosmaster --core instead of roscore. Therefore you simply skip logging and there is no issue with converting the logging message.

Timple commented 1 year ago

So this https://github.com/ros2/ros1_bridge/issues/393#issuecomment-1471540515 led me to investigate the history.

The last working commit for Log messages was 81f8b08671c8d161a0f0482bae4580d4d01e69c9. Since 2381bf474aa70323752b9f66cb5bbe93a5b0f99c it's broken (PR #382).

@LoyVanBeek did you ever run in to problems with Log messages?

LoyVanBeek commented 1 year ago

Hey Tim

Nope, have never tried bridging those until now. We only use the parameter_bridge. When I configure it to bridge /rosout and type rcl_interfaces/msg/Log with this config:

topics:
  - topic: /rosout
    type: rcl_interfaces/msg/Log
    queue_size: 1

I get:

failed to create bidirectional bridge for topic '/rosout' with ROS 2 type 'rcl_interfaces/msg/Log': No template specialization for the pair

We're still on Foxy + Noetic btw.

Even with the mapping rules in https://github.com/ros2/rcl_interfaces/blob/humble/rcl_interfaces/mapping_rules.yaml, the 'enum' for error levels also doesn't yet line up. And the ROS1 field topics[] is also missing from the ROS 2 variant. But I'd expect that to be fine: https://github.com/ros2/ros1_bridge/commit/2381bf474aa70323752b9f66cb5bbe93a5b0f99c#diff-addbc08357f431e24b7c461dce9513f7aa52338c08319c8929b17e213a9e4037R808-R822

    ros1_field_missing_in_ros2 = any(ros1_fields_not_mapped)

    if ros1_field_missing_in_ros2:
        # if some fields exist in ROS 1 but not in ROS 2
        # check that no fields exist in ROS 2 but not in ROS 1
        # since then it might be the case that those have been renamed and should be mapped
        for ros2_member in ros2_spec.structure.members:
            for ros1_field in ros1_spec.parsed_fields():
                if ros1_field.name.lower() == ros2_member.name:
                    break
            else:
                # if fields from both sides are not mappable the whole message is not mappable
                return None
return mapping

So I'm not sure what the problem is. I have a branch on my fork https://github.com/LoyVanBeek/ros1_bridge/tree/debug/mapping_uuids that adds a whole bunch of logging to pinpoint this. All I have to offer at the moment.

kennyS99 commented 9 months ago

Yes, i found the same issue for rolling ros2 version. i installed the ros noetic version in my ubuntu22 docker container built from source. and when I print out the pairs, there is no output like this: " - 'rcl_interfaces/msg/Log' (ROS 2) <=> 'rosgraph_msgs/Log' (ROS 1)"

I have tried many methods to solve this problem, but it does not work. i would appreciate that If anybody could provide a solution to it.

kennyS99 commented 9 months ago

Yes, i found the same issue for rolling ros2 version. i installed the ros noetic version in my ubuntu22 docker container built from source. and when I print out the pairs, there is no output like this: " - 'rcl_interfaces/msg/Log' (ROS 2) <=> 'rosgraph_msgs/Log' (ROS 1)"

I have tried many methods to solve this problem, but it does not work. i would appreciate that If anybody could provide a solution to it.

Hi guys, I have solved this problem with this commit b9f1739fd84fc877a8ec6e5c416b65aa2d782f89. My work env is (ubuntu 22 jammy + build from source ros noetic + ros2 rolling) docker container.

Timple commented 9 months ago

You are pointing to a commit that modified a typo in a readme. I guess you meant another commit?

kennyS99 commented 9 months ago

This commit 81f8b08 is still stuck on the same issue that /rosout topics cannot be mapped. Nope, this commit solved my problem. https://github.com/ros2/ros1_bridge/commit/b9f1739fd84fc877a8ec6e5c416b65aa2d782f89

limshoonkit commented 7 months ago

is there a solution to this problem? failed to create 2to1 bridge for topic '/rosout' with ROS 2 type 'rcl_interfaces/msg/Log' and ROS 1 type 'rosgraph_msgs/Log': No template specialization for the pair

do we just checkout the code at this point of commit https://github.com/ros2/ros1_bridge/commit/b9f1739fd84fc877a8ec6e5c416b65aa2d782f89?

Timple commented 7 months ago

We do. But it's a shame we miss all the new features and improvements that are being implemented.

But that's how it goes: workaround is in place, so the issue plunges down the backlog :slightly_frowning_face:

limshoonkit commented 7 months ago

@Timple,

Thanks for the follow up. I modified https://github.com/contradict/ros-humble-ros1-bridge/blob/main/Dockerfile to checkout the commit. Screenshot from 2023-11-14 17-05-29

Afterwards, I tried running the examples. I have the following docker containers running with -net=host option.

ros-humble-ros1-bridge running ros1-bridge osrf/ros:noetic-desktop-full running roscore osrf/ros:noetic-desktop-full for running ros1 talker osrf/ros:humble-desktop-full for running ros2 listener

i can see that the bridge is connected Screenshot from 2023-11-14 17-13-44

but my listener is not outputting anything. Screenshot from 2023-11-14 17-14-39

is there another bug i am unaware of?

update

I run the commnad ros2 topic info /chatter --verbose Type: std_msgs/msg/String

Publisher count: 1

Node name: _NODE_NAMEUNKNOWN Node namespace: _NODE_NAMESPACEUNKNOWN Topic type: std_msgs/msg/String Endpoint type: PUBLISHER GID: 01.0f.0c.f2.55.00.80.68.01.00.00.00.00.00.12.03.00.00.00.00.00.00.00.00 QoS profile: Reliability: RELIABLE History (Depth): UNKNOWN Durability: VOLATILE Lifespan: Infinite Deadline: Infinite Liveliness: AUTOMATIC Liveliness lease duration: Infinite

Subscription count: 1

Node name: _NODE_NAMEUNKNOWN Node namespace: _NODE_NAMESPACEUNKNOWN Topic type: std_msgs/msg/String Endpoint type: SUBSCRIPTION GID: 01.0f.0c.f2.55.00.80.68.01.00.00.00.00.00.13.04.00.00.00.00.00.00.00.00 QoS profile: Reliability: BEST_EFFORT History (Depth): UNKNOWN Durability: VOLATILE Lifespan: Infinite Deadline: Infinite Liveliness: AUTOMATIC Liveliness lease duration: Infinite

and apparently the Node name for the ros1_bridge package in my ros2 humble docker is not defined. _NODE_NAMEUNKNOWN i am expecting the node to be ros1_bridge as i can see it in my ros1 noetic docker with rosnode list.

issue resolved

problem was my docker network configuration and host firewall settings, the ros1_bridge works fine. recommend to disable firewall with sudo ufw disable

Timple commented 7 months ago

Not to my knowledge.

But if you go bug-hunting: might as well try the master :wink:

TommyChangUMD commented 7 months ago

Hi. This thread helped me a lot in getting the ros1-bridge to work on my ROS2 Humble + ROS Noetic setup. I've created a Docker image that can build the ros-humble-ros1-bridge package in 10 minutes -- no need to compile ROS2 Humble from the source. You can find my setup here: https://github.com/TommyChangUMD/ros-humble-ros1-bridge-builder/

KKSTB commented 6 months ago

Hi @TommyChangUMD

Nice work. I actually made it to work on ROS2 Iron + ROS Noetic. Also the bridge works by copying the build output into my ROS2 install folder which is very neat and clean.

smith-doug commented 5 months ago

I'm running a horrible amalgamation of master + action support + some cherry picked fixes. I had to create custom convert_2_to_1 template specializations to convert the severity levels between ros1/ros2. The dynamic bridge needed an extra check to set the QoS for /rosout as well. The other nodes might need that too, but I haven't looked at them.

I'm not sure if this repo is still alive, or will accept changes for humble.