0
$\begingroup$

Rosanswers logo

image description

Hi, according to the attached picture I have a base link (point 1) with 0 coordinates. Then, I know the coordinates of the point 2 relative to point 1 frame. Also I have a static_tf from point 3 to point 2 relative to point 3 coordinate frame (blue numbers = z offset).

My question is: how to find coordinates of the point 3 relative to the base link?


Originally posted by Jericho on ROS Answers with karma: 3 on 2020-12-05

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The transform tree keeps track of the relationship between frames, including static transforms, which you can view with rosrun rqt_tf_tree rqt_tf_tree. To access the data, there are multiple methods depending on how you want to read/use the results:

If you have questions that are not answered by the tutorials, please, feel free to clarify.


###Answer Part 2

Yes, tf2 enables you to transform many data types into a frame of your choosing. As this answer explains, you can use the tfBuffer::transform() function. If you have a pose as a PoseStamped message in base_frame but want it in other_frame, after appropriate setup, you can do something like (C++)

tf_buffer.transform(pose_in_base_frame, pose_in_other_frame, "other_frame");

or (Python)

pose_in_other_frame = tf_buffer.transform(pose_in_base_frame, "other_frame")

Here's an answer that deals with transforming a PointStamped message in Python for additional info.

If all you have are values (not an actual message), you can insert those values into a new message first.


Originally posted by tryan with karma: 1421 on 2020-12-06

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Jericho on 2020-12-06:
Thanks for your answer, I actually do have one question. I have a desired pose relative to base (just a set of 6 values xyzrpy) and I need to calculate tf from some other than base frame. Is there a possibility to not firstly broadcast this pose as tf and then subscribe? Can I just, having these 6 values in my code, calculate a tf right there using tf libraries?

Comment by tryan on 2020-12-07:
Future readers, see Answer Part 2, added to my original answer above.

$\endgroup$

Your Answer

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