ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Quaternion to Euler angle convention in TF

asked 2016-07-17 12:21:44 -0500

b2256 gravatar image

In reference to this question , the desired conversion is the opposite direction. That is using tf.transformations.euler_from_quaternion function, taking the result from robot_localization of /odometry/filtered topic, my attempt is to unravel the quaternion from the ENU convention to NED convention. The end result should be pitch, yaw, and roll using the aviation (NED) convention.

My interpretation is that one must first change back (from ROS ENU) the signs of y and z, followed by “unwinding” the quaternion to euler from 'rzyx' to 'rxyz' per the documentation for euler_from_quaternion definition and the question response: “q = tf.transformations.quaternion_from_euler(yaw, pitch, roll, 'rzyx')”

My question: Is my interpretation correct? Any insight is greatly appreciated.


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-08-02 19:44:32 -0500

Mark Rose gravatar image

See also this question:

The easiest way to convert to yaw-pitch-roll is to take the quaternion and create a Matrix3x3:

Let q be the quaternion of the current odom transform
tfScalar yaw, pitch, roll;
tf::Matrix3x3 mat(q);
mat.getEulerYPR(&yaw, &pitch, &roll);

(Note that the tfScalar type is usually typedef'd to double in scalar.h. Also see .)

edit flag offensive delete link more


Perfect! Thank you so much!

antoineniotna gravatar image antoineniotna  ( 2018-10-02 04:26:11 -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



Asked: 2016-07-17 12:21:44 -0500

Seen: 10,388 times

Last updated: Aug 02 '16