wideband/firmware/pid.cpp

13 lines
263 B
C++
Raw Normal View History

2020-10-31 14:58:34 -07:00
#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;
}