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

# the meaning of function lookupTransform

• \param target_frame The frame to which data should be transformed
• \param source_frame The frame where the data originated
• \param time The time at which the value of the transform is desired. (0 will get the latest)
• \return The transform between the frames

geometry_msgs::TransformStamped lookupTransform(const std::string& target_frame, const std::string& source_frame, const ros::Time& time) const;

I don't know it returns the transform from target_frame to source_frame ,or the transform from source_frame to target_frame .This makes me a little confused. I would be very grateful if anyone could help me

edit retag close merge delete

Sort by » oldest newest most voted

The argument names for this function assume a very specific use case.

If I rename the arguments lookupTransform(a, b, time) then what this function does is return an object specifying the pose of frame_b relative to frame_a. For a simple planar 2D example, if frame_a and frame_b are initially aligned and have yaw=0, shifting frame_b to the right 1 meter will result in this function returning transform.translation.x = 1.0.

more

Thank you very much for your answer! As a beginner, I am not very familiar with some common terms in ROS.But I found through a little experiment thatlookupTransform(T2,T1,time)(T1 and T2 are two coordinate systems)will return transform.translation.x which is the coordinates of the origin of T1 coordinate system in the T2 coordinate system. And I think this is the same as what you explained. So I guess, suppose the coordinate of an object in the T2 coordinate system is X2, and the coordinate in the T1 coordinate system is X1, then X2=R21*X1+τ21, R and τ are the rotation transformation and translation transformation returned by the function , and 21 means transform from 1 to 2, which corresponds exactly to 1 as source and 2 as target. In the sense of matrix theory, this may be a transformation matrix between the ...(more)