Rotation3d
- class wpimath.geometry.Rotation3d(*args, **kwargs)
Bases:
pybind11_object
A rotation in a 3D coordinate frame represented by a quaternion.
Overloaded function.
__init__(self: wpimath.geometry._geometry.Rotation3d) -> None
Constructs a Rotation3d with a default angle of 0 degrees.
__init__(self: wpimath.geometry._geometry.Rotation3d, q: wpimath.geometry._geometry.Quaternion) -> None
Constructs a Rotation3d from a quaternion.
- Parameters:
q – The quaternion.
__init__(self: wpimath.geometry._geometry.Rotation3d, roll: radians, pitch: radians, yaw: radians) -> None
Constructs a Rotation3d from extrinsic roll, pitch, and yaw.
Extrinsic rotations occur in that order around the axes in the fixed global frame rather than the body frame.
Angles are measured counterclockwise with the rotation axis pointing “out of the page”. If you point your right thumb along the positive axis direction, your fingers curl in the direction of positive rotation.
- Parameters:
roll – The counterclockwise rotation angle around the X axis (roll).
pitch – The counterclockwise rotation angle around the Y axis (pitch).
yaw – The counterclockwise rotation angle around the Z axis (yaw).
__init__(self: wpimath.geometry._geometry.Rotation3d, axis: numpy.ndarray[numpy.float64[3, 1]], angle: radians) -> None
Constructs a Rotation3d with the given axis-angle representation. The axis doesn’t have to be normalized.
- Parameters:
axis – The rotation axis.
angle – The rotation around the axis.
__init__(self: wpimath.geometry._geometry.Rotation3d, rvec: numpy.ndarray[numpy.float64[3, 1]]) -> None
Constructs a Rotation3d with the given rotation vector representation. This representation is equivalent to axis-angle, where the normalized axis is multiplied by the rotation around the axis in radians.
- Parameters:
rvec – The rotation vector.
__init__(self: wpimath.geometry._geometry.Rotation3d, rotationMatrix: numpy.ndarray[numpy.float64[3, 3]]) -> None
Constructs a Rotation3d from a rotation matrix.
- Parameters:
rotationMatrix – The rotation matrix. @throws std::domain_error if the rotation matrix isn’t special orthogonal.
__init__(self: wpimath.geometry._geometry.Rotation3d, initial: numpy.ndarray[numpy.float64[3, 1]], final: numpy.ndarray[numpy.float64[3, 1]]) -> None
Constructs a Rotation3d that rotates the initial vector onto the final vector.
This is useful for turning a 3D vector (final) into an orientation relative to a coordinate system vector (initial).
- Parameters:
initial – The initial vector.
final – The final vector.
- X() radians
Returns the counterclockwise rotation angle around the X axis (roll).
- Y() radians
Returns the counterclockwise rotation angle around the Y axis (pitch).
- Z() radians
Returns the counterclockwise rotation angle around the Z axis (yaw).
- property angle
- property angle_degrees
- axis() numpy.ndarray[numpy.float64[3, 1]]
Returns the axis in the axis-angle representation of this rotation.
- static fromDegrees(roll: degrees, pitch: degrees, yaw: degrees) wpimath.geometry._geometry.Rotation3d
- getQuaternion() wpimath.geometry._geometry.Quaternion
Returns the quaternion representation of the Rotation3d.
- rotateBy(other: wpimath.geometry._geometry.Rotation3d) wpimath.geometry._geometry.Rotation3d
Adds the new rotation to the current rotation.
- Parameters:
other – The rotation to rotate by.
- Returns:
The new rotated Rotation3d.
- toRotation2d() wpimath.geometry._geometry.Rotation2d
Returns a Rotation2d representing this Rotation3d projected into the X-Y plane.
- property x
- property x_degrees
- property y
- property y_degrees
- property z
- property z_degrees