Package swervelib.imu

Class AnalogGyroSwerve

java.lang.Object
swervelib.imu.SwerveIMU
swervelib.imu.AnalogGyroSwerve

public class AnalogGyroSwerve extends SwerveIMU
Creates a IMU for AnalogGyro devices, only uses yaw.
  • Field Details

    • gyro

      private final edu.wpi.first.wpilibj.AnalogGyro gyro
      Gyroscope object.
    • yawOffset

      private double yawOffset
      The yaw offset for the gyroscope.
  • Constructor Details

    • AnalogGyroSwerve

      public AnalogGyroSwerve(int channel)
      Analog port in which the gyroscope is connected. Can only be attached to analog ports 0 or 1.
      Parameters:
      channel - Analog port 0 or 1.
  • Method Details

    • 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.