Class REVDevices

java.lang.Object
swervelib.core.parser.deserializer.reflections.REVDevices

public class REVDevices extends Object
Reflection class for SparkBases and other REV devices.
  • Constructor Details

    • REVDevices

      public REVDevices()
  • Method Details

    • getMotorController

      public static SmartMotorController getMotorController(int canid, String canbus, SmartMotorControllerConfig config, org.wpilib.math.system.DCMotor motor, String motorControllerType)
      Parameters:
      canid - CAN ID of the SparkBase
      canbus - CAN bus number of the SparkBase, see CANBuses
      config - SmartMotorControllerConfig to apply to the SmartMotorController
      motor - DCMotor to use with the SmartMotorController
      motorControllerType - Motor controller type.
      Returns:
      SmartMotorController
    • getAbsoluteEncoder

      public static org.wpilib.util.Pair<Supplier<org.wpilib.units.measure.Angle>, Object> getAbsoluteEncoder(int canid, String canbus, boolean inverted)
      Get the Angle Supplier and the encoder object.
      Parameters:
      canid - CAN ID of the encoder.
      canbus - CAN bus number of the encoder, see CANBuses
      inverted - Inversion of the encoder.
      Returns:
      Pair of Supplier and Object
      Implementation Note:
      Angle is in the range of [0, 1) by default.
    • getAttachedAbsoluteEncoder

      public static org.wpilib.util.Pair<Supplier<org.wpilib.units.measure.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