Ask Your Question
0

Rotate quaternion by body yaw

asked 2018-09-25 21:12:52 -0500

okalachev gravatar image

updated 2018-09-25 21:13:28 -0500

How to change a quaternion's body-fixed yaw?

Using Matrix3x3's getRPY and then setRPY doesn't work, because this is about the axes, fixed to the initial orientation, so it's fixed yaw, not body yaw.

Using getEulerYPR and then setEulerYPR doesn't work as well, because yaw rotation it the first, and it gets affected the following pitch and roll rotation.

I think getEulerRPY/setEulerRPY might work, but there are no such functions in the tf and tf2 libraries.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-09-28 18:43:48 -0500

okalachev gravatar image

This looks working (pq - input quaternion):

tf::Quaternion q;
q.setRPY(0, 0, angle_to_rotate);
pq = pq * q;
edit flag offensive delete link more
1

answered 2018-09-25 23:38:24 -0500

hamid gravatar image

hi

try to use:

tf::Quaternion rotation;
rotation = tf::createQuaternionFromRPY(Roll,Pitch,Yaw);
edit flag offensive delete link more

Comments

The problem is, that if I keep roll and pitch, changing the yaw, that would be rotation about extrinsic Z axis, while I need about intrinsic (body-attached) one.

okalachev gravatar imageokalachev ( 2018-09-26 08:30:46 -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

2 followers

Stats

Asked: 2018-09-25 21:12:52 -0500

Seen: 256 times

Last updated: Sep 28 '18