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

Revision history [back]

click to hide/show revision 1
initial version

It's not ros::time, it's ros::Time (capitalizing the 'T' is necessary).

You can use the toSec method of a Time instance to get the time as a double (see the Time Overview wiki).

The API for Time can be found here, while the API for its superclass TimeBase can be found here.

An example of using ROS_INFO for the last_real member of a received TimerEvent instance tEvent might look like so:

void callback1(const ros::TimerEvent& tEvent) {
  ROS_INFO("Event last_real time: %f", tEvent.last_real.toSec());
}