Class TractionController

  • All Implemented Interfaces:
    PID<edu.wpi.first.wpilibj.pidwrappers.PIDEncoder,​java.lang.Float>, PIDRateValueSrc<edu.wpi.first.wpilibj.pidwrappers.PIDEncoder>, PIDSrc<edu.wpi.first.wpilibj.pidwrappers.PIDEncoder,​java.lang.Float>, ComposedComponent<java.lang.Object>, edu.wpi.first.wpilibj.PIDSource, edu.wpi.first.wpilibj.SpeedController

    public class TractionController
    extends VelocityController
    A VelocityController with toggleable "traction control". When disabled, the PID control is bypassed and the input values are fed directly into the backing SpeedController instance.
    • Constructor Detail

      • TractionController

        public TractionController​(edu.wpi.first.wpilibj.SpeedController speedController,
                                  edu.wpi.first.wpilibj.pidwrappers.PIDEncoder encoder,
                                  float maxRotationalRate,
                                  float kP,
                                  float kI,
                                  float kD,
                                  float maxIntegralError,
                                  float deadband)
      • TractionController

        public TractionController​(edu.wpi.first.wpilibj.SpeedController speedController,
                                  PIDRateValueSrc<edu.wpi.first.wpilibj.pidwrappers.PIDEncoder> encoderPidSrc,
                                  float maxRotationalRate,
                                  float kP,
                                  float kI,
                                  float kD,
                                  float maxIntegralError,
                                  float deadband)
    • Method Detail

      • setTractionEnabled

        public void setTractionEnabled​(boolean tractionEnabled)
        Enable traction control
        Parameters:
        tractionEnabled - whether to enable traction control
      • isTractionEnabled

        public boolean isTractionEnabled()
        Check if traction control is enabled
        Returns:
        the current traction control state
      • set

        public void set​(double v)
        Description copied from class: VelocityController
        Set the target rotational rate of this VelocityController. This method should be called very frequently, as the PID loop only iterates when this method is called.
        Specified by:
        set in interface edu.wpi.first.wpilibj.SpeedController
        Overrides:
        set in class VelocityController
        Parameters:
        v - target value.