Commit Graph

497 Commits

Author SHA1 Message Date
Peter Barker e4001e67e2 AP_Compass: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Michael du Breuil deec4ec6af Compass: Rework compass calibrator
Summary of significant changes:
  -Autsave doesn't depend on STREAM_EXTRA3
  -Don't risk only saving one compass on copter if CAL_ALWAYS_REBOOT is set
  -Only calibrate compasses that are both health and marked for use (there was a inconsistency in handling the mask)
  -Fix incorrect failure reporting on DO_ACCEPT_MAG_CAL with a mask of 0 if a channel was specifically not started
  -Fix not starting the buzzer if the delay is set to 0 seconds
  -Always send MAG_CAL_REPORT until its acknowledged
  -Correct the field in MAG_CAL_REPORT for autosave to indicate if the compass had actually been saved, rather then being scheduled to be saved
  -Remmove unused public interfaces
2016-10-27 14:04:33 +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
Peter Barker 216a6493c9 AP_Compass: AP_Compass_LSM9DS1: remove unused variable 2016-10-24 08:57:56 -02: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
Andy Little 0d113b265c Examples: fix examples for px4
The change to use AP_BoardConfig messed up the examples. Here are some
updated but there are plenty more to do.
2016-10-04 12:50:47 -03:00
Andrew Tridgell 36ea946cf5 AP_Compass: use board defined compass ofs max in calibrator 2016-09-23 10:53:00 +10:00
Jonathan Challinger 17fb7dc88f AP_Compass: initialize offset before beginning sphere fit 2016-09-23 10:52:51 +10:00
Jonathan Challinger 419f1bc00e AP_Compass: change fixed point format for more range 2016-09-23 10:52:46 +10:00
Jonathan Challinger 0652d71a72 AP_Compass: correct wrapping behavior in conversion to fixed point 2016-09-23 10:52:44 +10:00
Andrew Tridgell f82827ce79 AP_Compass: removed disco special compass offsets
not needed any more with newer hardware
2016-09-14 19:06:06 +10:00
Randy Mackay ba5db0c5d8 Compass: add CAL_FIT parameter description values
No functional change
2016-09-14 09:57:52 +09:00
José Roberto de Souza 13287f61e3 AP_Compass: Make COMPASS_AERO probe BMM150 2016-09-03 01:03:17 -03:00
Gustavo Jose de Sousa b259356703 AP_Compass: BMM150: convert it to use Device periodic callback 2016-09-03 01:03:07 -03:00
Lucas De Marchi 667fca60f5 AP_Compass: BMM150: reduce lock region
Use a semaphore to update the accumulated values instead of using the
timer semaphore.
2016-09-03 01:03:07 -03:00
Matt 9eca21c26a AP_Compass: Removed duplicate code 2016-08-29 10:38:41 -03:00
Lucas De Marchi 4595a2b7d8 AP_Compass: Remove i2c lockup count
This was returned only for a single bus and on all supported platforms
this is hardcoded to 0.
2016-07-28 18:03:09 -03:00
Lucas De Marchi c6edae7e8e Revert "Global: workaround toolchain problem on windows"
This reverts commit 4e2b30b413.

The toolchain for windows is now updated, we can remove this workaround.
2016-07-25 17:56:12 -03:00
Andrew Tridgell 018d8f732a AP_Compass: work around poor magnetic setup on Disco
bring compass offsets into line with what the calibrator can handle
2016-07-20 13:38:17 +10:00
Lucas De Marchi 4e2b30b413 Global: workaround toolchain problem on windows
The minimum version for gcc was supposed to be 4.9 for any platform.
However our build instructions are outdated. Remove the problematic
parts that use the sparse-endian.h header while we don't fix the setup
for windows.
2016-07-19 09:30:39 +09:00
Lucas De Marchi 3ba27df405 AP_Compass: BMM150: minor refactors
- Correctly sort includes and add missing AP_Math.h
  - Use anonymous struct for trim_registers in _load_trim_values,
    renaming its members so they don't start with underscore
  - Don't change _dig* values when we failed to read from sensor
  - Add some blank lines
  - Make _dig_* members be inside a _dig struct
  - Use constrain_int32 instead of if/else chain
  - s/time_us/time_usec/
  - Construct raw_field with a single constructor in _update()
  - Add missing copyright notice
  - Group methods together in declaration
2016-07-06 10:04:05 -03:00
José Roberto de Souza 6e53854122 AP_Compass: Add BMM150 backend 2016-07-06 10:03:30 -03:00
Lucas De Marchi 9ccce2c980 AP_Compass: explicitely add compasses for erlebrain2, pxf and pxfmini 2016-05-18 18:24:14 -03:00
Lucas De Marchi 8372e74c0f AP_Compass: simplify handling of sensors for Linux boards
In addition:
    - bbbmini, navio and navio2 can force HMC5843 backend to
      be external.
    - there was a typo in the backend name that's now fixed:
      AK8953 vs AK8963
