Package ca.team3161.lib.robot.pid
Class PIDulum<V extends PIDAngleValueSrc<?>>
- java.lang.Object
-
- ca.team3161.lib.robot.pid.AbstractPID<V,java.lang.Float>
-
- ca.team3161.lib.robot.pid.PIDulum<V>
-
- Type Parameters:
V
- the specific source type which provides angle measurements for this PIDulum.
- All Implemented Interfaces:
PID<V,java.lang.Float>
,ComposedComponent<PIDSrc<V,java.lang.Float>>
public final class PIDulum<V extends PIDAngleValueSrc<?>> extends AbstractPID<V,java.lang.Float> implements ComposedComponent<PIDSrc<V,java.lang.Float>>
A PID controller for inverted pendulum systems (PID pendulum... getPIDValue it?)
-
-
Field Summary
-
Fields inherited from class ca.team3161.lib.robot.pid.AbstractPID
deadband, deadbandPeriod, deadbandUnit, deltaError, integralError, kD, kI, kP, lastTimeNotAtTarget, prevError, source
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<PIDSrc<V,java.lang.Float>>
getComposedComponents()
Get the composed components within this one.java.lang.Float
pid(java.lang.Float target)
Iterate the PID loop.
-
-
-
Constructor Detail
-
PIDulum
public PIDulum(PIDSrc<V,java.lang.Float> source, float deadband, int deadbandPeriod, java.util.concurrent.TimeUnit deadbandUnit, float kP, float kI, float kD, float offsetAngle, float torqueConstant)
- Parameters:
source
- the PIDSrc source sensordeadband
- filter value - do not act when current error is within this bounddeadbandPeriod
- the amount of time to remain within acceptable error of the target value before claiming to actually be at the targetdeadbandUnit
- the units for deadbandPeriodkP
- P constantkI
- I constantkD
- D constantoffsetAngle
- the balance point of the inverted pendulumtorqueConstant
- "feed forward" term constant to allow the pendulum to hold position against gravity
-
-
Method Detail
-
pid
public java.lang.Float pid(java.lang.Float target)
Iterate the PID loop.- Specified by:
pid
in interfacePID<V extends PIDAngleValueSrc<?>,java.lang.Float>
- Specified by:
pid
in classAbstractPID<V extends PIDAngleValueSrc<?>,java.lang.Float>
- Parameters:
target
- the desired target value. Units depend on the context of this PID- Returns:
- the output value to set to eg a SpeedController to reach the specified target
-
getComposedComponents
public java.util.Collection<PIDSrc<V,java.lang.Float>> getComposedComponents()
Get the composed components within this one.- Specified by:
getComposedComponents
in interfaceComposedComponent<V extends PIDAngleValueSrc<?>>
- Returns:
- the composed components.
-
-