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

Revision history [back]

click to hide/show revision 1
initial version

Is your documentation using a fixed axis or rotating axis (extrinsic or intrinsic rotation?)

The URDF documentation is using a fixed axis rotation. This is described in more detail here: REP 103

Also, here: Rotation Methods (ROS)

If your documentation is using rotating axis (intrinsic rotation) there is no problem as ypr on a rotating axis is same as rpy on a fixed axis.

Otherwise:

The easiest way might to convert rotations between Euler angles is to use an intermediate representation like a quaternion.

In ROS if you are using Python, you can use the transformations.py module mentioned here (with a link to the full source): transformations.py

Example Python session using this (first way is with quaternions, second with matrices):

$ python
Python 2.7.3 (default, Jul  5 2013, 08:52:38) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import transformations
>>> import math
>>> q=transformations.quaternion_from_euler(math.pi,0,0,'szyx')
>>> q
array([  0.00000000e+00,  -0.00000000e+00,   1.00000000e+00,
        6.12303177e-17])
>>> transformations.euler_from_quaternion(q,'sxyz')
(0.0, -0.0, 3.141592653589793)
>>> m=transformations.euler_matrix(math.pi,0,0,'szyx')
>>> m
array([[ -1.00000000e+00,  -1.22460635e-16,  -0.00000000e+00,
        0.00000000e+00],
    [  1.22460635e-16,  -1.00000000e+00,   0.00000000e+00,
        0.00000000e+00],
    [ -0.00000000e+00,   0.00000000e+00,   1.00000000e+00,
        0.00000000e+00],
    [  0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
        1.00000000e+00]])
>>> transformations.euler_from_matrix(m,'sxyz')
(0.0, 0.0, 3.141592653589793)