mechatronics drive
Dependencies: BNO055_fusion mbed
Fork of DEMO3 by
LOCALIZE.h@3:c58eb4be51de, 2016-03-03 (annotated)
- Committer:
- 12104404
- Date:
- Thu Mar 03 01:00:32 2016 +0000
- Revision:
- 3:c58eb4be51de
- Parent:
- 2:634c1adf89b2
- Child:
- 4:d70375cfa533
cleaned up localization;
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 | 1:8966a48ce8d5 | 7 | #define R_P_ADDR 0x04 |
12104404 | 2:634c1adf89b2 | 8 | //0x0B^0x0F=0x04 |
12104404 | 2:634c1adf89b2 | 9 | #define R_N_ADDR 0x0B |
12104404 | 1:8966a48ce8d5 | 10 | |
12104404 | 1:8966a48ce8d5 | 11 | #define FRAME_H 180 |
12104404 | 1:8966a48ce8d5 | 12 | #define FRAME_W 150 |
12104404 | 1:8966a48ce8d5 | 13 | #define RX_OFF 7 |
12104404 | 1:8966a48ce8d5 | 14 | #define RY_OFF 6 |
12104404 | 1:8966a48ce8d5 | 15 | #define R_ERROR 14 |
12104404 | 1:8966a48ce8d5 | 16 | |
12104404 | 1:8966a48ce8d5 | 17 | #define ERROR_IMU -1 |
12104404 | 1:8966a48ce8d5 | 18 | #define ERROR_RX_P -2 |
12104404 | 1:8966a48ce8d5 | 19 | #define ERROR_RX_N -3 |
12104404 | 1:8966a48ce8d5 | 20 | #define ERROR_RY_P -4 |
12104404 | 1:8966a48ce8d5 | 21 | #define ERROR_RY_N -5 |
12104404 | 0:96d6eb224379 | 22 | |
12104404 | 0:96d6eb224379 | 23 | typedef struct { |
12104404 | 0:96d6eb224379 | 24 | int x; |
12104404 | 0:96d6eb224379 | 25 | int y; |
12104404 | 0:96d6eb224379 | 26 | int a; |
12104404 | 0:96d6eb224379 | 27 | }LOCALIZE_xya; |
12104404 | 0:96d6eb224379 | 28 | |
12104404 | 0:96d6eb224379 | 29 | class LOCALIZE |
12104404 | 0:96d6eb224379 | 30 | { |
12104404 | 0:96d6eb224379 | 31 | public: |
12104404 | 0:96d6eb224379 | 32 | LOCALIZE(I2C& y_i2c, I2C& x_imu_i2c, PinName imu_reset); |
12104404 | 0:96d6eb224379 | 33 | int init(void); |
12104404 | 3:c58eb4be51de | 34 | void get_raw_xy(void); |
12104404 | 0:96d6eb224379 | 35 | void get_angle(LOCALIZE_xya *xya); |
12104404 | 1:8966a48ce8d5 | 36 | void get_xy(LOCALIZE_xya *xya); |
12104404 | 0:96d6eb224379 | 37 | |
12104404 | 0:96d6eb224379 | 38 | protected: |
12104404 | 3:c58eb4be51de | 39 | int _rx_p, _rx_n, _ry_p, _ry_n; |
12104404 | 0:96d6eb224379 | 40 | I2C _y_i2c; |
12104404 | 0:96d6eb224379 | 41 | I2C _x_imu_i2c; |
12104404 | 0:96d6eb224379 | 42 | BNO055 _imu; |
12104404 | 1:8966a48ce8d5 | 43 | BNO055_EULER_TypeDef _euler; |
12104404 | 1:8966a48ce8d5 | 44 | BNO055_GRAVITY_TypeDef _gravity; |
12104404 | 1:8966a48ce8d5 | 45 | BNO055_LIN_ACC_TypeDef _accel; |
12104404 | 1:8966a48ce8d5 | 46 | LOCALIZE_xya _xya; |
12104404 | 0:96d6eb224379 | 47 | }; |
12104404 | 0:96d6eb224379 | 48 | |
12104404 | 0:96d6eb224379 | 49 | #endif //LOCALIZE_H |