NHK2017Ateamかにろぼ
Dependencies: 2017NHKpin_config mbed FEP HMC6352 MotorDriverController PID QEI omni
\ ̄\ / ̄/ /l \ \ / / lヽ | ヽ ヽ | | / / | \ ` ‐ヽ ヽ ● ● / / ‐ / \ __ l | ||___|| / l __ / \ \ / \/ /\| 人__人 |/\ //\| |/\\ //\| |/\\ / . \_____/ \ ┏┓ ┏━┓┏┓ ┏┓ ┏┓┏┓ ┏┓ ┏┓┗┛ ┏┓ ┗┓┃┗┛ ┏┛┗━┓ ┃┃┃┃ ┃┃┏━┛┗┓┏┓┏┛┗━┓┃┃┏┓┏┓┏━━━┓ ┗┓┏━┛ ┃┃┗┛ ┃┃┗━┓┏┛┗┛┗┓┏┓┃┗┛┗┛┃┃┗━━━┛ ┏┛┃┏━┓┃┗━━┓┃┃┏━┛┗┓ ┏┛┃┃┃ ┃┃ ┃┏┛┗━┛┗━━┓┃┃┃┃┏┓┏┛ ┗━┛┃┃ ┃┃┏┓ ┃┃┏━━┓┏━━┛┃┃┃┃┗┛┃ ┏┛┃ ┃┃┃┗━━┓ ┗┛┗━━┛┗━━━┛┗┛┗━━┛ ┗━┛ ┗┛┗━━━┛
bot/controller/controller.h@3:d25e7fb07ed2, 2017-08-23 (annotated)
- Committer:
- UCHITAKE
- Date:
- Wed Aug 23 01:07:20 2017 +0000
- Revision:
- 3:d25e7fb07ed2
- Parent:
- 2:ea151e05033a
- Child:
- 5:bc5ba4f070ad
add document
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
UCHITAKE | 3:d25e7fb07ed2 | 1 | /** |
UCHITAKE | 3:d25e7fb07ed2 | 2 | * @file controller.h |
UCHITAKE | 3:d25e7fb07ed2 | 3 | * @brief FEPを使ったコントローラ受信部 |
UCHITAKE | 3:d25e7fb07ed2 | 4 | */ |
UCHITAKE | 0:757e9800c103 | 5 | #ifndef CONTROLLER_H |
UCHITAKE | 0:757e9800c103 | 6 | #define CONTROLLER_H |
UCHITAKE | 0:757e9800c103 | 7 | |
UCHITAKE | 0:757e9800c103 | 8 | #include "mbed.h" |
UCHITAKE | 0:757e9800c103 | 9 | #include "pin_config.h" |
UCHITAKE | 1:269914e0aa07 | 10 | #include <math.h> |
UCHITAKE | 0:757e9800c103 | 11 | |
UCHITAKE | 0:757e9800c103 | 12 | #include "FEP.h" |
UCHITAKE | 0:757e9800c103 | 13 | |
UCHITAKE | 1:269914e0aa07 | 14 | #define M_PI 3.141592653589793 |
UCHITAKE | 0:757e9800c103 | 15 | #define ADDR 000 |
UCHITAKE | 0:757e9800c103 | 16 | |
UCHITAKE | 1:269914e0aa07 | 17 | /** @def |
UCHITAKE | 1:269914e0aa07 | 18 | * FEP受信成功 |
UCHITAKE | 1:269914e0aa07 | 19 | */ |
UCHITAKE | 1:269914e0aa07 | 20 | #define FEP_SUCCESS 0 |
UCHITAKE | 1:269914e0aa07 | 21 | |
UCHITAKE | 1:269914e0aa07 | 22 | /** @def |
UCHITAKE | 1:269914e0aa07 | 23 | * スティック生値を割る数 |
UCHITAKE | 1:269914e0aa07 | 24 | */ |
UCHITAKE | 1:269914e0aa07 | 25 | #define STICK_DIVIDE 255.0 |
UCHITAKE | 1:269914e0aa07 | 26 | |
UCHITAKE | 1:269914e0aa07 | 27 | /** @def |
UCHITAKE | 1:269914e0aa07 | 28 | * スティックニュートラルの範囲 |
UCHITAKE | 1:269914e0aa07 | 29 | */ |
UCHITAKE | 1:269914e0aa07 | 30 | #define STICK_NEWTRAL 0.1 |
UCHITAKE | 1:269914e0aa07 | 31 | |
UCHITAKE | 1:269914e0aa07 | 32 | /** @def |
UCHITAKE | 1:269914e0aa07 | 33 | * スティックの距離の限界 |
UCHITAKE | 1:269914e0aa07 | 34 | */ |
UCHITAKE | 1:269914e0aa07 | 35 | #define STICK_NORM_MAX 1.0 |
UCHITAKE | 1:269914e0aa07 | 36 | |
UCHITAKE | 3:d25e7fb07ed2 | 37 | /** |
UCHITAKE | 3:d25e7fb07ed2 | 38 | * @brief FEPを使ったコントローラのクラス |
UCHITAKE | 3:d25e7fb07ed2 | 39 | */ |
UCHITAKE | 1:269914e0aa07 | 40 | class Controller : public FEP |
UCHITAKE | 1:269914e0aa07 | 41 | { |
UCHITAKE | 0:757e9800c103 | 42 | public : |
UCHITAKE | 3:d25e7fb07ed2 | 43 | |
UCHITAKE | 3:d25e7fb07ed2 | 44 | /** |
UCHITAKE | 3:d25e7fb07ed2 | 45 | * @brief コンストラクタ |
UCHITAKE | 3:d25e7fb07ed2 | 46 | */ |
UCHITAKE | 0:757e9800c103 | 47 | Controller(); |
UCHITAKE | 1:269914e0aa07 | 48 | |
UCHITAKE | 3:d25e7fb07ed2 | 49 | /** |
UCHITAKE | 3:d25e7fb07ed2 | 50 | * @brief メンバ変数にボタンのステートを格納 |
UCHITAKE | 3:d25e7fb07ed2 | 51 | */ |
UCHITAKE | 3:d25e7fb07ed2 | 52 | void receiveState(); |
UCHITAKE | 3:d25e7fb07ed2 | 53 | |
UCHITAKE | 0:757e9800c103 | 54 | private : |
UCHITAKE | 1:269914e0aa07 | 55 | void getStickData(); |
UCHITAKE | 1:269914e0aa07 | 56 | |
UCHITAKE | 1:269914e0aa07 | 57 | char data[6]; |
UCHITAKE | 1:269914e0aa07 | 58 | uint8_t fepTemp; |
UCHITAKE | 3:d25e7fb07ed2 | 59 | |
UCHITAKE | 1:269914e0aa07 | 60 | protected : |
UCHITAKE | 1:269914e0aa07 | 61 | bool Button1[7]; |
UCHITAKE | 1:269914e0aa07 | 62 | bool Button2[6]; |
UCHITAKE | 1:269914e0aa07 | 63 | double stick[4]; |
UCHITAKE | 1:269914e0aa07 | 64 | double degree[2]; |
UCHITAKE | 1:269914e0aa07 | 65 | double norm[2]; |
UCHITAKE | 1:269914e0aa07 | 66 | double vector[2]; |
UCHITAKE | 2:ea151e05033a | 67 | double vector2[2]; |
UCHITAKE | 0:757e9800c103 | 68 | }; |
UCHITAKE | 0:757e9800c103 | 69 | |
UCHITAKE | 0:757e9800c103 | 70 | #endif//CONTROLLER_H |