ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to get yaw, pitch, roll from a quaternion

asked 2021-03-01 04:07:16 -0600

Aleksander Bobiński gravatar image

Hi, I'm a ros beginner and I don't quite understand the euler_from_quaternion function from tf.transformations. I have an IMU sensor which returns a quaternion representing the rotation from the navigation frame (ENU) to the sensor. What I would like to have are yaw, pitch and roll angles. For that I know I could use euler_from_quaternion with the second argument rzyx or szyx. My question is should I use 'rzyx' or 'szyx'?

edit retag flag offensive close merge delete

Comments

Did you search through prior question?

kscottz gravatar image kscottz  ( 2021-03-01 13:04:47 -0600 )edit

kscottz thanks for your pointer. I did but I couldn't find Matrix3x3 which has the getRPY method in python. It's not listed here https://docs.ros.org/en/melodic/api/t...; What am I missing?

Aleksander Bobiński gravatar image Aleksander Bobiński  ( 2021-03-01 14:56:14 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2021-03-01 15:15:03 -0600

howardcochran gravatar image

Hello.

In all cases that I have used tf.transformations.euler_from_quaternion, I always call it with only one parameter (a 4-tuple representing a quaternion (x, y, z, w). The default value for the second parameter (axes='sxyz') does the normal, expected thing. That parameter allows you to change the order in which the rotations are done as they are converted to roll,pitch,yaw form. According to the comments in the source code, there are 24 possible values for the axes parameters.

In short, unless you are doing something special, just leave that parameter off.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2021-03-01 04:07:16 -0600

Seen: 957 times

Last updated: Mar 01 '21