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

the meaning of function lookupTransform

asked 2021-10-06 20:18:53 -0500

Laura gravatar image
  • \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 flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-10-07 09:11:35 -0500

Mike Scheutzow gravatar image

updated 2021-10-07 09:13:00 -0500

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.

edit flag offensive delete link 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)

Laura gravatar image Laura  ( 2021-10-07 11:12:19 -0500 )edit

Question Tools



Asked: 2021-10-06 20:18:53 -0500

Seen: 1,159 times

Last updated: Oct 07 '21