wideband/firmware/pid.cpp

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;
}