Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PID_example Motor_calibration Demo_mode Demo_mode ... more
pid.h
00001 #pragma once 00002 00003 class PID { 00004 private: 00005 double Kp, Ki, Kd; 00006 double error_integral; 00007 double error_previous; 00008 double pid_period; // Time between pid updates. 00009 bool first_update; 00010 00011 // ---- Low Pass Filter variables ---- 00012 double B[3]; 00013 double A[2]; 00014 double wz[2]; 00015 public: 00016 PID(); 00017 void set_period(double period); 00018 void set_k_values(double Kp, double Ki, double Kd); 00019 // Sets the error memory to 0. 00020 // Leaves the K values intact. 00021 void clear_state(); 00022 00023 double update(double error); 00024 00025 private: 00026 double biquad_step(double x); 00027 };
Generated on Wed Aug 10 2022 00:15:42 by
1.7.2