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

How can a node keep working while it waits for another one to publish on a topic?

asked 2019-03-01 03:55:58 -0500

eric.valls.grunewald gravatar image

I have a node (A) that works over a list of variables. This list should be updated regularly with the information given by another node (B). I can't rely on B working at a certain frequency and, as I don't want A to stop working in a ros::spin() (as B could take very long to publish something) I can't use the usual topic/callback. How could I implement this idea?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-01 04:58:46 -0500

gvdhoorn gravatar image

Please take a look at ros::spinOnce().

See roscpp/Overview/Callbacks and Spinning for more info on the different threading models.

I would also recommend to take a look at message_filters, particularly Cache.

edit flag offensive delete link more

Comments

1

I realise searching can be difficult (due to keywords being used), but this has been discussed many times before.

In the future: could you please include what you've searched for yourself, what you've tried, what you've observed, etc? That avoids posters from suggesting things you've seen.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-01 05:00:20 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-03-01 03:55:58 -0500

Seen: 66 times

Last updated: Mar 01 '19