eclipse-zenoh/zenoh-plugin-dds

[Bug] Unable to get ROS service response

Closed this issue · 1 comments

F1rrel commented

Describe the bug

When running zenoh-bridge-dds, ROS service does not respond to any request from the client. The requests are received correctly by the ROS service server. Tried both forward discovery mode and without it, the result is the same.

Issue #102 and PR #108 suggest, that this should be already working.

To reproduce

Host1:

  1. Run zenoh-bridge-dds:
./target/release/zenoh-bridge-dds -d 1 -f -l tcp/0.0.0.0:7447
  1. Run ROS2 service server:
ROS_DOMAIN_ID=1 ros2 run demo_nodes_cpp add_two_ints_server

Host2:

  1. Run zenoh-bridge-dds:
./target/release/zenoh-bridge-dds -d 2 -f -e tcp/<HOST1 IP>:7447
  1. Run ROS2 service client:
ROS_DOMAIN_ID=2 ros2 run demo_nodes_cpp add_two_ints_client

Host1:

  1. Server receives the service request
[INFO] [timestamp] [add_two_ints_server]: Incoming request
a: 2 b: 3

Host2:
No response received and hangs.

System info

  • Platform: Ubuntu 20.04
  • ROS version: ROS2 Foxy and ROS2 Humble
  • zenoh-plugin-dds: 41698a3
JEnoch commented

Hi @F1rrel ,
sorry for the delay to respond.

The ROS 2 Services requires the forward discovery mode, since the client waits to discover the server and this can occur only if the bridge is forwarding the discovery info to the remote bridges.

With forward discovery mode active I tried to reproduce (on Humble), with various combination of startup order. It always work for me.
Maybe some race condition with discovery messages occurs for some reason in your setup... The ROS 2 services being implemented as RPC over DDS with 2 topics (Response/Reply) and thus 4 Publishers/Subscribers do discover each other in each domain at each service call... this is quite a fragile pattern.

That's one of the reason we developed a new bridge for ROS 2: https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds
As it improves the discovery forwarding between the bridges and maps the ROS Services and Action on Zenoh queryable, it's less fragile to such race condition issue and will probably work smoothly for your test.

You can try the following:
Host 1:

  • ./target/release/zenoh-bridge-ros2dds -d 1 -l tcp/0.0.0.0:7447
  • ROS_DOMAIN_ID=1 ros2 run demo_nodes_cpp add_two_ints_server

Host 2:

  • ./target/release/zenoh-bridge-ros2dds -d 2 -e tcp/<HOST1 IP>:7447
  • ROS_DOMAIN_ID=2 ros2 run demo_nodes_cpp add_two_ints_client

Note that the -f option is not necessary with this new bridge, as the forwarding of discovery info is made by default.