Commit Graph

201 Commits

Author SHA1 Message Date
Michael du Breuil c86dcf91d6 AP_InertialSensor: Run vibration monitoring on all instances 2020-10-24 09:54:04 +11:00
Andy Piper faf9bbbf3a AP_InertialSensor: make the backend fast gyro rate configurable
raise gyro rate default on F7 and H7
clean up gyro rate docs and output startup banner
2020-07-10 16:45:29 +10:00
Andy Piper 61bb42cc0c AP_InertialSensor: allow up to four distinct notch center frequencies to be updated
apply the LPF after the notch filters to reduced notch-induced noise
2020-06-21 19:09:35 +10:00
Andy Piper 8ac79da643 AP_InertialSensor: FFT gyro window would overflow on windows >= 256
convert FFT buffers to ObjectBuffer<float> for lock-free access
push gyro samples directly into the FFT ring buffer from the gyro thread
2020-05-24 07:43:34 +10:00
Andy Piper 0e9b2a26c5 AP_InertialSensor: SITL the raw sample rate is not the same as the sensor rate
use regulated time for frequency noise to avoid spurious harmonics
SITL sensors must be true separate instances
don't compile in FFT structures if DSP disabled
2020-02-22 11:15:37 +11:00
Andy Piper 3d9776dd6d AP_InertialSensor: expose statically filtered gyro values for FFT analysis and allow sampling to gyro window for FFT analysis.
FFT windows can be dynamically allocated
add harmonic notch dynamic tracking mode
unwind gyro window allocation in the case of failure
allow access to harmonic notch harmonics
2020-02-22 11:15:37 +11:00
Andrew Tridgell 9dc618ddd4 AP_InertialSensor: added gyro_harmonic_notch_enabled() 2019-11-19 07:08:01 +08:00
Andrew Tridgell 77d21f9f5d AP_InertialSensor: return HarmonicNotchDynamicMode 2019-11-19 07:08:01 +08:00
Andy Piper 6381183aa3 AP_InertialSensor: expose harmonic notch tracking mode 2019-10-31 11:18:40 +08:00
Andy Piper 50f7e50634 AP_InertialSensor: add harmonic notch filter to gyro filter chain
Allow dynamic updates to the calculated frequency. Convert bandwidth and frequency to floats.
backend variables do not need to be indexed per-backed
2019-09-11 18:41:05 +10:00
Andrew Tridgell 3444e82ef9 AP_InertialSensor: added RC switch for killing IMUs 2019-07-07 19:03:01 +10:00
Andrew Tridgell 053f0cb689 AP_InertialSensor: try much harder to get all IMU samples
this we ensures we get new data for all active IMUs on each loop,
rather than sometimes returning with some IMUs not having data.

This matters as not having a sample on an IMU for a single loop can
cause an EKF IMU failover, which will degrade the learned bias
variances

The issue is usually only seen under high load, such as requesting a
loop rate beyond what the hardware is capable of
2019-07-07 19:03:01 +10:00
Andy Piper 36878e9b3c AP_InertialSensor: Allow all filter frequencies to be 16bit. 2019-06-06 17:09:17 +10:00
Andy Piper 18d403c3ac AP_InertialSensor: Rework notch filter allocation and sampling
https://github.com/ArduPilot/ardupilot/issues/11346

Allocate a notch filter per-IMU.
Update the notch filters in the backend at the sensor sample rate.
Allow raw logging of post-filtered gyro and accel values.
2019-06-06 17:09:17 +10:00
Andrew Tridgell 9c48d001ac AP_InertialSensor: skip gyro cal on watchdog reset 2019-04-22 16:53:35 +10:00
Siddharth Purohit 8c2d3945de AP_IneertialSensor: add support for custom accel scale
adds support for 30g measurement on ICM20649
2019-03-21 18:54:32 +11:00
Tom Pittenger 9347e6d36f AP_InertialSensor: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
Peter Barker b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
Michael du Breuil 983356213a AP_InertialSensor: Remove unused parameter 2018-12-23 12:46:37 -08:00
Peter Barker 011c93f38e AP_InertialSensor: add override keyword 2018-11-08 11:30:12 +11:00
Peter Barker 1a640e3405 AP_InertialSensor: parameterise sensor-rate logging, generalise it
AP_InertialSensor: add parameters for push-to-log interval and count

AP_InertialSensor: rename BAT_RAW to BAT_OPT

This becomes a bitmask of options for the BatchSampler

AP_InertialSensor: rename 'fast sample' to 'sensorrate sample'

AP_InertialSensor: const sensor-rate filter method

AP_InertialSampler: remove hard-coding of sample rate multiplier

AP_InertialSensor: use parameter to enable/disable sensor-rate logging

AP_InertialSensor: use a parameter to control sensor-rate logging

AP_InertialSensor: allow backends to override sensor data multiplier

e.g. some accelerometers are sensitive over wider ranges than the default 16G

