Class NavX

  • All Implemented Interfaces:
    edu.wpi.first.wpilibj.PIDSource, edu.wpi.first.wpilibj.Sendable, java.lang.AutoCloseable

    public class NavX
    extends com.kauailabs.navx.frc.AHRS
    A wrapper for the AHRS / NavX gyroscope
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.kauailabs.navx.frc.AHRS

        com.kauailabs.navx.frc.AHRS.BoardAxis, com.kauailabs.navx.frc.AHRS.BoardYawAxis, com.kauailabs.navx.frc.AHRS.SerialDataType
    • Constructor Summary

      Constructors 
      Constructor Description
      NavX()  
      NavX​(edu.wpi.first.wpilibj.SPI.Port port)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getAngle()  
      double getHeading()
      Returns the heading of the robot.
      static NavX getInstance()
      Get the Default NavX instance
      double getRate()  
      edu.wpi.first.wpilibj.geometry.Rotation2d getRotation()
      Get the NavX heading as a Rotation2d object
      double getWrappedAngle()
      Get the gyro angle, wrapped by 360 degrees
      void initDrivebaseSimulation​(IDifferentialDrivebase drivebase)  
      void setInverted​(boolean inverted)
      Set if the NavX readings should be inverted
      • Methods inherited from class com.kauailabs.navx.frc.AHRS

        deregisterCallback, enableBoardlevelYawReset, enableLogging, getAccelFullScaleRangeG, getActualUpdateRate, getAltitude, getAngleAdjustment, getBarometricPressure, getBoardYawAxis, getByteCount, getCompassHeading, getDisplacementX, getDisplacementY, getDisplacementZ, getFirmwareVersion, getFusedHeading, getGyroFullScaleRangeDPS, getLastSensorTimestamp, getPIDSourceType, getPitch, getPressure, getQuaternionW, getQuaternionX, getQuaternionY, getQuaternionZ, getRawAccelX, getRawAccelY, getRawAccelZ, getRawGyroX, getRawGyroY, getRawGyroZ, getRawMagX, getRawMagY, getRawMagZ, getRequestedUpdateRate, getRoll, getTempC, getUpdateCount, getVelocityX, getVelocityY, getVelocityZ, getWorldLinearAccelX, getWorldLinearAccelY, getWorldLinearAccelZ, getYaw, initSendable, isAltitudeValid, isBoardlevelYawResetEnabled, isCalibrating, isConnected, isMagneticDisturbance, isMagnetometerCalibrated, isMoving, isRotating, pidGet, registerCallback, reset, resetDisplacement, setAngleAdjustment, setPIDSourceType, zeroYaw
      • Methods inherited from class edu.wpi.first.wpilibj.SendableBase

        close
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface edu.wpi.first.wpilibj.Sendable

        addChild, getName, getSubsystem, setName, setName, setName, setName, setSubsystem
    • Constructor Detail

      • NavX

        public NavX()
      • NavX

        public NavX​(edu.wpi.first.wpilibj.SPI.Port port)
    • Method Detail

      • getInstance

        public static NavX getInstance()
        Get the Default NavX instance
        Returns:
        NavX instance
      • setInverted

        public void setInverted​(boolean inverted)
        Set if the NavX readings should be inverted
        Parameters:
        inverted - Is NavX inverted?
      • getAngle

        public double getAngle()
        Overrides:
        getAngle in class com.kauailabs.navx.frc.AHRS
      • getHeading

        public double getHeading()
        Returns the heading of the robot.
        Returns:
        the robot's heading in degrees, from 180 to 180
      • getRate

        public double getRate()
        Overrides:
        getRate in class com.kauailabs.navx.frc.AHRS
      • getWrappedAngle

        public double getWrappedAngle()
        Get the gyro angle, wrapped by 360 degrees
        Returns:
        Wrapped angle
      • getRotation

        public edu.wpi.first.wpilibj.geometry.Rotation2d getRotation()
        Get the NavX heading as a Rotation2d object
        Returns:
        Heading