Class PIDulum<V extends PIDAngleValueSrc<?>>

  • 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?)
    • 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 sensor
        deadband - filter value - do not act when current error is within this bound
        deadbandPeriod - the amount of time to remain within acceptable error of the target value before claiming to actually be at the target
        deadbandUnit - the units for deadbandPeriod
        kP - P constant
        kI - I constant
        kD - D constant
        offsetAngle - the balance point of the inverted pendulum
        torqueConstant - "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 interface PID<V extends PIDAngleValueSrc<?>,​java.lang.Float>
        Specified by:
        pid in class AbstractPID<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