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
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
6af00027ab
AP_InertialSensor: removed unused variables
...
thanks to Francisco for noticing
2016-11-16 08:41:06 +11: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
95a849f472
AP_InertialSensor: added register checking for MPU9250
2016-11-11 08:08:56 +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
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
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
bd84e592f8
AP_InertialSensor: check for NULL device pointer in probe()
...
handle missing devices
2016-11-09 17:08:10 +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
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
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
64a5d3938c
AP_InertialSensor: implement device IDs for MPU6000 and MPU9250 AuxilaryBus
2016-11-09 17:08:04 +11:00
Andrew Tridgell
a5c5e033d2
AP_InertialSensor: fixed threading and locking in remaining backends
...
use a backend semaphore for shared data and use thread per bus where
available
2016-11-09 17:08:01 +11:00
Martin Evans
0e19b8c9a0
AP_HAL_Linux: Set initial rotation on Dark to None
2016-10-24 10:00:24 -02: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
mirkix
a4d0ad8571
AP_InertialSensor: Fix name of sensor
2016-08-23 11:25:59 +09:00
Lucas De Marchi
1f96336f7c
Global: rename bus type enum entries
2016-06-27 17:51:41 -03:00
Gustavo Jose de Sousa
de94392759
AP_InertialSensor: MPU9250: remove _bus_type field
...
Use _dev->bus_type instead.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa
83feb2e2ae
AP_InertialSensor: MPU9250: let Device handle read flag
...
There's no need to handle that in MPU9250 anymore.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa
1e99a7125c
AP_InertialSensor: MPU9250: remove _register_write_check()
...
That function isn't used in the code base and there should be a better way to
debug writes on registers.
2016-06-27 17:20:51 -03:00
Lucas De Marchi
057822b51c
AP_InertialSensor: AuxiliaryBus: fix return value
...
We should return the number of bytes written/read, not 0 on success.
This number may be useful in some cases so return it.
While at it fix a simple wrong space in the header.
2016-03-17 02:55:39 -03:00
Staroselskii Georgii
da550e5e98
AP_Inertial_Sensor: do not rotate MPU9250 on Navio2
2016-02-27 03:06:50 -03:00
Lucas De Marchi
02a7fa5c2b
AP_InertialSensor: MPU9250: use AP_HAL::Device abstraction
...
This makes MPU9250 be almost the same as MPU6000 driver. Work has been
done here to make than similar so it's easier to spot the differences.
2016-02-16 19:49:09 -02:00
Víctor Mayoral Vilches
e493bfcae4
AP_InertialSensor: add PXFmini support
2016-01-05 15:35:56 -02:00
Aaron Wang Shi
3a31970056
AP_InertialSensor: add support to BH hat
...
- MPU6050 I2C for BH v0.1
- MPU9250 SPI for BH v0.2
2015-12-21 15:54:30 +11:00
Andrew Tridgell
75ea8f3dc0
AP_InertialSensor: removed "have sample" logic from drivers
...
the frontend has all the information it needs, so we can simplify the
drivers some more
2015-11-16 17:57:35 +11:00
Andrew Tridgell
0e4bab74ba
AP_InertialSensor: simplify sensor backends
...
use common code for filtering and update, allowing each sensor driver
to be simpler and more consistent
2015-11-16 17:57:35 +11:00
José Roberto de Souza
0cbe99a862
AP_InertialSensor: MPU9250 I2C: Connect the auxiliary I2C bus to the main bus
...
Using MPU9250 over I2C we can connect the auxiliary bus where there is
a AK8963 and connect this bus to the main one, this way we don't need
any AuxiliaryBus infrastructure as we need with SPI and we can talk
with AK8963 as we would talk with a standalone AK8963.
2015-11-11 14:29:07 +11:00
José Roberto de Souza
607ab5b005
AP_InertialSensor: MPU9250: Add I2C support
2015-11-11 14:29:07 +11:00
José Roberto de Souza
c3dae6fcec
AP_InertialSensor: MPU9250: Remove methods not used anymore
...
Those methods were used by AK8963 before it started to use auxiliary bus.
2015-11-11 14:29:06 +11:00
José Roberto de Souza
3e1b974fd2
AP_InertialSensor: MPU9250: Export auxiliary bus
2015-11-11 14:29:06 +11:00