Class ThriftyBotDevices

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

public class ThriftyBotDevices extends Object
Reflection class for SmartMotorControllers and other devices from ThriftyBot.
  • Constructor Details

    • ThriftyBotDevices

      public ThriftyBotDevices()
  • Method Details

    • getMotorController

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

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

      public static Pair<Supplier<Angle>,Object> getAttachedAbsoluteEncoder(String attachType, Object motorController, boolean inverted)
      Get the attached absolute encoder.
      Parameters:
      attachType - Absolute encoder type. Only DutyCycle and analog inputs are supported.
      motorController - Spark motor controller to get the absolute encoder from.
      inverted - Inverted absolute encoder readings.
      Returns:
      Pair of Supplier and DutyCycleEncoder Object