[ROS2] service failure feedback to client
In ROS1, a service client would receive a false
value when it either failed to call the service server, or there was some error such as invalid input. For example, the cpp api was specified like this.
bool callback(MReq& request, MRes& response);
However, in ROS2, the callback api returns a void
, and there does not seem to be a way to indicate to the service client that the service is unavailable or failed. Several questions have been raised by other users on how to do this: here on ros answers, on ros discourse, and there is a open issue.
Just wondering whether the removal of the return value was a design decision and if so, what the reasoning behind it was. What would be the best way to replicate this functionality, or an alternative way of using services in line with the current implementation.
Asked by LanceChen on 2021-05-05 21:18:28 UTC
Comments
in python you can use cli.service_is_ready() But I see that this function sometimes needs to be called repeatedly until it returns true.
Asked by highmax1234 on 2021-05-11 15:46:15 UTC
Calling service_is_ready would detect if the service node has crashed, but I'm also interested in the case where invalid input is given to the service, and so cannot properly handle the request.
Asked by LanceChen on 2021-05-11 18:52:17 UTC