BMX055
Dependents: 9Dsensor_test LINE_TRACE_CAR
BMX055.h
00001 /* 00002 宣言方法 00003 BMX055 bmx(SDA_pin,SCL_pin); 00004 00005 bmx.Get_acc(); 00006 bmx.Get_gyro(); 00007 bmx.Get_mag(); で値をゲット 00008 00009 値は 00010 bmx.accel[3]; 00011 bmx.gyroscope[3]; 00012 bmx.magnet[3]; に入っている 00013 */ 00014 00015 #ifndef BMX055_H_ 00016 #define BMX055_H_ 00017 00018 #include "mbed.h" 00019 #include "Quaternion.h" 00020 00021 #define ACC 0x19<<1 00022 #define GYRO 0x69<<1 00023 #define MAG 0x13<<1 00024 00025 00026 00027 class BMX055 00028 { 00029 public: 00030 BMX055(PinName SDA, PinName SCL); 00031 static const float ACC_BIAS[3]; 00032 static const float ACC_GAIN[3]; 00033 00034 Quaternion posture; 00035 00036 Quaternion initial_mag; 00037 00038 Quaternion initial_acc; 00039 00040 void Update_posture(); 00041 00042 void mag_calibration(DigitalIn button); 00043 00044 /*void Get_acc(void); 00045 void Get_gyro(void); 00046 void Get_mag(void);*/ 00047 00048 void set_initial_mag(void); 00049 00050 void set_initial_acc(void); 00051 00052 float get_azimuth_machineframe(void); 00053 private: 00054 I2C bmx055; 00055 void bmx_init(void); 00056 00057 void Get_acc(void); 00058 void Get_gyro(void); 00059 void Get_mag(void); 00060 00061 float accel[3]; 00062 float gyroscope[3]; 00063 float magnet[3]; 00064 Timer timer; 00065 double before_time; 00066 00067 double acc_biases[3] = { -0.3033175,-1.0404895,-0.0261225 }; 00068 double acc_gains[3] = { 1.006541011,0.994069761,0.992982982 }; 00069 double gyro_biases[3] = { -3.453e-3, 3.81e-4, -2.35e-3 }; 00070 double gyro_gains[3] = { 1,1,1 }; 00071 float mag_biases[3] = { 0,0,0 }; 00072 float mag_gains[3] = { 1,1,1 }; 00073 }; 00074 00075 00076 00077 #endif
Generated on Sat Jul 16 2022 06:27:02 by
1.7.2