Class NavXSwerve


  • public class NavXSwerve
    extends SwerveIMU
    Communicates with the NavX as the IMU.
    • Field Detail

      • gyro

        private com.kauailabs.navx.frc.AHRS gyro
        NavX IMU.
      • yawOffset

        private double yawOffset
        Offset for the NavX yaw reading.
    • Constructor Detail

      • NavXSwerve

        public NavXSwerve()
        Constructor for the NavX swerve.
    • Method Detail

      • factoryDefault

        public void factoryDefault()
        Reset IMU to factory default.
        Specified by:
        factoryDefault in class SwerveIMU
      • clearStickyFaults

        public void clearStickyFaults()
        Clear sticky faults on IMU.
        Specified by:
        clearStickyFaults in class SwerveIMU
      • setYaw

        public void setYaw​(double yaw)
        Set the yaw in degrees.
        Specified by:
        setYaw in class SwerveIMU
        Parameters:
        yaw - Yaw angle in degrees.
      • getYawPitchRoll

        public void getYawPitchRoll​(double[] yprArray)
        Fetch the yaw/pitch/roll from the IMU.
        Specified by:
        getYawPitchRoll in class SwerveIMU
        Parameters:
        yprArray - Array which will be filled with {yaw, pitch, roll} in degrees.
      • getIMU

        public Object getIMU()
        Get the instantiated IMU object.
        Specified by:
        getIMU in class SwerveIMU
        Returns:
        IMU object.