Skip to content
Snippets Groups Projects
Commit 38feee9c authored by rmackay9's avatar rmackay9
Browse files

AP_IMU: added num_samples_available to allow main loop timing to be synced...

AP_IMU: added num_samples_available to allow main loop timing to be synced with arrival of new data from IMU.
parent 3901387c
No related branches found
No related tags found
No related merge requests found
...@@ -257,3 +257,9 @@ float AP_IMU_INS::get_gyro_drift_rate(void) ...@@ -257,3 +257,9 @@ float AP_IMU_INS::get_gyro_drift_rate(void)
{ {
return _ins->get_gyro_drift_rate(); 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();
}
...@@ -55,6 +55,9 @@ public: ...@@ -55,6 +55,9 @@ public:
virtual bool update(void); virtual bool update(void);
virtual bool new_data_available(void); virtual bool new_data_available(void);
/// Get number of samples read from the sensors
virtual uint16_t num_samples_available(void);
// for jason // for jason
virtual float gx() { virtual float gx() {
return _sensor_cal[0]; return _sensor_cal[0];
...@@ -95,7 +98,6 @@ public: ...@@ -95,7 +98,6 @@ public:
} }
virtual float get_gyro_drift_rate(void); virtual float get_gyro_drift_rate(void);
private: private:
AP_InertialSensor * _ins; ///< INS provides an axis and unit correct sensor source. AP_InertialSensor * _ins; ///< INS provides an axis and unit correct sensor source.
......
...@@ -41,6 +41,11 @@ bool IMU::new_data_available(void) { ...@@ -41,6 +41,11 @@ bool IMU::new_data_available(void) {
return true; return true;
} }
uint16_t IMU::num_samples_available(void)
{
return 0;
}
float IMU::gx(void) { float IMU::gx(void) {
return 0.0; return 0.0;
} }
......
...@@ -62,9 +62,18 @@ public: ...@@ -62,9 +62,18 @@ public:
/// ///
virtual bool update(void); 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); 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 /// Fetch the current gyro values
/// ///
/// @returns vector of rotational rates in radians/sec /// @returns vector of rotational rates in radians/sec
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment