-
Notifications
You must be signed in to change notification settings - Fork 74
Description
Description
A ROS node implements a service but throw an exception when calling it.
This error is never thrown on rclnodejs side (C++ I guess) and the client.sendRequest
never response.
- Library Version: 0.28.1
- ROS Version: Ros2 humble
- Platform / OS: Ubuntu 22
Steps To Reproduce
Inside our code base, we have a node named /bt_navigator_rclcpp_node
. The issue is that we do not directly spin the node, but another node spinning it for us.
When calling ros2 param list /bt_navigator_rclcpp_node
inside a terminal, the following exception is thrown:
Exception while calling service of node '/bt_navigator_rclcpp_node': None
Actual Behavior
In my Node code, I use the following function in order to call the service:
private _callService(client: Client<ROS_CLIENT_TYPES>, request: ROS_REQUEST_TYPES, callback: (response?: unknown) => void): void {
const doesServiceExists = client.isServiceServerAvailable();
if (!doesServiceExists) {
callback(undefined);
this._destroyClient(client);
return;
}
client.waitForService(ROS_SUBSCRIBER_TIMEOUT_MS)
.then((isAvailable: boolean) => {
if (!isAvailable) {
callback(undefined);
this._destroyClient(client);
}
console.log('1. Calling: service', client.serviceName);
client.sendRequest(request, (response: unknown) => {
console.log('2. Response received: service', client.serviceName);
callback(response);
this._destroyClient(client);
});
});
}
The issue is that isServiceServerAvailable
function returns true (which means that the list parameter service exists on this node, and which is the case) and waitForService
also returns true (which means that the service is available right now, which is not the case as this service is buggy). Next, the first console log is properly printed, but the second one is never displayed. I also tried to catch any exception by surrounding the sendRequest
method with a try catch. No error are thrown on rclnodejs side.
Expected Behavior
waitForService
should returns false in case of unavailable service.