Package ca.team3161.lib.robot.pid
Class TractionController
- java.lang.Object
-
- ca.team3161.lib.robot.pid.AbstractPID<edu.wpi.first.wpilibj.pidwrappers.PIDEncoder,java.lang.Float>
-
- ca.team3161.lib.robot.pid.VelocityController
-
- ca.team3161.lib.robot.pid.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.
-
-
Field Summary
-
Fields inherited from class ca.team3161.lib.robot.pid.VelocityController
deadband, inverted, maxIntegralError, maxRotationalRate, speedController, target
-
Fields inherited from class ca.team3161.lib.robot.pid.AbstractPID
deadbandPeriod, deadbandUnit, deltaError, integralError, kD, kI, kP, lastTimeNotAtTarget, prevError, source
-
-
Constructor Summary
Constructors Constructor Description 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)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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisTractionEnabled()Check if traction control is enabledvoidset(double v)Set the target rotational rate of this VelocityController.voidsetTractionEnabled(boolean tractionEnabled)Enable traction control-
Methods inherited from class ca.team3161.lib.robot.pid.VelocityController
disable, get, getComposedComponents, getInverted, getPIDSourceType, getPIDValue, getRate, getSensor, pid, setInverted, setPIDSourceType, stopMotor
-
Methods inherited from class ca.team3161.lib.robot.pid.AbstractPID
atTarget, clear, getkD, getkI, getkP, getSrc, setkD, setkI, setkP
-
-
-
-
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:VelocityControllerSet 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:
setin interfaceedu.wpi.first.wpilibj.SpeedController- Overrides:
setin classVelocityController- Parameters:
v- target value.
-
-