ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A
Ask Your Question

Translating Cartesian Coordinates from Hand frame to World Frame: ROS & Baxter Help

asked 2016-06-13 09:22:34 -0500

laurent gravatar image


So I'm working with the baxter robot and using the ROS workspace. The baxter has a camera attached to its arm, from which I can read x,y,z coordinates of certain object, relative to the hand frame.

Once my object is detected, I need its x,y,z coordinate, but from the robot's main frame, so i need to translate from the hand to the robot frame, and given that the robot has 6 degrees of motion, I'm having a hard time figuring out how to do that. I know that I'm supposed to use DH matrices, but could someone try and explain to me how i should proceed?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-13 09:40:10 -0500

gvdhoorn gravatar image

updated 2016-06-13 09:40:42 -0500

I know that I'm supposed to use DH matrices [..]

well, that is one possibility, but ..

[..] but could someone try and explain to me how i should proceed?

I would use the TF(2) framework (wiki):

tf2 is the second generation of the transform library, which lets the user keep track of multiple coordinate frames over time. tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.

I think you'll be most interested in the "lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time" bit.

TF can be a bit of a challenge to get to grips with, so I highly recommend you do the tutorials first (and try to understand them, not just copy/paste the examples), before you try to integrate it into your own code.

edit flag offensive delete link more


So using tf echo i was able to obtain the position and rotation coordinates of the hand of my robot. but i can't seem to figure out how, using tf, i would transform coordinates from my hand to my base perspective

laurent gravatar imagelaurent ( 2016-06-13 13:32:02 -0500 )edit

tf_echo is a nice command line tool, but what you really want to use is the tf library in your C++ or Python based node / script. Have you looked at the other tutorials?

gvdhoorn gravatar imagegvdhoorn ( 2016-06-13 15:02:03 -0500 )edit

yes i have, I actually figured out a way to get the transformation matrix using fromTranslationRotation()! Thank you so much!!

laurent gravatar imagelaurent ( 2016-06-13 15:24:37 -0500 )edit

See if the tf2_ros::BufferInterface::transform(..) function already does what you want. Manually transforming poses is fine, but the utility functions exist for a reason.

gvdhoorn gravatar imagegvdhoorn ( 2016-06-14 03:09:00 -0500 )edit

Do yoiu know if there's an API for the BufferInterface for python? There this link( but somehow i can't access the buffer interface API

laurent gravatar imagelaurent ( 2016-06-14 07:58:50 -0500 )edit

I think it's this but it appears the Python side is slightly under-documented. You might want to ask about that at the issue tracker.

gvdhoorn gravatar imagegvdhoorn ( 2016-06-14 09:18:51 -0500 )edit

I don't know much C++, But looking at the function in the c++ api, it says that it returns the transformed output. Which is a little confusing to me, since it doesn't know the input frame, only the frame you want to transform to

laurent gravatar imagelaurent ( 2016-06-14 09:58:32 -0500 )edit

ROS msgs like geometry_msgs/Pose include a header.frame_id field. That contains what you call the input frame (or at least: it should contain it). Make sure you input properly setup Poses/Points/etc, and the rest should be taken care of for you.

gvdhoorn gravatar imagegvdhoorn ( 2016-06-14 10:21:54 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-06-13 09:22:34 -0500

Seen: 523 times

Last updated: Jun 13 '16