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

Quaternion to Euler angle convention in TF

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

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.

B2256

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
3

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

Mark Rose gravatar image

See also this question: http://answers.ros.org/question/50113...

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 http://docs.ros.org/api/tf/html/c++/c... .)

edit flag offensive delete link more

Comments

Perfect! Thank you so much!

antoineniotna gravatar image antoineniotna  ( 2018-10-02 04:26:11 -0600 )edit

Question Tools

3 followers

Stats

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

Seen: 11,358 times

Last updated: Aug 02 '16