Commit Graph

104 Commits

Author SHA1 Message Date
Andrew Tridgell 3d7d46b9b0 AP_InertialSensor: replaced INS_MPU6K_FILTER with INS_ACCEL_FILTER and INS_GYRO_FILTER
this allows filtering to be set separately on accels and gyros where possible
2015-03-12 12:50:31 +11:00
Jonathan Challinger 155c173ed1 AP_InertialSensor: rename _rotate_and_offset to _publish 2015-03-12 12:50:27 +11:00
Jonathan Challinger 502446d821 AP_InertialSensor: use LowPassFilter2pVector3f 2015-03-12 12:50:27 +11:00
Andrew Tridgell 9dfbdb1e69 AP_InertialSensor: run the MPU6000 at 1kHz on fast CPUs
use a software filter and 1kHz sampling for better filtering if we
have a fast enough CPU to do it
2014-10-24 12:10:40 +11:00
Andrew Tridgell a047d1f569 AP_InertialSensor: moved default filter and sample_rate to frontend
this simplifies the backends and prevents code repitition
2014-10-24 12:10:40 +11:00
Andrew Tridgell 3a9a5a9c18 AP_InertialSensor: implement gyro and accel health monitoring
sensor is healthy if it gave a sample on the last update()
2014-10-24 12:10:39 +11:00
Andrew Tridgell 586fa9a816 AP_InertialSensor: added product_id support
fill in parameter from first backend
2014-10-24 12:10:39 +11:00
Andrew Tridgell 3ce7667e5a AP_InertialSensor: tidy up MPU6000 driver 2014-10-24 12:10:37 +11:00
Andrew Tridgell d48beb0c0f AP_InertialSensor: converted PX4 driver to new API 2014-10-24 12:10:37 +11:00
Andrew Tridgell 448efc70a3 AP_InertialSensor: first steps in frontend/backend split
This converts the MPU6000 driver to a frontend/backend structure, and
disables all other drivers. They will be progressively re-enabled as
each is converted
2014-10-24 12:10:36 +11:00
Randy Mackay a09f7b9198 AP_InertialSensor_MPU6k: init members to reduce compiler warnings 2014-07-16 14:40:55 +09:00
Andrew Tridgell abb53eb9a2 AP_InertialSensor: simplify using HAL board subtypes 2014-07-14 09:44:35 +10:00
Andrew Tridgell 3ed4f82cb0 AP_InertialSensor: fixed DRDY include for Linux 2014-07-14 09:44:33 +10:00
Andrew Tridgell 06b6d7aaf0 AP_InertialSensor: fixeup DRDY pin for different boards 2014-07-14 09:44:33 +10:00
Víctor Mayoral Vilches 3379ddd51f AP_InertialSensor_MPU6000: Add _register_write_check method.
This private method allows to check whether the value written and
the posterior value readed are the same.
Should be used only for debuging purposes, for release versions use
_register_write instead.
2014-07-14 09:44:33 +10:00
Víctor Mayoral Vilches ad3a3f9366 AP_InertialSensor_MPU6000: Fix the CS. 2014-07-14 09:29:45 +10:00
Víctor Mayoral Vilches d9cb29ea8b AP_InertialSensor_MPU6000: Correct DRDY pin. 2014-07-14 09:29:18 +10:00
Andrew Tridgell ece01da10e AP_InertialSensor: fixed _dump_registers() for MPU6000
need to take the semaphore to prevent bus errors
2014-06-29 12:11:21 +10:00
Andrew Tridgell b1c5f23bbd AP_InertialSensor: make get_delta_time() const
allows use from AP_NavEKF
2014-02-15 05:29:47 +11:00
Andrew Tridgell a0688a69d4 AP_InertialSensor: generalise the accel/gyro calibration for N sensors 2013-12-09 17:34:06 +11:00
Andrew Tridgell 2753449e75 AP_InertialSensor: added support for multiple accel/gyro devices
this makes it possible to ask for the gyro and accel vectors from
secondary INS devices.
2013-12-09 17:34:05 +11:00
Andrew Tridgell 80def01fbe AP_InertialSensor: fixed semaphore error on startup for MPU6000 2013-11-09 11:26:50 +11:00
Andrew Tridgell f5299e2e11 AP_InertialSensor: added healthy check for PX4 and HIL
used to detect bad accels
2013-11-07 13:53:59 +11:00
Andrew Tridgell 9ecd889e9d AP_InertialSensor: detect bad MPU6000 SPI transactions and lower bus speed
this uses bad data or bad INT_STATUS values from the MPU6000 to detect
the sensor running too fast and lower bus speed
2013-11-07 12:48:17 +11:00
Andrew Tridgell b98bcbf715 AP_InertialSensor: automatically lower bus speed on mpu6k bad reads 2013-11-07 12:48:16 +11:00
Andrew Tridgell bdc40cc7df AP_InertialSensor: try to lower SPI bus speed on errors 2013-11-07 12:48:16 +11:00
Andrew Tridgell 9833900f91 AP_InertialSensor: run MPU6000 sensor register reads at 8MHz
run other register IO at 500kHz
2013-10-13 11:03:08 +09:00
Andrew Tridgell e5e4cdee18 AP_InertialSensor: added wait_for_sample() API call
this waits for a new INS sample to arrive, using whatever method is
most efficient on each INS type
2013-10-08 17:31:15 +11:00
Andrew Tridgell dda68bddcb AP_InertialSensor: updates for AP_HAL::MemberProc 2013-09-30 21:06:42 +10:00
Andrew Tridgell 03036c632d AP_InertialSensor: use new scheduler API 2013-09-28 21:24:03 +10:00
Randy Mackay f7ba0438ef InertialSensor: remove DMP
this saves 3K of flash
2013-09-27 10:43:33 +09:00
Andrew Tridgell 14636e1cdf AP_InertialSensor: changed num_samples_available() to sample_available()
this makes the interface clearer. It also fixes a 3D accel cal bug.
2013-09-27 10:49:00 +10:00
Andrew Tridgell 1ec5cbed81 AP_InertialSensor: removed SMACCM support 2013-09-26 22:38:31 +10:00
Andrew Tridgell 770b7b5901 AP_InertialSensor: prevent a lockup in MPU6000 driver
thanks to the VRBrain port for noticing this bug.

