Commit Graph

235 Commits

Author SHA1 Message Date
Andrew Tridgell 03b7bc9e65 AP_InertialSensor: use internal drivers for PHMINI
this gets us fast sampling
2016-11-09 17:08:12 +11:00
Andrew Tridgell 3d7d773883 AP_InertialSensor: added support for ICM20608 on Pixracer 2016-11-09 17:08:08 +11:00
Andrew Tridgell 2c1e9024f1 AP_InertialSensor: detect missing accels or gyros 2016-11-09 17:08:07 +11:00
Andrew Tridgell 106a91c64c AP_InertialSensor: use init_gyro() on startup
this saves the calibration parameters which should be done on
calibration
2016-11-09 17:08:07 +11:00
Andrew Tridgell 408593465f AP_InertialSensor: fixed rotation for mpu9250 on pixracer 2016-11-09 17:08:07 +11:00
Andrew Tridgell 790dd4769b AP_InertialSensor: simplify rotations for MPU9250 2016-11-09 17:08:07 +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 bbb9bfa95e AP_InertialSensor: save only gyro calibration
When we are initializing the gyro and then saving the calibration we are
also saving the calibration values for the accelerometers. Right now
this is non-problematic, but we want to check that the ID of the
accelerometer corresponds to the ID of the sensor detected. If we also
save accel calibrations we would actually override the ID of the
accelerometer.

Rename the method to _save_gyro_calibration() and save only on gyro
values.
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 4ef92b5e39 AP_InertialSensor: enable all 3 IMUs on PH2 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
Andrew Tridgell b92c48548a AP_InertialSensor: added per-instance rotation for LSM9DS0 2016-11-09 17:08:00 +11:00
Andrew Tridgell 2df6ed08c2 AP_InertialSensor: added optional per-instance orientation
this is needed for multi-sensor boards to get orientation right for
each sensor
2016-11-09 17:08:00 +11:00
Andrew Tridgell 7832f1a1b6 AP_InertialSensor: allow for in-tree drivers for PX4 2016-11-09 17:07:58 +11:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
priseborough 7460d97c9a AP_InertialSensor: Update parameter documentation
Add brief description of body frame conventions.
2016-10-27 14:54:45 +11:00
priseborough 54a431a51d AP_InertialSensor: Update position offset parameter documentation
Notify users of the potential for velocity noise when using larger offset values..
Specific advice in terms of values has not been provided because it is highly dependent on Gyro noise levels.
2016-10-27 14:54:43 +11:00
priseborough 6db93d8a21 AP_InertialSensor: Add parameters defining accelerometer position offset 2016-10-27 14:54:41 +11: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
Gustavo Jose de Sousa 68fe536da3 AP_InertialSensor: use BMI160 for Intel Aero 2016-09-03 01:03:07 -03:00
Gustavo Jose de Sousa cd0d65dc3f AP_InertialSensor: don't check {gyro,accel}_available twice
That gives a slightly simpler code.
2016-07-22 19:58:08 -03:00
Gustavo Jose de Sousa 69405cc99a AP_InertialSensor: fix timing debug macro
- Use "INS_" prefix for the name in order to limit the scope for that macro.

- Don't define it in the code and check if it is defined instead of checking
  the value. With that, there's no need to touch the code for enabling debug,
  only a reconfiguration is necessary (e.g., `CXXFLAGS='-DINS_TIMING_DEBUG' waf
  configure ...`).
2016-07-21 19:01:28 -03:00
Gustavo Jose de Sousa ee7c40be61 AP_InertialSensor: BMI160: add backend
The reason of defining BMI160_MAX_FIFO_SAMPLES as 8 can be found on the
following histogram of the number of samples in the FIFO on each read while
performing the accelerometer calibration process:

Samples Count   Freq Acc. Freq
------------------------------
      1  3842 0.1201  0.120111
      2 13172 0.4118  0.531904
      3  9065 0.2834  0.815300
      4  2710 0.0847  0.900022
      5  2231 0.0697  0.969769
      6   816 0.0255  0.995279
      7   137 0.0043  0.999562
      8    13 0.0004  0.999969
     13     1 0.0000  1.000000
