Commit Graph

799 Commits

Author SHA1 Message Date
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
Randy Mackay 69bfeaf58e INS: accel offset parameter range desc to 3.5m/s/s 2015-08-10 10:30:34 -07: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 4d4dac867e AP_InertialSensor: pass backend instead of pointer to function
Different detect() function might need different arguments and passing a
pointer to function here is cumbersome. For example, it forces to have a
method like "detect_i2c2" rather than allowing hal.i2c2 to be passed as
parameter.
2015-08-08 14:12:22 +10:00
Gustavo Jose de Sousa d3eebdb6aa AP_InertialSensor: L3G4200D: add probe code
This driver works properly but had the initialization logic missing. Add
the support to probe it.
2015-08-08 14:12:22 +10:00
Lucas De Marchi 55279664c2 AP_InertialSensor: remove out of place ifdef
AP_InertialSensor isn't a good place to comment about board issues.
2015-08-08 14:12:21 +10:00
Lucas De Marchi 2e76d998df AP_InertialSensor: remove unused enum bus_speed
The methods actually use the enum from AP_HAL::SPIDeviceDriver, so don't
declare a new one. The I2C implementation is empty; if we actually start
to use it we'd better move the bus abstraction to HAL.
2015-08-08 14:12:21 +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
Lucas De Marchi 3851862f60 AP_InertialSensor: remove unused drivers
Nobody is using these drivers, they need to be rewritten using the
backend logic and give the false impression they are supported.
2015-08-07 20:57:49 +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
Lucas De Marchi eda4879f3f AP_InertialSensor: use ARRAY_SIZE macro 2015-07-21 14:25:07 +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
Lucas De Marchi efec7723ff AP_InertialSensor: reset the MPU9250 chip on startup
Now that the initialization of MPU9250 is shared between the
AP_InertialSensor and other drivers using it as a backend, we can reset
the MPU9250 in order to put it in a known state.
2015-07-06 10:48:07 +10:00
Lucas De Marchi eb4e2ac2e5 AP_InertialSensor: factor out MPU9250 initialization
Now we have the initialization code split in 2 parts:

1) Making sure the MPU9250 chip is alive and working: this is now in a
static function that may be called by other drivers that use MPU9250 as
backend.

2) The configuration of gyro and accel. Once the first part is completed
successfully the AP_InertialSensor_MPU9250 finishes the configuration of
the sensors it uses.

The only change in behavior here is that before we would try 25 time (5x
inside _hardware_init time 5x inside _init_sensor() that calls the first
function) to "boot the chip" and now we are doing "only" 5.
2015-07-06 10:48:07 +10:00
Lucas De Marchi 953bfbd3fe AP_InertialSensor: provide static methods for spi transactions
Add static methods to do the SPI transactions and provide the wrapper
methods when we have an instance of the object. This is useful so these
methods can be called from other contexts when the AP_InertialSensor
hasn't been initialized yet.
2015-07-06 10:48:07 +10:00
mirkix f82344358f AP_InertialSensor: Change BBBMINI standard orientation 2015-07-06 10:12:39 +10:00
Staroselskii Georgii d40b45c9ae AP_InertialSensor: disable reset on MPU9250
The Compass library is initialized before the InertialSensor. AK8963 with
MPU9250 as backend already takes care of resetting MPU9250. The problem with
also resetting it in the MPU9250 initialization code is that if the reset
happens during an internal I2C transaction, the AK8963 may hang. So here we
remove the reset inside MPU9250. There still a possibility that the first
MPU9250 initialization is not successful and it resets the chip, but it's not
happening in tests.
2015-07-01 20:44:09 +03:00
Andrew Tridgell ac3200fd32 AP_InertialSensor: make max_abs_offsets a single float, not a vector 2015-06-30 10:51:43 +10:00
Gustavo Jose de Sousa 0fcd98c804 AP_InertialSensor: disable debug on LSM9DS0 2015-06-30 10:28:05 +10:00
Gustavo Jose de Sousa c168e19e73 AP_InertialSensor: fix coding style with uncrustify on LSM9DS0
This commit makes backend source code for LSM9DS0 comply with the configuration
files "uncrustify_cpp.cfg" and "uncrustify_headers.cfg".
2015-06-30 10:28:02 +10:00
Gustavo Jose de Sousa 2f2a627002 AP_InertialSensor: use runtime GPIO drdy pins numbers instead C constant macros
As we intend to eventually get board related parameters from a configuration
file, this commit makes the GPIO numbers for data-ready pins be instance
variables instead of from C constant macros.

Another advantage of using instance variables in this context is the
possibility of using more than one LSM9DS0.
2015-06-30 10:27:59 +10:00
Gustavo Jose de Sousa 0ef914adac AP_InertialSensor: don't take SPI semaphore if not necessary on LSM9DS0
If the data-ready polling is done entirely on GPIO pins, it isn't necessary to
hold the semaphore before we now we have data to consume. In that case, only
take the SPI semaphore if there's new data available.

On the other hand, if at least one SPI transaction is done in order to check
for new data, then it makes sense to take the semaphore beforehand.
2015-06-30 10:27:57 +10:00
Gustavo Jose de Sousa a82ab25ed3 AP_InertialSensor: use bitfield macros instead of literal values on LSM9DS0
This commit makes accel and gyro initialization routines use bitfield macros
instead of hardcoding the literal value when wrinting on registers. That is
less prone to typos and a lot of times self-explanatory. Also, due to the
latter, the long comments explaining each register field were removed (any
detail can be checked on the datasheet).
2015-06-30 10:27:54 +10:00
Gustavo Jose de Sousa 1572324315 AP_InertialSensor: add macros for LSM9DS0 registers' bitfields 2015-06-30 10:27:51 +10:00
Gustavo Jose de Sousa 033409c629 AP_InertialSensor: set max abs calibration offset for LSM9DS0 2015-06-30 10:27:48 +10:00
Gustavo Jose de Sousa 42eb73a1d1 AP_InertialSensor: add LSM9DS0 backend
This adds the backend driver for LSM9DS0. This implementation is based on the
legacy driver coded by Víctor Mayoral Vilches (under folder LSM9DS0) and makes
some necessary adaptations and fixes in order to work properly. The legacy
driver folder was removed.
2015-06-30 10:27:46 +10:00
Gustavo Jose de Sousa c340e072f2 AP_InertialSensor: use accel instance max abs offset instead of a constant value
The calibration on LSM9DS0 was giving offsets between 4.0 and 4.2 on x-axis and
around 3.6 on y-axis. It turned out that those offsets were actually right.

The maximum absolute values of calibration offset should be a sensor
characteristic rather than a constant value for all sensors.

