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

Revision history [back]

So msg->angle_timestamp1 is an int, right?

If it's time in seconds (which is not a good idea, because the resolution is way too coarse), this should work:

ros::Time current_time_encoder(msg->angle_timestamp1);

If it's nanoseconds, this works:

ros::Time current_time_encoder(msg->angle_timestamp1 / 1e9, msg->angle_timestamp1 % 1e9);

Similarly 1e6 for microseconds, 1e3 for milliseconds.