# Exact relative position between two links

Hi! I'll be blunt...

I used LDD and lxf2urdf to build a robot and I want to change the parent of some of the links because I need certain parts to be independent of the rest of the robot (e.g. the back wheel) if I intend to make some of the joints continuous.

I tried using rviz to select the links and see their relative position, but I found that those numbers aren't precise enough. So how do I know the relative position between two links with the maximum possible precision?

I didn't find any questions regarding this, excuse me if I just couldn't find them! :(

Update:

For example, let's take a random joint from my .urdf file:

<joint name="ref_70_joint" type="fixed">
<origin xyz="-0.0135999953902 6.27180865763e-08 0.00020025516928" rpy="3.14159265343 1.5396542947e-05 -1.04458704296e-05" />
<axis xyz="0 0 0" />
</joint>


At time 1332949971.511
- Translation: [0.014, 0.000, -0.000]
- Rotation: in Quaternion [0.000, -0.000, 1.000, -0.000]
in RPY [-3.142, -0.000, -0.000]


As you can see I only get three decimal digits, just like rviz.

Originally posted by Capelare on ROS Answers with karma: 202 on 2012-03-27

Post score: 0

I've got a better idea. Just write a simple node that uses a TransformListener and print out that information directly. Ideally, someone would write a patch for tf_echo so that precision can be specified...

#!/usr/bin/python

import rospy
import tf

if __name__ == '__main__':
rospy.init_node('tf_a')
listener = tf.TransformListener()

rate = rospy.Rate(10.0)
while not rospy.is_shutdown():
try:
print trans, rot
except (tf.LookupException, tf.ConnectivityException):
continue

rate.sleep()


Originally posted by David Lu with karma: 10932 on 2012-03-28

This answer was ACCEPTED on the original site

Post score: 2

Comment by Capelare on 2012-03-28:
That's a great idea, thx! :)

Comment by Reza Ch on 2013-03-21:
What about printing this data in C++. How to write this code in C++ ?

I'm not sure how precisely you're seeing the relative position of the links in rviz. However, what I would do is use rosrun tf tf_echo one_frame two_frame which should give you the numbers with all the available precision, I think .

Originally posted by David Lu with karma: 10932 on 2012-03-27

This answer was NOT ACCEPTED on the original site

Post score: 2