ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
rclpy.spin
doesn't exit until it receives the ctrl-c signal. I would recommend one of the following:
spin_once
. At my company we've got a SpinUntil
method that will spin the node until a lambda is true, or it times-out and we can handle that case.join
on your spin thread:
spin_until_future_complete
instead of spin
. This way you can set the future, and it'll stop the spinning.while still_testing:
kind of loop with a spin_once
(with the timeout!) so that you only spin as long as you need it to. Once your test is done, then you can still_testing = False
in your tear down method and the spinning will eventually stop