Enum Class GyroAxis

java.lang.Object
java.lang.Enum<GyroAxis>
yams.core.mechanisms.config.enums.GyroAxis
All Implemented Interfaces:
Serializable, Comparable<GyroAxis>, Constable

public enum GyroAxis extends Enum<GyroAxis>
Axis of the gyro that points up through the robot, so the robot turning shows up as rotation about it: YAW for a gyro mounted flat, ROLL or PITCH for one mounted on its side.
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The gyro's Y axis points up: the robot turning is the gyro's pitch.
    The gyro's X axis points up: the robot turning is the gyro's roll.
    The gyro's Z axis points up: the robot turning is the gyro's yaw.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    static GyroAxis
    Returns the enum constant of this class with the specified name.
    static GyroAxis[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ROLL

      public static final GyroAxis 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

      public static final GyroAxis 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

      public static final GyroAxis YAW
      The gyro's Z axis points up: the robot turning is the gyro's yaw. The default.
  • Method Details

    • values

      public static GyroAxis[] 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

      public static GyroAxis valueOf(String name)
      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 name
      NullPointerException - 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 a Rotation3d's pitch does not have.
      Parameters:
      gyroAttitude - Attitude reported by the gyro.
      Returns:
      The robot's attitude.