CSharpRoboticsLib.ControlSystems.SimplePID.Get C# (CSharp) Method

Get() public method

Gets the value of the PID loop, using the point given as the input for the proportional value
public Get ( double currentPoint ) : double
currentPoint double current point of the system as read by a sensor
return double
        public double Get(double currentPoint)
        {
            double error = (SetPoint - currentPoint);
            if (Continuous)
                error = Utility.Util.WrapError(currentPoint, SetPoint, MinInput, MaxInput);

            double p = m_kP == 0 ? 0 : m_kP * error;
            double I = m_kI == 0 ? 0 : m_kI * m_i.Get(error);
            double d = m_kD == 0 ? 0 : m_kD * m_d.Get(error);

            return Utility.Util.Limit(p + I + d, Min, Max);
        }