M-File Help: SO3 | View code for SO3 |
Representation of 3D rotation
This subclasss of RTBPose is an object that represents an SO(3) rotation
SO3 | general constructor |
SO3.exp | exponentiate an so(3) matrix |
SO3.angvec | rotation about vector |
SO3.eul | rotation defined by Euler angles |
SO3.oa | rotation defined by o- and a-vectors |
SO3.rpy | rotation defined by roll-pitch-yaw angles |
SO3.Rx | rotation about x-axis |
SO3.Ry | rotation about y-axis |
SO3.Rz | rotation about z-axis |
SO3.rand | random orientation |
new | new SO3 object |
dim* | returns 3 |
isSE* | returns false |
issym* | true if rotation matrix has symbolic elements |
plot* | graphically display coordinate frame for pose |
animate* | graphically animate coordinate frame for pose |
print* | print the pose in single line format |
display* | print the pose in human readable matrix form |
char* | convert to human readable matrix as a string |
det | determinant of matrix component |
eig | eigenvalues of matrix component |
log | logarithm of rotation matrix |
inv | inverse |
simplify* | apply symbolic simplication to all elements |
interp | interpolate between rotations |
SO3.check | convert object or matrix to SO3 object |
theta | return rotation angle |
double | convert to rotation matrix |
R | convert to rotation matrix |
SE3 | convert to SE3 object with zero translation |
T | convert to homogeneous transformation matrix with zero translation |
UnitQuaternion | convert to UnitQuaternion object |
toangvec | convert to rotation about vector form |
toeul | convert to Euler angles |
torpy | convert to roll-pitch-yaw angles |
isrot* | returns true |
ishomog* | returns false |
trprint* | print single line representation |
trplot* | plot coordinate frame |
tranimate* | animate coordinate frame |
tr2eul | convert to Euler angles |
tr2rpy | convert to roll-pitch-yaw angles |
trnorm | normalize the rotation matrix |
check | convert object or matrix to SO2 object |
exp | exponentiate an so(3) matrix |
isa | check if matrix is 3x3 |
angvec | rotation about vector |
eul | rotation defined by Euler angles |
oa | rotation defined by o- and a-vectors |
rpy | rotation defined by roll-pitch-yaw angles |
Rx | rotation about x-axis |
Ry | rotation about y-axis |
Rz | rotation about z-axis |
* means inherited from RTBPose
+ | elementwise addition, result is a matrix |
- | elementwise subtraction, result is a matrix |
* | multiplication within group, also group x vector |
.* | multiplication within group followed by normalization |
/ | multiply by inverse |
./ | multiply by inverse followed by normalization |
== | test equality |
~= | test inequality |
n | normal (x) vector |
o | orientation (y) vector |
a | approach (z) vector |
Construct an SO(2) object
p = SO3() is an SO3 object representing null rotation.
p = SO3(R) is an SO3 object formed from the rotation matrix R (3x3)
p = SO3(T) is an SO3 object formed from the rotational part of the homogeneous transformation matrix T (4x4)
P = SO3(Q) is an SO3 object that is a copy of the SO3 object Q. | % |
Construct an SO(3) object from angle and axis vector
R = SO3.angvec(theta, v) is an orthonormal rotation matrix (3x3) equivalent to a rotation of theta about the vector v.
SE3.angvec, eul2r, rpy2r, tr2angvec
Convert to SO3
q = SO3.check(x) is an SO3 object where x is SO3 object or 3x3 orthonormal rotation matrix.
Determinant of SO3 object
det(p) is the determinant of the SO3 object p and should always be +1.
Eigenvalues and eigenvectors
E = eig(p) is a column vector containing the eigenvalues of the the rotation matrix of the SO3 object p.
[v,d] = eig(p) produces a diagonal matrix d of eigenvalues and a full matrix v whose columns are the corresponding eigenvectors so that A*v = v*d.
Construct an SO(3) object from Euler angles
p = SO3.eul(phi, theta, psi, options) is an SO3 object equivalent to the specified Euler angles. These correspond to rotations about the Z, Y, Z axes respectively. If phi, theta, psi are column vectors (Nx1) then they are assumed to represent a trajectory then p is a vector (1xN) of SO3 objects.
R = SO3.eul(eul, options) as above but the Euler angles are taken from consecutive columns of the passed matrix eul = [phi theta psi]. If eul is a matrix (Nx3) then they are assumed to represent a trajectory then p is a vector (1xN) of SO3 objects.
'deg' | Compute angles in degrees (radians default) |
SO3.rpy, SE3.eul, eul2tr, rpy2tr, tr2eul
Construct SO3 object from Lie algebra
p = SO3.exp(so2) creates an SO3 object by exponentiating the se(2) argument (2x2).
Get approach vector
P.a is the approach vector (3x1), the third column of the rotation matrix, which is the z-axis unit vector.
Get normal vector
P.n is the normal vector (3x1), the first column of the rotation matrix, which is the x-axis unit vector.
Get orientation vector
P.o is the orientation vector (3x1), the second column of the rotation matrix, which is the y-axis unit vector..
Interpolate between SO3 objects
P1.interp(p2, s) is an SO3 object representing a slerp interpolation between rotations represented by SO3 objects P1 and p2. s varies from 0 (P1) to 1 (p2). If s is a vector (1xN) then the result will be a vector of SO3 objects.
P1.interp(p2,n) as above but returns a vector (1xN) of SO3 objects interpolated between P1 and p2 in n steps.
Inverse of SO3 object
q = inv(p) is the inverse of the SO3 object p. p*q will be the identity matrix.
Test if a rotation matrix
SO3.ISA(R) is true (1) if the argument is of dimension 3x3 or 3x3xN, else false (0).
SO3.ISA(R, 'valid') as above, but also checks the validity of the rotation matrix.
Lie algebra
se2 = P.log() is the Lie algebra augmented skew-symmetric matrix (3x3) corresponding to the SE2 object P.
Construct a new object of the same type
p2 = P.new(x) creates a new object of the same type as P, by invoking the SO3 constructor on the matrix x (3x3).
p2 = P.new() as above but defines a null rotation.
Construct an SO(3) object from orientation and approach vectors
p = SO3.oa(o, a) is an SO3 object for the specified orientation and approach vectors (3x1) formed from 3 vectors such that R = [N o a] and N = o x a.
Get rotation matrix
R = P.R() is the rotation matrix (3x3) associated with the SO3 object P. If P is a vector (1xN) then R (3x3xN) is a stack of rotation matrices, with the third dimension corresponding to the index of P.
Construct a random SO(3) object
SO3.rand() is an SO3 object with a uniform random RPY/ZYX orientation. Random numbers are in the interval 0 to 1.
Compound SO3 object with inverse and normalize
P./Q is the composition, or matrix multiplication of SO3 object P by the inverse of SO3 object Q. If either of P or Q are vectors, then the result is a vector where each element is the product of the object scalar and the corresponding element in the object vector. If both P and Q are vectors they must be of the same length, and the result is the elementwise product of the two vectors.
SO3.mrdivide, SO3.times, trnorm
Construct an SO(3) object from roll-pitch-yaw angles
p = SO3.rpy(roll, pitch, yaw, options) is an SO3 object equivalent to the specified roll, pitch, yaw angles angles. These correspond to rotations about the Z, Y, X axes respectively. If roll, pitch, yaw are column vectors (Nx1) then they are assumed to represent a trajectory then p is a vector (1xN) of SO3 objects.
p = SO3.rpy(rpy, options) as above but the roll, pitch, yaw angles angles angles are taken from consecutive columns of the passed matrix rpy = [roll, pitch, yaw]. If rpy is a matrix (Nx3) then they are assumed to represent a trajectory and p is a vector (1xN) of SO3 objects.
'deg' | Compute angles in degrees (radians default) |
'xyz' | Rotations about X, Y, Z axes (for a robot gripper) |
'yxz' | Rotations about Y, X, Z axes (for a camera) |
SO3.eul, SE3.rpy, tr2rpy, eul2tr
Rotation about X axis
p = SO3.Rx(theta) is an SO3 object representing a rotation of theta radians about the x-axis.
p = SO3.Rx(theta, 'deg') as above but theta is in degrees.
Rotation about Y axis
p = SO3.Ry(theta) is an SO3 object representing a rotation of theta radians about the y-axis.
p = SO3.Ry(theta, 'deg') as above but theta is in degrees.
Rotation about Z axis
p = SO3.Rz(theta) is an SO3 object representing a rotation of theta radians about the z-axis.
p = SO3.Rz(theta, 'deg') as above but theta is in degrees.
Convert to SEe object
q = P.SE3() is an SE3 object with a rotational component given by the SO3 object P, and with a zero translational component.
Get homogeneous transformation matrix
T = P.T() is the homogeneous transformation matrix (4x4) associated with the SO3 object P, and has zero translational component. If P is a vector (1xN) then T (4x4xN) is a stack of rotation matrices, with the third dimension corresponding to the index of P.
Compound SO3 objects and normalize
R = P.*Q is an SO3 object representing the composition of the two rotations described by the SO3 objects P and Q, which is matrix multiplication of their orthonormal rotation matrices followed by normalization.
If either, or both, of P or Q are vectors, then the result is a vector.
If P is a vector (1xN) then R is a vector (1xN) such that R(i) = P(i).*Q.
If Q is a vector (1xN) then R is a vector (1xN) such thatR(i) = P.*Q(i).
If both P and Q are vectors (1xN) then R is a vector (1xN) such that R(i) = P(i).*R(i).
RTBPose.mtimes, SO3.divide, trnorm
Convert to angle-vector form
[theta,v] = P.toangvec(options) is rotation expressed in terms of an angle theta (1x1) about the axis v (1x3) equivalent to the rotational part of the SO3 object P.
If P is a vector (1xN) then theta (Kx1) is a vector of angles for corresponding elements of the vector and v (Kx3) are the corresponding axes, one per row.
'deg' | Return angle in degrees |
Convert to Euler angles
eul = P.toeul(options) are the ZYZ Euler angles (1x3) corresponding to the rotational part of the SO3 object P. The 3 angles eul=[PHI,THETA,PSI] correspond to sequential rotations about the Z, Y and Z axes respectively.
If P is a vector (1xN) then each row of eul corresponds to an element of the vector.
'deg' | Compute angles in degrees (radians default) |
'flip' | Choose first Euler angle to be in quadrant 2 or 3. |
Convert to roll-pitch-yaw angles
rpy = P.torpy(options) are the roll-pitch-yaw angles (1x3) corresponding to the rotational part of the SO3 object P. The 3 angles rpy=[R,P,Y] correspond to sequential rotations about the Z, Y and X axes respectively.
If P is a vector (1xN) then each row of rpy corresponds to an element of the vector.
'deg' | Compute angles in degrees (radians default) |
'xyz' | Return solution for sequential rotations about X, Y, Z axes |
'yxz' | Return solution for sequential rotations about Y, X, Z axes |
Convert to Euler angles (compatibility)
rpy = P.tr2eul(options) is a vector (1x3) of ZYZ Euler angles equivalent to the rotation P (SO3 object).
Convert to RPY angles (compatibility)
rpy = P.tr2rpy(options) is a vector (1x3) of roll-pitch-yaw angles equivalent to the rotation P (SO3 object).
Normalize rotation (compatibility)
R = P.trnorm() is an SO3 object equivalent to P but normalized (guaranteed to be orthogonal).
Convert to UnitQuaternion object
q = P.UnitQuaternion() is a UnitQuaternion object equivalent to the rotation described by the SO3 object P.
© 1990-2014 Peter Corke.