Commit Graph

762 Commits

Author SHA1 Message Date
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 64a5d3938c AP_InertialSensor: implement device IDs for MPU6000 and MPU9250 AuxilaryBus 2016-11-09 17:08:04 +11:00
Andrew Tridgell ac2c25539b AP_InertialSensor: implement device IDs for AuxilaryBus 2016-11-09 17:08:04 +11:00
Andrew Tridgell 4ef92b5e39 AP_InertialSensor: enable all 3 IMUs on PH2 2016-11-09 17:08:04 +11:00
Andrew Tridgell 5cf768ced2 AP_InertialSensor: fixed missing return 2016-11-09 17:08:02 +11:00
Andrew Tridgell 38ff8b3536 AP_InertialSensor: removed unused product_id function in L3G4200D 2016-11-09 17:08:01 +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 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 7832f1a1b6 AP_InertialSensor: allow for in-tree drivers for PX4 2016-11-09 17:07:58 +11:00
Andrew Tridgell 919aa61918 AP_InertialSensor: support AuxiliaryBus without register_periodic_callback() 2016-11-09 17:07:57 +11:00
Andrew Tridgell 2b66df68a1 AP_InertialSensor: use thread-per-bus for lsm303d and mpu6000 2016-11-09 17:07:56 +11:00
Andrew Tridgell 90dc9e3327 AP_InertialSensor: dummy implementation of register_periodic_callback()
for AuxiliaryBus
2016-11-09 17:07:55 +11:00
Lucas De Marchi 91c4bf470f AP_InertialSensor: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03: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
Andrew Tridgell afe2c31ae7 AP_Inertial_Sensor: use const reference 2016-10-27 15:06:11 +11:00
priseborough 7460d97c9a AP_InertialSensor: Update parameter documentation
Add brief description of body frame conventions.
2016-10-27 14:54:45 +11:00
priseborough 470f5c4562 AP_InertialSensor: Correct SITL IMU1 accel for position in body frame 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
Martin Evans 0e19b8c9a0 AP_HAL_Linux: Set initial rotation on Dark to None 2016-10-24 10:00:24 -02: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
Peter Barker 17883f6683 AP_InertialSensor: fix INS_generic example (call BoardConfig.init()) 2016-10-24 11:00:22 +09:00
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Julien Beraud 714c8fd318 AP_InertialSensor_MPU6000: Add support for fsync bit for Bebop
Already present on Disco
2016-10-03 12:20:03 -03:00
Andrew Tridgell 6f9530ebaa AP_InertialSensor: added optional FSYNC external sync bit
used to synchronise with image sensor on Disco
2016-09-05 12:55:32 +10: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 b6c0e11200 AP_InertialSensor: BMI160: convert it to use Device periodic callback
Some notes:
 - The only place that made sense to use
   suspend_timer_procs()/resume_timer_procs() calls were where we registered
   the timer process. Now there's no need for that anymore. Remove those calls
   from other place in the source too.
 - There's no need to acquire the device lock now that we are running as a
   periodic callback.
2016-09-03 01:03:07 -03:00
mirkix a4d0ad8571 AP_InertialSensor: Fix name of sensor 2016-08-23 11:25:59 +09:00
Murilo Belluzzo 36bdd7f1f1 AP_InertialSensor: MPU6000: Add missing read() check 2016-08-03 00:18:20 -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
José Roberto de Souza dd36952efe AP_InertialSensor: BMI160: Register poll function with the timer lock 2016-07-21 15:42:32 -03:00
Andrew Tridgell d30e55fa44 AP_InertialSensor: initial support for Disco
setup right orientation
2016-07-20 13:38:17 +10:00
Lucas De Marchi 6d1acc5813 AP_InertialSensor: BMI160: remove stray call to set speed
It's already supposed to be on high speed there.
2016-07-18 11:20:49 -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
Andrew Tridgell eee9fc88a1 AP_InertialSensor: avoid ifdef for AP_MODULE_SUPPORTED 2016-07-14 13:39:47 +10:00
Andrew Tridgell 33ce1213a2 AP_InertialSensor: call gyro_sample and accel_sample AP_Module hooks 2016-07-14 13:39:47 +10:00
Andrew Tridgell cb858d2c99 AP_InertialSensor: fixed typo 2016-07-01 15:35:22 +10:00
Andrew Tridgell 834acaffee AP_InertialSensor: provide IMU temperature to HAL for all boards 2016-07-01 15:29:52 +10:00
Lucas De Marchi 1f96336f7c Global: rename bus type enum entries 2016-06-27 17:51:41 -03:00
Gustavo Jose de Sousa f6bebc96c0 AP_InertialSensor: INS_generic: remove unused includes 2016-06-27 17:22:43 -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
Gustavo Jose de Sousa de94392759 AP_InertialSensor: MPU9250: remove _bus_type field
Use _dev->bus_type instead.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 83feb2e2ae AP_InertialSensor: MPU9250: let Device handle read flag
There's no need to handle that in MPU9250 anymore.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 1e99a7125c AP_InertialSensor: MPU9250: remove _register_write_check()
That function isn't used in the code base and there should be a better way to
debug writes on registers.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa a6e5eb9e14 AP_InertialSensor: MPU6000: remove _bus_type field
Use _dev->bus_type instead.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 0718649c8b AP_InertialSensor: MPU6000: let Device handle read flag
There's no need to handle that in MPU6000 anymore.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 309fe4a88c AP_InertialSensor: MPU6000: remove _register_write_check()
That function isn't used in the code base and there should be a better way to
debug writes on registers.
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
Ricardo de Almeida Gonzaga d5a2c57c5e AP_InertialSensor: Fix typos 2016-05-13 19:20:05 -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
Lucas De Marchi f304fcf4da AP_InertialSensor: examples: add coding style fixes
Several coding style problems were already fixed by previous commit,
just finish the cleanup on this example:

  - replace tabs with spaces
  - remove unneeded \r
  - remove extra spaces
