ros / geometry2

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

tf2_ros::Buffer::lookupTransform does not work as expected #474

Closed randoms closed 4 years ago

randoms commented 4 years ago

From the document

geometry_msgs::TransformStamped 
Buffer::lookupTransform(const std::string& target_frame, const ros::Time& target_time,
                        const std::string& source_frame, const ros::Time& source_time,
                        const std::string& fixed_frame, const ros::Duration timeout) const

target_time The time to which the data should be transformed. (0 will get the latest)

if target_time is 0, the function will get the latest time to transform. So target_time 0 should be the same with ros::Time::now(). But the result is different, The function checks tf data in a loop. If target_time is 0, the function compares tf data with current time in each loop, not the time when lookupTransform was called. So you will get an Extrapolation Error if target_time is set to 0.

See this issue as reference.

I'm not sure which is the expected behavior.