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

Executing two callbacks of two subscribers parallelly. How?

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

JeyP4 gravatar image

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

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
1

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

ahendrix gravatar image

Use ros::MultiThreadedSpinner : http://wiki.ros.org/roscpp/Overview/C... to execute multiple callbacks in parallel.

edit flag offensive delete link more

Comments

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

JeyP4 gravatar image JeyP4  ( 2019-03-22 17:55:35 -0600 )edit

Question Tools

2 followers

Stats

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

Seen: 798 times

Last updated: Mar 22 '19