# How to get desired coordinates with known static_tf?

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?

edit retag close merge delete

Sort by ยป oldest newest most voted

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

more

1

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?

( 2020-12-06 17:59:34 -0500 )edit

( 2020-12-07 07:35:48 -0500 )edit