taiyou komazawa
/
Nucleo_fliping_arm
2018 HongoMechaTech A
lib/PID_Control.h@0:e83b840a5f86, 2018-09-18 (annotated)
- Committer:
- Komazawa_sun
- Date:
- Tue Sep 18 03:11:01 2018 +0000
- Revision:
- 0:e83b840a5f86
????????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Komazawa_sun | 0:e83b840a5f86 | 1 | #ifndef PID_CONTROL_H_ |
Komazawa_sun | 0:e83b840a5f86 | 2 | #define PID_CONTROL_H_ |
Komazawa_sun | 0:e83b840a5f86 | 3 | |
Komazawa_sun | 0:e83b840a5f86 | 4 | #include <mbed.h> |
Komazawa_sun | 0:e83b840a5f86 | 5 | |
Komazawa_sun | 0:e83b840a5f86 | 6 | class PID_Control |
Komazawa_sun | 0:e83b840a5f86 | 7 | { |
Komazawa_sun | 0:e83b840a5f86 | 8 | public: |
Komazawa_sun | 0:e83b840a5f86 | 9 | PID_Control(double kp = 0, double ki = 0, double kd = 0); |
Komazawa_sun | 0:e83b840a5f86 | 10 | |
Komazawa_sun | 0:e83b840a5f86 | 11 | double PID(double present, double target, double interval); |
Komazawa_sun | 0:e83b840a5f86 | 12 | void reset(); |
Komazawa_sun | 0:e83b840a5f86 | 13 | void set_PID(double kp, double ki, double kd); |
Komazawa_sun | 0:e83b840a5f86 | 14 | |
Komazawa_sun | 0:e83b840a5f86 | 15 | private: |
Komazawa_sun | 0:e83b840a5f86 | 16 | |
Komazawa_sun | 0:e83b840a5f86 | 17 | double diff[2]; |
Komazawa_sun | 0:e83b840a5f86 | 18 | double integral; |
Komazawa_sun | 0:e83b840a5f86 | 19 | double p, i, d; |
Komazawa_sun | 0:e83b840a5f86 | 20 | double kp, ki, kd; |
Komazawa_sun | 0:e83b840a5f86 | 21 | double control; |
Komazawa_sun | 0:e83b840a5f86 | 22 | }; |
Komazawa_sun | 0:e83b840a5f86 | 23 | |
Komazawa_sun | 0:e83b840a5f86 | 24 | #endif |