0
$\begingroup$

Rosanswers logo

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.


Originally posted by 2ROS0 on ROS Answers with karma: 1133 on 2016-07-25

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

@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.


Originally posted by BluPlana with karma: 26 on 2017-02-23

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by gvdhoorn on 2017-02-24:\

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.

Comment by gvdhoorn on 2017-02-24:
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.

Comment by BluPlana on 2017-02-24:
@gvdhoorn: Thanks. Your response is really helpful!

for points that are not stamped, what happens?

Comment by BluPlana on 2017-02-24:
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

Comment by gvdhoorn on 2017-02-24:\

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.