Enum Class GyroAxis
- All Implemented Interfaces:
Serializable, Comparable<GyroAxis>, Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionorg.wpilib.math.geometry.Rotation3dtoRobotAttitude(org.wpilib.math.geometry.Rotation3d gyroAttitude) Rotate the gyro's attitude into the robot's frame, so its yaw is the robot's heading and its roll and pitch are the robot's tilt, whichever way the gyro is mounted.static GyroAxisReturns the enum constant of this class with the specified name.static GyroAxis[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ROLL
The gyro's X axis points up: the robot turning is the gyro's roll. The gyro's Y axis is taken to point to the robot's left, like WPILib's robot frame. -
PITCH
The gyro's Y axis points up: the robot turning is the gyro's pitch. The gyro's X axis is taken to point to the robot's front, like WPILib's robot frame. -
YAW
The gyro's Z axis points up: the robot turning is the gyro's yaw. The default.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
toRobotAttitude
public org.wpilib.math.geometry.Rotation3d toRobotAttitude(org.wpilib.math.geometry.Rotation3d gyroAttitude) Rotate the gyro's attitude into the robot's frame, so its yaw is the robot's heading and its roll and pitch are the robot's tilt, whichever way the gyro is mounted. Reading the heading as the robot frame yaw also keeps its full half rotation range each way, which aRotation3d's pitch does not have.- Parameters:
gyroAttitude- Attitude reported by the gyro.- Returns:
- The robot's attitude.
-