PID motor controll for the biorobotics project.
Dependents: PID_example Motor_calibration Demo_mode Demo_mode ... more
Diff: pid.h
- Revision:
- 3:f1067b5bb5af
- Parent:
- 0:009e84d7af32
- Child:
- 4:5353c5d0d2ed
diff -r b30a467e90d3 -r f1067b5bb5af pid.h --- a/pid.h Mon Oct 29 14:15:57 2018 +0000 +++ b/pid.h Mon Oct 29 15:27:56 2018 +0000 @@ -1,7 +1,5 @@ #pragma once -#include "BiQuad.h" - class PID { private: double Kp, Ki, Kd; @@ -10,12 +8,16 @@ double pid_period; // Time between pid updates. bool first_update; - // Filter to make sure the derivative component does not amplify the noise. - BiQuad low_pass_filter; + // ---- Low Pass Filter variables ---- + double B[3]; + double A[2]; + double wz[2]; public: PID(); void set_period(double period); void set_k_values(double Kp, double Ki, double Kd); double update(double error); + + double biquad_step(double x); }; \ No newline at end of file