Commit Graph

762 Commits

Author SHA1 Message Date
Andrew Tridgell 216cf53922 AP_InertialSensor: handle FIFO overflow for MPU6k and 9250
this prevents temporary corruption of INS data on FIFO overflow
2016-11-19 12:54:22 +11:00
Andrew Tridgell 18d4286166 AP_InertialSensor: fixed pixfalcon 9250 detection 2016-11-18 14:24:39 +11:00
Andrew Tridgell cb1a5d4c74 AP_InertialSensor: take semaphore for update of accumulators
this fixes a race in update of delta angle and delta velocity between
backend and frontend
2016-11-18 06:32:17 +11:00
Andrew Tridgell f3f1f6b0b6 AP_InertialSensor: fixed gyro orientation on l3gd20H on pixhawk 2016-11-16 20:33:56 +11:00
Andrew Tridgell 6af00027ab AP_InertialSensor: removed unused variables
thanks to Francisco for noticing
2016-11-16 08:41:06 +11:00
Francisco Ferreira bfbb275577 AP_InertialSensor: on accel cal failure don't save values to zero
When the accel calibration fails leave the previous values saved but set them to defaults (scale default is ones, not zeros) and notify the GCS
This fixes an arithmetic exception when doing a second accel cal after the first one failed
2016-11-15 11:42:54 -08: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 c0303ffe8a AP_InertialSensor: temporarily disable fast sampling
a problem has been found with the filtering with fast sampling on
ICM-20608 and MPU9250. Disable until it is solved.
2016-11-14 18:18:17 +11:00
Andrew Tridgell c794ad9ee8 AP_InertialSensor: use smaller FIFO buffers
this allows for reading multiple chunks from the fifo per callback
2016-11-13 13:16:22 +11:00
Andrew Tridgell 8d19808152 AP_InertialSensor: fixed missing checked register goto
thanks to Francisco for spotting
2016-11-11 08:08:56 +11:00
Andrew Tridgell 49856c37f2 AP_InertialSensor: reduce checked register count
thanks to Francisco for spotting this
2016-11-11 08:08:56 +11:00
Andrew Tridgell 4be8f05ad4 AP_InertialSensor: added register checking for LSM9DS0 2016-11-11 08:08:56 +11:00
Andrew Tridgell 77a83c091a AP_InertialSensor: added register checking for MPU6000/ICM20608 2016-11-11 08:08:56 +11:00
Andrew Tridgell 95a849f472 AP_InertialSensor: added register checking for MPU9250 2016-11-11 08:08:56 +11:00
Andrew Tridgell 3289e90134 AP_InertialSensor: added error count increments in drivers 2016-11-11 08:08:55 +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
Andrew Tridgell af0ec41652 AP_InertialSensor: fixed accel clip detection with fast sampling
we need to check on every sample at the full rate
2016-11-10 13:39:17 +11:00
Andrew Tridgell 70c27a85de AP_InertialSensor: on PH2 run the first MPU9250 at 8kHz 2016-11-10 13:04:15 +11:00
Andrew Tridgell 1ea4c6938c AP_InertialSensor: allow auxiliary bus with fast sampling 2016-11-10 11:44:52 +11:00
Andrew Tridgell 8da42b7a8b AP_InertialSensor: fixed temperature for fast sampling case 2016-11-10 11:44:52 +11:00
Andrew Tridgell cb70bae167 AP_InertialSensor: use in-tree drivers for PH2SLIM 2016-11-10 11:44:52 +11:00
Andrew Tridgell e27a76e460 AP_InertialSensor: fixed auxiliary bus with FIFO enabled
make sure fifo reset doesn't check I2C master enable
2016-11-10 11:44:51 +11:00
Andrew Tridgell 46785e8ecf AP_InertialSensor: improved method for FIFO integrity checking
check temperature every 255 samples against FIFO data
2016-11-10 11:44:51 +11:00
Andrew Tridgell 8a3f6a8902 AP_InertialSensor: use FIFO and implement fast sampling for MPU9250 2016-11-10 11:44:51 +11:00
Andrew Tridgell e25a391a8f AP_InertialSensor: fixed typo 2016-11-09 17:08:15 +11:00
Andrew Tridgell d2f6a514b9 AP_InertialSensor: catch FIFO alignment errors using temperature reading
Two cases of what seems to be FIFO alignment errors have been seen on
a Pixracer-beta board with a ICM-20608. At a cost of 2 extra bytes per
transfer we can catch these by looking for sudden temperature changes
caused by bad data in the temperature registers.
2016-11-09 17:08:15 +11:00
Andrew Tridgell d248b33104 AP_InertialSensor: simplify config of MPU6000
use zero sample rate divider on both MPU6000 and ICM20608
2016-11-09 17:08:14 +11:00
Andrew Tridgell 7137d5c6f2 AP_InertialSensor: switch pixracer to always use in-tree drivers 2016-11-09 17:08:14 +11:00
Andrew Tridgell 84c3e29891 AP_InertialSensor: use AP_HAL rotations for MPU6000 2016-11-09 17:08:14 +11:00
Andrew Tridgell 2f01dfe81c AP_InertialSensor: fixed from review by Lucas 2016-11-09 17:08:13 +11:00
Andrew Tridgell 81b933d9d0 AP_InertialSensor: use int32_t summation for fast sampling
very slightly faster
2016-11-09 17:08:13 +11:00
Andrew Tridgell 03b7bc9e65 AP_InertialSensor: use internal drivers for PHMINI
this gets us fast sampling
2016-11-09 17:08:12 +11:00
Andrew Tridgell af1c5fd6d3 AP_InertialSensor: always use FIFO on MPU6000
and enable fast sampling on ICM20608 if on SPI
2016-11-09 17:08:12 +11:00
Andrew Tridgell fde80a9408 AP_InertialSensor: modify LSM303D settings to match PX4 driver
this allows existing accel calibration to be used
2016-11-09 17:08:12 +11:00
Andrew Tridgell a9a5e50bd1 AP_InertialSensor: removed timer callback for MPU6000
Thanks to Lucas for pointing out this is not needed
2016-11-09 17:08:11 +11:00
Andrew Tridgell bd84e592f8 AP_InertialSensor: check for NULL device pointer in probe()
handle missing devices
2016-11-09 17:08:10 +11:00
Andrew Tridgell 3d7d773883 AP_InertialSensor: added support for ICM20608 on Pixracer 2016-11-09 17:08:08 +11:00
Andrew Tridgell 2c1e9024f1 AP_InertialSensor: detect missing accels or gyros 2016-11-09 17:08:07 +11:00
Andrew Tridgell 106a91c64c AP_InertialSensor: use init_gyro() on startup
this saves the calibration parameters which should be done on
calibration
2016-11-09 17:08:07 +11:00
Andrew Tridgell 408593465f AP_InertialSensor: fixed rotation for mpu9250 on pixracer 2016-11-09 17:08:07 +11:00
Andrew Tridgell 790dd4769b AP_InertialSensor: simplify rotations for MPU9250 2016-11-09 17:08:07 +11:00
Andrew Tridgell aa4025bdf9 AP_InertialSensor: make INS sensor IDs match for PX4
in-tree driver IDs now match PX4Firmware driver IDs on Pixhawk2
2016-11-09 17:08:06 +11:00
Andrew Tridgell 9e7e1b2f01 AP_InertialSensor: fixed merge conflicts with patches from Lucas 2016-11-09 17:08:06 +11:00
Lucas De Marchi 104e29acf2 AP_InertialSensor: MPU6000: change accel scale to 16G
Also change the ID of MPU6000 so previous calibration values are not
considered valid.
2016-11-09 17:08:06 +11:00
Lucas De Marchi dc09661b9e AP_InertialSensor: MPU6000: save driver version
When registering accel and gyro we use the upper 16bits of the id to
store the driver version. When changing the driver behavior in
non-compatible ways, changing this version will trigger a request for
calibration.
2016-11-09 17:08:06 +11:00
Lucas De Marchi 0d3adef8b2 AP_InertialSensor: MPU6000: remove TODO leftover
This will never be done as blindly changing speed is not the way to fix
communication issues.
2016-11-09 17:08:05 +11:00
Andrew Tridgell 0a1616cc71 AP_InertialSensor: use correct device IDs on PX4 driver 2016-11-09 17:08:05 +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 f81dba2100 AP_InertialSensor: add doc to get_id() of backend
This is different from get_id() of Device and ultimately from each
sensor this this is identifying the backend, not the sensor.
2016-11-09 17:08:05 +11:00