DERPS

Dependencies:   BMP280 BNO055_fusion PowerControl mbed

Fork of STRAIGHT_DRIVE_NO_SEP by Antoine Laurens

Committer:
12104404
Date:
Thu Mar 24 07:20:51 2016 +0000
Revision:
15:7729da55873a
Parent:
13:c62f975dfcfe
Child:
19:2dd81b864e14
how to combine x y control

Who changed what in which revision?

UserRevisionLine numberNew 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 10:cf44f4387bc7 11 #define FRAME_OFF 0
12104404 8:b36be08c44f8 12 #define FRAME_H 150
12104404 8:b36be08c44f8 13 #define FRAME_W 104
12104404 6:0602a9e8118b 14 #define R_WAIT 0.025
12104404 1:8966a48ce8d5 15 #define R_ERROR 14
12104404 4:d70375cfa533 16 #define RX_OFF 7
12104404 4:d70375cfa533 17 #define RY_OFF 6
12104404 1:8966a48ce8d5 18
12104404 1:8966a48ce8d5 19 #define ERROR_IMU -1
12104404 1:8966a48ce8d5 20 #define ERROR_RX_P -2
12104404 1:8966a48ce8d5 21 #define ERROR_RX_N -3
12104404 1:8966a48ce8d5 22 #define ERROR_RY_P -4
12104404 1:8966a48ce8d5 23 #define ERROR_RY_N -5
12104404 0:96d6eb224379 24
12104404 0:96d6eb224379 25 typedef struct {
12104404 0:96d6eb224379 26 int x;
12104404 0:96d6eb224379 27 int y;
12104404 0:96d6eb224379 28 int a;
12104404 0:96d6eb224379 29 }LOCALIZE_xya;
12104404 0:96d6eb224379 30
12104404 0:96d6eb224379 31 class LOCALIZE
12104404 0:96d6eb224379 32 {
12104404 0:96d6eb224379 33 public:
12104404 15:7729da55873a 34 LOCALIZE(I2C& y_i2c, I2C& x_imu_i2c, PinName imu_reset, PinName sw1, PinName sw2, PinName sw3, PinName sw4);
12104404 0:96d6eb224379 35 int init(void);
12104404 3:c58eb4be51de 36 void get_raw_xy(void);
12104404 0:96d6eb224379 37 void get_angle(LOCALIZE_xya *xya);
12104404 1:8966a48ce8d5 38 void get_xy(LOCALIZE_xya *xya);
12104404 6:0602a9e8118b 39 int _angle, _rx_p, _rx_n, _ry_p, _ry_n;//
12104404 6:0602a9e8118b 40 BNO055_EULER_TypeDef _euler;
12104404 13:c62f975dfcfe 41 void ledSw(void);
12104404 6:0602a9e8118b 42
12104404 0:96d6eb224379 43 protected:
12104404 0:96d6eb224379 44 I2C _y_i2c;
12104404 0:96d6eb224379 45 I2C _x_imu_i2c;
12104404 0:96d6eb224379 46 BNO055 _imu;
12104404 15:7729da55873a 47 DigitalIn _sw1;
12104404 15:7729da55873a 48 DigitalIn _sw2;
12104404 15:7729da55873a 49 DigitalIn _sw3;
12104404 15:7729da55873a 50 DigitalIn _sw4;
12104404 6:0602a9e8118b 51
12104404 1:8966a48ce8d5 52 BNO055_GRAVITY_TypeDef _gravity;
12104404 1:8966a48ce8d5 53 BNO055_LIN_ACC_TypeDef _accel;
12104404 1:8966a48ce8d5 54 LOCALIZE_xya _xya;
12104404 13:c62f975dfcfe 55
12104404 0:96d6eb224379 56 };
12104404 0:96d6eb224379 57
12104404 0:96d6eb224379 58 #endif //LOCALIZE_H