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

Support spin once #562

Closed
mattrichard opened this issue Feb 13, 2020 · 0 comments · Fixed by #563
Closed

Support spin once #562

mattrichard opened this issue Feb 13, 2020 · 0 comments · Fixed by #563
Labels

Comments

@mattrichard
Copy link
Collaborator

rclnodejs has no support for spin once (that I'm aware of) like in rclcpp and rclpy. In #561 I had to resort to using setTimeout instead in the unit test to wait for the event loop to finish once. At a minimum, spin once should help improve unit tests within rclnodejs and make them more reliable.

minggangw pushed a commit that referenced this issue Feb 17, 2020
Adds spinOnce support to rclnodejs. Unlike spin which runs in a separate thread, spinOnce will run synchronously and block the caller until the event loop has finished or times-out. Ideally, this should result in more predictable execution of unit tests that rely on the event loop. spinOnce cannot be used if already spinning and will throw error if attempted.

Usage:

let node = rclnodejs.createNode('my_node');
rclnodejs.spinOnce(node);

Fix #562
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants