![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
drive down
Dependencies: BMP280 BNO055_fusion PowerControl mbed
Fork of TEAM_G_FLOW_RIDA by
LOCALIZE.h@27:fb1298d35bd1, 2016-04-13 (annotated)
- Committer:
- 12104404
- Date:
- Wed Apr 13 03:14:43 2016 +0000
- Revision:
- 27:fb1298d35bd1
- Parent:
- 25:f3bf8351bbd4
- Child:
- 29:e8ef4a2e628d
gravity compensation;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
12104404 | 0:96d6eb224379 | 1 | #ifndef LOCALIZE_H |
12104404 | 0:96d6eb224379 | 2 | #define LOCALIZE_H |
12104404 | 0:96d6eb224379 | 3 | |
12104404 | 0:96d6eb224379 | 4 | #include "mbed.h" |
12104404 | 0:96d6eb224379 | 5 | #include "BNO055.h" |
12104404 | 0:96d6eb224379 | 6 | |
12104404 | 22:a68c32db9f9d | 7 | //Comment if not testing on ground |
12104404 | 27:fb1298d35bd1 | 8 | //#define IMU_GROUND 1 |
12104404 | 22:a68c32db9f9d | 9 | |
12104404 | 19:2dd81b864e14 | 10 | #define R_P_ADDR 0x04 //0x0B^0x0F=0x04 |
12104404 | 2:634c1adf89b2 | 11 | #define R_N_ADDR 0x0B |
12104404 | 1:8966a48ce8d5 | 12 | |
12104404 | 10:cf44f4387bc7 | 13 | #define FRAME_OFF 0 |
12104404 | 8:b36be08c44f8 | 14 | #define FRAME_H 150 |
12104404 | 8:b36be08c44f8 | 15 | #define FRAME_W 104 |
12104404 | 6:0602a9e8118b | 16 | #define R_WAIT 0.025 |
12104404 | 1:8966a48ce8d5 | 17 | #define R_ERROR 14 |
12104404 | 4:d70375cfa533 | 18 | #define RX_OFF 7 |
12104404 | 4:d70375cfa533 | 19 | #define RY_OFF 6 |
12104404 | 25:f3bf8351bbd4 | 20 | #define UR_JUMP 25 |
12104404 | 25:f3bf8351bbd4 | 21 | #define UR_JUMPS 7 |
12104404 | 19:2dd81b864e14 | 22 | #define UR_DEADZONE 3 |
12104404 | 1:8966a48ce8d5 | 23 | |
12104404 | 1:8966a48ce8d5 | 24 | #define ERROR_IMU -1 |
12104404 | 1:8966a48ce8d5 | 25 | #define ERROR_RX_P -2 |
12104404 | 1:8966a48ce8d5 | 26 | #define ERROR_RX_N -3 |
12104404 | 1:8966a48ce8d5 | 27 | #define ERROR_RY_P -4 |
12104404 | 1:8966a48ce8d5 | 28 | #define ERROR_RY_N -5 |
12104404 | 0:96d6eb224379 | 29 | |
12104404 | 0:96d6eb224379 | 30 | typedef struct { |
12104404 | 0:96d6eb224379 | 31 | int x; |
12104404 | 0:96d6eb224379 | 32 | int y; |
12104404 | 0:96d6eb224379 | 33 | int a; |
12104404 | 0:96d6eb224379 | 34 | }LOCALIZE_xya; |
12104404 | 0:96d6eb224379 | 35 | |
12104404 | 0:96d6eb224379 | 36 | class LOCALIZE |
12104404 | 0:96d6eb224379 | 37 | { |
12104404 | 0:96d6eb224379 | 38 | public: |
12104404 | 23:455f7da3dd7a | 39 | LOCALIZE(I2C& y_i2c, I2C& x_imu_i2c, PinName imu_reset, PinName sw1, PinName sw2, PinName sw3, PinName sw4, DigitalOut& led1, DigitalOut& led2, DigitalOut& led3, DigitalOut& led4); |
12104404 | 0:96d6eb224379 | 40 | int init(void); |
12104404 | 3:c58eb4be51de | 41 | void get_raw_xy(void); |
12104404 | 0:96d6eb224379 | 42 | void get_angle(LOCALIZE_xya *xya); |
12104404 | 1:8966a48ce8d5 | 43 | void get_xy(LOCALIZE_xya *xya); |
12104404 | 6:0602a9e8118b | 44 | int _angle, _rx_p, _rx_n, _ry_p, _ry_n;// |
12104404 | 6:0602a9e8118b | 45 | BNO055_EULER_TypeDef _euler; |
12104404 | 20:10a305298e27 | 46 | inline void ledSw(void); |
12104404 | 6:0602a9e8118b | 47 | |
12104404 | 0:96d6eb224379 | 48 | protected: |
12104404 | 0:96d6eb224379 | 49 | I2C _y_i2c; |
12104404 | 0:96d6eb224379 | 50 | I2C _x_imu_i2c; |
12104404 | 0:96d6eb224379 | 51 | BNO055 _imu; |
12104404 | 15:7729da55873a | 52 | DigitalIn _sw1; |
12104404 | 15:7729da55873a | 53 | DigitalIn _sw2; |
12104404 | 15:7729da55873a | 54 | DigitalIn _sw3; |
12104404 | 15:7729da55873a | 55 | DigitalIn _sw4; |
12104404 | 23:455f7da3dd7a | 56 | DigitalOut _led1; |
12104404 | 23:455f7da3dd7a | 57 | DigitalOut _led2; |
12104404 | 23:455f7da3dd7a | 58 | DigitalOut _led3; |
12104404 | 23:455f7da3dd7a | 59 | DigitalOut _led4; |
12104404 | 25:f3bf8351bbd4 | 60 | uint8_t jumpsX; |
12104404 | 25:f3bf8351bbd4 | 61 | uint8_t jumpsY; |
12104404 | 6:0602a9e8118b | 62 | |
12104404 | 1:8966a48ce8d5 | 63 | BNO055_GRAVITY_TypeDef _gravity; |
12104404 | 1:8966a48ce8d5 | 64 | BNO055_LIN_ACC_TypeDef _accel; |
12104404 | 1:8966a48ce8d5 | 65 | LOCALIZE_xya _xya; |
12104404 | 13:c62f975dfcfe | 66 | |
12104404 | 0:96d6eb224379 | 67 | }; |
12104404 | 0:96d6eb224379 | 68 | |
12104404 | 0:96d6eb224379 | 69 | #endif //LOCALIZE_H |