Skip to content
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

Make rclpy.spin*() use a persistent executor #176

Merged
merged 3 commits into from
Apr 13, 2018
Merged

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Feb 2, 2018

This fixes a bug where coroutine callbacks that yield while being handled in rclpy.spin_once() never get executed again. The task is stored in the executor, but the executor is thrown away after spinning.

This PR makes the global methods reuse an executor. The test checks that a task which yields during rclpy.spin_once() gets resumed on a second invocation.

CI

@sloretz sloretz added bug Something isn't working in review Waiting for review (Kanban column) labels Feb 2, 2018
@sloretz sloretz self-assigned this Feb 7, 2018
@mikaelarguedas mikaelarguedas added this to the bouncy milestone Mar 1, 2018
mikaelarguedas
mikaelarguedas previously approved these changes Mar 26, 2018
Copy link
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, with reran CI since it's been a while

@sloretz sloretz added in progress Actively being worked on (Kanban column) and removed in review Waiting for review (Kanban column) labels Mar 27, 2018
@sloretz
Copy link
Contributor Author

sloretz commented Mar 29, 2018

New CI

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

FYI @mikaelarguedas I rebased with master. It means spin_until_future_complete has been updated to use a persistent executor. While in the neighborhood I also added doc strings to spin() and spin_once()

@sloretz sloretz added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Mar 29, 2018
@mikaelarguedas
Copy link
Member

@mikaelarguedas PTAL

if the global executor has a partially completed coroutine.

:param node: A node to add to the executor to check for work.
:param timeout_sec: Maximum time in seconds to wait for work.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this blocking forever if negative timeout provided? Is the default behavior to wait forever as well? (I guess it's yes in both questions, but it may be worth mentioning it in the docblock

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. I copy/pasted the timeout_sec documentation from executor.spin_once() in 93e42b5

@sloretz
Copy link
Contributor Author

sloretz commented Apr 11, 2018

New commit is only a docstring change, so running CI Linux testing only rclpy to run linters

Build Status

Copy link
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sloretz sloretz merged commit 4c6ee03 into master Apr 13, 2018
@sloretz sloretz deleted the rclpy_global_executor branch April 13, 2018 15:18
@sloretz sloretz removed the in review Waiting for review (Kanban column) label Apr 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants