• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

AP_IMU_Oilpan.h

Go to the documentation of this file.
00001 // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
00002 
00005 
00006 #ifndef AP_IMU_Oilpan_h
00007 #define AP_IMU_Oilpan_h
00008 
00009 #include "IMU.h"
00010 
00011 #include <AP_Math.h>
00012 #include <AP_ADC.h>
00013 #include <inttypes.h>
00014 
00015 class AP_IMU_Oilpan : public IMU
00016 {
00017 
00018 public:
00019         AP_IMU_Oilpan(AP_ADC *adc, uint16_t address) :
00020                 _adc(adc),
00021                 _address(address)
00022         {}
00023 
00024         virtual void            init(Start_style style = COLD_START);
00025         virtual void            init_accel(Start_style style = COLD_START);
00026         virtual void            init_gyro(Start_style style = COLD_START);
00027         virtual bool            update(void);
00028 
00029         // XXX backwards compat hacks
00030         void            zero_accel(void);
00031 
00032         void            print_accel_offsets(void);                                      
00033         void            print_gyro_offsets(void);                                       
00034 
00035         void            ax(const int v)         { _adc_offset[3] = v; }
00036         void            ay(const int v)         { _adc_offset[4] = v; }
00037         void            az(const int v)         { _adc_offset[5] = v; }
00038 
00039 private:
00040         float           _gyro_temp_comp(int i, int temp) const;
00041         void            _save_gyro_cal(void);
00042         void            _save_accel_cal(void);
00043 
00044         float           _gyro_in(uint8_t channel, int temperature);
00045         float           _accel_in(uint8_t channel);
00046 
00047         AP_ADC          *_adc;                                  // Analog to digital converter pointer
00048         uint16_t        _address;                               // EEPROM start address for saving/retrieving offsets
00049         float           _adc_offset[6];                 // Array that store the Offset of the gyros and accelerometers
00050 
00051         // XXX should not be implementing these here
00052         float           read_EE_float(int address);
00053         void            write_EE_float(float value, int address);
00054 
00055         // constants
00056         static const uint8_t    _sensors[6];
00057         static const int8_t     _sensor_signs[6];
00058         static const uint8_t    _gyro_temp_ch = 3;              // The ADC channel reading the gyro temperature
00059         static const float              _gyro_temp_curve[3][3];
00060 };
00061 
00062 #endif

Generated for ArduPilot Libraries by doxygen