Ask Your Question

Trouble in computing different Frames with different Quaternions

asked 2019-03-18 17:14:27 -0500

Arthur_Ace gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-19 05:34:14 -0500

fvd gravatar image

updated 2019-03-19 05:37:03 -0500

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-03-18 17:14:27 -0500

Seen: 45 times

Last updated: Mar 19 '19