ros2 / domain_bridge

Bridge communication across different ROS 2 domains.
Apache License 2.0
57 stars 11 forks source link

Add Foxy support #60

Open aprotyas opened 3 years ago

aprotyas commented 3 years ago

PR description

This PR attempts to make domain_bridge a Foxy-compatible package - based off of the galactic branch.

The following changes have been introduced:

TODOs

I'll just list the things that are missing in Foxy for now:

Closes https://github.com/ros2/domain_bridge/issues/59.

Signed-off-by: Abrar Rahman Protyasha aprotyas@u.rochester.edu

aprotyas commented 3 years ago

I've targeted this PR to the galactic branch, but will change that ASAP if the maintainers could push a foxy branch off of the current repository head.

jacobperron commented 3 years ago

@aprotyas Thanks for working on this :) I've retargeted the PR to foxy (which is based on galactic).

jacobperron commented 3 years ago

I've also pushed a commit to your branch to make CI target Foxy (cce4273).

aprotyas commented 3 years ago

@jacobperron thanks for retargeting to foxy.

Question: from the TODOs in the PR description, should the preference be to backport the PRs which introduced said rclcpp functionality, or to opt for the alternative methods I listed (usually just falling back to the rmw/rcl headers)? The latter option is nontrivial for the rclcpp::*Policy enum classes and almost impossible for rclcpp::InitOptions::set_domain_id, but I've already done that for rclcpp::Context::get_domain_id in 925a5e1.


EDIT (10/30)

Alright, so domain_bridge_lib and its tests successfully compile now, but there are a bunch of test failues. It looks like they're almost all related to the fact that the domain ID is not set correctly. There really does seem to be no way to set the domain ID. Thoughts?

antonyramsy commented 2 years ago

Hi. I just tried to test this branch with with ROS foxy, but i encountered an error when a node begins to publish some data. I used the example_bridge_config.yaml file as mentioned in the readme file and published data in the chatter topic. the error is:

terminate called after throwing an instance of 'std::runtime_error'
  what():  unexpected callback being called

this is my example_bridge_config.yaml file:

name: my_bridge
from_domain: 0
to_domain: 3
topics:
  chatter:
    type: example_interfaces/msg/String

am i missing something alongway doing it or it's a known issue?

aprotyas commented 2 years ago

@antonyramsy this branch was still WIP and I didn't have enough bandwidth to get back to it for a while now.

I remember seeing these errors when I was testing this branch too, and the problem was that in Foxy, rcl offers no such API to set domain IDs -- check https://github.com/ros2/domain_bridge/pull/60#discussion_r742555634 for what I'd already (unsuccessfully) tried. I just never had time to fully verify that my approach in https://github.com/ros2/domain_bridge/pull/60/commits/efa97ae33fed98103a5030cf70e605dc7295ea1a works.

I might have some time to revive this PR soon-ish, but if you need this branch to work soon I think the way to go would be to run the tests in this package and debug the errors from there. As it is, I think your configuration is correct but the branch is not ready to land.

antonyramsy commented 2 years ago

@aprotyas Thanks a lot for the response. I will consider using this package along with other approaches i can take, and will inform if any progress in the development has taken place.

aprotyas commented 2 years ago

@jacobperron as of ff41c31, the end-to-end tests pass in this branch. I'm still struggling against the default lifespan and deadline values in QOS profiles.

From https://github.com/ros2/rmw/pull/301#pullrequestreview-595709837, it looks like in Foxy, the default zero values for the lifespan and deadline means each RMW uses its own default value, which is difficult to test against compared to the "max" duration enforced post-Foxy (i.e. rclcpp::Duration(std::numeric_limits<int64_t>::max())). Is there a way around this?


@antonyramsy, this branch may be good to go now. If possible, can you test this branch out?

aprotyas commented 2 years ago

@antonyramsy it looks like you're using a Humble distribution as your underlay, can you change to Foxy?

On Wed, Jun 1, 2022, 07:02 antonyramsy @.***> wrote:

@aprotyas https://github.com/aprotyas I've tested this branch. first i got this error:

CMake Deprecation Warning at /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_target_interfaces.cmake:32 (message): Use rosidl_get_typesupport_target() and target_link_libraries() instead of rosidl_target_interfaces()

and changed rosidl_target_interfaces() with rosidl_get_typesupport_target(). after that another error appeared which looks like the message is not being created:

Starting >>> domain_bridge --- stderr: domain_bridge ~/domain_bridge_ws/src/src/domain_bridge/domain_bridge.cpp:43:10: fatal error: domain_bridge/msg/compressed_msg.hpp: No such file or directory 43 | #include "domain_bridge/msg/compressed_msg.hpp" | ^~~~~~~~~~ compilation terminated.

full text log: log.txt https://github.com/ros2/domain_bridge/files/8813437/log.txt

— Reply to this email directly, view it on GitHub https://github.com/ros2/domain_bridge/pull/60#issuecomment-1143456598, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIHOFW5JCS4Q4MZUC4HTPHDVM47L3ANCNFSM5G4JDZEQ . You are receiving this because you were mentioned.Message ID: @.***>

antonyramsy commented 2 years ago

@aprotyas Hi, sorry for delay. I've tested the updated code both on foxy and humble. in normal condition(sending some data in one domain and receiving it in another one) both of them are ok. but i realized that bidirectional bridging in ROS foxy is not working as i expect (maybe i'm doing it in the wrong way) but in humble it works fine(by using the same YAML config file in different versions of ROS). here is the config i'm using to test bidirectional bridge:

name: my_bridge
from_domain: 2
to_domain: 3
topics:
  chatter:
    type: example_interfaces/msg/String
    remap: chitter
    bidirectional: True

with this config i was able to publish some date on topic chatter from domain 2 and receive it in domain 3 under chitter topic. and vice versa(publishing in domain 3 in topic chatter and receiving it in domain 2 in topic chitter ) in ROS humble.

but doing the same in ROS foxy, although you are able to send data from domain 2 to 3, but you wont be able to see published data from domain 3 in topic chatter in domain 2 in topic chitter (the topic chitter does not show up in ros2 topic list command result.)