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

Euler angle convention in TF [closed]

asked 2013-01-29 18:45:49 -0500

I'm a bit confused by ROS conventions. On this page:

It says Euler angles are specified in yaw-pitch-roll (ZYX) format in ROS. However, the tf.transformations.quaternion_from_euler function seems to assume roll-pitch-yaw (XYZ) format, as on this page:

Doesn't this violate the convention, or am I missing something?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Jeffrey Kane Johnson
close date 2013-02-04 03:46:22

1 Answer

Sort by » oldest newest most voted

answered 2013-01-29 21:09:31 -0500

Stephan gravatar image

tf uses the Python transformation package written by Christoph Gohlke (see This package supports any definition of Euler angles. Simply pass the desired convention as a second parameter to quaternion_from_euler:

def quaternion_from_euler(ai, aj, ak, axes='sxyz'):
"""Return quaternion from Euler angles and axis sequence.

ai, aj, ak : Euler's roll, pitch and yaw angles
axes : One of 24 axis sequences as string or encoded tuple

>>> q = quaternion_from_euler(1, 2, 3, 'ryxz')
>>> numpy.allclose(q, [0.310622, -0.718287, 0.444435, 0.435953])


And from the documentation in the header of

A triple of Euler angles can be applied/interpreted in 24 ways, which can
be specified using a 4 character string or encoded 4-tuple:

  *Axes 4-string*: e.g. 'sxyz' or 'ryxy'

  - first character : rotations are applied to 's'tatic or 'r'otating frame
  - remaining characters : successive rotation axis 'x', 'y', or 'z'

I suppose the tf maintainers didn't want to modify the underlying (external) python library to change the default behaviour.

So to comply with the ROS convention for Euler angles, simply use quaternion_from_euler like this:

q = tf.transformations.quaternion_from_euler(yaw, pitch, roll, 'rzyx')
edit flag offensive delete link more


That makes sense. Thanks.

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2013-01-30 05:39:13 -0500 )edit

Question Tools



Asked: 2013-01-29 18:45:49 -0500

Seen: 11,901 times

Last updated: Jan 29 '13