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

roscpp message callback threading?

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

Bart gravatar image

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

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
3

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

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

Stats

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

Seen: 1,250 times

Last updated: Apr 17 '11