Ask Your Question
1

Find coordinates of point in a different coordinate frame

asked 2016-07-25 17:24:02 -0500

2ROS0 gravatar image

Hi,

I would like to know the easiest ROS way (tf, geometry_msgs or something of the sort) to get the coordinates of a point in another coordinate frame defined by a pose.

Let's say, I have a point w coordinates x, y, z in a global frame and I have a pose of a local coordinate frame wrt the same global frame in the form of a geometry_msgs/Pose. Now how do I find x1, y1, z1 which are the coordinates of that point in the local coordinate frame (given by that pose)

Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-02-23 22:34:56 -0500

BluPlana gravatar image

updated 2017-02-24 03:59:04 -0500

gvdhoorn gravatar image

@2ROS0: "(I don't want to do that for some smaller tasks)" Exactly the same with me.

I am looking for an API programming language equivalent of $ rosrun tf tf_echo [frame1] [frame2]

I'm also trying to see how this command works:

void transformPoint (const std::string &target_frame, const Stamped< tf::Point > &stamped_in, Stamped< tf::Point > &stamped_out) const

but I don't see an indication for the current/reference frame which is not too good.

edit flag offensive delete link more

Comments

I don't see an indication for the current/reference frame

The input to transformPoint(..) is a Stamped<tf::Point>. Stamped in ROS parlance means: "with a header", which implies that the frame_id of the hdr is valid. That is the source frame. target_frame is the .. target.

gvdhoorn gravatar imagegvdhoorn ( 2017-02-24 00:33:04 -0500 )edit
1

Note: the Stamped suffix is used on msgs to indicate that it has a Header. In this case the terminology / naming convention was carried over, but Stamped is not a msg def. Member names are identical though: api/Stamped.

gvdhoorn gravatar imagegvdhoorn ( 2017-02-24 00:34:46 -0500 )edit

@gvdhoorn: Thanks. Your response is really helpful!

for points that are not stamped, what happens?

BluPlana gravatar imageBluPlana ( 2017-02-24 03:40:18 -0500 )edit

However, for points without stamps, how does one know the operating frame? My point doesn't have any stamp, but I'm sure it is defined in the /world. However, when I perform Inverse kinematics on my KDL chain to that point, my IK_solver seems to take the endeff to the point in the chain_root_frame

BluPlana gravatar imageBluPlana ( 2017-02-24 03:52:09 -0500 )edit

for points that are not stamped, what happens?

well, for this particular overload you'll get a compiler error.

But in general you'll have to either convert your Point to a Stamped version (ie: by providing the required info), or use one of the more suited overloads.

gvdhoorn gravatar imagegvdhoorn ( 2017-02-24 04:01:51 -0500 )edit
0

answered 2016-07-26 02:54:31 -0500

Nico__ gravatar image

Hi,

I think the best way to do is to use tf. Look at this class http://docs.ros.org/jade/api/tf/html/... for more information about it !

You should use waitForTransform first to see if the tf transform you want exist and then use transform pose to transform a pose from one frame to another.

Nicolas

edit flag offensive delete link more

Comments

I think that needs tf frames to be broadcasted (I don't want to do that for some smaller tasks). I used the overloaded * operator in the tf transform class to transform a vector/quaternion into the new frame

2ROS0 gravatar image2ROS0 ( 2016-07-26 09:13:34 -0500 )edit

@roso I have the exact problem. It seems like people don't answer questions here anymore. Just my observation.

BluPlana gravatar imageBluPlana ( 2017-02-23 22:28:40 -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

Stats

Asked: 2016-07-25 17:24:02 -0500

Seen: 1,058 times

Last updated: Feb 24 '17