ros2 / ros1_bridge

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

Dynamic-bridge throw error and exit when callback service returns false #277

Closed sshmaxime closed 4 years ago

sshmaxime commented 4 years ago

Bug report

Required Info:

When calling a service using ROS2 as client to ROS1 as server, using the dynamic-bridge. The bridge exit after throwing an error:

terminate called after throwing an instance of 'std::runtime_error'
what():  Failed to get response from ROS 1 service /command_X

I figured out something. This happens only when the service return false, like that:

bool aarming_service(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response) {
  return false;
}

If it returns true, the error does not appear and the bridge works properly.

Why is that ?

dirk-thomas commented 4 years ago

Unfortunately ROS 2 servers don't have a way to communicate this failure generically to the client. Until ros2/ros2#921 is implemented there is no much the ros1_bridge can do about it (except just ignoring the service call and letting the client wait forever for a response which isn't really an option either).

sshmaxime commented 4 years ago

Thank you ! Was not aware of that :)