2016-07-15 16:46:06 -03:00
Gustavo Jose de Sousa e85ac8b2c5 AP_InertialSensor: inform maximum gyro average difference
While at it, define GYRO_INIT_MAX_DIFF_DPS.
2016-06-27 17:22:43 -03:00
Gustavo Jose de Sousa e6f62080f5 AP_InertialSensor: fix best_diff on gyro initialization
Without this patch, if accel_diff.length() > 0.2f and j == 0, then
best_diff[k] would be zero forever since diff_norm[k] >= 0 for any j.
2016-06-27 17:20:51 -03:00
Grant Morphett 34fa2a39bd AP_InertialSensor: Changing the default gyro filter from 10 to 4
This change is only for Rovers.
2016-06-16 14:37:55 +09:00
Lucas De Marchi b067bce140 AP_InertialSensor: remove support for flymaple 2016-05-23 21:49:45 -03:00
Lucas De Marchi 7503c1b6d4 AP_InertialSensor: update doc about used ids 2016-05-23 21:49:45 -03:00
dgrat 41661f815f AP_Math: Replace the pythagorous* functions with a variadic template
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
Andrew Tridgell be41d402b5 AP_InertialSensor: added set of delta angle time for replay 2016-04-26 15:50:46 +10:00
Andrew Tridgell 4401cbec72 AP_InertialSensor: cope with zero delta angle time from Replay 2016-04-26 15:37:11 +10:00
mirkix c3a6a56ebb AP_InertialSensor: Add second MPU9250 autodetection to BBBmini 2016-04-24 10:57:57 -03:00
ashwinvasudevan e33812e1cb AP_InertialSensor: added missing brackets 2016-03-23 17:46:41 +09:00
raspilot 1d1d224c18 AP_InertialSensor: Enable dual IMU for raspilot 2016-03-18 21:51:37 -03:00
AndersonRayner c9d5c548a6 Corrects a bracket error for the LSM9DS0 IMU
Switches the probe of the accel and gyro so they boot correctly (was
failing the WHOAMI with a switched result)
2016-02-25 20:08:01 -03:00
Jonathan Challinger c454631be8 AP_InertialSensor: work around gyro and accel errors on startup 2016-02-19 16:40:52 +09: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
Lucas De Marchi d2b267d026 AP_InertialSensor: LSM9DS0: use AP_HAL::SPIDevice abstraction 2016-02-16 19:49:09 -02:00
Lucas De Marchi 58f4624f8c AP_InertialSensor: L3G4200D: use AP_HAL::I2CDevice abstraction 2016-02-16 19:49:09 -02:00
Lucas De Marchi af846636e4 AP_InertialSensor: MPU60x0: use AP_HAL::Device abstraction 2016-02-16 19:49:09 -02:00
Lucas De Marchi 9c6bd38e91 AP_InertialSensor: sanitize includes
Due to the way the headers are organized changing a single change in an
inertial sensor driver would trigger a rebuild for most of the files in
the project. Time could be saved by using ccache (since most of the
things didn't change) but we can do better, i.e. re-organize the headers
so we don't have to re-build everything.

With this patch only AP_InertialSensor/AP_InertialSensor.h is exposed to
most users. There are some corner cases to integrate with some example
code, but most of the places now depend only on this header and this
header doesn't depend on the specific backends.

Now changing a single header, e.g. AP_InertialSensor_L3G4200D.h triggers
a rebuild only of these files:

	$ waf copter
	'copter' finished successfully (0.000s)
	Waf: Entering directory `/home/lucas/p/dronecode/ardupilot/build/minlure'
	[ 80/370] Compiling libraries/AP_InertialSensor/AP_InertialSensor.cpp
	[ 84/370] Compiling libraries/AP_InertialSensor/AP_InertialSensor_L3G4200D.cpp
	[310/370] Linking build/minlure/ArduCopter/libArduCopter_libs.a
	[370/370] Linking build/minlure/bin/arducopter
	Waf: Leaving directory `/home/lucas/p/dronecode/ardupilot/build/minlure'
2016-02-01 14:18:51 -02:00
Jonathan Challinger 4c2e6af6ee AP_InertialSensor: statically register with AP_AccelCal 2016-01-23 10:35:34 +09:00
Randy Mackay 081beacb8d AP_InertialSensor: replace sqrt with safe_sqrt to resolve compiler warning
Also add suppressing comment for missing break at end of switch
2016-01-23 10:10:17 +09:00
Andrew Tridgell ee453783eb AP_InertialSensor: added get_delta_angle_dt() API 2016-01-19 09:50:21 +11:00
Andrew Tridgell b2745bb545 AP_InertialSensor: we only need peak hold for negative X for now 2016-01-02 09:58:32 +11:00
Tom Pittenger 3aaf2b1d2b AP_InertialSensor: add pos/neg peak detector
new functions that get a filtered min/max accel peaks on each axis with fixed 500ms timeout:
    Vector3f get_accel_peak_hold_pos()
    Vector3f get_accel_peak_hold_neg()

This allows slower mechanisms, such as is_flying, to detect accel spikes which would indicate ground or object impacts. Vibe is too filtered. Independent positive and negative peaks are available
2016-01-02 09:58:31 +11:00
Jonathan Challinger 0a3c2774e9 AP_InertialSensor: fixes in response to review 2015-12-29 22:55:04 -08:00
Jonathan Challinger 137ace473d AP_InertialSensor: add accel_cal_requires_reboot 2015-12-29 10:46:35 -08:00
Jonathan Challinger f6a41a8936 AP_InertialSensor: ensure that accel calibration object isn't allocated more than once 2015-12-29 10:46:35 -08:00
Jonathan Challinger 492223cb84 AP_InertialSensor: support AP_AccelCal 2015-12-29 10:46:34 -08:00