-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timeout option to call_service messages #984
Conversation
rosbridge_library/src/rosbridge_library/capabilities/call_service.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have one question about what the default timeout should be -- for compatibility with the previous implementation, should it be a non-positive number for indefinite wait?
@@ -50,6 +58,12 @@ def setUp(self): | |||
self.trigger_cb, | |||
callback_group=self.cb_group, | |||
) | |||
self.trigger_long_srv = self.node.create_service( | |||
Trigger, | |||
self.node.get_name() + "/trigger_long", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just do "trigger_long"
without the leading slash to get the same effect here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean without the node name as well? Like that
self.node.get_name() + "/trigger_long", | |
"trigger_long", |
@@ -178,6 +178,10 @@ def protocol_parameter_handling(self): | |||
"call_services_in_new_thread", False | |||
).value | |||
|
|||
RosbridgeWebSocket.default_call_service_timeout = self.declare_parameter( | |||
"default_call_service_timeout", 5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the default be 5.0
or indefinite wait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan is to make it 5 seconds from Jazzy onward and indefinite when backporting it to Humble
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, we already had this discussion about default timeout -- sorry, I'll approve.
Public API Changes
Adds
timeout
option tocall_service
messagesDescription
If during calling a service, the Service Server dies, the ServiceCaller will get stuck waiting for response. This also makes the whole protocol stuck if
call_services_in_new_threads
option is not set.This PR adds a response timeout parameter to ServiceCaller and adds an optional
timeout
option tocall_service
messages with a default value of 5 seconds.If the API change gets accepted I will finish this PR by adding tests that cover this feature