diff --git a/libraries/AP_IMU/AP_IMU_INS.cpp b/libraries/AP_IMU/AP_IMU_INS.cpp index 0a23180261..b6f1f40c4a 100644 --- a/libraries/AP_IMU/AP_IMU_INS.cpp +++ b/libraries/AP_IMU/AP_IMU_INS.cpp @@ -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(); +} diff --git a/libraries/AP_IMU/AP_IMU_INS.h b/libraries/AP_IMU/AP_IMU_INS.h index 4c51acffbe..e0ba14414f 100644 --- a/libraries/AP_IMU/AP_IMU_INS.h +++ b/libraries/AP_IMU/AP_IMU_INS.h @@ -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. diff --git a/libraries/AP_IMU/IMU.cpp b/libraries/AP_IMU/IMU.cpp index 538e98c1ad..fb9acc03d0 100644 --- a/libraries/AP_IMU/IMU.cpp +++ b/libraries/AP_IMU/IMU.cpp @@ -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; } diff --git a/libraries/AP_IMU/IMU.h b/libraries/AP_IMU/IMU.h index 506158a5a7..990014c20b 100644 --- a/libraries/AP_IMU/IMU.h +++ b/libraries/AP_IMU/IMU.h @@ -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