Rosanswers logo

Hello all, I want get joint coordinates of skeleton. I understand that I can get this information using tf listener as mentioned here. http://wiki.ros.org/tf/Tutorials/Writing%20a%20tf%20listener%20%28C%2B%2B%29

But I have problem in understanding how to mention each joint(from pi pose) in this section of code. while (node.ok()) { tf::StampedTransform transform; try{ listener.lookupTransform("/turtle2", "/turtle1", ros::Time(0), transform); }

is it possible for any one to guide me or provide an example code so that I can get all the joint coordinates.


int main(int argc, char** argv) { ros::init(argc, argv, "my_tf_listener");

ros::NodeHandle node;

ros::ServiceClient add_turtle = node.serviceClient<turtlesim::Spawn>("spawn");
turtlesim::Spawn srv;

tf::TransformListener listener;

ros::Rate rate(1.0);
while (node.ok())
    tf::StampedTransform transform;
        listener.lookupTransform("/head", "/neck","/torso",
                                                        ros::Time(0), transform);

        catch (tf::TransformException &ex) 

return 0;


I'm trying to do this, but I'm getting error during compilation.

error: no matching function for call to ‘tf::TransformListener::lookupTransform(const char [6], const char [6], const char [7], const char [15], const char [12], const char [11], const char [16], const char [13], const char [12], const char [10], const char [11], const char [11], const char [11], const char [12], const char [12], ros::Time, tf::StampedTransform&)’ ros::Time(0), transform); ^

Thanks, Regards, Prasanna

Originally posted by PKumars on ROS Answers with karma: 92 on 2016-03-28

Post score: 1


1 Answer 1


Rosanswers logo

The listener only looks up the transformation between two frames. What do you expect your call to provide? You only pass a single transformation, but a huge list of frames. If you want multiple transformations, you have to call lookupTransform several times, each time with a pair of frame-names.

Originally posted by NEngelhard with karma: 3519 on 2016-03-28

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by PKumars on 2016-03-28:
OK. Thanks a lot for your reply. But if I put "/head" as one transform then what should be the second transform?

Comment by PKumars on 2016-03-28:
Sorry for the confusion. I want to get coordinates with respect to kinect frame. so what should I use as a second transform to get position with respect to kinect frame origin? Thanks..

Comment by NEngelhard on 2016-03-28:
I think you should reread the tutorials as you are mixing things. "/head" is no transformation but a frame. A transformation consist of the information of how you transform poses that are given in one frame into another frame.

Comment by PKumars on 2016-03-30:
Thanks for your guidance. I solved the problem. I'm posting it as an Answer. hope you have no objection.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.