-
Notifications
You must be signed in to change notification settings - Fork 72
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 to wait for service response in example #271
Conversation
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@@ -69,7 +69,7 @@ def set_parameter(self, state=True, timeout=5.0): | |||
request = SetParameters.Request() | |||
request.parameters = parameters | |||
future = client.call_async(request) | |||
rclpy.spin_until_future_complete(self, future) | |||
rclpy.spin_until_future_complete(self, future, timeout_sec=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.
There's already a timeout
being passed to set_parameter
, which seems to be totally unused right now. Should we use that instead?
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.
Use timeout parameter in 887ffac
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
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.
This should at least stop the hang, though I suspect we are now going to have a flaky test on our hands. Time will tell.
This might fix the occasional hang seen in https://ci.ros2.org/job/ci_windows/15468/ . If the service response isn't received by the client in 5 seconds then the test will exit.