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

roscpp message callback threading?

asked 2011-04-17 14:10:38 -0600

Bart gravatar image

updated 2011-04-17 15:52:50 -0600

tfoote gravatar image

If a simple node with ros::spin() in the main loop subscribes to two messages, will the message callbacks be called sequentially or be potentially processed in parallel?

Is the GlobalCallbackQueue global to all nodes/ROS, or just the node making the call?

I reviewed roscpp/Overview/Callbacks, and it indicates that there is a callback queue(s), but it doesn't confirm that one callback completes before the next callback is initiated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-04-17 16:15:06 -0600

tfoote gravatar image

All threading is local to processes.

All callbacks can be associated with a specific callback queue. All callbacks go into the default queue if not specified. A NodeHandle can have a custom callback queue associated with it, or specific callback registrations.

If you have a single thread servicing a callback queue. All will be serial.

Any specific callback will only be called after the last instance has finished, regardless of how many threads there are in the queue.

edit flag offensive delete link more

Question Tools


Asked: 2011-04-17 14:10:38 -0600

Seen: 1,249 times

Last updated: Apr 17 '11