2016-03-31 14:54:17 -03:00
AndersonRayner 10e7d43007 AP_InertialSensor: Add output of all IMUs to example 2016-03-31 14:54:17 -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
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 057822b51c AP_InertialSensor: AuxiliaryBus: fix return value
We should return the number of bytes written/read, not 0 on success.
This number may be useful in some cases so return it.

While at it fix a simple wrong space in the header.
2016-03-17 02:55:39 -03:00
Gustavo Jose de Sousa 4613b68efb AP_InertialSensor: waf: skip VibTest example
The code is currently broken.
2016-03-14 11:54:31 -03:00
Staroselskii Georgii da550e5e98 AP_Inertial_Sensor: do not rotate MPU9250 on Navio2 2016-02-27 03:06:50 -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 c1d19fa4dc AP_InertialSensor: LSM9DS0: sanitize whitespaces 2016-02-01 14:18:51 -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
Lucas De Marchi 1ca03006ad AP_InertialSensor: MPU9150: remove driver
This is not used by any board and has a lot of commented out code. For
example, the compass is not enabled.  The comment in the beginning of
the driver says it should serve as an example, but we should rather use
a working driver as an example. If this was at least a bit simpler and
that worked in the past we could refactor it to the new I2CDevice API.
This is not the case.
2016-02-01 14:18:51 -02:00
Lucas De Marchi 22f2a2ee09 AP_InertialSensor: L3G4200D: fix coding style
- remove trailing and leading whitespaces
  - remove unecessary void from functions taking no parameters
2016-02-01 14:18:51 -02:00
Lucas De Marchi 637b53f4ce AP_InertialSensor: L3G4200D: sanitize includes 2016-02-01 14:18:51 -02:00
Lucas De Marchi 5088dca072 AP_InertialSensor: MPU60x0: coding style fixes 2016-02-01 14:18:51 -02:00
Lucas De Marchi ed653f8dbb AP_InertialSensor: MPU60x0: add comment about 8G/16G 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
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 3d22490397 waf: examples: use methods from bld instead of ardupilotwaf 2016-01-22 20:10:29 -02:00
Andrew Tridgell 24d8610013 AP_InertialSensor: use SIM_GYR_SCALE in SITL 2016-01-19 15:29:08 +11:00
Andrew Tridgell ee453783eb AP_InertialSensor: added get_delta_angle_dt() API 2016-01-19 09:50:21 +11:00
Gustavo Jose de Sousa d281067bcc waf: make example binaries be placed in 'examples' dir
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
Víctor Mayoral Vilches e493bfcae4 AP_InertialSensor: add PXFmini support 2016-01-05 15:35:56 -02: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 bae16a61e2 AP_InertialSensor: fix segfault 2015-12-29 23:10:56 -08: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
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Andrew Tridgell 3fb0b8f69d AP_InertialSensor: fixed example build 2015-12-27 14:57:30 +09:00
Andrew Tridgell 17fc58f3cd AP_InertialSensor: re-work for more flexible main loop rates 2015-12-27 14:57:12 +09:00