mirror of https://github.com/rusefi/wideband.git
13 lines
263 B
C++
13 lines
263 B
C++
|
#include "pid.h"
|
||
|
|
||
|
float Pid::GetOutput(float setpoint, float observation)
|
||
|
{
|
||
|
float error = setpoint - observation;
|
||
|
|
||
|
// Integrate error
|
||
|
m_integrator += error * m_period;
|
||
|
|
||
|
// Multiply by gains and sum
|
||
|
return m_kp * error + m_ki * m_integrator;
|
||
|
}
|