Main Content

angle2rod

Convert rotation angles to Euler-Rodrigues vector

Description

rod = angle2rod(rotationAng1,rotationAng2,rotationAng3) function converts the rotation described by the three rotation angles, rotationAng1, rotationAng2, and rotationAng3, into an M-by-3 Euler-Rodrigues (Rodrigues) matrix, rod, using the default rotation sequence of 'ZYX' (yaw, pitch, roll). The rotation angles represent a series of right-hand intrinsic passive rotations from frame A to frame B. The resulting Euler-Rodrigues vector represents a right-hand passive rotation from frame A to frame B.

rod = angle2rod(rotationAng1,rotationAng2, rotationAng3,rotationSequence) function converts the rotation described by the three rotation angles and a rotation sequence, rotationSequence, into an M-by-3 Euler-Rodrigues array, rod, that contains the M Rodrigues vector. The rotation sequence parameter also specifies the order of the three rotation angles.

example

Examples

collapse all

Determine the Rodrigues vector from rotation angles.

yaw = 0.7854;
pitch = 0.1;
roll = 0;
r = angle2rod(yaw,pitch,roll)
r = 1×3

   -0.0207    0.0500    0.4142

Determine the Rodrigues vectors from multiple rotation angles.

yaw = [0.7854 0.5];
pitch = [0.1 0.3];
roll = [0 0.1];
r = angle2rod(pitch,roll,yaw,'YXZ')
r = 2×3

    0.0207    0.0500    0.4142
    0.0885    0.1381    0.2473

Input Arguments

collapse all

First rotation angles, specified as an m-by-1 array, in radians. The rotationAng1 argument represents the first rotation in rotationSequence.

Data Types: double | single

Second rotation angles, specified as an m-by-1 array, in radians. The rotationAng2 argument represents the second rotation in rotationSequence.

Data Types: double | single

Third rotation angles, specified as an m-by-1 array, in radians. The rotationAng3 argument represents the third rotation in rotationSequence.

Data Types: double | single

Rotation sequence, specified as a scalar. For sequences like 'ZXZ', there are two rotations about the same axis, such as two different yaw angles in 'ZXZ'.

Data Types: char | string

Output Arguments

collapse all

Euler-Rodrigues vector determined from rotation angles.

Algorithms

An Euler-Rodrigues vector b represents a rotation by integrating a direction cosine of a rotation axis with the tangent of half the rotation angle as follows:

b=[bxbybz]

where:

bx=tan(12θ)sx,by=tan(12θ)sy,bz=tan(12θ)sz

are the Rodrigues parameters. Vector s represents a unit vector around which the rotation is performed. Due to the tangent, the rotation vector is indeterminate when the rotation angle equals ±pi radians or ±180 deg. Values can be negative or positive.

References

[1] Dai, J.S. "Euler-Rodrigues formula variations, quaternion conjugation and intrinsic connections." Mechanism and Machine Theory, 92, 144-152. Elsevier, 2015.

Version History

Introduced in R2017a