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

Revision history [back]

I'm not sure if I'm doing it correctly but so far this is what I've experienced:

I have some long running goal callbacks and I think the main downside is that I can't handle new goals because the callback will only run in the one thread, but in my architecture I prevent new goals while the first one is running or have the single goal setter first preempt. You have to consider whether there are threads to handle other things like receiving messages- the goal doesn't necessarily need to run in a separate thread, but you can have callbacks for subscriptions or whatever else run in extra threads. Or sleep occasionally to accommodate those, and continually check for preemption (also ros shutdown) throughout the long goal callback.