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

Questions regarding concurrency in ROS c++ ?

asked 2022-07-11 00:39:12 -0600

Shiva_uchiha gravatar image

Q1. I am aware that subscriber and processor run on separate thread and spin thread handles callbacks. However my doubt is if there are more that 2 subscribers, do all subscribers run on single subscriber thread or 2 subscriber thread ?

Q2. Do Ros Actions and Server run on the spin thread or do they run on their separate thread ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-07-11 08:57:33 -0600

standmit gravatar image

By default, there is only one global CallbackQueue and all callbacks are executed on the same main thread where you call ros::spin() or ros::spinOnce(). If you want to run callbacks in parallel, you should use ros::MultiThreadedSpinner or ros::AsyncSpinner instead of ros::spin() or ros::spinOnce(). You can also create multiple CallbackQueue and spin them separately. Please read the related guide: http://wiki.ros.org/roscpp/Overview/C...

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-07-11 00:39:12 -0600

Seen: 86 times

Last updated: Jul 11 '22