Ask Your Question
0

How to get desired coordinates with known static_tf?

asked 2020-12-05 10:12:06 -0500

Jericho gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-12-06 10:47:47 -0500

tryan gravatar image

updated 2020-12-07 07:33:29 -0500

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.

edit flag offensive delete link more

Comments

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?

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

Future readers, see Answer Part 2, added to my original answer above.

tryan gravatar image tryan  ( 2020-12-07 07:35:48 -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: 2020-12-05 10:02:57 -0500

Seen: 591 times

Last updated: Dec 07 '20