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.
PID.h@0:be531c5604db, 2019-01-11 (annotated)
- Committer:
- TakumiToda
- Date:
- Fri Jan 11 08:00:51 2019 +0000
- Revision:
- 0:be531c5604db
- Child:
- 1:4705d8930670
PID
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TakumiToda | 0:be531c5604db | 1 | #ifndef PID_H |
| TakumiToda | 0:be531c5604db | 2 | #define PID_H |
| TakumiToda | 0:be531c5604db | 3 | |
| TakumiToda | 0:be531c5604db | 4 | #include "mbed.h" |
| TakumiToda | 0:be531c5604db | 5 | |
| TakumiToda | 0:be531c5604db | 6 | |
| TakumiToda | 0:be531c5604db | 7 | class PID { |
| TakumiToda | 0:be531c5604db | 8 | public: |
| TakumiToda | 0:be531c5604db | 9 | PID(); |
| TakumiToda | 0:be531c5604db | 10 | float control(float target, float nowrpm, Timer *timer); |
| TakumiToda | 0:be531c5604db | 11 | float PI_lateD(float target, float nowrpm, Timer *timer); |
| TakumiToda | 0:be531c5604db | 12 | float control_P(float target, float nowrpm, float new_Kp); |
| TakumiToda | 0:be531c5604db | 13 | float control_PI(float target, float nowrpm, Timer *timer); |
| TakumiToda | 0:be531c5604db | 14 | void setParameter_pid(float new_Kp, float new_Ki, float new_Kd); |
| TakumiToda | 0:be531c5604db | 15 | void setParameter_KuPu(float new_Ku, float new_Pu); |
| TakumiToda | 0:be531c5604db | 16 | void reset(float target); |
| TakumiToda | 0:be531c5604db | 17 | |
| TakumiToda | 0:be531c5604db | 18 | float Ku; |
| TakumiToda | 0:be531c5604db | 19 | float Pu; |
| TakumiToda | 0:be531c5604db | 20 | float Kp; |
| TakumiToda | 0:be531c5604db | 21 | float Ti; |
| TakumiToda | 0:be531c5604db | 22 | float Td; |
| TakumiToda | 0:be531c5604db | 23 | float Ki; |
| TakumiToda | 0:be531c5604db | 24 | float Kd; |
| TakumiToda | 0:be531c5604db | 25 | |
| TakumiToda | 0:be531c5604db | 26 | private: |
| TakumiToda | 0:be531c5604db | 27 | Timer *timer; |
| TakumiToda | 0:be531c5604db | 28 | float integral; |
| TakumiToda | 0:be531c5604db | 29 | float prev_hensa; |
| TakumiToda | 0:be531c5604db | 30 | float nowtime; |
| TakumiToda | 0:be531c5604db | 31 | float prev_time; |
| TakumiToda | 0:be531c5604db | 32 | float lateD; |
| TakumiToda | 0:be531c5604db | 33 | }; |
| TakumiToda | 0:be531c5604db | 34 | |
| TakumiToda | 0:be531c5604db | 35 | #endif |