klampt.math.so3 module¶
Operations for rigid rotations in Klampt. All rotations are represented by a 9-list specifying the entries of the rotation matrix in column major form.
In other words, given a 3x3 matrix:
[a11,a12,a13]
[a21,a22,a23]
[a31,a32,a33],
Klamp’t represents the matrix as a list [a11,a21,a31,a12,a22,a32,a13,a23,a33].
The reasons for this representation are 1) simplicity, and 2) a more convenient interface with C code.
-
klampt.math.so3.
canonical
(v)[source]¶ Given a unit vector v, finds R that defines a basis [x,y,z] such that x = v and y and z are orthogonal
-
klampt.math.so3.
cross_product
(w)[source]¶ Returns the cross product matrix associated with w.
The matrix [w]R is the derivative of the matrix R as it rotates about the axis w/||w|| with angular velocity ||w||.
-
klampt.math.so3.
distance
(R1, R2)[source]¶ Returns the absolute angle one would need to rotate in order to get from R1 to R2
-
klampt.math.so3.
error
(R1, R2)[source]¶ Returns a 3D “difference vector” that describes how far R1 is from R2. More precisely, this is the Lie derivative, which is the rotation vector representation of R1*R2^T.
-
klampt.math.so3.
from_axis_angle
(aa)[source]¶ Converts an axis-angle representation (axis,angle) to a 3D rotation matrix.
-
klampt.math.so3.
from_moment
(w)¶ Converts a rotation vector representation w to a 3D rotation matrix.
-
klampt.math.so3.
from_quaternion
(q)[source]¶ Given a unit quaternion (w,x,y,z), produce the corresponding rotation matrix.
-
klampt.math.so3.
from_rotation_vector
(w)[source]¶ Converts a rotation vector representation w to a 3D rotation matrix.
-
klampt.math.so3.
from_rpy
(rollpitchyaw)[source]¶ Converts from roll,pitch,yaw angle triple to a rotation matrix. The triple is given in radians. The x axis is “roll”, y is “pitch”, and z is “yaw”.
-
klampt.math.so3.
interpolate
(R1, R2, u)[source]¶ Interpolate linearly between the two rotations R1 and R2.
-
klampt.math.so3.
is_rotation
(R, tol=1e-05)[source]¶ Returns true if R is a rotation matrix, i.e. is orthogonal to the given tolerance and has + determinant
-
klampt.math.so3.
moment
(R)¶ Returns the rotation vector w (exponential map) representation of R such that e^[w] = R. Equivalent to axis-angle representation with w/||w||=axis, ||w||=angle.
-
klampt.math.so3.
quaternion
(R)[source]¶ Given a Klamp’t rotation representation, produces the corresponding unit quaternion (w,x,y,z).
-
klampt.math.so3.
rotation
(axis, angle)[source]¶ Given a unit axis and an angle in radians, returns the rotation matrix.
-
klampt.math.so3.
rotation_vector
(R)[source]¶ Returns the rotation vector w (exponential map) representation of R such that e^[w] = R. Equivalent to axis-angle representation with w/||w||=axis, ||w||=angle.