Class SwerveIMUs.SwerveIMU

java.lang.Object
org.team1126.lib.swerve.hardware.SwerveIMUs.SwerveIMU
All Implemented Interfaces:
AutoCloseable
Enclosing class:
SwerveIMUs

public abstract static class SwerveIMUs.SwerveIMU extends Object
A swerve IMU.
  • Constructor Details

    • SwerveIMU

      public SwerveIMU()
  • Method Details

    • construct

      Constructs a swerve IMU. Wraps to support simulation if applicable.
      Parameters:
      ctor - The IMU's constructor.
      config - The general swerve API configuration.
      simHook - Hook to update the IMU if simulation is active.
    • getYaw

      public abstract edu.wpi.first.math.geometry.Rotation2d getYaw()
      Gets the IMU's absolute yaw.
    • getPitch

      public abstract edu.wpi.first.math.geometry.Rotation2d getPitch()
      Gets the IMU's absolute pitch.
    • getRoll

      public abstract edu.wpi.first.math.geometry.Rotation2d getRoll()
      Gets the IMU's absolute roll.
    • getAPI

      Object getAPI()
      Returns the device's underlying API.
    • getSignals

      default List<com.ctre.phoenix6.BaseStatusSignal> getSignals()
      Returns all Phoenix status signals in use by the hardware. Phoenix hardware should not invoke .refresh() on their status signals in their implementations. This method is required for the odometry thread to register signals to be refreshed automatically. Because signals are not thread safe, all returned signals should also be cloned in their initialization as to not interfere with telemetry, which is invoked on the main thread. The exception to this rule is IMU pitch and roll values, as they are only measured synchronously when calling SwerveAPI.refresh().
    • readError

      default boolean readError()
      If the device has encountered an error while reading inputs.