Ask Your Question

Executing two callbacks of two subscribers parallelly. How?

asked 2019-03-22 16:01:30 -0500

JeyP4 gravatar image

updated 2019-03-22 16:02:50 -0500

If one sub1.callback is on execution and meanwhile msg arrives on other sub2. I want to process sub2.callback parallely. Is it possible? How?

ros::Subscriber image_sub= nh.subscribe("/rgb, 2, &class::imCallback, &class);
ros::Subscriber depth_sub= nh.subscribe("/depth", 2, &class::depthCallback, &class);

I read many posts on callback queues, MultiThreadedSpinner, boost. I am confused which way is good for my application !!

image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-22 16:58:13 -0500

ahendrix gravatar image

Use ros::MultiThreadedSpinner : to execute multiple callbacks in parallel.

edit flag offensive delete link more


Thanks @ahendrix So, seperate callback queues for each subscriber is not required?

JeyP4 gravatar imageJeyP4 ( 2019-03-22 17:55:35 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-03-22 16:01:30 -0500

Seen: 28 times

Last updated: Mar 22