public class WsTalon extends WsMotorController
Controls a Talon or Victor motor controller as a Phoenix BaseMotorController.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WsTalon(String name, int channel, String CANBUS, double p_default)
    Constructs the motor controller from config.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addClosedLoop(double P, double I, double D)
     
    void
    addFollower(int canConstant, String CANBUS, boolean oppose)
    Add a follower motor to the current motor.
    double
    Returns the current motor output percent.
    double
    Returns the quadrature position from a Talon's encoder.
    double
    Return the motor controller or motor temperature
    double
    Returns the quadrature velocity from a Talon's encoder.
    void
    initClosedLoop(double P, double I, double D)
    Sets up closed loop control for the motor
    void
    Does nothing, config values only affects start state.
    void
    Sets motor speed to current value, from -1.0 to 1.0.
    void
    Sets the motor to brake mode, will not freely spin.
    void
    Sets the motor to coast mode, will freely spin.
    void
    setCurrentLimit(int statorLimit)
     
    void
    setCurrentLimit(int statorLimit, int supplyLimit)
    Sets the current limit of the motor controller.
    void
    setPosition(double target)
    Sets the motor to track the given position
    void
    setPosition(double target, int slotID)
    Sets the motor to track the given position with a specific PIDFF constants
    void
    setSpeed(double value)
    Wraps setValue().

    Methods inherited from class org.wildstang.hardware.roborio.outputs.WsMotorController

    stop

    Methods inherited from class org.wildstang.framework.io.outputs.AnalogOutput

    getValue, setValue

    Methods inherited from class org.wildstang.framework.io.outputs.Output

    disable, enable, getName, hashCode, isEnabled, update

    Methods inherited from class java.lang.Object

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

    • WsTalon

      public WsTalon(String name, int channel, String CANBUS, double p_default)
      Constructs the motor controller from config.
      Parameters:
      name - Descriptive name of the controller.
      channel - Motor controller CAN constant.
      p_default - Default output value.
  • Method Details

    • addFollower

      public void addFollower(int canConstant, String CANBUS, boolean oppose)
      Add a follower motor to the current motor.
      Parameters:
      canConstant - CAN constant of the new follower motor.
      CANBUS - Attached CAN bus name.
      oppose - True if the follow should oppose the direction of this motor.
    • setBrake

      public void setBrake()
      Sets the motor to brake mode, will not freely spin.
      Specified by:
      setBrake in class WsMotorController
    • setCoast

      public void setCoast()
      Sets the motor to coast mode, will freely spin.
      Specified by:
      setCoast in class WsMotorController
    • setCurrentLimit

      public void setCurrentLimit(int statorLimit, int supplyLimit)
      Sets the current limit of the motor controller.
      Parameters:
      statorLimit - the stator limit to apply
      supplyLimit - the supply limit to apply
    • setCurrentLimit

      public void setCurrentLimit(int statorLimit)
    • getVelocity

      public double getVelocity()
      Returns the quadrature velocity from a Talon's encoder.
      Specified by:
      getVelocity in class WsMotorController
      Returns:
      Current velocity, 0 if not a Talon.
    • getPosition

      public double getPosition()
      Returns the quadrature position from a Talon's encoder.
      Specified by:
      getPosition in class WsMotorController
      Returns:
      Current position, 0 if not a Talon.
    • getOutput

      public double getOutput()
      Description copied from class: WsMotorController
      Returns the current motor output percent.
      Specified by:
      getOutput in class WsMotorController
      Returns:
      Current motor output as a percent.
    • getTemperature

      public double getTemperature()
      Description copied from class: WsMotorController
      Return the motor controller or motor temperature
      Specified by:
      getTemperature in class WsMotorController
      Returns:
      Current temperature.
    • sendDataToOutput

      public void sendDataToOutput()
      Sets motor speed to current value, from -1.0 to 1.0.
      Specified by:
      sendDataToOutput in class WsMotorController
    • setSpeed

      public void setSpeed(double value)
      Description copied from class: WsMotorController
      Wraps setValue().
      Overrides:
      setSpeed in class WsMotorController
      Parameters:
      value - New motor percent speed, from -1.0 to 1.0.
    • initClosedLoop

      public void initClosedLoop(double P, double I, double D)
      Sets up closed loop control for the motor
      Parameters:
      P - the P value
      I - the I value
      D - the D value
    • addClosedLoop

      public void addClosedLoop(double P, double I, double D)
    • setPosition

      public void setPosition(double target)
      Sets the motor to track the given position
      Parameters:
      target - the encoder target value to track to
    • setPosition

      public void setPosition(double target, int slotID)
      Sets the motor to track the given position with a specific PIDFF constants
      Parameters:
      target - the encoder target to track to
      slotID - the ID slot of the sparkmax to use
    • notifyConfigChange

      public void notifyConfigChange()
      Does nothing, config values only affects start state.