Ask Your Question
3

Euler angle convention in TF [closed]

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

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

http://www.ros.org/wiki/geometry/CoordinateFrameConventions

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:

http://ros.org/wiki/tf/Overview/Transformations

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
6

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

Stephan gravatar image

tf uses the Python transformation package written by Christoph Gohlke (see http://www.lfd.uci.edu/~gohlke/). 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])
True

"""

And from the documentation in the header of transformations.py:

"""
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

Comments

That makes sense. Thanks.

Jeffrey Kane Johnson gravatar imageJeffrey Kane Johnson ( 2013-01-30 05:39:13 -0600 )edit

Question Tools

2 followers

Stats

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

Seen: 8,920 times

Last updated: Jan 29 '13