AP_Inertialsensor: correct sample rate multiplier
2018-05-01 09:35:29 +10:00
Andrew Tridgell 44131202cd AP_InertialSensor: 4kHz batch sampling 2018-05-01 09:35:29 +10:00
Jacob Walser ad4e928e7d AP_InertialSensor: add support for custom board orientations 2018-04-24 13:04:37 +01:00
Peter Barker be634a893f AP_InertialSensor: remove unused ins error count logging 2018-04-04 14:21:20 +01:00
Peter Barker 2396a248ed AP_InertialSensor: use ahrs singleton for simple accelcal 2018-04-02 23:25:05 +01:00
Andrew Tridgell e8726865ab AP_InertialSensor: Correct scaling of batch data 2018-03-08 18:00:16 -08:00
Peter Barker 096f7367bf AP_InertialSensor: add ins() to AP:: namespace 2018-02-13 17:15:05 +11:00
Andrew Tridgell c0c5f23aa5 AP_InertialSensor: added INS_ENABLE_MASK
this allows for only a specified subset of IMUs to be probed, so you
can disable IMUs that aren't needed.

The back corresponds to bits in the order the IMUs are normally probed
on the board
2018-01-20 10:36:22 +11:00
Andrew Tridgell 99499dece2 AP_InertialSensor: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Andrew Tridgell 39c206ca03 AP_InertialSensor: limit delta-time from INS
limit delta-time to 2x average time

DEBUG CODE - DO NOT MERGE
2017-12-12 11:39:38 +11:00
Peter Barker 161e2145cb AP_InertialSensor: tighten type of simple_accel_cal result 2017-12-01 17:01:10 +00:00
Peter Barker 9566abb3a8 AP_InertialSensor: add IMU batch sampling 2017-10-27 16:33:45 +11:00
Peter Barker 5096e2fca9 AP_InertialSensor: use df singleton, factor out log_{gyro,accel}_raw 2017-10-27 16:33:45 +11:00
Andrew Tridgell d5cab1140a AP_InertialSensor: added simple_accel_cal()
this is useful for mass market vehicles where a full 3D accel cal is
too complex.
2017-10-10 10:57:38 +11:00
Lucas De Marchi d566567d87 AP_InertialSensor: add static create method 2017-09-26 03:01:21 +01:00
Andrew Tridgell 7e1368f7a5 AP_InertialSensor: implement notch filter on gyro 2017-08-29 13:52:29 +10:00
Peter Barker 6ae86a0b8c AP_InertialSensor: use DataFlash should_log to determine raw logging 2017-06-29 15:26:27 +01:00
Andrew Tridgell db25b6e966 AP_InertialSensor: estimate and log sensor rates for all IMUs
this adds IMU.GHz and IMU.AHz log fields so we can see the actual
observed sensor rates of each IMU
2017-05-01 15:06:46 +10:00
Andrew Tridgell 49cc0965c0 AP_InertialSensor: separate handling of FIFO and non-FIFO sensors
FIFO sensors produce data at a well known rate, but samples come in
bunches, so we can't use the system clock to calculate deltaT.

non-FIFO sensors produce data when we sample them, but that rate is
less regular due to timing jitter.

For FIFO sensors this changes makes us use a learned sample rate,
which allows for different clock speeds on sensor and system board.

For non-FIFO sensors we use the system clock to measure deltaT

the overall effect is a fix for sensors that produce samples at other
than the claimed datasheet rate.
2017-05-01 15:06:46 +10:00
Andrew Tridgell e62fdad12c AP_InertialSensor: added get_last_update_usec()
this will be used by the inter-EKF scheduling changes
2017-05-01 14:24:55 +10:00
Andrew Tridgell 624178f3be AP_InertialSensor: added INS_FAST_SAMPLE parameter
this allows enable/disable of fast sampling per IMU, making
experimentation easier.

It also fixes the fast sampling to always average over 8 samples, and
fixes the 9250 to use the correct accumulator when not doing fast
sampling
2016-11-15 21:16:40 +11:00
Andrew Tridgell 4ebf3309f7 AP_InertialSensor: auto-handle invensense sensor changes
some boards swap out MPU6000 for MPU9250 or ICM20608
2016-11-11 08:08:55 +11:00
Lucas De Marchi 469efb00f6 AP_InertialSensor: save id for gyro and accel instances
This allows each sensor to be uniquely identified in the system by using
either the index inside the backend or for those that use the Device
interface, to use the bus type, location, and device id.

We leave 16-bit for each sensor to be able to change its own
identification in future, which allows them to be changed in an
incompatible manner forcing a re-calibration.
2016-11-09 17:08:05 +11:00
Lucas De Marchi bbb9bfa95e AP_InertialSensor: save only gyro calibration
When we are initializing the gyro and then saving the calibration we are
also saving the calibration values for the accelerometers. Right now
this is non-problematic, but we want to check that the ID of the
accelerometer corresponds to the ID of the sensor detected. If we also
save accel calibrations we would actually override the ID of the
accelerometer.

Rename the method to _save_gyro_calibration() and save only on gyro
values.
2016-11-09 17:08:05 +11:00
Lucas De Marchi ace61087a1 AP_InertialSensor: remove product_id
We only leave the parameter there for backward-compatibility. However
product id on the inertial sensor is not much useful since it's only
kept for the first instance.

A better implementation per-gyro and per-accel is needed in order to
avoid problems with sensors taking the offsets configured for another
sensor.
2016-11-09 17:08:05 +11:00
Andrew Tridgell 2df6ed08c2 AP_InertialSensor: added optional per-instance orientation
this is needed for multi-sensor boards to get orientation right for
each sensor
2016-11-09 17:08:00 +11:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Andrew Tridgell afe2c31ae7 AP_Inertial_Sensor: use const reference 2016-10-27 15:06:11 +11:00
priseborough 6db93d8a21 AP_InertialSensor: Add parameters defining accelerometer position offset 2016-10-27 14:54:41 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00