Rosanswers logo

Hi there,

I have trouble computing Frames in TF with each other and I hope that one of you can help me out here. I know that I am supposed to use a Rotation Matrix and Quaternions etc. but right now, nothing makes sense.

Here's what I want to do. I have two Frames with different Coordinate Systems. One of them is normal (X/Y/Z), and then there is one Frame in it, that has (Z/Y/X) (Its a Camera Frame)

The lookup from the twisted Frame to the normal Frame works fine, and I know that If I want to modify this lookup/transform, then I have to use the twisted Frames Coordinate System. But I don't want to do that. I want to use this lookup, and then modify the transform from the viewpoint of the "normal" frame.

Z/Y/X ------------------------------------> X/Y/Z -----------------------------> 0 Vector (Z/Y/X) Vector (X/Y/Z)

Z/Y/X ------------------------------------------------------------------------------> 0 Combined Vector with Combined Rotation

Is there a clean way to do this? Are there any functions that I missed? I use C++ and I am still a beginner with ROS, sorry about that.

Thank you

Originally posted by Arthur_Ace on ROS Answers with karma: 13 on 2019-03-18

Post score: 0


1 Answer 1


Rosanswers logo

TF was made so you don't have to fiddle with rotation matrices and quaternions by yourself. Just ask your TF listener object what the transform between two frames is, and apply it to your Pose.

The only example in the TF documentation sadly stops after looking up the transform, but after you got the Transform object, you can simply apply it to your Pose by using doTransform. Include tf2_geometry_msgs to use this.

See the TF2 API here, and especially the doTransform, fromMsg, and toMsg entries. For completeness, the methods of the Listener class are here.

Don't forget to check that your transform was successful and the Pose is safe before sending your real robot to it.

Originally posted by fvd with karma: 2180 on 2019-03-19

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

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