Failing to get the semaphore is an expected error with the MPU6000, as
we read data both from timer context and mainline code. That means
semaphore conflicts are inevitable. We shouldn't consider them an
error, and shouldn't panic when some arbitrary number of them have
happened since boot.

Instead the wait_for_sample() code checks that we receive new data at
least every 50ms. That is a much safer test.
2013-09-23 22:48:36 +10:00
Andrew Tridgell 76e20150e9 AP_InertialSensor: ensure parent class is initialised in instance classes 2013-04-12 14:30:35 +10:00
Randy Mackay af13f6795c INS: switch to global definition of GRAVITY_MSS
saves 4 bytes of RAM
2013-04-05 22:57:46 +09:00
Randy Mackay 318a831b57 INS: set default filter to 20hz for APM2.x and PX4 2013-03-01 19:35:34 +09:00
Andrew Tridgell a63275d284 AP_InertialSensor: expand register range in MPU6000 _dump_registers() 2013-02-13 19:33:40 +11:00
Andrew Tridgell 7b1245937c AP_InertialSensor: always sample at 200Hz in MPU6000
this changes the sampling to 200Hz regardless of requested rate, and
it is downsampled inside num_samples_available() using a shift. This
gives better noise resistance in ArduPlane.

This patch also makes it possible to update the filter frequency while
running, which is very useful for bench testing with a vibration
source
2013-02-07 10:23:08 +11:00
Randy Mackay bad81a5113 AP_InertialSensor_MPU6k: remove unnecessary check of sign when receiving fifo packet from dmp 2013-01-27 11:22:39 +09:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell d7996acdf7 AP_InertialSensor: added set_board_orientation() method 2013-01-13 17:32:48 +11:00
Andrew Tridgell 6142eac4b4 AP_InertialSensor: simplify get_delta_time() API
use a single float return rather than two APIs.

This also changes the MPU6k driver to match the new 2.9 behaviour of
using the MPU6k sample timing instead of micros()
2013-01-11 21:17:21 +11:00
Pat Hickey 910e09fc96 AP_InertialSensor_MPU6000: fix sync/async semaphore usage with new scheduler 2013-01-10 14:12:19 -08:00
James Bielman 8e38ef6567 MPU6000: Flip Y and Z axes for SMACCM_HAL.
- The accelerometer is upside-down on the PX4FMU vs the APM2.
2013-01-09 11:19:51 -08:00
James Bielman 1309b7332a MPU6000: Use signed addition when accumulating readings.
- Fixes very erratic accel readings on the PX4 board.
2013-01-09 11:19:51 -08:00
Andrew Tridgell f48790a56e AP_InertialSensor: poll for new data in num_samples_available()
this lowers the latency for new data
2013-01-09 20:31:09 +11:00
Andrew Tridgell 4ab1cddd15 AP_InertialSensor: ensure we always have the SPI semaphore for MPU6k 2013-01-09 20:30:20 +11:00
Andrew Tridgell b39166b71a MPU6000: fixed minor timing bug
if we miss a sample due to SPI contention we shouldn't update last
sample time
2013-01-07 11:07:29 +11:00
James Bielman d84ba8ef59 Use HAL suspend/resume timer procs rather than atomic.
- Preparation for removing begin/end atomic.
2013-01-03 17:33:13 -08:00