ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

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

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

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

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

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



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 -0600 )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

1 follower


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

Seen: 50 times

Last updated: Mar 01 '19