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

Revision history [back]

click to hide/show revision 1
initial version

Following best practices(and experience), you should try to avoid doing any type of expensive(computationally) or blocking operation on callbacks, as you could see the moment a callback is being executed is similar to an "interrupt" happening and being processed. This means the system halts the operation (of at least one thread) to execute your callback before returning to its normal operation.

Regarding your controller example, your first approach is what I'd suggest following on, you could also have another system picking up on changes that have happened due to callbacks (not necessarily the main loop).

Hope this helps.