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

Exact relative position between two links

asked 2012-03-27 13:38:05 -0500

Capelare gravatar image

updated 2012-03-28 07:28:32 -0500

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">
  <parent link="ref_58_link_hub"/>
  <child link="ref_60_link"/>
  <origin xyz="-0.0135999953902 6.27180865763e-08 0.00020025516928" rpy="3.14159265343 1.5396542947e-05 -1.04458704296e-05" />
  <axis xyz="0 0 0" />
</joint>

Now let's see what rosrun tf tf_echo /ref_58_link_hub /ref_60_link returns:

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.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2012-03-28 07:48:59 -0500

David Lu gravatar image

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 roslib; roslib.load_manifest('package_name')
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:
        (trans,rot) = listener.lookupTransform('/ref_58_link_hub', '/ref_60_link', rospy.Time(0))
        print trans, rot
    except (tf.LookupException, tf.ConnectivityException):
        continue

    rate.sleep()
edit flag offensive delete link more

Comments

That's a great idea, thx! :)

Capelare gravatar image Capelare  ( 2012-03-28 08:52:10 -0500 )edit

What about printing this data in C++. How to write this code in C++ ?

Reza Ch gravatar image Reza Ch  ( 2013-03-21 02:52:46 -0500 )edit
2

answered 2012-03-27 16:15:39 -0500

David Lu gravatar image

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 .

edit flag offensive delete link more

Comments

Thanks for your reply, but I think that doesn't show all the precision either. I'm going to update the question with an example.

Capelare gravatar image Capelare  ( 2012-03-28 05:54:02 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2012-03-27 13:38:05 -0500

Seen: 1,850 times

Last updated: Mar 28 '12