Class TalonFXWrapper

java.lang.Object
com.team2813.lib2813.vendor.ctre.motor.TalonFXWrapper
All Implemented Interfaces:
com.team2813.lib2813.control.Encoder, com.team2813.lib2813.control.Motor, com.team2813.lib2813.control.PIDMotor

public class TalonFXWrapper extends Object implements com.team2813.lib2813.control.PIDMotor
  • Constructor Summary

    Constructors
    Constructor
    Description
    TalonFXWrapper(int canID, CANBus canbus, com.team2813.lib2813.control.InvertType invertType)
    Create a TalonFXWrapper on the specified canbus.
    TalonFXWrapper(int canID, com.team2813.lib2813.control.InvertType invertType)
    Create a TalonFXWrapper on the RoboRIO's canbus
    TalonFXWrapper(int canID, String canbusName, com.team2813.lib2813.control.InvertType invertType)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Constructing DeviceInformation with a CAN bus string is deprecated for removal in the 2027 season.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addFollower(int deviceNumber, CANBus canbus, com.team2813.lib2813.control.InvertType invertType)
     
    void
    addFollower(int deviceNumber, com.team2813.lib2813.control.InvertType invertType)
     
    void
    addFollower(int deviceNumber, String canbus, com.team2813.lib2813.control.InvertType invertType)
    Deprecated, for removal: This API element is subject to removal in a future version.
    void
    configPID(double p, double i, double d)
     
    void
    configPID(int slot, double p, double i, double d)
     
    void
    configPIDF(double p, double i, double d, double f)
     
    void
    configPIDF(int slot, double p, double i, double d, double f)
     
     
     
     
     
    void
    set(com.team2813.lib2813.control.ControlMode controlMode, double demand)
     
    void
    set(com.team2813.lib2813.control.ControlMode controlMode, double demand, double feedForward)
     
    void
    Sets the behavior the motor should exhibit upon receiving a request to stop: MotorSubsystem.stopMotor() Coast: The motor stops applying an input, but continues to move with its inertia.
    void
    setPosition(Angle position)
     
    void
    Sends a disable command to the motor, placing it in its neutral value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TalonFXWrapper

      public TalonFXWrapper(int canID, CANBus canbus, com.team2813.lib2813.control.InvertType invertType)
      Create a TalonFXWrapper on the specified canbus.
      Parameters:
      canID - [0, 62] the can ID of the motor
      canbus - the canbus that the motor is on
      invertType - the invert type
      Throws:
      NullPointerException - if either invertType or canbus are null
      IllegalArgumentException - if invertType is not in InvertType.rotationValues. In other words, this exception is thrown when passed an InvertType that is for following motors
      com.team2813.lib2813.util.InvalidCanIdException - if the CAN id is invalid
    • TalonFXWrapper

      @Deprecated(forRemoval=true) public TalonFXWrapper(int canID, String canbusName, com.team2813.lib2813.control.InvertType invertType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructing DeviceInformation with a CAN bus string is deprecated for removal in the 2027 season. Construct instances using a CANBus instance instead.
      Create a TalonFXWrapper on the specified canbus name.
      Parameters:
      canID - [0, 62] the can ID of the motor
      canbusName - the canbus that the motor is on
      invertType - the invert type
      Throws:
      NullPointerException - if either invertType or canbus are null
      IllegalArgumentException - if invertType is not in InvertType.rotationValues. In other words, this exception is thrown when passed an InvertType that is for following motors
      com.team2813.lib2813.util.InvalidCanIdException - if the CAN id is invalid
    • TalonFXWrapper

      public TalonFXWrapper(int canID, com.team2813.lib2813.control.InvertType invertType)
      Create a TalonFXWrapper on the RoboRIO's canbus
      Parameters:
      canID - [0, 62] the can ID of the motor
      invertType - the invert type
      Throws:
      NullPointerException - if invertType is null
      IllegalArgumentException - if invertType is not in InvertType.rotationValues. In other words, this exception is thrown when passed an InvertType that is for following motors
      com.team2813.lib2813.util.InvalidCanIdException - if the CAN id is invalid
  • Method Details

    • set

      public void set(com.team2813.lib2813.control.ControlMode controlMode, double demand)
      Specified by:
      set in interface com.team2813.lib2813.control.Motor
    • set

      public void set(com.team2813.lib2813.control.ControlMode controlMode, double demand, double feedForward)
      Specified by:
      set in interface com.team2813.lib2813.control.Motor
    • getPositionMeasure

      public Angle getPositionMeasure()
      Specified by:
      getPositionMeasure in interface com.team2813.lib2813.control.Encoder
    • getAppliedCurrent

      public Current getAppliedCurrent()
      Specified by:
      getAppliedCurrent in interface com.team2813.lib2813.control.Motor
    • setPosition

      public void setPosition(Angle position)
      Specified by:
      setPosition in interface com.team2813.lib2813.control.Encoder
    • getVelocityMeasure

      public AngularVelocity getVelocityMeasure()
      Specified by:
      getVelocityMeasure in interface com.team2813.lib2813.control.Encoder
    • motor

      public TalonFX motor()
    • setNeutralMode

      public void setNeutralMode(NeutralModeValue mode)
      Sets the behavior the motor should exhibit upon receiving a request to stop: MotorSubsystem.stopMotor()
      • Coast: The motor stops applying an input, but continues to move with its inertia.
      • Brake: The motor stops applying an input, and actively opposes its inertia.
      Parameters:
      mode -
    • stopMotor

      public void stopMotor()
      Sends a disable command to the motor, placing it in its neutral value.
      Specified by:
      stopMotor in interface com.team2813.lib2813.control.Motor
      See Also:
    • configPIDF

      public void configPIDF(int slot, double p, double i, double d, double f)
      Specified by:
      configPIDF in interface com.team2813.lib2813.control.PIDMotor
    • configPIDF

      public void configPIDF(double p, double i, double d, double f)
      Specified by:
      configPIDF in interface com.team2813.lib2813.control.PIDMotor
    • configPID

      public void configPID(int slot, double p, double i, double d)
      Specified by:
      configPID in interface com.team2813.lib2813.control.PIDMotor
    • configPID

      public void configPID(double p, double i, double d)
      Specified by:
      configPID in interface com.team2813.lib2813.control.PIDMotor
    • addFollower

      @Deprecated(forRemoval=true) public void addFollower(int deviceNumber, String canbus, com.team2813.lib2813.control.InvertType invertType)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • addFollower

      public void addFollower(int deviceNumber, CANBus canbus, com.team2813.lib2813.control.InvertType invertType)
    • addFollower

      public void addFollower(int deviceNumber, com.team2813.lib2813.control.InvertType invertType)