Gazebo camera timestamp issue
If I use a gazebo camera like this:
<sensor:camera name="camera1_sensor">
<imageSize>160 160</imageSize>
<controller:gazebo_ros_camera name="controller-cam1" plugin="libgazebo_ros_camera.so">
<updateRate>20.0</updateRate>
<imageTopicName>/gazebo/cam1</imageTopicName>
<cameraInfoTopicName>/gazebo/cam1/info</cameraInfoTopicName>
</controller:gazebo_ros_camera>
</sensor:camera>
The timestamps for full second N is actually output as N-1 + 1000000000ns. This leads to weird behavior, for example when using
boost::lexical_cast<std::string>(image_message1->header.stamp)
in a C++ application, as it produces the string "{N-1}.10" instead of the expected "{N}.00".
I assume that it is probably wrong to blindly use the lexical_cast on every datatype that comes along. And actually this is not a big issue, if you finally realize that it works that way.
But I wonder if this is the correct behavior/usage of ROS::Time? Can I expect other components that output ROS::Time tho behave in the same way and should I do it the same if I ever was to create a ROS::Time object?