Skip to content
Snippets Groups Projects
PDController.cpp 284 B
Newer Older
  • Learn to ignore specific revisions
  • 
    #include "PDController.h"
    
    double PDController::compute (double currentValue) {
        double currentVelocity = currentValue - _previousCurrentValue;
        _previousCurrentValue = currentValue;
        return _kp * (_targetValue - currentValue) + _kd * (_targetVelocity - currentVelocity);
    }