Commit Graph

122 Commits

Author SHA1 Message Date
Lucas De Marchi 2c44f3e313 AP_HAL_InertialSensor: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-18 17:12:52 +10:00
Gustavo Jose de Sousa 7789aec85b AP_InertialSensor: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:43 +10:00
Lucas De Marchi cf1273668e AP_InertialSensor: refactor constructors to avoid leak
We were previously leaking the AP_MPU6000_BusDriver if the
~AP_InertialSensor_MPU6000::detect*() failed. In order to avoid the
leak move the repeated code in a single private _detect() member that
receives everything as argument. Then this method takes ownership of the
objects.

By a adding a destructor to AP_InertialSensor_MPU6000 it becomes easier to
free the objects it takes ownership of.
2015-08-08 14:12:22 +10:00
Lucas De Marchi c3063f0ab2 AP_InertialSensor: MPU6000: be agnostic to I2C bus/address
This decision is better made by the caller rather than polluting the
driver with board-specific details.
2015-08-08 14:12:22 +10:00
Lucas De Marchi f3f54157be AP_InertialSensor: fix copying wrong number of bytes
We should copy only the bytes we read, not the maximum number.
2015-08-08 14:12:21 +10:00
Lucas De Marchi 209e1924a5 AP_InertialSensor: fix whitespace usage 2015-08-08 14:12:21 +10:00
Andrew Tridgell 212898d02b AP_InertialSensor: don't use INT_STATUS drdy to lower SPI bus speed
as pointed out by Lucas in PR#2604 this is probably a bad idea
2015-07-30 14:05:20 +10:00
Grant Morphett e2eda97ec6 AP_InertialSensor: fix coverity warnings - param init in construct 2015-07-30 12:37:08 +10:00
Tom Pittenger 01161135d6 AP_InitialSensor_MPU6000: compiler warning - init order 2015-07-27 10:30:17 +09:00
Andrew Tridgell 6df33dd3f4 AP_InertialSensor: fixed MPU6000_SPI bus initialisation
we need _spi for get_semaphore()
2015-07-10 16:46:30 +10:00
Julien BERAUD 3cf952d1f8 AP_InertialSensor: add fifo support for MPU6000
And remove the use of data rdy in this case
2015-07-10 14:24:09 +10:00
Julien BERAUD 8a76ff53bd AP_InertialSensor: add i2c bus driver for MPU6050 2015-07-10 14:24:09 +10:00
Julien BERAUD 1679728730 AP_InertialSensor: Configure SPI as a generic bus for MPU6000
Add the possibility to implement an i2c bus communication for the
MPU6050 on parrot bebop
2015-07-10 14:24:09 +10:00
Andrew Tridgell 4eab27abe9 AP_InertialSensor: fixed logic bug in MPU6000 init
thanks to coverity
2015-06-20 14:53:04 +10:00
Lucas De Marchi 3aa46e3213 AP_InertialSensor: use functor macros
Functor is not yet being used but let's make is macro fallback to the
previous Delegate implementation for easy of transition between the two.
2015-05-26 13:46:53 +10:00
Andrew Tridgell 089e63f987 AP_InertialSensor: fixed PSTR handling
must use PSTR on code compiled for AVR
2015-05-05 13:54:00 +10:00
Tom Pittenger 0e076d6dc8 AP_InertialSensor: compile warnings: format not a string literal, argument types not checked
PSTR() goofs things up when using hal.console->printf_P()
2015-05-05 13:27:02 +10:00
ahcorde 103bb2a08d AP_InertialSensor: Fix orientation MPU6000 PXF 2015-03-16 09:50:51 +11:00
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