PID motor controll for the biorobotics project.
Dependents: PID_example Motor_calibration Demo_mode Demo_mode ... more
pid.h
- Committer:
- MAHCSnijders
- Date:
- 2018-11-05
- Revision:
- 14:e5fc69651b1d
- Parent:
- 4:5353c5d0d2ed
File content as of revision 14:e5fc69651b1d:
#pragma once class PID { private: double Kp, Ki, Kd; double error_integral; double error_previous; double pid_period; // Time between pid updates. bool first_update; // ---- 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); // Sets the error memory to 0. // Leaves the K values intact. void clear_state(); double update(double error); private: double biquad_step(double x); };