ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You are just observing floating point precision errors. That is why we use 64 bit precision to store ROS time values.
I added this line to your program:
ROS_INFO("delta between float and double %f %f float cast of time %f", f_grabtime, d_grabtime, (float) d_grabtime);
Where d_grabtime is a double instead of a float. And you get this output:
[ INFO] [1378710468.378363642]: delta between float and double 1378710528.000000 1378710468.378310 float cast of time 1378710528.000000