Class CTREDevices

java.lang.Object
swervelib.parser.deserializer.reflections.CTREDevices

public class CTREDevices extends Object
Reflection class for TalonFX and TalonFXSs and other devices from CTRE.
  • Constructor Details

    • CTREDevices

      public CTREDevices()
  • Method Details

    • getMotorController

      public static yams.motorcontrollers.SmartMotorController getMotorController(int canid, String canbus, yams.motorcontrollers.SmartMotorControllerConfig config, DCMotor motor, String motorControllerType)
      Get the CTREDevices.MotorControllerType as a SmartMotorController.
      Parameters:
      canid - CAN ID of the CTREDevices.MotorControllerType
      canbus - CAN bus name of the CTREDevices.MotorControllerType
      config - SmartMotorControllerConfig to apply to the SmartMotorController
      motor - DCMotor to use with the SmartMotorController
      motorControllerType - Motor controller type.
      Returns:
      SmartMotorController
    • getGyroAngle

      public static Pair<Supplier<Angle>,Object> getGyroAngle(int canid, String canbus, SwerveDriveJson.GyroAxis axis, boolean inverted)
      Get the gyroscope angle supplier and gyroscope object.
      Parameters:
      canid - CAN ID of the gyroscope.
      canbus - CAN bus name of the gyroscope.
      axis - Gyro axis.
      inverted - Inverted gyro readings.
      Returns:
      Pair of Supplier and Object
    • getAbsoluteEncoder

      public static Pair<Supplier<Angle>,Object> getAbsoluteEncoder(int canid, String canbus, boolean inverted)
      Get the CANcoder angle.
      Parameters:
      canid - CAN ID of the encoder.
      canbus - CAN bus name of the encoder.
      inverted - Inverted encoder readings.
      Returns:
      Supplier of Angle and CANcoder