NHK2017Ateamかにろぼ
Dependencies: 2017NHKpin_config mbed FEP HMC6352 MotorDriverController PID QEI omni
\ ̄\ / ̄/ /l \ \ / / lヽ | ヽ ヽ | | / / | \ ` ‐ヽ ヽ ● ● / / ‐ / \ __ l | ||___|| / l __ / \ \ / \/ /\| 人__人 |/\ //\| |/\\ //\| |/\\ / . \_____/ \ ┏┓ ┏━┓┏┓ ┏┓ ┏┓┏┓ ┏┓ ┏┓┗┛ ┏┓ ┗┓┃┗┛ ┏┛┗━┓ ┃┃┃┃ ┃┃┏━┛┗┓┏┓┏┛┗━┓┃┃┏┓┏┓┏━━━┓ ┗┓┏━┛ ┃┃┗┛ ┃┃┗━┓┏┛┗┛┗┓┏┓┃┗┛┗┛┃┃┗━━━┛ ┏┛┃┏━┓┃┗━━┓┃┃┏━┛┗┓ ┏┛┃┃┃ ┃┃ ┃┏┛┗━┛┗━━┓┃┃┃┃┏┓┏┛ ┗━┛┃┃ ┃┃┏┓ ┃┃┏━━┓┏━━┛┃┃┃┃┗┛┃ ┏┛┃ ┃┃┃┗━━┓ ┗┛┗━━┛┗━━━┛┗┛┗━━┛ ┗━┛ ┗┛┗━━━┛
bot/controller/controller.h@16:86958857c739, 2017-08-30 (annotated)
- Committer:
- uchitake
- Date:
- Wed Aug 30 16:33:24 2017 +0900
- Revision:
- 16:86958857c739
- Parent:
- 15:9a2dce34b660
- Child:
- 19:3a62cbc6fee9
Quit inheritance
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 | 5:bc5ba4f070ad | 15 | #define ADDR 203 |
UCHITAKE | 1:269914e0aa07 | 16 | #define FEP_SUCCESS 0 |
uchitake |
15:9a2dce34b660 | 17 | #define DATA_SIZE 6 |
UCHITAKE | 1:269914e0aa07 | 18 | #define STICK_DIVIDE 255.0 |
UCHITAKE | 1:269914e0aa07 | 19 | #define STICK_NEWTRAL 0.1 |
UCHITAKE | 1:269914e0aa07 | 20 | #define STICK_NORM_MAX 1.0 |
UCHITAKE | 1:269914e0aa07 | 21 | |
UCHITAKE | 3:d25e7fb07ed2 | 22 | /** |
UCHITAKE | 3:d25e7fb07ed2 | 23 | * @brief FEPを使ったコントローラのクラス |
UCHITAKE | 3:d25e7fb07ed2 | 24 | */ |
UCHITAKE | 1:269914e0aa07 | 25 | class Controller : public FEP |
UCHITAKE | 1:269914e0aa07 | 26 | { |
UCHITAKE | 0:757e9800c103 | 27 | public : |
UCHITAKE | 3:d25e7fb07ed2 | 28 | |
UCHITAKE | 3:d25e7fb07ed2 | 29 | /** |
UCHITAKE | 3:d25e7fb07ed2 | 30 | * @brief コンストラクタ |
UCHITAKE | 3:d25e7fb07ed2 | 31 | */ |
UCHITAKE | 0:757e9800c103 | 32 | Controller(); |
UCHITAKE | 1:269914e0aa07 | 33 | |
UCHITAKE | 3:d25e7fb07ed2 | 34 | /** |
uchitake |
16:86958857c739 | 35 | * @brief コンストラクタ |
uchitake |
16:86958857c739 | 36 | * @param FEPtx FEPtx |
uchitake |
16:86958857c739 | 37 | * @param FEPrx FEPrx |
uchitake |
16:86958857c739 | 38 | * @param addr address |
uchitake |
16:86958857c739 | 39 | */ |
uchitake |
16:86958857c739 | 40 | Controller(PinName FEPtx, PinName FEPrx,int addr); |
uchitake |
16:86958857c739 | 41 | |
uchitake |
16:86958857c739 | 42 | /** |
UCHITAKE | 3:d25e7fb07ed2 | 43 | * @brief メンバ変数にボタンのステートを格納 |
UCHITAKE | 3:d25e7fb07ed2 | 44 | */ |
UCHITAKE | 3:d25e7fb07ed2 | 45 | void receiveState(); |
uchitake |
15:9a2dce34b660 | 46 | |
uchitake |
16:86958857c739 | 47 | /** |
uchitake |
16:86958857c739 | 48 | * ボタン1の状態を取得 |
uchitake |
16:86958857c739 | 49 | * @param number button number |
uchitake |
16:86958857c739 | 50 | * @return status |
uchitake |
16:86958857c739 | 51 | */ |
uchitake |
16:86958857c739 | 52 | bool getButton1(int number); |
uchitake |
16:86958857c739 | 53 | |
uchitake |
16:86958857c739 | 54 | /** |
uchitake |
16:86958857c739 | 55 | * ボタン2の状態を取得 |
uchitake |
16:86958857c739 | 56 | * @param number button number |
uchitake |
16:86958857c739 | 57 | * @return status |
uchitake |
16:86958857c739 | 58 | */ |
uchitake |
16:86958857c739 | 59 | bool getButton2(int number); |
uchitake |
16:86958857c739 | 60 | |
uchitake |
16:86958857c739 | 61 | /** |
uchitake |
16:86958857c739 | 62 | * スティックの値を取得 |
uchitake |
16:86958857c739 | 63 | * @param number sticknumber(x, y, x, y) |
uchitake |
16:86958857c739 | 64 | * @return stick value |
uchitake |
16:86958857c739 | 65 | */ |
uchitake |
16:86958857c739 | 66 | float getStick(int number); |
uchitake |
16:86958857c739 | 67 | |
uchitake |
16:86958857c739 | 68 | /** |
uchitake |
16:86958857c739 | 69 | * スチィックの角度を取得 |
uchitake |
16:86958857c739 | 70 | * @param number left...0 right...1 |
uchitake |
16:86958857c739 | 71 | * @return radian |
uchitake |
16:86958857c739 | 72 | */ |
uchitake |
16:86958857c739 | 73 | float getRadian(int number); |
uchitake |
16:86958857c739 | 74 | |
uchitake |
16:86958857c739 | 75 | /** |
uchitake |
16:86958857c739 | 76 | * スティックの距離を取得 |
uchitake |
16:86958857c739 | 77 | * @param number left..0 right..1 |
uchitake |
16:86958857c739 | 78 | * @return norm |
uchitake |
16:86958857c739 | 79 | */ |
uchitake |
16:86958857c739 | 80 | float getNorm(int number); |
uchitake |
16:86958857c739 | 81 | |
UCHITAKE | 0:757e9800c103 | 82 | private : |
uchitake |
15:9a2dce34b660 | 83 | void setStick(); |
UCHITAKE | 1:269914e0aa07 | 84 | |
UCHITAKE | 1:269914e0aa07 | 85 | char data[6]; |
UCHITAKE | 1:269914e0aa07 | 86 | uint8_t fepTemp; |
uchitake |
15:9a2dce34b660 | 87 | |
UCHITAKE | 1:269914e0aa07 | 88 | protected : |
uchitake |
15:9a2dce34b660 | 89 | bool button1[7]; |
uchitake |
15:9a2dce34b660 | 90 | bool button2[6]; |
UCHITAKE | 1:269914e0aa07 | 91 | double stick[4]; |
uchitake |
15:9a2dce34b660 | 92 | double radian[2]; |
UCHITAKE | 1:269914e0aa07 | 93 | double norm[2]; |
UCHITAKE | 0:757e9800c103 | 94 | }; |
UCHITAKE | 0:757e9800c103 | 95 | |
uchitake |
15:9a2dce34b660 | 96 | #endif//CONTROLLER_H |