Robotics StackExchange | Archived questions

maintain time across callbacks

Hi,

I have a simple ROS node which runs a ros::spin() call after initializing. Now, is there a way to maintain time between these callbacks? I want have a variable that records the time each time the callback is called and compute some stuff using the frequency of these callbacks.

Is there something internal to the callback structure that I can use?

Thank you.

Asked by 2ROS0 on 2016-11-18 17:29:30 UTC

Comments

You can just get the current ROS time whenever/wherever you need it. Link

Asked by JoshMarino on 2016-11-18 22:26:11 UTC

Answers