Robotics StackExchange | Archived questions

Combination of timer and subscriber

Hello, I am currently struggling to write a node for synchronous processing while subscribing to a topic.

Specifically,

I tried to write a node to accomplish this requirement, but ros::subscriber cannot perform the 2 ms (500 Hz) synchronization process because the process stops until the topic is subscribed.

Is there any solution?

Asked by nemunatu on 2022-11-15 22:07:32 UTC

Comments

It would be nice to share a minimal reproducible example

Asked by ravijoshi on 2022-11-15 22:49:41 UTC

@nemunatu you need to spend more time studying how publish/subscribe systems work. You subscribe once when the app starts, and then after that ros will call a function that you specified for each message that arrives. Setting up a subscribe does take some time, but once it is set up it runs very quick.

Asked by Mike Scheutzow on 2022-11-16 20:46:45 UTC

Answers