AP_IMU: added num_samples_available to allow main loop timing to be synced with arrival of new data from IMU.

This commit is contained in:
rmackay9 2012-08-30 16:49:21 +09:00
parent 0a6219695b
commit fc4ff007e6
4 changed files with 24 additions and 2 deletions

View File

@ -257,3 +257,9 @@ float AP_IMU_INS::get_gyro_drift_rate(void)
{
return _ins->get_gyro_drift_rate();
}
/// Get number of samples read from the sensors
uint16_t AP_IMU_INS::num_samples_available(void)
{
return _ins->num_samples_available();
}

View File

@ -55,6 +55,9 @@ public:
virtual bool update(void);
virtual bool new_data_available(void);
/// Get number of samples read from the sensors
virtual uint16_t num_samples_available(void);
// for jason
virtual float gx() {
return _sensor_cal[0];
@ -95,7 +98,6 @@ public:
}
virtual float get_gyro_drift_rate(void);
private:
AP_InertialSensor * _ins; ///< INS provides an axis and unit correct sensor source.

View File

@ -41,6 +41,11 @@ bool IMU::new_data_available(void) {
return true;
}
uint16_t IMU::num_samples_available(void)
{
return 0;
}
float IMU::gx(void) {
return 0.0;
}

View File

@ -62,9 +62,18 @@ public:
///
virtual bool update(void);
// true if new data is available from the sensors
/// Check if new sensor data is available
///
/// @returns true if new data is available from the sensors
///
virtual bool new_data_available(void);
/// Get number of samples read from the sensors
///
/// @returns number of samples read from the sensors
///
virtual uint16_t num_samples_available(void);
/// Fetch the current gyro values
///
/// @returns vector of rotational rates in radians/sec