diff --git a/libraries/AP_IMU/AP_IMU_Oilpan.cpp b/libraries/AP_IMU/AP_IMU_Oilpan.cpp index a635d28397..6149817823 100644 --- a/libraries/AP_IMU/AP_IMU_Oilpan.cpp +++ b/libraries/AP_IMU/AP_IMU_Oilpan.cpp @@ -87,7 +87,7 @@ AP_IMU_Oilpan::_init_gyro() for (int i = 0; i < 6; i++) adc_in = _adc->Ch(_sensors[i]); - + digitalWrite(A_LED_PIN, HIGH); digitalWrite(C_LED_PIN, LOW); delay(20); @@ -98,7 +98,7 @@ AP_IMU_Oilpan::_init_gyro() _sensor_cal[j] = adc_in; } - for(int i = 0; i < 50; i++){ + for(int i = 0; i < 100; i++){ for (int j = 0; j < 3; j++){ adc_in = _adc->Ch(_sensors[j]); // Subtract temp compensated typical gyro bias diff --git a/libraries/AP_IMU/AP_IMU_Oilpan.h b/libraries/AP_IMU/AP_IMU_Oilpan.h index 1678c61ce9..0909fdca18 100644 --- a/libraries/AP_IMU/AP_IMU_Oilpan.h +++ b/libraries/AP_IMU/AP_IMU_Oilpan.h @@ -27,7 +27,8 @@ public: /// AP_IMU_Oilpan(AP_ADC *adc, AP_Var::Key key) : _adc(adc), - _sensor_cal(key, PSTR("IMU_SENSOR_CAL"), AP_Var::k_flag_no_auto_load) + _sensor_cal(key, PSTR("IMU_SENSOR_CAL")) + // _sensor_cal(key, PSTR("IMU_SENSOR_CAL"), AP_Var::k_flag_no_auto_load) {} /// Do warm or cold start. @@ -41,22 +42,25 @@ public: /// WARM_START loads accelerometer and gyro calibration from a previous cold start. /// virtual void init(Start_style style = COLD_START); - + virtual void save(); virtual void init_accel(); virtual void init_gyro(); virtual bool update(void); - - // for jason - int ax() { return _sensor_cal[3]; } - int ay() { return _sensor_cal[4]; } - int az() { return _sensor_cal[5]; } - void ax(const int v) { _sensor_cal[3] = v; } - void ay(const int v) { _sensor_cal[4] = v; } - void az(const int v) { _sensor_cal[5] = v; } - - + // for jason + float gx() { return _sensor_cal[0]; } + float gy() { return _sensor_cal[1]; } + float gz() { return _sensor_cal[2]; } + float ax() { return _sensor_cal[3]; } + float ay() { return _sensor_cal[4]; } + float az() { return _sensor_cal[5]; } + + void ax(const float v) { _sensor_cal[3] = v; } + void ay(const float v) { _sensor_cal[4] = v; } + void az(const float v) { _sensor_cal[5] = v; } + + private: AP_ADC *_adc; ///< ADC that we use for reading sensors AP_VarA _sensor_cal; ///< Calibrated sensor offsets