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

Use spin_until_future_complete instead of spin_some in parameters_event demo #427

Merged
merged 3 commits into from
Jan 30, 2020

Conversation

ivanpauno
Copy link
Member

From ros2/rclcpp#844, spin_some collects pending executables just once, and executes all of them.

That broke this example, because the following happens.
The clients requests aren't handled by the services until spin is called.
The parameter event is published by the service when handling the requests.

If executables are not collected more than once, on_parameter_event callbacks won't be ever called (the only ones called are the ones from the previous declare_parameter calls).

The bad thing, is that now the user have to terminate the example by using ctrl-c (maybe, add a log saying that).

Fixes: https://ci.ros2.org/view/nightly/job/nightly_linux_release/1428/testReport/junit/demo_nodes_cpp/TestExecutablesTutorial/test_processes_output/.

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
@ivanpauno ivanpauno added the bug Something isn't working label Jan 29, 2020
@ivanpauno ivanpauno self-assigned this Jan 29, 2020
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

I don't think we should change the behavior of this demo (now it will block until ctrl-c where as before it would close on its own).

Instead, we should setup a future, complete it based on some condition, and use spin_until_future_complete.

@wjwwood
Copy link
Member

wjwwood commented Jan 29, 2020

Or you could spin in a thread, and call shutdown after some condition is met, if you want to avoid a future.

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

I don't think we should change the behavior of this demo (now it will block until ctrl-c where as before it would close on its own).

Instead, we should setup a future, complete it based on some condition, and use > spin_until_future_complete.

I also thought about that, but it makes the example more complex.
The only condition I can think is: the callback was called 10 times.

Changes requires: ros2/rclcpp#971

@ivanpauno
Copy link
Member Author

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

@ivanpauno ivanpauno changed the title Use spin and not spin_some in parameters_event demo Use spin_until_future_complete instead of spin_some in parameters_event demo Jan 29, 2020
@ivanpauno ivanpauno merged commit 003348c into master Jan 30, 2020
@delete-merged-branch delete-merged-branch bot deleted the ivanpauno/fix-parameter-events-demo branch January 30, 2020 12:35
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