@ -20,6 +20,9 @@ class AP_InertialSensor
*/
virtual bool update() = 0;
// check if the sensors have new data
virtual bool new_data_available(void) = 0;
/* Getters for individual gyro axes.
* Gyros have correct coordinate frame and units (degrees per second).
@ -159,6 +159,11 @@ bool AP_InertialSensor_MPU6000::update( void )
return true;
}
bool AP_InertialSensor_MPU6000::new_data_available( void )
{
return _count != 0;
float AP_InertialSensor_MPU6000::gx() { return _gyro.x; }
float AP_InertialSensor_MPU6000::gy() { return _gyro.y; }
float AP_InertialSensor_MPU6000::gz() { return _gyro.z; }
@ -20,6 +20,7 @@ class AP_InertialSensor_MPU6000 : public AP_InertialSensor
/* Concrete implementation of AP_InertialSensor functions: */
bool update();
bool new_data_available();
float gx();
float gy();
float gz();
@ -71,6 +71,11 @@ bool AP_InertialSensor_Oilpan::update()
bool AP_InertialSensor_Oilpan::new_data_available( void )
return _adc->new_data_available(_sensors);
float AP_InertialSensor_Oilpan::gx() { return _gyro.x; }
float AP_InertialSensor_Oilpan::gy() { return _gyro.y; }
float AP_InertialSensor_Oilpan::gz() { return _gyro.z; }
@ -19,6 +19,7 @@ class AP_InertialSensor_Oilpan : public AP_InertialSensor
void init(AP_PeriodicProcess * scheduler);
@ -7,6 +7,7 @@ void AP_InertialSensor_Stub::init( AP_PeriodicProcess * scheduler ) {}
/*================ AP_INERTIALSENSOR PUBLIC INTERFACE ==================== */
bool AP_InertialSensor_Stub::update( void ) { return true; }
bool AP_InertialSensor_Stub::new_data_available( void ) { return true; }
float AP_InertialSensor_Stub::gx() { return 0.0f; }
@ -19,6 +19,7 @@ class AP_InertialSensor_Stub : public AP_InertialSensor