ros / geometry2

A set of ROS packages for keeping track of coordinate transforms.
190 stars 275 forks source link

rostime_converter loses nanosecond precision #543

Open lucasw opened 1 year ago

lucasw commented 1 year ago

This converts the time into floating point in order to translate from python rostime to C++ rostime, and nanosecond precision is lost:

https://github.com/ros/geometry2/blob/noetic-devel/tf2_py/src/tf2_py.cpp#L150-L161

I ran into this doing exact time syncs which dropped all the messages out of a node doing tf transform lookups in python, the looked up transforms had stamps that were slightly off from the stamp I requested to be looked up and I was putting them into output messages assuming they were the same.

I don't know if this is correct PyObject usage but a partial solution is here, I can turn it into a PR, cover ros::Duration conversion as well:

https://github.com/lucasw/geometry2/commit/26feffa7615f9812863ed2bac3f68b046b5976de

And there must be converters going the other direction from C++ to python with probably the same problem- but I didn't see them after a quick look. And maybe some other similar time converters exist in other packages?