maintain time across callbacks

asked 2016-11-18 16:29:30 -0500

2ROS0 gravatar image


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.

edit retag flag offensive close merge delete


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

JoshMarino gravatar image JoshMarino  ( 2016-11-18 21:26:11 -0500 )edit