TeamCode/src/main/java/org/firstinspires/ftc/teamcode/libraries/SensorLib.java
public float loop(float error, float dt) {
            if (Math.abs(error) < mKiCutoff)      // only integrate small errors to avoid wild over-correction
                mIntegral += error*dt;
            float derivative = (dt > 0) ? (error - mPrevError)/dt : 0;
            float output = mKp*error + mKi*mIntegral + mKd*derivative;
            mPrevError = error;
            return output;
        }
// run one cycle of the PID filter given current error and delta-time since the previous call
run one cycle of the PID filter given current error and delta-time since the previous call
run one cycle of the PID filter given current error and delta - time since the previous call
public float loop(float error, float dt) {
            if (Math.abs(error) < mKiCutoff)      
                mIntegral += error*dt;
            float derivative = (dt > 0) ? (error - mPrevError)/dt : 0;
            float output = mKp*error + mKi*mIntegral + mKd*derivative;
            mPrevError = error;
            return output;
        }
public float loop ( float error , float dt ) { if ( Math . abs ( error ) < mKiCutoff ) mIntegral += error * dt ; float derivative = ( dt > 0 ) ? ( error - mPrevError ) / dt : 0 ; float output = mKp * error + mKi * mIntegral + mKd * derivative ; mPrevError = error ; return output ; }
run one cycle of the PID filter given current error and delta-time since the previous call
run one cycle of the PID filter given current error and delta - time since the previous call
// only integrate small errors to avoid wild over-correction