Ask Your Question

Revision history [back]

I tried to make a node that gives me the distance between the fixed point and the baselink over the time. [...]

  listener.lookupTransform("/base_link", "/door1",  
                          ros::Time(0), transform);

What are you trying to do? Find the distance between /world and /base_link or between base_link and door1? Your explanation and your code don't match.

Also, I am a little confused what your "Dist to Door1" outputs mean. In the first two cases, it seems as if they give the distance between the frames you mention in the rosrun tf tf_echo output, but the third one seems to be wrong.

From the tf_echo outputs it seems that everything is correct: /door1 is about 6.5 meters away from /world, /base_link is about 5.5 meters away from /world, and because they are rotated by about 180° and /world is almost in the middle between the two frames, the total distance from /base_link to /door1 is about 11 m.

You have to look at the RPY angles (in radian). Simply put, the rotation is applied before the translation.