2016-05-18 18:24:14 -03:00
Lucas De Marchi 1ddbafabdd AP_Compass: add name field to internal compass drivers 2016-05-18 18:24:14 -03:00
Andrew Tridgell f7ac6c8d86 AP_Compass: make internal compasses use a higher cal threshold
they tend to be a lot noisier
2016-05-18 16:32:32 +10:00
Gustavo Jose de Sousa 0c31354539 AP_Compass: implement completion mask
Fill the completion mask and send that through MAVLink while calibrating the
compass.
2016-05-16 19:08:36 -03:00
dgrat f8540f1a80 AP_Compass: Do not use is_zero() for non-float types 2016-05-16 19:08:35 -03:00
Ricardo de Almeida Gonzaga 2e58653983 AP_Compass: Fix typos 2016-05-13 19:20:05 -03:00
Staroselskii Georgii a2ae662b3e AP_Compass: add an extra rotation for internal LSM9DS1 on Navio2
In order not to force users to set rotation themselves, we need this
hack to make an extra rotation needed for a second compass.
2016-05-10 17:24:43 -03:00
Staroselskii Georgii 2e5cfc2849 AP_Compass: added external compass autodetection on Navio 2016-05-10 17:24:43 -03:00
Staroselskii Georgii 62f2695e83 AP_Compass: added several compasses' autodetection on Navio 2 2016-05-10 17:24:43 -03:00
Staroselskii Georgii 71736a0ecc AP_Compass: enable LSM9DS1 magnetometer for boards without default one 2016-05-10 17:24:43 -03:00
Staroselskii Georgii b677f975e7 AP_Compass: added LSM9DS1 magnetometer support 2016-05-10 17:24:43 -03:00
Lucas De Marchi 68ae619448 AP_Compass: detect compasses for minlure
Minlure has an onboard compass (HMC5883L) as slave of MPU-6000, but also
allows the use of an external HMC5883L compass, which should be
connected to the lure's I2C port.
2016-05-10 16:08:39 -03:00
Gustavo Jose de Sousa 91246ad8af AP_Compass: HMC5843: apply HMC5883L "arrow" rotation only if external
That rotation is done because of the "arrow" pointing the sensor direction in
3DR GPS+Compass kit (which isn't natural to the sensor orientation, by the
way). Thus, do that rotation only for external HMC5883L compasses.
2016-05-10 16:05:29 -03:00
Gustavo Jose de Sousa 35cddc7af0 AP_Compass: HMC5843: move hardcoded rotation to before call to rotate_field()
That rotation is set for AP_COMPASS_TYPE_HMC5883L, because it's usually
the compass from 3DR GPS+Compass kit, which has an arrow pointing the
"correct" direction. That rotation should be done before rotate_field()
as it represents the "standard" position for the kit.

This patch also makes published values consistent with respect to rotation.
Before this, raw fields used in calibration were published with a
rotation different from the filtered field when _product_id is
AP_COMPASS_TYPE_HMC5883L.
2016-05-10 15:56:38 -03:00
Gustavo Jose de Sousa ad91a810b3 AP_Compass: Backend: add method is_external() 2016-05-10 15:55:58 -03:00
Gustavo Jose de Sousa 670b0071f9 AP_Compass: HMC5843: add parameter force_external to constructor
And to the detection probe() method. That way we don't need to use a board
`#ifdef` inside the class code.  Additionally, we make raspilot board use it.
2016-05-10 15:52:54 -03:00
Andrew Tridgell 88a1ebaf0e AP_Compass: allow setting of exact timestamp in HIL compass 2016-05-07 18:27:19 +10:00
Andrew Tridgell 0e32c047c3 AP_Compass: allow for COMPASS_EXTERNAL=2 for forced external
this allows users with unusual compass bus connections to force the
compass to external
2016-05-01 10:54:46 +10:00
Andrew Tridgell ed999a283f AP_Compass: added get_learn_type() API
this allows caller to determine if EKF offsets should be saved
2016-04-30 16:43:14 +10:00
mirkix 3df5a02448 AP_Compass: Add HMC5843 and second AK8963 autodetection to BBBmini 2016-04-24 10:57:57 -03:00
Randy Mackay 4aba25d2ef AP_Compass_AK8963: remove unused _bus_sem, _last_accum_time
Resolves a compiler warning
2016-04-23 23:06:21 -07:00
Lucas De Marchi 46936767c1 AP_Compass: LSM303D: check for overruns in compass values 2016-03-23 17:50:38 -03:00
Lucas De Marchi cf2d866d51 AP_Compass: LSM303D: used AP_HAL::Device interface
Initialization was also changed a little bit so we don't try to
initialize 25 times. We rather use the same methods as in the
AP_InertialSensor drivers.

Also move up the call to is_zero() in read_raw so we don't set
_mag_[x|y|z] in case of failure.
2016-03-23 17:50:38 -03:00
Lucas De Marchi 5164fbb81b AP_Compass: LSM303D: cleanup driver
Make it similar to other compass drivers, including method names.
2016-03-23 17:50:38 -03:00
Lucas De Marchi 20a4a42cb3 AP_Compass: don't store raw and unfiltered fields
These are not used. The only place where raw fields are used are in the
compass calibrator and we don't need to store them.

Additionally remove duplicated documentation about the meaning of the
functions to avoid them getting out of sync.
2016-03-23 17:50:38 -03:00
Lucas De Marchi e6059f5197 AP_Compass: rename files to follow other libraries
AP_Compass.h is the main header to be exported and AP_Compass.cpp its
implementation. There's no need for an additional header.
2016-03-23 17:50:38 -03:00
Lucas De Marchi 286697b844 AP_Compass: don't rebuild tree when single driver changes
Let the drivers be internal to the library so we don't need to rebuild
the entire tree when a single driver changes.
2016-03-23 17:50:38 -03:00