Lucas De Marchi
69b6d95cb2
global: use static method to construct AP_Board_Config{,_CAN}
2017-09-26 03:01:21 +01:00
Lucas De Marchi
87b30b4552
global: use static method to construct AP_InertialSensor
2017-09-26 03:01:21 +01:00
Lucas De Marchi
d566567d87
AP_InertialSensor: add static create method
2017-09-26 03:01:21 +01:00
Lucas De Marchi
caa4e3ee89
AP_InertialSensor: remove raspilot
2017-09-12 15:06:19 -07:00
Lucas De Marchi
06fe5ce8ba
AP_InertialSensor: implement periodic thread for AuxiliaryBus
2017-09-11 09:52:41 -07:00
Andrew Tridgell
7e1368f7a5
AP_InertialSensor: implement notch filter on gyro
2017-08-29 13:52:29 +10:00
Kevin Lopez Alvarez
ca3627c140
AP_InertialSensor: add ppro support
2017-07-24 13:47:06 +10:00
Randy Mackay
51fa8fb0bd
AP_InertialSensor: resolve member init order compiler warning
2017-07-07 17:27:23 +09:00
Randy Mackay
edc9d4db5b
AP_InertialSensor: increase accel filter to 20hz
2017-07-03 09:38:15 +09:00
Peter Barker
6ae86a0b8c
AP_InertialSensor: use DataFlash should_log to determine raw logging
2017-06-29 15:26:27 +01:00
Leonard Hall
447b20efa5
AP_InertialSensor: reduce accel filter to 10hz
2017-06-01 14:53:48 +09:00
Andrew Tridgell
62b826953d
AP_InertialSensor: use AP_Math rand_float()
2017-05-03 20:12:04 +10:00
Andrew Tridgell
bfd8d151c8
AP_InertialSensor: lower slave rate with fast sampling
...
On an invensense IMU with fast sampling we need to lower the slave
sample rate for slave sensors such as the built-in AK8963 compass on a
MPU9250.
The slave rate is set as a multiple of the main rate, so it needs to be
much lower for fast sampling. If we leave it high then it greatly
impacts on IMU sample rate.
Without this change a MPU9250 with fast sampling and a compass enabled
will give a gyro rate of around 7200Hz. With this change it gets 7760Hz
2017-05-02 12:11:08 +10:00
Andrew Tridgell
519a293af9
AP_InertialSensor: fixed instance usage in set_gyro_oversampling()
...
thanks Francisco!
2017-05-02 08:27:11 +10:00
Andrew Tridgell
112b22516a
AP_InertialSensor: fixed use of accel2_noise
...
thanks Francisco!
2017-05-02 08:24:50 +10:00
Andrew Tridgell
2876f1467c
AP_InertialSensor: converge sensor rate quickly, then slowly
...
converge fast for the first 60 seconds, then more slowly to reduce
noise
2017-05-01 15:13:56 +10: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
74eb7a7243
AP_InertialSensor: make SITL sensor rate match a Pixhawk1
...
use 760Hz 2nd gyro and 800 Hz 2nd accel
2017-05-01 15:06:46 +10:00
Andrew Tridgell
25cd16a275
AP_InertialSensor: fixed LSM303D registered sample rate
...
we are running the LSM303D at 1600Hz, and are sampling it at 1kHz. We
need to tell the AP_InertialSensor layer that samples will arrive at 1kHz
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
c952e58edb
AP_InertialSensor: fixed invensense driver temp reading
...
different parts have quite different zero offsets in temperature
2017-04-03 10:06:27 +10:00
Lucas De Marchi
2e4e4365d0
AP_InertialSensor: enable fast sampling for aerofc
2017-03-24 12:06:19 +11:00
Lucas De Marchi
87846fe049
AP_InertialSensor: use MPU6500 on aerofc
2017-03-24 12:06:19 +11:00
Andrew Tridgell
875274e761
AP_InertialSensor: added support for ICM-20602
...
treat the same as a 20608
2017-03-02 14:21:36 +11:00
Andrew Tridgell
b86513f503
AP_InertialSensor: support AUAV21 board
2017-03-01 17:24:10 +11:00
Lucas De Marchi
2d50eb312c
AP_InertialSensor: add support to MPU6500
...
Just like and MPU9250 without mag and with different WHOAMI register.
2017-02-26 13:37:13 +11:00
murata
a3f5b4f319
AP_InertialSensor: Change from magic number 0 to definition name.
2017-02-18 14:12:36 +00:00
Lucas De Marchi
9535b45cc9
AP_InertialSensor: examples: fix double to float warnings
...
While at it add function prototype.
2017-02-12 01:22:35 +00:00
Andrew Tridgell
01da36295d
AP_InertialSensor: support the L3GD20H gyro
...
this is used by the MRo Pixhawk1
2017-01-31 07:39:36 +11:00
murata
0733d760f6
AP_HAL_VRBRAIN: Unify from print or println to printf.
...
AP_InertialSensor: Unify from print or printin to printf.
2017-01-27 18:20:22 +11:00
murata
2643e7e906
AP_InertialSensor: Unify from print or println to printf.
2017-01-27 18:20:22 +11:00
Julien Beraud
3d9dacb227
AP_InertialSensor: push gyro data for opticalflow
...
Do it only if there is an optical flow in the current HAL
2017-01-23 21:23:16 +11:00
Lucas De Marchi
5472bc4de1
Global: change Device::PeriodicCb signature
...
Remove bool return as it's never being used and not supported on PX4.
2017-01-14 10:03:54 +11:00
mirkix
62fabca19d
AP_InertialSensor: Enable I2C bypass for MPU9250 conntected via I2C to access internal AK8963
2017-01-11 21:44:24 -08:00
Randy Mackay
946d30476a
AP_InertialSensor: fix whoami for MPU6k
2017-01-05 10:29:51 +09:00
murata
d56bad781f
AP_InertialSensor: change if statements to switch statement
...
No functional change
2016-12-24 12:23:59 +09:00
murata
398b7b83dd
AP_InertialSensor: minor formatting fixes
...
No functional change
2016-12-24 12:23:58 +09:00
Lucas De Marchi
9569ed94a9
AP_InertialSensor: Invensense: use capital letters for define
2016-12-20 09:23:30 +09:00
Andrew Tridgell
a30745903a
AP_InertialSensor: use ACC2_BIAS
2016-12-19 08:07:15 +11:00
priseborough
60ebe97e10
AP_InertialSensor: remove unused EKF1 include
2016-12-19 08:07:11 +11:00
Andrew Tridgell
65b9b86099
AP_InertialSensor: unify MPU6000 and MPU9250 drivers
...
make a single AP_InertialSensor_Invensense driver. This avoids a lot
of duplication and will save time as new varients are added
2016-12-16 12:31:34 +11:00
Pierre Kancir
de05e6ba29
InertialSensor : MPU9250 utilize an explicit type cast to avoid the loss of a fractional part
2016-12-05 12:39:30 -08:00
Pierre Kancir
13c16e187f
InertialSensor: MPU6000 utilize an explicit type cast to avoid the loss of a fractional part
2016-12-05 10:59:45 -08:00
Randy Mackay
dfd58cc57b
AP_InertialSensor: fix build warning for MPU9250
2016-11-30 18:00:14 +09:00
Randy Mackay
699279ed1f
AP_InertialSensor: fix build warning for MPU6000
2016-11-30 18:00:13 +09:00
Andrew Tridgell
f9845c93b1
AP_InertialSensor: keep transfers nicely setup for DMA on stm32
...
this avoids using stack based bounce buffers which may not support DMA
on stm32
2016-11-27 11:26:10 +11:00
Andrew Tridgell
771cedca3d
AP_InertialSensor: reduced number of SPI transfers
...
use cached copy of temperature in MPU6000 and MPU9250 to detect FIFO
error when possible
2016-11-26 19:02:22 +11:00
Andrew Tridgell
27605b0258
AP_InertialSensor: run invensese reg checking at low speed
...
config register read/write should be at low bus speed.
also change to check every 20 calls to reduce checking cost
2016-11-25 20:31:40 +11:00
Andrew Tridgell
0f984290c3
AP_InertialSensor: enable fast sampling by default on some boards
2016-11-25 17:59:54 +11:00
Andrew Tridgell
f3a778f980
AP_InertialSensor: fixed freeing of fifo buffer
2016-11-25 17:50:19 +11:00
Andrew Tridgell
6f28c61c8d
AP_InertialSensor: changed SIZE to LEN
...
thanks to Lucas for suggestion
2016-11-25 17:50:19 +11:00
hiro2233
cb7f46d653
AP_InertialSensor: fixed handling of user_ctrl register
...
with aux bus implementations
2016-11-25 17:50:18 +11:00
Andrew Tridgell
9b4c588c09
AP_InertialSensor: adapt drivers for SPI-DMA capable systems
...
no longer need accumulate() transfers with SPI enabled DMA on stm32
2016-11-25 17:49:58 +11:00
Andrew Tridgell
28daddaaf2
AP_InertialSensor: don't use accumulate approach on Linux or I2C
2016-11-25 17:49:57 +11:00
Andrew Tridgell
d9c8db7024
AP_InertialSensor: implement a new strategy for fast sampling
...
this moves to using a 1p filter on the high rate data, followed by
averaging down to 1kHz then a 2p filter to apply configured cutoff
frequency.
It also fixes the FIFO reset to not cause data corruption. We need to
disable all FIFO channels before doing the reset, and wait for the
FIFO to stop in the sensor.
Finally it moves sampling of the MPU6000 and MPU9250 into the main
thread. That significantly improves scheduling performance as we no
longer get long FIFO SPI transfers happening during other tasks. All
transfers happen at the start of the fast loop. That makes timing much
more predictable.
Thanks to Leonard and Paul for help with this design!
2016-11-25 17:49:57 +11:00
Lucas De Marchi
87c6d5da13
AP_InertialSensor: replace panic() with return
...
When blocking forever there's no reason to call panic later since it
will never going to be reached. This reduces binary size in a few bytes
since the message isn't required anymore.
2016-11-21 18:04:10 -02:00
Andrew Tridgell
6129b1abb6
AP_InertialSensor: wait forever for semaphore on startup
...
some boards take a silly amount of time to get semaphore on startup
2016-11-21 17:57:21 -02:00
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