kani
Dependencies: 2017NHKpin_config FEP omni_wheel PID R1307 ikarashiMDC
\ ̄\ / ̄/ /l \ \ / / lヽ | ヽ ヽ | | / / | \ ` ‐ヽ ヽ ● ● / / ‐ / \ __ l | ||___|| / l __ / \ \ / \/ /\| 人__人 |/\ <ズワイガニ //\| |/\\ //\| ケガニ |/\\ / . \_____/ \ ┏┓ ┏━┓┏┓ ┏┓ ┏┓┏┓ ┏┓ ┏┓┗┛ ┏┓ ┗┓┃┗┛ ┏┛┗━┓ ┃┃┃┃ ┃┃┏━┛┗┓┏┓┏┛┗━┓┃┃┏┓┏┓┏━━━┓ ┗┓┏━┛ ┃┃┗┛ ┃┃┗━┓┏┛┗┛┗┓┏┓┃┗┛┗┛┃┃┗━━━┛ ┏┛┃┏━┓┃┗━━┓┃┃┏━┛┗┓ ┏┛┃┃┃ ┃┃ ┃┏┛┗━┛┗━━┓┃┃┃┃┏┓┏┛ ┗━┛┃┃ ┃┃┏┓ ┃┃┏━━┓┏━━┛┃┃┃┃┗┛┃ ┏┛┃ ┃┃┃┗━━┓ ┗┛┗━━┛┗━━━┛┗┛┗━━┛ ┗━┛ ┗┛┗━━━┛
Diff: bot/PIDcontroller/PID_controller.h
- Revision:
- 47:43f55ff8916b
- Parent:
- 45:a3ff2bc0574b
- Child:
- 49:703cc56d4858
--- a/bot/PIDcontroller/PID_controller.h Sun Oct 29 15:40:26 2017 +0900 +++ b/bot/PIDcontroller/PID_controller.h Mon Nov 06 18:27:03 2017 +0900 @@ -25,21 +25,21 @@ #include "pin_config.h" #include "PID.h" -#include "HMC6352.h" +#include "R1307.h" const double KC = 8.2; const double TI = 0.0; const double TD = 0.0000; -const float INTERVAL = 0.01; +const float INTERVAL = 0.001; const float INPUT_LIMIT = 360.0; const float OUTPUT_LIMIT = 0.4; const float BIAS = 0.0; -const int SENSED_THRESHOLD = 1800; +const float SENSED_THRESHOLD = 180.0; /** * @brief コンパスセンサを使ったPIDコントローラ */ -class PIDC : public PID, HMC6352, Ticker +class PIDC { public : /** @@ -56,7 +56,7 @@ * @param td TD * @param interval interval */ - PIDC(PinName sda, PinName scl, float kc, float ti, float td, float interval); + PIDC(PinName tx, PinName scl, float kc, float ti, float td, float interval); /** * @brief センサの値とPIDの値をアップデート @@ -78,34 +78,30 @@ * 現在の角度を取得 * @return 現在の角度(degree) */ - int getCurrentDegree() const; + float getCurrentDegree() const; /** * センサの生値を取得 * @return コンパスセンサの生値 */ - int getRawDegree(); + float getRawDegree(); void setPoint(float point); - /** - * @brief キャリブレーションする - * @param mode ENTER OR EXIT - */ - void calibration(int mode); private : - - void updateOutput(); + float offSetDegree; + int turnOverNumber; + float beforeDegree; - int offSetDegree; - int turnOverNumber; - int beforeDegree; + PID pid; + R1307 r1370; + Serial pidcSerial; protected : - int rawDegree; + float rawDegree; float calculationResult; - int currentDegree; + float currentDegree; }; #endif//PID_CONTROLLER_H