The constant value previously used (3.5 m/s/s for all axes) is set here as a
default maximum absolute calibration offset for every instance to keep it
working.
2015-06-30 10:27:44 +10:00
Gustavo Jose de Sousa c72dc9bd45 AP_InertialSensor: make single rotation on MPU9250
The previous implementation made some boards apply two rotations to suit
their default orientation. That was happening because there was an
unconditional rotation being done (commented as "rotate for bbone
default").

This commit makes that unconditional rotation as a default rotation
instead and adjusts the former additional rotations to be single
rotations.
2015-06-22 17:45:20 +10:00
Gustavo Jose de Sousa 3dad768e8b AP_InertialSensor: log failure to initialize after max attempts on MPU9250
This happens for example when you are trying to use an SPI speed that's
above the one supported by the sensor or the controller.
2015-06-22 17:45:20 +10:00
Gustavo Jose de Sousa 587471ab54 AP_InertialSensor: disable I2C on MPU9250
As the datasheet says: "To prevent switching into I2C mode when using
SPI, the I2C interface should be disabled by setting the I2C_IF_DIS
configuration bit."

We also reset the sensor like PX4Firmware does for initializing the
MPU6000.  See: ee1d8cd770/src/drivers/mpu6000/mpu6000.cpp (L695)
2015-06-22 17:45:20 +10:00
Andrew Tridgell 4eab27abe9 AP_InertialSensor: fixed logic bug in MPU6000 init
thanks to coverity
2015-06-20 14:53:04 +10:00
mirkix 588a16dec2 AP_InertialSensor: Add Linux support for VibTest example 2015-06-18 08:48:23 +10:00
Andrew Tridgell 4fe092fead AP_InertialSensor: panic on bad gyro or accel sample rates 2015-06-17 15:01:23 +10:00
Andrew Tridgell d3b85eb792 AP_InertialSensor: use driver supplied sample rate
this will work with a wider range of sensors
2015-06-17 14:44:19 +10:00
Andrew Tridgell e91bfdfc1c AP_InertialSensor: fixed VibTest example build 2015-06-17 14:15:58 +10:00
Andrew Tridgell bc0ae630a1 AP_InertialSensor: always provide delta_velocity and delta_angles
this makes the NavEKF code simpler
2015-06-17 13:10:26 +10:00
Andrew Tridgell f831c16238 AP_InertialSensor: use fixed sensor sample times
this uses fixed sample times for PX4 IMUs, rather than reported
timestamps. It avoids timing jitter caused by the over-sampling in
the PX4 drivers
2015-06-17 13:03:56 +10:00
Randy Mackay 9d81856580 InertialSensor: fix name of get_delta_velocity method 2015-06-17 12:46:54 +10:00
Andrew Tridgell 727be87d84 AP_InertialSensor: support HIL functions for delta_velocity and delta_angles 2015-06-16 09:53:55 +10:00
Randy Mackay 8ceccd778d InertialSensor: disable vibration checks on APM2
Also bug fix get_accel_clip_count's instance check
2015-06-12 21:36:56 +09:00
Randy Mackay 0db7acc628 InertialSensor: calc vibration and accel clipping 2015-06-12 21:36:22 +09:00
Andrew Tridgell 214b61bfc0 AP_InertialSensor: fixed example build 2015-06-01 17:35:15 +10:00
Andrew Tridgell 7f7113c1de AP_InertialSensor: convert example from .pde to .cpp 2015-06-01 17:07:04 +10:00
Andrew Tridgell 6a2c585632 AP_InertialSensor: fixed build warnings 2015-05-30 22:51:19 +10:00
Peter Barker 8be9e99fad AP_InertialSensor_PX4: 64-bit timestamps for ACCx and GYRx messages 2015-05-27 11:54:17 +10:00
Peter Barker f489f6b696 AP_InertialSensor: use 64-bit timestamps in dataflash logs 2015-05-27 11:54:17 +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 aaa35bd1ec AP_InertialSensor: using atan2f() gives more accurate euler corrections
thanks to Jon and Paul!
2015-05-16 08:19:18 +10:00
Andrew Tridgell 9e723ef907 AP_InertialSensor: added calibrate_trim() function
used for redoing trim calculation
2015-05-16 07:56:34 +10:00
Andrew Tridgell b564ba0868 AP_InertialSensor: fixed AHRS_TRIM calculation again 2015-05-16 07:56:33 +10:00
Jonathan Challinger 159599879f AP_InertialSensor: simplify and correct AHRS_TRIM computation 2015-05-15 21:03:03 +10:00
Randy Mackay 3f8b832075 InertialSensor: fix example sketch 2015-05-13 10:13:51 +09:00
Randy Mackay 1f14eec4ea InertialSensor: accel_calibrated_all_ok replaces calibrated
This checks that the current number of accelerometers matches the number
of calibrated accels in order to catch accel failures at boot
2015-05-12 16:32:16 +09:00
Andrew Tridgell 8bf2baef70 AP_InertialSensor: fixed primary accel/gyro in replay 2015-05-11 11:19:11 +10:00
Andrew Tridgell afc9812d0b AP_InertialSensor: update VibTest after moving messages info DataFlash 2015-05-07 13:25:37 +10:00
Andrew Tridgell 7d90033a36 AP_InertialSensor: support raw accel and gyro dataflash logging 2015-05-07 12:08:30 +10:00
Andrew Tridgell f5140e25b0 AP_InertialSensor: updated VibTest for latest PX4 interfaces 2015-05-07 10:51:52 +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
Andrew Tridgell 31693e332e AP_InertialSensor: use non-PSTR printf
this is not built on AVR
2015-05-05 13:48:34 +10:00
Andrew Tridgell e6a8a6da07 AP_InertialSensor: revert AP_Math class change 2015-05-05 13:27:06 +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
Tom Pittenger 9e98c68099 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:01 +10:00
Tom Pittenger 820199635b AP_InertialSensors: compiler warnings: apply is_zero(float) or is_equal(float) 2015-05-05 13:26:51 +10:00
Tom Pittenger 3cb2221315 AP_IntertialSensor: double to float warning 2015-05-05 13:26:50 +10:00
Andrew Tridgell ef527d9daa AP_InertialSensor: fix for HAL_SITL rename 2015-05-05 09:45:55 +10:00
Randy Mackay 6773c0b232 AP_InertialSensor: default primary accel and gyro 2015-05-01 16:37:33 +09:00
Jonathan Challinger bb88a4f8fe AP_InertialSensor: healthy() checks bounds 2015-05-01 16:37:15 +09:00
Jonathan Challinger af80f20a51 AP_InertialSensor: add get_primary_gyro, fix get_primary_accel 2015-05-01 16:37:14 +09:00
Andrew Tridgell 007b01533d AP_InertialSensor: switched to 16g accel range for MPU9250
this matches the Pixhawk, and makes us less prone to vibration. We
have seen clipping at 8g
2015-04-28 15:30:29 +10:00
Tom Pittenger a4b8575432 InertialSensor: fix compile warnings re float constants 2015-04-24 14:03:49 +09:00
mirkix 13ee34c58a AP_InertialSensor: MPU9150 fix compiler warnings 2015-04-14 11:14:48 +10:00
Lucas De Marchi b292873304 AP_InertialSensor: fix starvation in L3G4200D
The main thread would always be blocked on the semaphore to read the
data from accelerometer and gyroscope. Especially if we have a slow
update of these values in _accumulate() due to the I2C transfer function
taking too much time: the timer thread would never give up the CPU,
causing starvation on the main thread.

This fixes the issue by reducing the critical region using a flip-buffer
so _accumulate() can work on its own copy of the data. Now that the
critical region is smaller, also avoid the semaphore and use a spinlock
instead.
2015-04-14 10:01:47 +10:00
Andrew Tridgell 45e016ea5b AP_InertialSensor: check for zero delta_velocity dt 2015-04-03 15:10:47 -07:00
Jonathan Challinger b306d7a356 AP_InertialSensor: accel cal sample for 400ms instead of 1s 2015-04-03 14:54:19 -07:00
Jonathan Challinger 1e1d8efa22 AP_InertialSensor: use expected update rate for accel cal sampling 2015-04-03 14:54:17 -07:00
Jonathan Challinger bd84328440 AP_InertialSensor: hack to "reset" the accel filter before taking a cal sample 2015-04-03 14:54:15 -07:00
Jonathan Challinger b2b42e081a AP_InertialSensor: use delta_velocity/dt for calibration if available 2015-04-03 14:54:10 -07:00
Jonathan Challinger 423160eaf8 AP_InertialSensor: publish delta_velocity_dt 2015-04-03 14:54:06 -07:00
Andrew Tridgell 4147825b87 AP_InertialSensor: fixed gyro calibration bug
we must not update _gyro_offset[] until we have completed calibration
of that gyro, or we will end up using the new offsets when asking for
the raw gyro vector
2015-04-03 06:57:30 -07:00
Andrew Tridgell 23272e4013 AP_InertialSensor: added get_temperature() interface
this will allow logging of individual temperature sensors
2015-03-17 13:32:54 +11:00
ahcorde 103bb2a08d AP_InertialSensor: Fix orientation MPU6000 PXF 2015-03-16 09:50:51 +11:00
Andrew Tridgell cf2445dc97 AP_InertialSensor: prevent nested accelerometer calibration 2015-03-15 15:22:59 +11:00
Andrew Tridgell 8a99cab535 AP_InertialSensor: load only HIL backend for hil_mode 2015-03-13 22:52:55 +11:00
Andrew Tridgell 520c7c1306 AP_InertialSensor: always allow for AK8963 on MPU9250 2015-03-13 18:46:17 +11:00
Andrew Tridgell 60b8736cf1 AP_InertialSensor: use right AK8963 compass defines 2015-03-13 18:46:15 +11:00
Andrew Tridgell 808c33d0a7 AP_InertialSensor: support both MPU9250 and MPU9255
seems to be just different WHOAMI register
2015-03-13 13:26:49 +11:00
Andrew Tridgell 07fd31c724 AP_InertialSensor: change copter filters to 20Hz
with the backend filters disabled 20Hz is closer to the old default of
30Hz
2015-03-12 13:11:17 +11:00
Andrew Tridgell a1d43e39e0 AP_InertialSensor: added get_gyro_filter_hz() and get_accel_filter_hz() 2015-03-12 12:50:31 +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
Andrew Tridgell f3314791f2 AP_InertialSensor: removed INS_CALSENSFRAME
it is no longer needed as we have shifted the accel cal indexes
2015-03-12 12:50:31 +11:00
Andrew Tridgell 4bc6c8e655 AP_InertialSensor: shift to new parameter indexes for accel calibration
this allows for users to switch between development trees and previous
stable versions while retaining their accel calibration values.
2015-03-12 12:50:30 +11:00
Andrew Tridgell 5d0eb49114 AP_InertialSensor: calculate queue depth based on requested sample rate
this auto-scales the queue depth for plane, rover and copter
2015-03-12 12:50:30 +11:00
Andrew Tridgell ea49d1cd39 AP_InertialSensor: removed unused variable 2015-03-12 12:50:30 +11:00
Andrew Tridgell e6a4b9f68c AP_InertialSensor: check accel health during accel cal 2015-03-12 12:50:29 +11:00
Andrew Tridgell 875339f12a AP_InertialSensor: try to avoid a compiler fault in travis 2015-03-12 12:50:29 +11:00
Andrew Tridgell 786172aa4e AP_InertialSensor: removed 1D accel calibration
it is finally time to move on from this. We want to push people
towards better calibration and removing the 1D accel cal is the first
step
2015-03-12 12:50:28 +11:00
Andrew Tridgell a975520033 AP_InertialSensor: check range of accels in 3D calibration
during 3D accel cal it is possible to get data which passes the sphere
fit but which has very poor coverage and does not provide sufficient
data for a good result. This checks that each axis covers a range of
at least 12 m/s/s in body frame
2015-03-12 12:50:28 +11:00
Andrew Tridgell a8a8628515 AP_InertialSensor: added INS_CALSENSFRAME parameter
this allows us to detect if accel calibration was done in sensor frame
or not. If it was done in sensor frame then the accel calibration is
independent of AHRS_ORIENTATION, which makes it easier to move a board
to a new airframe without having to recalibrate.
2015-03-12 12:50:28 +11:00
Jonathan Challinger bc655ff0cc AP_InertialSensor_PX4: add optional debug 2015-03-12 12:50:28 +11:00
Jonathan Challinger 074ee49cd0 AP_InertialSensor_PX4: interleave accel and gyro samples by time 2015-03-12 12:50:28 +11:00
Jonathan Challinger addf80b669 AP_InertialSensor_PX4: explicitly configure sensors, publish deltas 2015-03-12 12:50:27 +11:00
Jonathan Challinger b5131b7b64 AP_InertialSensor: add coning.py example 2015-03-12 12:50:27 +11:00
Jonathan Challinger 2a547f329b AP_InertialSensor: allow backends to publish delta velocities and angles 2015-03-12 12:50:27 +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
Randy Mackay 5f26a36060 INS: protect against two calibrations running at the same time 2015-03-09 17:58:38 +11:00
Randy Mackay f9c6e35d19 INS: add calibrating method 2015-03-09 17:58:38 +11:00
Randy Mackay b0e7990c90 INS: set gyro_cal_ok only after completing calibration 2015-03-09 17:58:37 +11:00
Andrew Tridgell aec7907571 AP_InertialSensor: updated comment on accel check in gyro cal 2015-03-09 17:58:36 +11:00
Andrew Tridgell 494e909703 AP_InertialSensor: ensure accel cal completion messages get through 2015-03-09 07:36:50 +11:00
Andrew Tridgell 38bde56523 AP_InertialSensor: continue finding best gyro after convergence
with multiple gyros if we are still calibrating one of the gyros then
keep looking for better values for the already converged gyros.
2015-03-08 07:49:38 +11:00
Andrew Tridgell 20a4c98bac AP_InertialSensor: use accelerometers to prevent bad gyro cal
if the board is rotating at a steady rate we can end up with a bad
gyro calibration. This can happen on a steadily moving platform such
as a ship.

This uses the accelerometers to detect the steady movement and not
accept the gyro calibration
2015-03-08 07:48:16 +11:00
Andrew Tridgell 434d094993 AP_InertialSensor: allow MAVLink packets to flow during accelcal
this uses the snoop functionality of GCS_MAVLink to allow the delay
callback to be used during accel calibration
2015-03-07 21:56:39 +11:00
Randy Mackay b650d39786 InertialSensor: remove product_id set to zero 2015-02-21 09:14:33 +09:00
Andrew Tridgell 9b2d44d6ed AP_InertialSensor: use delay_microseconds_boost()
this gives much more consistent timing for PX4
2015-02-16 12:19:13 +11:00
Andrew Tridgell f54d799bff AP_InertialSensor: added TIMING_DEBUG code for finding loop timing issues 2015-02-16 10:12:10 +11:00
Andrew Tridgell 04bef5ccf3 AP_InertialSensor: don't skip delay if we are a bit early
this produces a bit more even timing
2015-02-14 12:25:44 +11:00
Andrew Tridgell 4537acb898 AP_InertialSensor: change for new PX4 device paths 2015-02-14 12:25:43 +11:00
mirkix 460b434708 AP_InertialSensor: add apm1 oilpan support 2015-02-11 18:22:44 +11:00
Grant Morphett b511410b48 AP_InertialSensor: Changes to fix the warnings in rover sitl build.
We are starting the process of resolving all the warnings in the
ardupilot builds of all vehicles and platforms.
2015-02-11 18:16:45 +11:00
Emile Castelnuovo dae32984f1 AP_InertialSensor: use PX4 library for VRBRAIN boards. 2015-02-02 08:43:59 +11:00
Emile Castelnuovo 731329fc55 AP_InertialSensor: correction to AP_InertialSensor_VRBRAIN 2015-02-02 08:43:58 +11:00
LukeMike 6a93148b92 AP_InertialSensor: added library for VRBRAIN Inertial Sensor 2015-02-02 08:43:58 +11:00
Andrew Tridgell 6e62e1ca7b AP_InertialSensor: make calibrated() const 2015-02-01 14:13:54 +11:00
Randy Mackay b43dc3bdfb INS: fix example sketch 2015-01-28 17:15:42 +09:00
Andrew Tridgell 8b59c72eb9 AP_InertialSensor: cope with 2 IMUs in SITL 2015-01-20 19:47:45 +11:00
Andrew Tridgell b3ce56d34d AP_InertialSensor: fixed 2nd IMU in Replay
this makes for much more accurate replay runs
2015-01-20 09:20:47 +11:00
mirkix fa950a735e AP_InertialSensor: add support for BBBMINI, simple ArduPilot DIY Cape for the BeagleBone Black 2015-01-12 21:36:40 +13:00
Andrew Tridgell 1b3c3c754d AP_InertialSensor: use correct ifdef for AK8963 2015-01-07 11:58:05 +11:00
Staroselskii Georgii f7f9cd2173 AP_InertialSensor: prevented MPU9250 from disabling I2C slaves 2015-01-07 08:41:13 +11:00
Andrew Tridgell 745b739ab7 AP_InertialSensor: make calibrated() function fast enough to call in flight
this will be used in plane to make AHRS SYS_STATUS unhealthy if a user
tries to fly with EKF enabled without a full 3D accel cal.

Note that it doesn't rely on using AP_Param load() to detect that a
value has been set, as some users are first doing a 3D cal then later
doing a 1D cal. In that case load() was returning true and would give
a false positive
2015-01-03 14:06:42 +11:00
Andrew Tridgell 06a72839ed AP_InertialSensor: fixed error detection on secondary IMUs
the break; was preventing error detection on lsm303d/l3gd20
2015-01-01 08:55:57 +11:00
Andrew Tridgell b9adc6e466 AP_InertialSensor: prefer sensors that have zero error counts
if a sensor has failed in flight then try not to use it if another
error-free sensor is available
2014-12-29 21:19:35 +11:00
Andrew Tridgell 7bb56e50aa AP_InertialSensor: fixed example build 2014-11-28 10:40:19 +11:00
Andrew Tridgell f84f432ecf AP_InertialSensor: allow gyro calibration to take up to 30 seconds
this gives time for the user time to get their battery hatches on and
hold the model steady. 5 seconds was just far too short
2014-11-22 18:27:51 +11:00
Andrew Tridgell 7c288e020b AP_InertialSensor: fixed detection of dead IMU
if a PX4 sensor does not give new data we need to avoid calling
_rotate_and_offset_*() to avoid marking it as healthy. Otherwise if
the MPU6k dies we won't switch to the LSM303D automatically
2014-11-16 12:30:33 +11:00
Andrew Tridgell 986b7bf894 AP_InertialSensor: fixed frequency to 16 bit in LDM303D and L3GD20 drivers 2014-11-11 17:06:22 +11:00
Andrew Tridgell 3518cf5480 AP_InertialSensor: fixed default MPU9250 orientation for NavIO 2014-11-04 16:18:35 +11:00
Andrew Tridgell ad7c612334 AP_InertialSensor: fixed SITL with new HIL code 2014-10-24 15:05:44 +11:00
Andrew Tridgell aeaa3c1e04 AP_InertialSensor: fixed build for VRBrain 2014-10-24 12:10:41 +11:00
Andrew Tridgell 40e83ceb1f AP_InertialSensor: simplify next sample time calculations
this makes the calculation much clearer
2014-10-24 12:10:40 +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 17b2214798 AP_InertialSensor: make it easier to add multiple backends
use _add_backend() to add new backends on startup
2014-10-24 12:10:40 +11:00
Andrew Tridgell bc5d79118d AP_InertialSensor: updated comments 2014-10-24 12:10:39 +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 520727e5bd AP_InertialSensor: fixed example build 2014-10-24 12:10:39 +11:00
Andrew Tridgell dbcd02f2be AP_InertialSensor: converted MPU9150 driver
untested conversion
2014-10-24 12:10:38 +11:00
Andrew Tridgell ff5f791343 AP_InertialSensor: converted flymaple driver to new API 2014-10-24 12:10:38 +11:00
Andrew Tridgell a42af0f2f1 AP_InertialSensor: use common AP_InertialSensor driver for PX4 and VRBRAIN 2014-10-24 12:10:38 +11:00
Andrew Tridgell 3ce7667e5a AP_InertialSensor: tidy up MPU6000 driver 2014-10-24 12:10:37 +11:00
Andrew Tridgell 2d47a07480 AP_InertialSensor: ported L3G4200D driver to new API 2014-10-24 12:10:37 +11:00
Andrew Tridgell deafcd6ddc AP_InertialSensor: improved timing in all drivers 2014-10-24 12:10:37 +11:00
Andrew Tridgell ff6d87f145 AP_InertialSensor: minor tidy up for HIL driver 2014-10-24 12:10:37 +11:00
Andrew Tridgell 85686c22ec AP_InertialSensor: converted the APM1/Oilpan driver to new API 2014-10-24 12:10:37 +11:00
Andrew Tridgell dcef9bb3b8 AP_InertialSensor: converted the MPU9250 driver to new API 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 ec11417705 AP_InertialSensor: converted HIL backend, which gets SITL working 2014-10-24 12:10:36 +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 834f2bea07 INS: add gyro_calibrated_ok_all method
This returns true if the gyros have been calibrated successfully
2014-10-09 10:00:07 +09:00
Randy Mackay 0803d79701 INS: param descriptions for ACC2, GYR2 2014-09-27 21:05:33 +09:00
Randy Mackay 74553e523d INS: add get_accel_health_all and get_gyro_health_all
Returns true only if all available accels or gyros are healthy
2014-09-03 11:22:46 +09:00
Randy Mackay 50ae5b2519 InertialSensor: reorder .cpp file to match .h
No functional changes
2014-09-03 11:19:36 +09:00
Andrew Tridgell dcdb53584b AP_InertialSensor: use lockless structures in MPU9250 driver
this avoids suspending timers when transferring data between main
thread and SPI read thread
2014-08-22 21:13:11 +10:00
Andrew Tridgell 5c9e5fbc11 AP_InertialSensor: removed use of hrt_absolute_time() 2014-08-20 09:10:24 +10:00
Andrew Tridgell a14f8dbd0a AP_InertialSensor_MPU9250: use micros64() and millis64() 2014-08-20 08:02:34 +10:00
Andrew Tridgell 3c2ab31415 AP_InertialSensor: get rid of data_ready for MPU9250
when running off a 1kHz timer and reading at 1kHz it is better to
double sample than it is to skip a sample, as skipping samples will
throw the filter off, whereas a double sample will have minimal effect
2014-08-19 20:03:33 +10:00
Andrew Tridgell 9e01c657e5 AP_InertialSensor: update MPU9250 driver for 1kHz operation
use a time base sample wait, with 1kHz sampling
2014-08-19 20:03:33 +10:00
Andrew Tridgell 532e9aace4 AP_InertialSensor: fixed timer bug in HIL sensors 2014-08-19 20:03:33 +10:00
Andrew Tridgell 12239de00d AP_InertialSensor: fix data_ready return for L3GD20 2014-08-19 10:14:20 +10:00
Andrew Tridgell 7286e7acd2 AP_InertialSensor: fixed build errors on APM2 2014-08-19 10:08:17 +10:00
Andrew Tridgell 50068a7c6a AP_InertialSensor: fixed default orientation for PXF board MPU9250 2014-08-19 10:08:16 +10:00
Víctor Mayoral Vilches 5e5319e23b AP_InertialSensor: MPU9250 cleaning 2014-08-19 10:08:16 +10:00
Víctor Mayoral Vilches df1de4efd6 AP_InertialSensor: Driver added for the LSM303D 2014-08-19 10:08:15 +10:00
Víctor Mayoral Vilches 8968647873 AP_InertialSensor: INS_generic example, add support L3GD20 2014-08-19 10:08:15 +10:00
Víctor Mayoral Vilches 0f908a8ccd HAL_Linux: Add L3GD20 to the AP_InertialSensor header 2014-08-19 10:08:15 +10:00
Víctor Mayoral Vilches 556d46a4ef AP_InertialSensor: L3GD20 driver added
L3GD20 gyro userspace sensor added. The driver constructs
over the implementation of the PX4 Dev Team at
https://github.com/diydrones/PX4Firmware.
2014-08-19 10:08:15 +10:00
Víctor Mayoral Vilches bfacf08c30 HAL_Linux: LSM9DS0 legacy driver moved to AP_InertialSensor/LSM9DS0/
The new LSM9DS0 driver will consist of the AP_InertialSensor_L3GD20 and
the AP_InertialSensor_LSM303D. For that reason the old LSM9DS0
(consisting of gyro and accel+mag implemented on a single class) has
been moved to a folder.

Legacy LSM9DS0 didn't probe to receive "correct" data.
2014-08-19 10:08:15 +10:00
Randy Mackay 51f40fe3d6 INS: add accessor for mpu6k filter 2014-08-14 11:47:23 +09:00
Randy Mackay 0e7cbd28c8 INS_HIL: init members to resolve compiler warnings 2014-08-14 11:27:32 +09:00
Andrew Tridgell 24251a7e12 AP_InertialSensor: fixed example build 2014-08-13 21:48:35 +10:00
Andrew Tridgell 984064f3d3 AP_InertialSensor: fixed example build 2014-08-13 18:46:44 +10:00
Mikhail Avkhimenia 34da221c3d AP_InertialSensor: Use MPU9250 DRDY pin only on boards that support it 2014-08-12 22:13:00 +10:00
Andrew Tridgell f8ceccce32 AP_InertialSensor: improved HIL timing consistancy
try to keep the average time for each sample right
2014-08-09 22:50:15 +10:00
Andrew Tridgell 1d4d848300 AP_InertialSensor: fixed a build warning 2014-08-08 13:48:03 +10:00
Andrew Tridgell ed6ab5f1d3 AP_InertialSensor: use bool for blocking_read()
uint8_t return was confusing
2014-08-07 13:09:17 +10:00
Michael Carpenter b4c0e1215b AP_InertialSensor: Use return value of blocking_read to handle calibration timeouts 2014-08-07 13:04:18 +10:00
Andrew Tridgell cc735a4200 AP_InertialSensor: some more debug info for VibTest 2014-07-31 12:48:30 +10:00
Andrew Tridgell f7b01a6f3f AP_InertialSensor: avoid integer underflow in mavlink txspace check 2014-07-27 22:18:52 +10:00
Andrew Tridgell 662276597a AP_InertialSensor: fixed example build 2014-07-25 17:52:14 +10:00
Andrew Tridgell 79f453dfd3 AP_InertialSensor: use LSM9DSO_AM device 2014-07-19 13:23:54 +10:00
Randy Mackay 6baedbda1d AP_InertialSensor: add empty virtual destructor 2014-07-16 14:56:56 +09:00
Randy Mackay a09f7b9198 AP_InertialSensor_MPU6k: init members to reduce compiler warnings 2014-07-16 14:40:55 +09:00
Randy Mackay c5a03ea18e AP_InertialSensor: init members to reduce compiler warnings 2014-07-16 14:40:53 +09:00
LukeMike 85fc72c57c AP_InertialSensor: VRBRAIN added 3th inertial sensor 2014-07-15 20:42:15 +10:00
Andrew Tridgell 0f724c1d7a AP_InertialSensor: removed per-device example code
now can use a single generic test for all boards
2014-07-14 09:44:36 +10:00
Andrew Tridgell 5a170c6343 AP_InertialSensor: added INS_generic test 2014-07-14 09:44:36 +10:00
Andrew Tridgell d1ba78002d AP_InertialSensor: added paranoid check for DRDY pin 2014-07-14 09:44:36 +10:00
Andrew Tridgell 6f9965cc22 AP_InertialSensor: fixed setup of DRDY pin on MPU9250 2014-07-14 09:44:36 +10:00
Andrew Tridgell 6a6dbe5790 AP_InertialSensor: added check for WHOAMI on MPU9250 2014-07-14 09:44:35 +10:00
Andrew Tridgell abb53eb9a2 AP_InertialSensor: simplify using HAL board subtypes 2014-07-14 09:44:35 +10:00
Andrew Tridgell 848b563fc3 AP_InertialSensor: rotate acccel/gyro for PXF 2014-07-14 09:44:34 +10:00
Andrew Tridgell ea188528fc AP_InertialSensor: fixed build errors for LSM9DSO 2014-07-14 09:44:34 +10:00
Víctor Mayoral Vilches 2982fc029c AP_InertialSensor_LSM9DS0: Fix _dump_registers method 2014-07-14 09:44:34 +10:00
Víctor Mayoral Vilches feedc40f72 AP_InertialSensor_LSM9DS0: Move LSM9DS0_DEBUG flag to the header 2014-07-14 09:44:34 +10:00
Andrew Tridgell 297bb52ced AP_InertialSensor: added MPU9250 header 2014-07-14 09:44:34 +10:00
Víctor Mayoral Vilches f213f01983 AP_InertialSensor_LSM9DS0: Remove previous CS handling.
CS is now being automatically handled by the SPI Driver.
2014-07-14 09:44:33 +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 0fff8df491 AP_InertialSensor: fix LSM9DS0 test code 2014-07-14 09:32:30 +10:00
Víctor Mayoral Vilches bb5de8a6a1 AP_InertialSensor_LSM9DS0: Fix the CS. 2014-07-14 09:29:45 +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 aa60a89cda AP_InertialSensor_MPU9250: Fix SPI CS. 2014-07-14 09:29:45 +10:00
Víctor Mayoral Vilches bae84e2942 AP_InertialSensor: Add missing library to test example. 2014-07-14 09:29:36 +10:00
Víctor Mayoral Vilches 4df3b55ed4 AP_InertialSensor_MPU9250: Add missing library for example/
In order to compile the examples test a library needed to
added.
2014-07-14 09:29:36 +10:00
Víctor Mayoral Vilches eb95130441 AP_InertialSensor_MPU9250: remove legacy CS. 2014-07-14 09:29:18 +10:00
Víctor Mayoral Vilches 5e7e28a83e AP_InertialSensor_MPU9250.cpp: Update the DRDY pin. 2014-07-14 09:29:18 +10:00
Víctor Mayoral Vilches d053a91cd5 AP_InertialSensor_MPU6000: Remove MPU6000_CS_PIN
Remove MPU6000_CS_PIN, a legacy way of handling
Chip Select.
2014-07-14 09:29:18 +10:00
Víctor Mayoral Vilches d9cb29ea8b AP_InertialSensor_MPU6000: Correct DRDY pin. 2014-07-14 09:29:18 +10:00
Víctor Mayoral Vilches df14318bbd AP_InertialSensor_L3G4200D: Clock-based wait_for_sample() impl. 2014-07-14 09:29:08 +10:00
Víctor Mayoral Vilches 7cf1187473 AP_InertialSensor_MPU9150: Clock-based wait_for_sample() impl.
Adapt the I2C driver to a system clock based wait_for_sample()
implementation.

The sample rate of the sensor has been corrected to 800 Hz (could be
further pushed up to 1KHz).

Filters for the mag have also been created but remain commented until
the code for the mag is ready.
2014-07-14 09:10:23 +10:00
Víctor Mayoral Vilches c4babc543d AP_InertialSensor_LSM9DS0: SPI userspace sensor driver.
ST Microelectronics 9 DOF IMU userspace sensor driver. Some
work with the filters needs to be done.
2014-07-14 09:10:23 +10:00
Víctor Mayoral Vilches 1c07985518 AP_InertialSensor_MPU9150: Comment the suspend_timer_procs
It causes the driver to hang. This matter should be inspected.
2014-07-14 09:02:47 +10:00
Víctor Mayoral Vilches d65aefbef5 AP_InertialSensor_MPU6000: Fix the test code so that compiles. 2014-07-14 09:02:47 +10:00
Víctor Mayoral Vilches fac3d1c271 AP_InertialSensor_MPU9250: SPI userspace sensor driver.
InvenSense MPU9250 sensor driver and test code (available under
libraries/examples/).
2014-07-14 09:02:47 +10:00
Víctor Mayoral Vilches 4d79887cc5 L3G4200D: fix in the test example provided.
The test coded had a call to "wait_for_sample" that expected one
argument and 0 where provided.
2014-07-14 08:52:51 +10:00
Andrew Tridgell ab7e96b9de AP_InertialSensor: updates for ERLE board type 2014-07-14 08:51:44 +10:00
Victor Mayoral Vilches 44320708a7 AP_InertialSensor_MPU9150: I2C userspace driver sensor added.
The MPU9150 is a 9 axis sensor that includes 3 accelerometers,
3 gyroscopes and 3 magnetometers. All accessible through I2C.
The AP_InertialSensor_MPU9150 class allows APM to use this sensor.
2014-07-14 08:16:29 +10:00
Randy Mackay 7e04b5d1f1 INS: calibrated method checks all accelerometers 2014-07-13 22:05:21 +09:00
Andrew Tridgell d325f630e5 VibTest: added sample timing to console output 2014-07-09 12:12:23 +10:00
Andrew Tridgell 863e7a5f93 VibTest: fixed array bounds error 2014-07-09 08:11:52 +10:00
Andrew Tridgell 2c8240dbb4 VibTest: fixed gyro timestamps in logs
it was using the accel timestamps
2014-07-09 08:10:09 +10:00
Andrew Tridgell d50d5b8f24 VibTest: fixed sample count output on console 2014-07-08 10:59:30 +10:00
Andrew Tridgell 03770c4d34 VibTest: added gyro data and support 3 sensors
will be used for vibration testing on FMUv3
2014-07-08 10:07:58 +10:00
Andrew Tridgell ca12592448 AP_InertialSensor: allow for 3 accels and 3 gyros on Pixhawk
this supports FMUv3
2014-06-30 07:58:27 +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
LukeMike 8f552d5758 VRBRAIN: Changed the management of VirtualRobotix's boards. 2014-06-19 11:27:38 +02:00
Andrew Tridgell 4c43cd9775 AP_InertialSensor: fixes for HAL_GPIO_* 2014-06-02 10:42:35 +10:00
Andrew Tridgell 65fd25fb5a AP_InertialSensor: fixed example build 2014-05-18 08:08:19 +10:00
Andrew Tridgell 8533aecf18 AP_InertialSensor: fixed example build 2014-05-16 21:24:25 +10:00
Andrew Tridgell 086142580a AP_InertialSensor: added VibTest sketch
logs all accel data at high rate to SD card
2014-05-15 21:14:21 +10:00
Emile Castelnuovo 06744ea7d2 AP_InertialSensor: new files and definitions for VRBRAIN board 2014-04-08 16:19:19 +10:00
Andrew Tridgell 2763393908 AP_InertialSensor: fixed some compiler warnings 2014-03-24 12:52:16 +11:00
Andrew Tridgell 731f980327 AP_InertialSensor: fixed example build 2014-03-19 12:13:47 +09:00
Jonathan Challinger e81d2e9584 AP_InertialSensor: Correct out-of-bounds array access that was causing SITL to crash 2014-02-28 17:25:54 +11:00
Andrew Tridgell 2c85a7ba56 AP_InertialSensor: expose get_primary_accel() for use in AHRS 2014-02-27 16:27:46 +11:00
Andrew Tridgell 840f1b9a1e AP_InertialSensor: make HIL timing more accurate
needed for 400Hz replay
2014-02-27 08:10:42 +11:00
Andrew Tridgell 6732d6c79b AP_InertialSensor: enable get_accel_count() and get_gyro_count() APIs for HIL 2014-02-23 19:10:07 +11:00
Andrew Tridgell 0e18079c47 AP_InertialSensor: allow HIL sensors to support multiple instances
this allows log replay to test both sets of sensors on a Pixhawk log
2014-02-23 08:16:33 +11:00
Randy Mackay 33fe778cdd InertialSensor_PX4: resolve compiler warning 2014-02-21 13:53:34 +09:00
Andrew Tridgell fe0cb23733 AP_InertialSensor: fixed HIL for 400Hz INS 2014-02-19 10:29:00 +11:00
Mike McCauley 2c94a40310 AP_InertialSensor: AP_InertialSensor_Flymaple Remove unnecessary
comment
2014-02-17 05:56:37 +11:00
Mike McCauley dd6abb49a9 AP_InertialSensor: AP_InertialSensor_Flymaple::healthy() was required after
all.
2014-02-17 05:56:37 +11:00
Mike McCauley 0a43cf8c5c AP_InertialSensor: AP_InertialSensor_Flymaple removed redundant definition of
healthy().
2014-02-17 05:56:37 +11:00
Mike McCauley f7279aa13f AP_InertialSensor: AP_InertialSensor_Flymaple implement get_gyro_health
and get_accel_health.
2014-02-17 05:56:37 +11:00
Andrew Tridgell f9d0747750 AP_InertialSensor: fixed example build 2014-02-15 06:39:35 +11:00
Andrew Tridgell 3617c65af7 AP_InertialSensor: make HIL treat time like PX4 does 2014-02-15 05:48:20 +11:00
Andrew Tridgell b1c5f23bbd AP_InertialSensor: make get_delta_time() const
allows use from AP_NavEKF
2014-02-15 05:29:47 +11:00
Randy Mackay b7565affcd INS: add support for 400hz for PX4 2014-02-15 05:27:33 +11:00
Andrew Tridgell a95a3142e0 AP_InertialSensor: use fixed size arrays
apparently helps SITL build on MacOS
2014-02-08 19:32:26 +11:00
Andrew Tridgell 045efdb084 AP_InertialSensor: fixed example builds 2014-01-30 13:33:38 +11:00
Andrew Tridgell 58d3729d16 AP_InertialSensor: fixed default health functions
this fixes INS on APM1. Thanks to Mike McCauley for noticing this!
2014-01-22 22:08:28 +11:00
Don Gagne 68b3b31499 Param doc typo 2014-01-18 10:18:58 +09:00
Randy Mackay 965e5b2dfd INS: check for good calibration for 10seconds
Shortened gyro calibration commit also halved the total time we would
look for a good gyro calibration.  This restores the total time to 10
seconds.
2014-01-17 12:48:11 +09:00
Randy Mackay 1f76ada9dd INS: shortened gyro calibration
Removed delays before calibration, reduced number of samples taken,
widened convergence criteria
2014-01-16 13:40:49 +09:00
Randy Mackay a400ddeb88 INS: replace APM with vehicle in accel calibrate 2013-12-28 10:41:49 +09:00
Andrew Tridgell 8dd34f8bc4 AP_InertialSensor: fixed example build 2013-12-17 11:51:37 +11:00
Andrew Tridgell 6d39cf5e49 AP_InertialSensor: another attempt at fixing the spurious bad gyro health warnings
cope with _get_sample() not being called for a while
2013-12-14 15:47:49 +11:00
Andrew Tridgell 99e2dc87c9 AP_InertialSensor: prevent INS healthy errors while initialising
during gyro cal we shouldn't mark the gyro unhealthy
2013-12-13 20:47:24 +11:00
Andrew Tridgell 23a112c5d5 AP_InertialSensor: reduce the number of format string warnings 2013-12-11 17:29:27 +11:00
Andrew Tridgell 433ad19335 AP_InertialSensor: fixed loop limits
stops pointless operations
2013-12-11 14:57:13 +11:00
Andrew Tridgell e54fc6b8e3 AP_InertialSensor: make sure we wait for a sample before update() 2013-12-11 13:50:50 +11:00
Andrew Tridgell cba0cb963a AP_InertialSensor: auto-failover to working gyro and accel 2013-12-09 20:02:04 +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 d9b6f7f0f7 AP_InertialSensor: implement up to two sensors on PX4 2013-12-09 17:34:05 +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
Randy Mackay fd9b115d01 INS: move Product ID to @User Advanced 2013-11-26 22:18:28 +09:00
Andrew Tridgell 71bb462ad0 AP_InertialSensor: use fabsf() 2013-11-15 10:43:10 +11:00
Andrew Tridgell aef9289476 AP_InertialSensor: added INS_PRODUCT_ID values 2013-11-15 10:43:10 +11:00
Andrew Tridgell f10a4b04ae AP_InertialSensor: make PX4 healthy call _get_sample()
this prevents a false positive during times like arming where we are
not reading the sensors
2013-11-10 17:03:16 +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 1cd070a2e7 AP_InertialSensor: use const reference returns
saves some vector copies
2013-11-04 21:21:42 +11:00
Andrew Tridgell f4dde44b8d AP_InertialSensor: SITL doesn't use Oilpan code any more 2013-11-02 21:41:11 +11:00
Mike McCauley fe6cacf081 AP_InertialSensor: Minor correction to comments in AP_InertialSensor_Flymaple.cpp 2013-10-14 11:34:47 +10:00
Andrew Tridgell 7831113f84 AP_InertialSensor: yield the CPU for the right time in wait_for_sample()
this improves timing performance
2013-10-14 08:45:58 +11:00
Andrew Tridgell 8532e2bff8 AP_InertialSensor: fixed timing of PX4 sensor samples 2013-10-13 22:15:50 +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 b3af59cc0c AP_InertialSensor: don't build L3G4200D example 2013-10-10 09:54:20 +11:00
Andrew Tridgell a04c056598 AP_InertialSensor: remove unused get_last_sample_time_micros() 2013-10-10 09:54:19 +11:00
Andrew Tridgell 5d685385eb AP_InertialSensor: use gyro sample count on L3G4200D
this gives more even timing in ArduCopter
2013-10-08 19:20:34 +11:00
Andrew Tridgell 6444b0bddd AP_InertialSensor_L3G4200D: a sample is only available if gyro had a sample 2013-10-08 19:20:34 +11: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 c17a5e5ed1 AP_InertialSensor: added a small delay in accel calibration
allows threads to run on Linux
2013-10-08 11:50:54 +11:00
Andrew Tridgell 12af23bb7c AP_InertialSensor: added L3G4200D example 2013-10-08 11:50:53 +11:00
Andrew Tridgell 1aabd7155e AP_InertialSensor: added L3G4200D driver
this is for a cheap ebay 10DOF sensor
2013-10-08 11:50:53 +11:00
Mike McCauley c90c1b9998 AP_InertialSensor: Improvements to Flymaple sensors
Fix a bug that caused hang after 71 minutes. Use I2CDriver semaphore.
Remove test for in_accumulate: not needed.
2013-10-04 07:21:55 +10:00
Mike McCauley 9ea1108d4e AP_InertialSensor: Flymaple filter constructor arguments non non-zero 2013-10-04 07:21:55 +10:00
Andrew Tridgell dda68bddcb AP_InertialSensor: updates for AP_HAL::MemberProc 2013-09-30 21:06:42 +10:00
Andrew Tridgell 1191607036 AP_InertialSensor: enable Oilpan on Linux 2013-09-29 00:57:13 +10:00
Andrew Tridgell cf726c6642 AP_InertialSensor: rename Stub to HIL
more consistent with other drivers
2013-09-28 22:04:15 +10:00
Andrew Tridgell 03036c632d AP_InertialSensor: use new scheduler API 2013-09-28 21:24:03 +10:00
Andrew Tridgell 096660c4f9 AP_InertialSensor: mark flymaple as nobuild
won't build with build_examples.sh script
2013-09-27 16:57:13 +10:00
Mike McCauley e4eef61ec3 AP_InertialSensor: Flymaple sensors improvements
Flymaple sensors are now raw sampled at 800Hz, and LowPassFilter2p is used
to filter to the desired filter cutoff frequency.
Flymaple sensor polling is done in the main thread NOT in the timer
interrupts.
2013-09-27 15:45:59 +10:00
Mike McCauley 23429b6b9c AP_InertialSensor: Flymaple now polls sensors at 800Hz. More changes to
come...
2013-09-27 15:45:57 +10:00
Mike McCauley 29bced05bd AP_InertialSensor: Added examples/Flymaple for testing 2013-09-27 15:45:54 +10:00
Mike McCauley d11f952ef1 AP_InertialSensor: Formalise and document Flymaple Gyro scaling factor 2013-09-27 15:45:52 +10:00
Mike McCauley adfcdca074 AP_HAL_FLYMAPLE: Sensor reading improvements
I2C speed increased to 400kHz
Accelerometer 8g max, Normal power, 800Hz bandwidth
Gyros: 2000 degrees/sec, 256Hz LPF, 8kHz internal sample rate
2013-09-27 15:45:47 +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
Mike McCauley e4b5d0a3d6 AP_InertialSensor: Final Flymaple orientation fixes 2013-09-25 15:46:07 +10:00
Mike McCauley 276068356e AP_InertialSensor: Further Flymaple orientation fixes 2013-09-25 15:46:07 +10:00
Mike McCauley b02dbca9d4 AP_InertialSensor: fix orientation of Flymaple sensors 2013-09-25 15:46:07 +10:00
Mike McCauley 4d10a96077 AP_InertialSensor: Add flymaple support 2013-09-24 13:51:27 +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 4d2bfe1078 AP_InertialSensor: fixed another example build 2013-09-19 21:09:34 +10:00
Andrew Tridgell e1aa6e3ff1 libraries: fixed examples for no flash_leds() callback 2013-09-19 18:38:28 +10:00
Andrew Tridgell f8e9d48a76 AP_InertialSensor: removed the flash_leds() callback
AP_Notify now handles this
2013-09-19 18:32:19 +10:00
Andrew Tridgell 7b3a674d66 AP_InertialSensor: added set_default_filter() method 2013-09-09 19:18:52 +10:00
Andrew Tridgell 396c4f30d2 AP_InertialSensor_PX4: don't set QUEUEDEPTH
the default of 2 samples is fine
2013-09-09 18:04:40 +10:00
Andrew Tridgell 8b80beadc4 PX4: make FMUv2 identify itself differently
so we can tell which is which in logs
2013-09-09 18:04:40 +10:00
Andrew Tridgell ff0f6bcd42 AP_InertialSensor: fixed example build 2013-09-07 21:03:59 +10:00
Andrew Tridgell 5caf2e0ea4 AP_InertialSensor: fixed example build 2013-08-30 13:01:39 +10:00
Andrew Tridgell 65a490c209 AP_InertialSensor: update for new notify API 2013-08-30 13:01:35 +10:00
Randy Mackay 5651bdbe3a INS: integrate AP_Notify 2013-08-30 13:01:35 +10:00
Andrew Tridgell e5ad9dbd15 AP_InertialSensor: switch PX4 driver to fixed time per sample model
this makes the driver much simpler, and does away with the need for an
accumulate function
2013-08-30 13:01:33 +10:00
Andrew Tridgell 38fe89d661 AP_InertialSensor: switch to non-averaging system for PX4 IMUs
always use the latest value, based on a lowpass filter in the driver
2013-08-30 13:01:33 +10:00
Andrew Tridgell 46c5d18585 AP_InertialSensor: disable averaging on FMUv2
the new filter from Leonard means we shouldn't average values, and
instead just use the last value
2013-08-30 13:01:33 +10:00
Julian Oes c3b27629ec AP_InertialSensor: run PX4 FMUv2 at 800Hz
this gives much better noise suppression
2013-08-30 13:01:33 +10:00
Randy Mackay effc829790 INS: relax accel offset check to 3.5 m/s/s
One user, Dusty, has found that even with offsets of 3.1 m/s/s
successful alt hold and loiter are possible
2013-07-13 10:43:07 +09:00
Randy Mackay 20ed00dcc9 AP_InertialSensor: relax accel offset sanity check 2013-06-25 14:19:42 +09:00
Andrew Tridgell c92069644d AP_InertialSensor: fixed indent-tabs-mode 2013-05-30 09:52:12 +10:00
Andrew Tridgell 807dbf9786 AP_InertialSensor: fixed a build warning 2013-05-24 11:21:42 +10:00
Andrew Tridgell 59b6118a1d AP_InertialSensor: fixed parameter markup 2013-05-21 17:02:13 +10:00
Andrew Tridgell fefbeacf86 AP_InertialSensor: use SEVERITY_USER_RESPONSE for accel cal messages
thanks to the suggestion from Kevin
2013-05-09 09:28:25 +10:00
Andrew Tridgell 8f57b72e3f AP_InserialSensor: fixed example build 2013-05-08 16:45:31 +10:00
Andrew Tridgell 2ddeaa7f4d AP_InertialSensor: show calibration offsets for success and failure
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-05-08 16:19:06 +10:00