Peter Barker
7147a2deeb
AP_InertialSensor: re-order initialiser lines so -Werror=reorder will work
2024-09-24 22:50:28 +10:00
Andy Piper
a86f4fdc8f
AP_InertialSensor: move gyro and accel instance ids into AP_InertialSensor_Backend
2024-06-26 17:14:56 +10:00
Andrew Tridgell
a0acccb1f9
AP_InertialSensor: use NEW_NOTHROW for new(std::nothrow)
2024-06-04 09:20:21 +10:00
murata
324f5e3ac9
AP_InertialSensor: Console output can be disabled
2022-05-17 09:53:06 +10:00
Andrew Tridgell
b3ed4f4b12
AP_InertialSensor: fixed handling of more than 3 accel/gyro instances
...
allows for first 3 to work without a panic
2021-04-13 09:36:52 +10:00
Tatsuya Yamaguchi
2c95093d36
AP_InertialSensor: fix temperature sensor on LSM9DS0
2021-03-16 12:09:19 +11:00
Andrew Tridgell
4cddf37984
AP_InertialSensor: log unexpected register changes
...
when the register checking code finds an error we will log what
register changed and to what value
2021-02-24 18:18:37 +11:00
Andrew Tridgell
6c8a57c2d7
AP_InertialSensor: review fixes
2021-01-21 13:09:21 +11:00
Andrew Tridgell
6f6f89e5aa
AP_InertialSensor: enable temperature sensor on LSM9DS0
...
this allows for temperature calibration of the LSM303D in CubeBlack
and Pixhawk1
2021-01-21 13:09:21 +11:00
Andrew Tridgell
b89c241329
AP_InertialSensor: use take_blocking instead of HAL_SEMAPHORE_BLOCK_FOREVER
...
this makes for cleaner and smaller code as the failure case is not
needed
2020-01-19 20:19:30 +11:00
Peter Barker
ef860db558
AP_InertialSensor: add floating point constant designators
2019-04-05 23:04:17 -07:00
Andrew Tridgell
81cd103073
AP_InertialSensor: probe for new v2 invensense IMUs
...
also suppress LSM9DS0 whoami warnings, as these will now be common
with new IMUs
and make 20602 show up as a new devtype so we can distinguish it
2019-03-11 12:40:21 +11:00
Andrew Tridgell
dff3ea416c
AP_InertialSensor: allow for LSM9DS0 to be used on I2C
2019-03-10 09:03:06 +11:00
Lucas De Marchi
c4e8aeb105
AP_InertialSensor: remove linux-only include
...
We already include AP_HAL.h that includes the platform-agnostic gpio
header, which is all that this driver needs. This is an alternative
fix to #7794 .
2018-03-09 11:12:31 -08:00
Lucas De Marchi
caa4e3ee89
AP_InertialSensor: remove raspilot
2017-09-12 15:06:19 -07: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
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
01da36295d
AP_InertialSensor: support the L3GD20H gyro
...
this is used by the MRo Pixhawk1
2017-01-31 07:39:36 +11:00
murata
2643e7e906
AP_InertialSensor: Unify from print or println to printf.
2017-01-27 18:20:22 +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
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
f3f1f6b0b6
AP_InertialSensor: fixed gyro orientation on l3gd20H on pixhawk
2016-11-16 20:33: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
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
bd84e592f8
AP_InertialSensor: check for NULL device pointer in probe()
...
handle missing devices
2016-11-09 17:08:10 +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
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
Andrew Tridgell
b92c48548a
AP_InertialSensor: added per-instance rotation for LSM9DS0
2016-11-09 17:08:00 +11:00
Andrew Tridgell
ac2572384d
AP_InertialSensor: added start() method for LSM9DS0
...
needed to get sensor ordering right on multi-sensor boards
2016-11-09 17:08:00 +11:00
Andrew Tridgell
2b66df68a1
AP_InertialSensor: use thread-per-bus for lsm303d and mpu6000
2016-11-09 17:07:56 +11:00
raspilot
1d1d224c18
AP_InertialSensor: Enable dual IMU for raspilot
2016-03-18 21:51:37 -03:00
Lucas De Marchi
f75c12f57c
AP_InertialSensor: LSM9DS0: change mode of drdy pins to input
2016-03-18 21:51:37 -03:00
raspilot
c83e4df002
AP_InertialSensor: LSM9DS0: Disable I2C at init to avoid SDA hanging by slave.
2016-03-18 21:51:37 -03:00
raspilot
557beb4bb1
AP_InertialSensor: LSM9DS0: Fixed wrong call to _register_read_xm()
2016-03-18 21:51:37 -03:00
Lucas De Marchi
d2b267d026
AP_InertialSensor: LSM9DS0: use AP_HAL::SPIDevice abstraction
2016-02-16 19:49:09 -02:00
Lucas De Marchi
c1d19fa4dc
AP_InertialSensor: LSM9DS0: sanitize whitespaces
2016-02-01 14:18:51 -02:00
Caio Marcelo de Oliveira Filho
d7601095fa
AP_InertialSensor: use millis/micros/panic functions
2015-11-20 12:31:41 +09: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
Lucas De Marchi
20c6ffc5e3
Replace use of UARTDriver::printf_P() with UARTDriver::printf()
...
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi
6f4904189b
Replace use of println_P() with println()
2015-10-30 14:35:22 +09:00
Lucas De Marchi
2c38e31c93
Remove use of PSTR
...
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.
This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.
AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Gustavo Jose de Sousa
dfd671c54e
AP_InertialSensor: Backend: add hook for new gyro sample arrival
...
That hook will do common tasks for when new gyro raw sample is available.
2015-10-22 16:53:10 +11:00
Gustavo Jose de Sousa
e06627dfcb
AP_InertialSensor: Backend: add hook for new raw accel samples
...
That hook will eventually do necessary things when a new accelerometer raw
sample arrives (like calculating vibration levels).
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa
ac3a677626
AP_InertialSensor: remove param rotate_and_correct from publish functions
...
Once that parameter is always false.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa
f946f48dce
AP_InertialSensor: LSM9DS0: apply correction on each new sample
...
These changes are for enabling unified accelerometer vibration and clipping
calculation. For that, we need the values "rotated and corrected" before they
are filtered and the calculation must be called as soon as a new sample arrives
as it takes the sample rate into account.
Thus, move code that applies "corrections" to be executed as soon as accel data
arrive and call _publish_accel() passing rotate_and_correct parameter as false.
Also, do the same for gyro so we can keep it consistent.
2015-09-07 11:14:41 +10:00