![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
NHK2017Ateamかにろぼ
Dependencies: 2017NHKpin_config mbed FEP HMC6352 MotorDriverController PID QEI omni
\ ̄\ / ̄/ /l \ \ / / lヽ | ヽ ヽ | | / / | \ ` ‐ヽ ヽ ● ● / / ‐ / \ __ l | ||___|| / l __ / \ \ / \/ /\| 人__人 |/\ //\| |/\\ //\| |/\\ / . \_____/ \ ┏┓ ┏━┓┏┓ ┏┓ ┏┓┏┓ ┏┓ ┏┓┗┛ ┏┓ ┗┓┃┗┛ ┏┛┗━┓ ┃┃┃┃ ┃┃┏━┛┗┓┏┓┏┛┗━┓┃┃┏┓┏┓┏━━━┓ ┗┓┏━┛ ┃┃┗┛ ┃┃┗━┓┏┛┗┛┗┓┏┓┃┗┛┗┛┃┃┗━━━┛ ┏┛┃┏━┓┃┗━━┓┃┃┏━┛┗┓ ┏┛┃┃┃ ┃┃ ┃┏┛┗━┛┗━━┓┃┃┃┃┏┓┏┛ ┗━┛┃┃ ┃┃┏┓ ┃┃┏━━┓┏━━┛┃┃┃┃┗┛┃ ┏┛┃ ┃┃┃┗━━┓ ┗┛┗━━┛┗━━━┛┗┛┗━━┛ ┗━┛ ┗┛┗━━━┛
bot/PIDcontroller/PID_controller.h@18:41f7dd1a5ed1, 2017-08-31 (annotated)
- Committer:
- uchitake
- Date:
- Thu Aug 31 10:34:55 2017 +0900
- Revision:
- 18:41f7dd1a5ed1
- Parent:
- 6:590c9622ecf1
- Child:
- 19:3a62cbc6fee9
fix PIDcontroller class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
UCHITAKE | 6:590c9622ecf1 | 1 | /** |
UCHITAKE | 6:590c9622ecf1 | 2 | * @file PID_controller.h |
UCHITAKE | 6:590c9622ecf1 | 3 | * @brief コンパスセンサを使ったPIDコントローラ |
UCHITAKE | 6:590c9622ecf1 | 4 | */ |
UCHITAKE | 6:590c9622ecf1 | 5 | #ifndef PID_CONTROLLER_H |
UCHITAKE | 6:590c9622ecf1 | 6 | #define PID_CONTROLLER_H |
UCHITAKE | 6:590c9622ecf1 | 7 | |
UCHITAKE | 6:590c9622ecf1 | 8 | #include "mbed.h" |
UCHITAKE | 6:590c9622ecf1 | 9 | #include "pin_config.h" |
UCHITAKE | 6:590c9622ecf1 | 10 | |
UCHITAKE | 6:590c9622ecf1 | 11 | #include "PID.h" |
UCHITAKE | 6:590c9622ecf1 | 12 | #include "HMC6352.h" |
UCHITAKE | 6:590c9622ecf1 | 13 | |
UCHITAKE | 6:590c9622ecf1 | 14 | #define M_PI 3.141592653589793 |
UCHITAKE | 6:590c9622ecf1 | 15 | #define KC 1.0 |
UCHITAKE | 6:590c9622ecf1 | 16 | #define TI 0.0 |
UCHITAKE | 6:590c9622ecf1 | 17 | #define TD 0.0 |
uchitake |
18:41f7dd1a5ed1 | 18 | #define INTERVAL 0.05 |
uchitake |
18:41f7dd1a5ed1 | 19 | #define INPUT_LIMIT 180 |
uchitake |
18:41f7dd1a5ed1 | 20 | #define OUTPUT_LIMIT 1.0 |
uchitake |
18:41f7dd1a5ed1 | 21 | #define BIAS 0.0 |
uchitake |
18:41f7dd1a5ed1 | 22 | |
UCHITAKE | 6:590c9622ecf1 | 23 | /** |
UCHITAKE | 6:590c9622ecf1 | 24 | * @brief コンパスセンサを使ったPIDコントローラ |
UCHITAKE | 6:590c9622ecf1 | 25 | */ |
UCHITAKE | 6:590c9622ecf1 | 26 | class PIDC : public PID, HMC6352, Ticker |
UCHITAKE | 6:590c9622ecf1 | 27 | { |
UCHITAKE | 6:590c9622ecf1 | 28 | public : |
UCHITAKE | 6:590c9622ecf1 | 29 | /** |
uchitake |
18:41f7dd1a5ed1 | 30 | * @brief defaultコンストラクタ,タイマ割り込みでの計算開始 |
UCHITAKE | 6:590c9622ecf1 | 31 | */ |
UCHITAKE | 6:590c9622ecf1 | 32 | PIDC(); |
uchitake |
18:41f7dd1a5ed1 | 33 | |
uchitake |
18:41f7dd1a5ed1 | 34 | /** |
uchitake |
18:41f7dd1a5ed1 | 35 | * @brief コンストラクタ |
uchitake |
18:41f7dd1a5ed1 | 36 | * @param sda sda HMC6352 |
uchitake |
18:41f7dd1a5ed1 | 37 | * @param scl scl HMC6352 |
uchitake |
18:41f7dd1a5ed1 | 38 | * @param kc KC |
uchitake |
18:41f7dd1a5ed1 | 39 | * @param ti TI |
uchitake |
18:41f7dd1a5ed1 | 40 | * @param td TD |
uchitake |
18:41f7dd1a5ed1 | 41 | * @param interval interval |
uchitake |
18:41f7dd1a5ed1 | 42 | */ |
uchitake |
18:41f7dd1a5ed1 | 43 | PIDC(PinName sda, PinName scl, float kc, float ti, float td, float interval); |
uchitake |
18:41f7dd1a5ed1 | 44 | |
UCHITAKE | 6:590c9622ecf1 | 45 | void confirm(); |
UCHITAKE | 6:590c9622ecf1 | 46 | float getCo(); |
UCHITAKE | 6:590c9622ecf1 | 47 | private : |
uchitake |
18:41f7dd1a5ed1 | 48 | |
UCHITAKE | 6:590c9622ecf1 | 49 | void updateOutput(); |
uchitake |
18:41f7dd1a5ed1 | 50 | |
UCHITAKE | 6:590c9622ecf1 | 51 | int rawDegree; |
UCHITAKE | 6:590c9622ecf1 | 52 | int offSetDegree; |
UCHITAKE | 6:590c9622ecf1 | 53 | int turnOverNumber; |
UCHITAKE | 6:590c9622ecf1 | 54 | int beforeDegree; |
UCHITAKE | 6:590c9622ecf1 | 55 | |
UCHITAKE | 6:590c9622ecf1 | 56 | protected : |
UCHITAKE | 6:590c9622ecf1 | 57 | float co; |
UCHITAKE | 6:590c9622ecf1 | 58 | float processValue; |
UCHITAKE | 6:590c9622ecf1 | 59 | int initDegree; |
UCHITAKE | 6:590c9622ecf1 | 60 | }; |
UCHITAKE | 6:590c9622ecf1 | 61 | |
uchitake |
18:41f7dd1a5ed1 | 62 | #endif//PID_CONTROLLER_H |