ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hi Harbor,

Welcome to the ROS comunity!

Blocking your node inside a service or message callback is usually not a good idea. Good programming practices dictate that you should not block inside a callback, instead the callback should just take note of the data it received, return immediately and let another part of the code deal with the data that the callback received (maybe another node).

If you want to be able to stop a task, then you should be using actionlib instead. There is plenty of tutorials and documentation to help you get started.

I hope this helps!

Hi Harbor,

Welcome to the ROS comunity!

Blocking your node inside a service or message callback is usually not a good idea. Good programming practices dictate that you should not block inside a callback, instead the callback should just take note of the data it received, return immediately and let another part of the code deal with the data that the callback received (maybe another node). thread).

If you want to be able to stop a task, then you should be using actionlib instead. There is plenty of tutorials and documentation to help you get started.

I hope this helps!