Commit Graph

1038 Commits

Author SHA1 Message Date
Andrew Tridgell 8f83bf5e80 AP_Compass: fixed in-flight learning for all compasses
after recent changes only first compass was learnt

See
https://discuss.ardupilot.org/t/break-in-latest-master-in-flight-compass-calibration/52602
2020-02-25 12:40:27 +11:00
Siddharth Purohit f00a39af52 AP_Compass: run style script on Compass.cpp 2020-02-19 13:59:53 +09:00
Siddharth Purohit 8d227d401a AP_Compass: modify compass driver to support consistent ordering and hotplugging 2020-02-19 13:59:53 +09:00
Siddharth Purohit defc1b5fcb ArduCopter: add arming message for compass not detected but assigned 2020-02-19 13:59:53 +09:00
Andrew Tridgell 521cf4d6a1 AP_Compass: removed annoying startup messages
these happen due to sensor probing for older configs
2020-02-06 15:25:46 -07:00
Peter Barker cc3f6468e3 AP_Compass: mark some parameters as Calibration parameters 2020-02-04 20:29:09 +11:00
Andrew Tridgell 0ca45059ac AP_Compass: make all semaphores recursive
the cost is very similar and this prevents an easy coding error which
can occur on less used code paths
2020-01-19 20:19:30 +11:00
Andrew Tridgell 4ee6fb9cdf AP_Compass: use take_blocking instead of HAL_SEMAPHORE_BLOCK_FOREVER
this makes for cleaner and smaller code as the failure case is not
needed
2020-01-19 20:19:30 +11:00
Peter Hall c870df0351 AP_Compass: get_time_flying in vehicle 2020-01-14 22:34:37 -07:00
Andrew Tridgell ebceab9aa0 AP_Compass: don't probe for ICM20948 on AP_Periph 2020-01-07 12:37:35 +11:00
Andrew Tridgell 270844745f AP_Compass: limit rotations we try to ROTATION_MAX_AUTO_ROTATION 2020-01-01 16:59:27 +11:00
Pierre Kancir d332773689 AP_Compass: add register to checked ones and remove single-use goto
Also fix comment on TMRC register setting
2019-12-21 09:07:20 +11:00
Pierre Kancir d6563bff7d AP_Compass: probe for RM3100 2019-12-21 09:07:20 +11:00
Andrew Tridgell 09d7e732b7 AP_Compass: added mag_cal_fixed_yaw()
this is a fast compass calibration that uses a yaw value provided by
the user.
2019-12-18 17:20:37 +11:00
Peter Barker 880af0de4a AP_Compass: tidy constructor 2019-12-05 17:38:57 +11:00
Peter Barker 823f2bb217 AP_Compass: make compass_cal_status_t enum class Status within CompassCalibrator 2019-12-05 17:38:57 +11:00
Andrew Tridgell 303030c524 AP_Compass: narrow range of allowed scale factor 2019-12-03 20:48:23 +11:00
Andrew Tridgell 421fbef2a0 AP_Compass: added COMPASS_OPTIONS
this allows user to set that calibration requires GPS lock
2019-12-03 20:48:23 +11:00
Andrew Tridgell 6fd0ca36aa AP_Compass: added estimation of compass scale factor
this adds new COMPASS_SCALE, COMPASS_SCALE2 and COMPASS_SCALE3
parameters, which give the sensor scaling factor. It is used to
compensate for an incorrect scaling in a compass.

The 3D compass calibration process will set the correct value
automatically, otherwise users can set the value to a known value for
an existing compass
2019-12-03 20:48:23 +11:00
Randy Mackay ecb60955ff AP_Compass: minor comment fix
Co-Authored-By: Peter Barker <pb-gh@barker.dropbear.id.au>
2019-11-26 11:10:06 +11:00
lukezhqin 32f11ba863 AP_Compass: fix thin_samples to avoid comparing sample to itself 2019-11-26 11:10:06 +11:00
Randy Mackay f97cfd1065 AP_Compass: fix calibrator update when step one fails 2019-11-26 11:10:06 +11:00
Randy Mackay 89fa324a2b AP_Compass: rename CompassCalibrator::clear to stop 2019-11-26 11:10:06 +11:00
Randy Mackay 90cfbe01e4 AP_Compass: remove unused calc_mean_squared_residuals 2019-11-26 11:10:06 +11:00
Randy Mackay feb0f141fa AP_Compass: add comments to calibrator 2019-11-26 11:10:06 +11:00
Randy Mackay 09046aec66 AP_Compass: formatting fixes
this should be a non-functional change
2019-11-26 11:10:06 +11:00
Randy Mackay f58b09ebef AP_Compass: constify get_completion_mask and remove use of auto 2019-11-26 11:10:06 +11:00
Randy Mackay 396cec96ee AP_Compass: constify get_orientation 2019-11-26 11:10:06 +11:00
Andrew Tridgell 1fe146c409 AP_Compass: remove expected error
this happens with AK09916 probing on invensense sensor
2019-10-30 15:21:07 +11:00
Andrew Tridgell 513e483821 AP_Compass: disable HIL for AP_Periph
this saves several k of flash
2019-10-24 22:03:43 +11:00
Randy Mackay 01c36fa6aa AP_Compass: LEARN param default to 0 for all vehicles 2019-10-23 17:15:57 +11:00
Vlad-Andrei Dorobantu 83c641c76f AP_Compass: corrected the cause of SIGSEGV signal when running AP_Compass_test 2019-10-19 09:58:42 +11:00
Andrew Tridgell 7ad91fa1c9 AP_Compass: don't show too many params when max compasses 1 2019-10-16 08:58:52 +11:00
Peter Barker 8e412d0885 AP_Compass: adjust for new vehicle base class 2019-10-08 11:26:04 +11:00
murata ec0c49315f AP_Compass: Change direct value to define name 2019-09-24 13:23:24 +10:00
Peter Barker 6193d6cf69 AP_Compass: fix example by instantiating Baro
Baro is required to get location, and Compass tries to get the declination based on current location
2019-09-13 08:54:21 +09:00
Andrew Tridgell 71ad90819e AP_Compass: don't reset SITL compass offsets if set by user
makes for easier EKF compass bias learning testing
2019-09-11 14:22:18 +10:00
Andrew Tridgell df387dc396 AP_Compass: allow rotation of BMM150 compass 2019-09-07 09:53:21 +10:00
Andrew Tridgell 1cb775e2c2 AP_Compass: probe more addresses for IST8310
IST8310 can be on 4 possible i2c addresses
2019-09-07 07:35:54 +10:00
Andrew Tridgell bd0760f9d4 AP_Compass: removed unusued compass probes
now only use probe lists
2019-09-04 16:27:47 +10:00
Andrew Tridgell 3bc8522b54 AP_Compass: added ROTATION_NONE to probes
we no longer use defaults in the headers
2019-09-04 16:27:47 +10:00
Andrew Tridgell f877def909 AP_Compass: removed default rotations for compass probe
this prevents bugs where the force_external and rotation are mixed up
in hwdef.dat causing incorrect rotations
2019-09-04 16:27:47 +10:00
Andrew Tridgell 2a48241ebb AP_Compass: fixed naming of QMC5883L driver
needed for probe using COMPASS macro in hwdef.dat
2019-09-04 16:27:47 +10:00
Andrew Tridgell bcb139f02f AP_Compass: fixed uninitialised CAN device ID bits 2019-08-29 18:37:03 +10:00
Andrew Tridgell f4576ec8f3 AP_Compass: reduce firmware size for AP_Periph 2019-08-27 10:29:56 +10:00
Andrew Tridgell 0ec3f80bbe AP_Compass: enable LIS3MDL on I2C and RM3100 on SPI 2019-08-27 10:29:56 +10:00
Peter Barker 1adda1ccf0 AP_Compass: move automatic declination setting into AP_Compass itself 2019-08-13 10:02:13 +10:00
Peter Barker df01bed14f AP_Compass: take GCS link in place of channel to calibration routines 2019-08-05 09:23:10 +10:00
Michael du Breuil 58dbbd6d0e AP_Compass: Refactor battery current backend 2019-07-14 00:28:00 -07:00
Peter Barker 7b52c41287 AP_Compass: fix example by instantiating serial_manager 2019-07-01 19:11:03 +10:00
Michael du Breuil 9fc954b030 AP_Compass: Reduce scope of BattMonitor include 2019-06-18 10:02:05 +10:00
Andrew Tridgell 7206258587 AP_Compass: use new get_earth_field_ga() API 2019-06-03 12:21:29 +10:00
Andrew Tridgell 38c775e6df AP_Compass: removed old mRoControlZeroF7 config 2019-05-30 15:39:57 +10:00
Andrew Tridgell 481ae22671 AP_Compass: support new sensor config setup 2019-05-30 15:39:57 +10:00
Andrew Tridgell 532b82b3a3 AP_Compass: use DRIVER_HMC5843 to match driver name 2019-05-30 15:39:57 +10:00
Andrew Tridgell ba9b92c4af AP_Compass: rename to EXPECT_DELAY_MS() 2019-05-15 15:33:48 +10:00
Andrew Tridgell ecc6f15dc0 AP_Compass: use EXPECT_DELAY() macro 2019-05-15 15:33:48 +10:00
Andrew Tridgell 9e7929adf6 AP_Compass: removed unusued AP_Common/Semaphore.h 2019-05-15 15:33:48 +10:00
Phillip Kocmoud 1f827004be AP_Compass: Enable AK09916 inside the ICM20948 2019-05-10 15:05:42 +10:00
Pierre Kancir 427a88a1fe AP_Compass: fix AP_Compass_test 2019-05-01 14:17:34 -07:00
Peter Barker bf23f1df67 AP_Compass: move responsibility for logging into library 2019-04-23 10:06:17 +10:00
Peter Barker 0e8722181f AP_Compass: take responsibility for not running cal if armed 2019-04-23 10:06:17 +10:00
Andrew Tridgell 21aee52604 AP_Compass: flag compass cal as long expected delay 2019-04-22 16:53:35 +10:00
Siddharth Purohit 6dc94b0e3d Compass: fix compass orientation for AK09916 on Cube 2019-04-17 06:47:14 +10:00
Peter Barker 5455d27e84 AP_Compass: specify floating point constants
Probably indicates compiler floating-point-constants directive isn't
working
2019-04-05 23:04:17 -07:00
Peter Barker 7ae7c48362 AP_Compass: remove set_and_save_offsets taking integer parameters
because the only caller that mattered had floats to offer...
2019-04-05 06:09:25 -07:00
Michael du Breuil d65f4b5ff8 AP_Compass: Fix implicit include of SRV_Channel 2019-04-05 20:12:53 +11:00
Sagnik Bhattacharya 4c809888de AP_Compass: add more comments to example 2019-04-02 19:41:45 +11:00
Peter Barker 54e3959a99 AP_Compass: move enabled parameter into compass library 2019-04-02 10:24:49 +11:00
Mirko Denecke 9c8a7efbc6 AP_Compass: remove unused field 2019-03-26 16:09:11 +11:00
Peter Barker 2d16c37844 AP_Compass: examples: compass init never fails 2019-03-13 13:06:50 +11:00
Peter Barker f8be4efed4 AP_Compass: init never fails; return void rather than bool 2019-03-13 13:06:50 +11:00
Siddharth Purohit 6ff8f52957 AP_Compass: add support for AK09916 connected over fourth IMU over I2C 2019-03-06 20:47:10 +11:00
Siddharth Purohit 104c433081 AP_Compass: AK09916 fix sample register structure 2019-03-06 20:47:10 +11:00
Siddharth Purohit cff8bf14b7 AP_Compass: add support for AK09916 via invensensev2 aux bus 2019-03-06 20:47:10 +11:00
Andrew Tridgell 7f3103073a AP_Compass: setup for fmuv6 2019-02-26 16:18:26 +11:00
Peter Barker 7184d5e860 AP_Compass: add missing override keywords 2019-02-22 15:01:09 +00:00
Peter Barker 97f2d946ab AP_Compass: remove unused variables from AP_Compass_RM3100.h 2019-02-20 19:23:54 +11:00
Peter Barker f0fd6fd996 AP_Compass: remove keywords.txt 2019-02-17 00:29:38 -08:00
Peter Barker 7ab6a5d94d AP_Compass: uavcan: reindent after WITH_SEMAPHORE change (NFC) 2019-02-16 14:33:11 +11:00
Peter Barker 5b06d01402 AP_Compass: uavcan: use WITH_SEMAPHORE in place of give/take _registry 2019-02-16 14:33:11 +11:00
Tom Pittenger 2cd485e7ae AP_Compass: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
thomass 513964cdad AP_Compass: RM3100 simplify unisgned to signed integer conversion 2019-02-10 08:00:49 +11:00
thomass 97f3627bd5 AP_Compass: RM3100 added default cycle count value check on initialization as a whoami substitute 2019-02-10 08:00:49 +11:00
thomass 488133c396 AP_Compass: RM3100 make compliant with common methods for accumulating and draining samples 2019-02-10 08:00:49 +11:00
thomass ede80773b9 AP_Compass: RM3100 stop passing frontend for compliance with backend class 2019-02-10 08:00:49 +11:00
thomass 8155c8b178 AP_Compass: added backend implementation for RM3100 compass 2019-02-10 08:00:49 +11:00
Andrew Tridgell 4003ea841c AP_Compass: change to 3 compasses in SITL 2019-02-09 13:04:52 +11:00
Andrew Tridgell 700519d805 AP_Compass: raise default max compass offsets
the larger offset doesn't present any problems for the compass
drivers, and helps on planes with magnetic hatches
2019-02-03 04:57:25 -08:00
Andrew Tridgell a21f4dc0c9 AP_Compass: update COMPASS_LEARN docs 2019-01-27 14:31:28 +11:00
Andrew Tridgell 1b95f17940 AP_Compass: removed F4Light 2019-01-21 21:57:21 +11:00
Peter Barker 6fc76a32af GLOBAL: use AP::logger() and strip redundant Log_ from methods 2019-01-18 18:08:20 +11:00
Peter Barker b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
Randy Mackay 68363ff4a2 AP_Compass: devid param desc include ReadOnly 2018-12-27 10:08:11 +09:00
Andrew Tridgell 3d9126ec4a AP_Compass: run lsm303d at 91Hz, not 100Hz
Peter and I have discovered an odd behaviour with the lsm303d mag. If
you fetch data a bit too soon then it will give a peridic oscillation
in the output.

Checking the data ready bit in the status register doesn't help. The
only fix I've found is to run the sampling at a bit lower rate
2018-11-30 11:39:54 +11:00
Peter Barker e7a981d2c3 AP_Compass: add override keyword where required 2018-11-08 11:30:12 +11:00
Phillip Kocmoud 27a2b8a350 AP_Compass: Increase default MAX compass offset
After discussing the @tridge and @rmackay9 it was suggested that raising the maximum allowable compass offset value would allow users of the LIS3MDL and possibly others with larger compass offsets to fly with the default setting. 

This has been deemed a fairly safe change that still allows for sufficient overhead to prevent saturation.
2018-10-30 09:25:51 +09:00
Lucas De Marchi 9d95579b2d AP_Compass: update TYPEMASK documentation
Add missing drivers IST8308 and MAG3110.
2018-10-25 20:19:30 -07:00
Lucas De Marchi 34fb98b1e0 AP_Compass: probe for IST8308 on external buses 2018-10-25 20:19:30 -07:00
Lucas De Marchi c3d87f91fc AP_Compass: add support to IST8308 2018-10-25 20:19:30 -07:00
Andrew Tridgell 70246cf954 AP_Compass: added notify events (LEDs and buzzer) for learning 2018-10-24 07:25:42 +10:00
Andrew Tridgell 23ddd994ec AP_Compass: allow multiple COMPASS_LEARN runs per boot 2018-10-24 07:25:42 +10:00
Andrew Tridgell 026089747d AP_Compass: use LEARN_NONE on learn completion
master doesn't yet have the statistical EKF learning
2018-10-24 07:25:42 +10:00
Andrew Tridgell 0a7170774a AP_Compass: allow learning of all compasses
slave secondary compasses to primary
2018-10-24 07:25:42 +10:00
Andrew Tridgell 5ac6309848 AP_Compass: enable in-flight compass learning system
using COMPASS_LEARN=3
2018-10-24 07:25:42 +10:00
Andrew Tridgell 84d7160128 AP_Compass: use new accumulate functions for UAVCAN 2018-10-19 16:03:45 +11:00
Andrew Tridgell 579a84b53e AP_Compass: use new accumulate functions for AK8963 2018-10-19 16:03:45 +11:00
Andrew Tridgell 55e4b64755 AP_Compass: don't apply offsets twice in SITL 2018-10-19 16:03:45 +11:00
Andrew Tridgell 925555c995 AP_Compass: move accum fields to frontend
this is needed to ensure they are per-instance. Without this the SITL
backend produces zero for all but the first instance. The same would
be true for any multi-instance backend
2018-10-17 12:54:22 +11:00
Andrew Tridgell 83065d5e88 AP_Compass: convert SITL to new accumulate approach 2018-10-17 12:54:22 +11:00
Andrew Tridgell a260792e9e AP_Compass: use WITH_SEMAPHORE()
and removed usage of hal.util->new_semaphore()
2018-10-17 12:54:22 +11:00
vierfuffzig b455c7a769 AP_Compass: add rotation option for AK8963_MPU9250
allows using non-neutrally rotated AK8963 compass on MPU9250 as internal
reference: https://github.com/ArduPilot/ardupilot/pull/9459
2018-10-17 09:35:49 +11:00
Andrew Tridgell 0b9d0a4559 AP_Compass: removed incorrect semaphore take() in QMC5883L driver 2018-10-16 10:47:26 -07:00
Lucas De Marchi 1a9c386df2 AP_Compass: MMC3416: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi e83b345cbb AP_Compass: MAG3110: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi ac2771b311 AP_Compass: LSM9DS1: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi 2324a28e39 AP_Compass: LSM303D: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi 38d1f8705f AP_Compass: LIS3MDL: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi b05b3b9932 AP_Compass: IST8310: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi 8d54276263 AP_Compass: BMM150: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi 565df5ec94 AP_Compass: AK09916: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi e769c6932f AP_Compass: QMC5883L: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi c0bccdaed6 AP_Compass: HMC5843: use common method to accumulate samples 2018-10-15 14:41:09 -07:00
Lucas De Marchi 329516373c AP_Compass: add common method to accumulate and drain samples
Instead of repeating on each driver the same sequence of steps,
let's move them to the common parent class. This only implements
it, but no driver was ported yet.
2018-10-15 14:41:09 -07:00
Andrew Tridgell 2f2be6afda AP_Compass: use rotation_equal() from AP_Compass 2018-10-01 14:26:56 +09:00
Andrew Tridgell 803f255c73 AP_Compass: fixed handling of duplication rotations
we have some rotations that are duplicated, such as ROLL_180_YAW_90
and PITCH_180_YAW_270. This copes with those in the auto-orientation
code
2018-10-01 14:26:56 +09:00
Lucas De Marchi 93d99dacd1 AP_Compass: UAVCAN: remove additional semaphore
We already inherit from AP_Compass_Backend, so use the semaphore from
there to synchronize with the main thread, like the other backends.
2018-09-06 08:23:02 +10:00
Lucas De Marchi cd9b08dbae AP_Compass: rename variable for more buses
"all_external" reflects better the fact that we can have more than 2
buses (and now we are using the foreach macro).
2018-09-06 08:23:02 +10:00
Lucas De Marchi de535dc573 AP_Compass: remove unused external and name arguments
Aka "fix copy and pasta".
2018-09-06 08:23:02 +10:00
Lucas De Marchi 4039b51810 AP_Compass: stop passing frontend pointer
Let AP_Compass_Backend call AP::compass() *once* instead of passing
the frontend pointer over and over.
2018-09-06 08:23:02 +10:00
Lucas De Marchi 585b6dce0d AP_Compass: support more external compasses on aerofc
Let it probe on external bus. Aerofc has an HMC5883 on internal bus, but
we don't want it enabled as it interferes with the internal baro. Also
the rotation for the compass that comes with Aero RTF is different from
the other that got added later. That means people would need to orient a
third party IST8310-based compass differently on Aero RTF than on other
boards... that's a problem of having orientation based on the chip that
can't be solved on this commit.
2018-09-06 08:23:02 +10:00
liang.tang 2c0b9a16a5 AP_Compass: fix UAVCAN mag message handlers 2018-09-05 17:22:34 +10:00
Siddharth Purohit 14b701cff8 AP_Compass: move UAVCAN mag subscribers and handlers to Compass Backend 2018-08-29 22:54:59 +01:00
Francisco Ferreira 317e8e0296
AP_Compass: adapt to changes in AP_BoardConfig_CAN 2018-08-12 13:35:03 +01:00
Andrew Tridgell 3ed7c060df AP_Compass: address review comments 2018-08-07 10:00:10 +10:00
Jonathan Challinger cefd998177 AP_Compass: add expected DEV_ID parameters 2018-08-07 10:00:10 +10:00
Jonathan Challinger 878e84a015 AP_Compass: correct edge case where checks pass when saved dev_id != detected dev_id 2018-08-07 10:00:10 +10:00
Randy Mackay c88926f227 Compass: remove accumulate from example sketch 2018-08-06 11:05:34 +10:00
Randy Mackay 99b54935db Compass: remove accumulate
this method is a noop on all backends
2018-08-06 11:05:34 +10:00
Andrew Tridgell 2ded88e611 AP_Compass: allow override of QMC5883L orientation 2018-07-30 17:26:19 +10:00
Randy Mackay cb3731e08e Compass: fix compile warning in calibrator output 2018-07-30 14:57:01 +10:00
Andrew Tridgell e39d070b78 AP_Compass: clear DEV_ID for undetected compasses
this prevents user confusion with the number of compasses detected
2018-07-30 13:07:55 +10:00
Andrew Tridgell b181340fd9 AP_Compass: allow override of COMPASS_AUTO_ROT 2018-07-28 18:05:12 +10:00
Andrew Tridgell cbd6f4cc21 AP_Compass: fixed compass for tailsitters in SITL 2018-07-20 14:21:06 +10:00
Andrew Tridgell 027beb0dc1 AP_Compass: rename COMPASS_ROT_AUTO to COMPASS_AUTO_ROT
request from Randy
2018-07-18 16:07:19 +10:00
Andrew Tridgell 15d2daabf0 AP_Compass: don't do auto-orientation if using ROTATION_CUSTOM 2018-07-18 16:07:19 +10:00
Andrew Tridgell a73492b40a AP_Compass: fixed newline in statustext 2018-07-18 16:07:19 +10:00
Andrew Tridgell 196ba0e858 AP_Compass: make COMPASS_ROT_AUTO take 3 values
0 for disabled, 1 for check only, 2 for check and fix
2018-07-18 16:07:19 +10:00
Andrew Tridgell d15a4ad92a AP_Compass: improved error reporting, check all compasses
this uses extensions to the MAG_CAL_REPORT message to convey failures
of orientation checking.

It also checks all compasses, external or internal. It only tries to
fix the orientation if it is external
2018-07-18 16:07:19 +10:00
Andrew Tridgell a5749c1869 AP_Compass: allow diagonals and off-diagonals to be calculated on rot change
this re-runs the fit on change in orientation
2018-07-18 16:07:19 +10:00
Andrew Tridgell b4c7d1925e AP_Compass: allow for runtime changes to SIM_MAG_DIA_?
this makes for easier testing
2018-07-18 16:07:19 +10:00
Andrew Tridgell 3c2e8baee2 AP_Compass: improved orientation reporting
and fail magcal if we fail orientation detection for an external
compass
2018-07-18 16:07:19 +10:00
Andrew Tridgell 8b0f40b402 AP_Compass: implement automatic compass orientation
this automatically determines the compass orientation when doing a 3D
compass calibration, if COMPASS_ROT_AUTO is enabled.
2018-07-18 16:07:19 +10:00
Andrew Tridgell 4acc06df87 AP_Compass: support diagonal, off-diagonal and rotation in SITL
compass
2018-07-18 16:07:19 +10:00
Andrew Tridgell 3c0ed01fd0 AP_Compass: prevent use of null dev_icm device in ICM20948 driver 2018-07-14 17:51:50 +10:00
Andrew Tridgell 71647cfc6b AP_Compass: removed HMC5843 compass probe error 2018-07-14 17:51:50 +10:00
Andrew Tridgell ff6d639ed7 AP_Compass: separated out external compass probing
this allows any ChibiOS board to specify that it wants to probe for
all possible external compass types with a define in hwdef.dat

It also implements duplicate compass detection for all i2c drivers,
ensuring we can't get a load of a driver on the same bus/address twice
2018-07-14 17:51:50 +10:00
Andrew Tridgell 7ec6522b9d AP_Compass: default to right mag offsets for SITL 2018-07-13 10:19:01 +10:00
Andrew Tridgell 2fe2c8fbda AP_Compass: initialise compass IDs saved in SITL
this ensures we don't get uncalibrates compasses in SITL
2018-07-13 10:19:01 +10:00
Andrew Tridgell 823c4523b3 AP_Compass: added SITL device IDs 2018-07-13 10:19:01 +10:00
Andrew Tridgell f88a4b3a2f AP_Compass: fixed compass orientations on PH4 2018-07-10 18:29:14 +10:00
Andrew Tridgell 8fd69250bd AP_Compass: use I2C bus masks
this allows for external compasses on all external I2C ports, while
retaining existing device ordering
2018-07-10 15:39:47 +10:00
Peter Barker 051c811bfb AP_Compass: make compass_cal_requires_reboot const 2018-07-03 13:44:11 +10:00
Peter Barker 4c2925d693 AP_Compass: remove pointless initialisations
If you are allocating one of these on the stack you're doing something
wrong.
2018-07-02 10:44:34 +10:00
Lucas De Marchi 49d08ba72a Global: remove minlure
Minlure is a port of ArduPilot to Minnow Board connected to daughter
board. Very few of those were produced and nobody is flying with it.

It served its purpose and all the the improvements to ArduPilot remain
regardless of it not being supported anymore. Now it's just adding
maintenance work with no clear benefit, so pull the plug.
2018-06-26 07:32:08 -07:00
Peter Barker 9eb53e333b AP_Compass: tidy consistency calculations
AP_Compass: normalize vectors in-place to save a few bytes (thanks MdB)
2018-06-26 18:37:55 +10:00
Patrick José Pereira e456655932 AP_Compass: Use SITL singleton
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-06-26 00:02:01 +01:00
Andrew Tridgell b225868711 AP_Compass: detect conflict between AK09916 and ICM20948
this detects if we have both a AK09916 and an ICM20948 on the same i2c
bus. If that is found then the ICM20948 is disabled as it otherwise we
will have two devices on the same i2c address
2018-06-12 09:04:43 +10:00
Eugene Shamaev df6b7ed5ea AP_Compass_UAVCAN: update 2018-06-09 22:46:48 -07:00
Eugene Shamaev 9195ba80fc AP_Compass: helper func 2018-06-09 22:46:48 -07:00
Eugene Shamaev baa6daf270 AP_Compass: reducing indenting by linearizing the logic 2018-06-09 22:46:48 -07:00
Andrew Tridgell 2d9df83ed5 AP_Compass: probe for ist8310 on bus 2 as well as 0 for fmuv5 2018-06-06 15:01:38 +10:00
Andrew Tridgell 99540a184c AP_Compass: enable FMUv5 compass 2018-06-06 07:15:41 +10:00
Andrew Tridgell ccdfc75dd9 AP_Compass: placeholder for FMUv5 2018-06-06 07:15:41 +10:00
Peter Barker a3a1967e05 AP_Compass: add AP::compass() singleton getter 2018-05-17 15:37:14 +10:00
Francisco Ferreira 0a3af28d17 AP_Compass: remove Qualcomm board support 2018-05-17 09:57:20 +10:00
mirkix 85fe07f1f0 AP_Compass: enable probe HMC5843 for PocketPilot 2018-05-12 07:16:50 +10:00
night-ghost 4cffbf52d3 AP_COMPASS: fix MAG3110 driver 2018-05-07 11:45:29 +10:00
night-ghost a05c79f1d8 Compass: fix HAL_F4light compilation errors 2018-04-30 08:32:58 +10:00
Jacob Walser 44d0f7b2a1 AP_Compass: update ORIENT @Values 2018-04-24 13:04:37 +01:00
Jacob Walser 6699c59ad3 AP_Compass: add support for custom board orientations 2018-04-24 13:04:37 +01:00
kozinalexey 444c0bb54c AP_Compass: added ChibiOS external compass config 2018-04-14 11:09:34 +10:00
Andrew Tridgell eccc4f375b AP_Compass: fixed build warning 2018-04-12 11:50:44 +10:00
night-ghost 677f2bebc3 AP_Compass: added autodetect of all known compasses on external bus 2018-04-11 15:00:36 +10:00
night-ghost f26bb0cfbe AP_Compass: added range filter to backend, added its use in some sensors (thanks khancyr for style correction) 2018-04-11 14:46:42 +10:00
Peter Barker face8151b7 AP_Compass: include required header 2018-04-09 11:34:35 +10:00
Michael du Breuil c66d15efd7 AP_Compass: Read current for compensation from the battery singleton 2018-03-27 22:12:21 +01:00
Nathan E dcf127b73d Compass: clarify compass orientation description
Resolves an error directing users to reference the flight controller (instead of the frame) for COMPASS_ORIENT.
Changed wing to side for all vehicles
2018-03-21 09:01:45 +09:00
LinJieqiang c73e7f0cf3 add IST8310 compass sensors in AP_Compass.cpp 2018-03-09 11:25:35 -08:00
Andrew Tridgell 8b3db7c09f AP_Compass: allow for HAL_COMPASS_NONE 2018-03-02 12:52:50 +11:00
Andrew Tridgell 487b615faa AP_Compass: allow for override of MAG_BOARD_ORIENTATION 2018-03-02 12:52:50 +11:00
Peter Barker 46dbb248f9 AP_Compass: correct compiler warnings
In file included from ../../libraries/AP_Compass/AP_Compass.h:14:
../../libraries/AP_Compass/Compass_PerMotor.h:57:13: warning: private
field 'channel' is not used [-Wunused-private-field]
    uint8_t channel;

AP_Compass: fix compiler warning

../../libraries/AP_Compass/AP_Compass_MAG3110.h:52:11: warning: private
field 'compass_len' is not used [-Wunused-private-field]
    float compass_len;
          ^
2018-03-02 09:26:37 +09:00
Andrew Tridgell f61591c426 AP_Compass: added SP01 board type 2018-02-14 18:27:00 +11:00
Andrew Tridgell 52815cd952 AP_Compass: fixed compass orientation for mini-pix 2018-02-14 18:27:00 +11:00
ljwang 231aa16835 AP_Compass: support mini-pix 2018-02-14 18:27:00 +11:00
Randy Mackay 3bec25da85 AP_Compass: resolve compiler warnings 2018-02-10 08:54:34 +09:00
Andrew Tridgell 2c8e6bb834 AP_Compass: use generic defines for BMM150 2018-02-08 17:36:33 +11:00
Andrew Tridgell 57a3bc1397 AP_Compass: new compass learning system
this learns compass offsets using magnetic tables and compass
observations
2018-02-08 17:36:33 +11:00
Andrew Tridgell ca30f6aec8 AP_Compass: added per-motor compass calibration
this allows for a motor calibration vector per motor
2018-02-08 17:36:33 +11:00
Andrew Tridgell 2cc0f25ca0 AP_Compass: support PCNC1 2018-02-08 17:36:33 +11:00
Andrew Tridgell 0d8cdd2728 AP_Compass: fixed warning 2018-02-07 20:33:45 +11:00
Andrew Tridgell 23803df038 AP_Compass: allows boards to define orientation of HMC5843 2018-02-07 20:33:45 +11:00
Siddharth Purohit f0f4239d4a AP_Compass: skip using posix headers for non posix systems 2018-02-07 20:33:45 +11:00
LukeMike 432f6c2a4a VRBRAIN / APCompass: added compass sensor init for VR Brain boards 2018-02-05 08:26:49 +11:00
Andrew Tridgell 2067e25523 AP_Compass: make length filter in MAG3110 optional
compile time for now, later can may become parameter
2018-02-02 21:07:40 +11:00
night-ghost b6bf90ab93 AP_Compass: mAG3110 driver 2018-02-02 21:07:40 +11:00
Andrew Tridgell 20d75f52c2 AP_Compass: use calloc in preferance to malloc 2018-01-17 11:22:05 +11:00
Andrew Tridgell b741c6c29e AP_Compass: fixed build error on ChibiOS 2018-01-15 11:46:02 +11:00
Andrew Tridgell 8e87c30a33 AP_Compass: fixed MindPX-v2 compass orientations 2018-01-15 11:46:02 +11:00
Andrew Tridgell 36a141f9f1 AP_Compass: support MindPX-v2 2018-01-15 11:46:02 +11:00
Andrew Tridgell 743714de4c AP_Compass: support ChibiOS FMUv4 2018-01-15 11:46:02 +11:00
Andrew Tridgell 5d9fa7f85b AP_Compass: support ChibiOS 2018-01-15 11:46:02 +11:00
Randy Mackay 86cbc445bd AP_Compass: ICM20948 default rotation to Pitch180Yaw90 2018-01-12 08:16:41 +09:00
Andrew Tridgell f326377a5c AP_Compass: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Mark Whitehorn b0e2f06a7a AP_Compass: add LIS3MDL probe for Pixracer 2017-12-08 09:49:25 +11:00
HeBin 26de6de848 AP_Compass: add Robsense PhenixPro Devkit Board support 2017-11-22 10:10:21 -08:00
Georgii Staroselskii 710594eee3 AP_Compass: enable compass on Edge 2017-10-20 13:03:08 -07:00
Andrew Tridgell 5646afac1c AP_Compass: avoid double detection of the AK09916
with an ICM20948 we can double detect the compass due to the i2c pass-thru
2017-10-04 11:49:06 +11:00
Lucas De Marchi 2fc6e52431 AP_Compass: use IST8310 and HMC5883 as external mags 2017-09-27 09:25:34 -07:00
Francisco Ferreira 6e286a2e66
AP_Compass: re-enable QMC5883 compass driver by default
This reverts commit a657daf635
2017-09-27 12:24:36 +01:00
Lucas De Marchi 69b6d95cb2 global: use static method to construct AP_Board_Config{,_CAN} 2017-09-26 03:01:21 +01:00
Lucas De Marchi c1a957fbf3 global: use static method to construct Compass 2017-09-26 03:01:21 +01:00
Lucas De Marchi 320260a151 AP_Compass: add static create method 2017-09-26 03:01:21 +01:00
Andrew Tridgell 678bd084b7 AP_Compass: added IST8310 on FMUv3 I2C 2017-09-23 08:07:18 +10:00
Rufus Wong 9491f7da55 AP_Compass: Add break to prevent fallthrough of PIXRACER to PIXHAWK_PRO 2017-09-18 19:57:22 +10:00
Lucas De Marchi b1740e2d9c AP_Compass: remove raspilot 2017-09-12 15:06:19 -07:00
Lucas De Marchi d5f57fdd93 AP_Compass: AK8963: remove fallback to timer thread
Now that the bus thread from the AuxiliaryBus is implemented we can
remove the fallback.
2017-09-11 09:52:41 -07:00
davidaroyer ad18e99bef AP_Compass: add support for Aerotenna OcPoC-Zynq hardware 2017-09-08 07:30:49 -07:00
Michael du Breuil fb77d0739e AP_Compass: Remove unused time calls, stash the time in the read loop 2017-09-07 19:53:14 +01:00
Mark Whitehorn 3642ecd9ef AP_COMPASS: fix errors in addition of alternate LIS3MDL I2C address
testing shows ROTATION_YAW_90 is correct for mRo Neo M8N GPS/compass
2017-08-10 19:46:26 +10:00
Mark Whitehorn a6e9baa8f6 AP_Compass: probe for LIS3MDL in mRo Neo-M8N GPS module 2017-08-10 19:46:26 +10:00
Francisco Ferreira 6cf8791eb5
AP_Compass: correct comment in LIS3MDL driver
Commit 17f2393c1b decreased timer frequency but didn't change comment to match
2017-08-04 19:56:26 +01:00
Lucas De Marchi 6bab28397a AP_Compass: remove user of timesliced logic 2017-08-02 08:00:53 -07:00
ljwang 5a7ec7d429 Delete write registers at start,using another way to repair 2017-08-02 16:15:14 +10:00
ljwang 648871a388 Fixed the QMC5883 identification,add check ID 2017-08-02 16:15:14 +10:00
Randy Mackay a657daf635 Compass: disable QMC5883 compass driver by default
This driver causes occasional heading issues so disabling until these are resolved
2017-07-25 09:27:29 +09:00
Kevin Lopez Alvarez df406c4389 AP_Compass : increase max possible offset 2017-07-24 13:48:20 +10:00
Kevin Lopez Alvarez 17f2393c1b AP_Compass: Decrease LIS3MDL ODR and timer 2017-07-24 13:48:20 +10:00
Kevin Lopez Alvarez 08b531e6a8 AP_Compass: LIS3MDL correct orientation 2017-07-24 13:48:20 +10:00
Kevin Lopez Alvarez cf8c1c2665 AP_Compass: Remove comments and use correct board number 2017-07-24 13:47:44 +10:00
Kevin Lopez Alvarez 1467daee2a AP_Compass: add ppro support
disable lis3mdl for now
2017-07-24 13:47:06 +10:00
Andrew Tridgell 732dc5984a AP_Compass: added COMPASS_TYPEMASK parameter
this allows driver type to be disabled, to avoid probing them and
wasting CPU on sensors that are not being used

This also moves UAVCAN compass to be detected last, as discussed in the
dev call
2017-07-19 15:53:22 +10:00
Peter Barker 6b53b5b5f3 AP_Compass: make handle_mag_cal_command return type stricter 2017-07-17 14:17:19 +01:00
ljwang 603e903ccd AP_Compass: QMC5883 Add internal i2c bus and fix rotation error 2017-07-12 12:56:59 +10:00
Eugene Shamaev aa1f6a7587 AP_Compass: united enumeration on startup, multiple CAN drivers, correct dev_id based on network and node ID 2017-07-03 11:44:32 +01:00
Miguel Arroyo ee328c9683 AP_Compass: move SITL Compass to standard sensor backend model 2017-06-29 09:22:08 +10:00
Andrew Tridgell f3d995a716 AP_Compass: improved robustness of BMM150 detection code
cope with bus errors on startup
2017-06-21 16:25:37 +10:00
Andrew Tridgell 68460144df AP_Compass: added retries on init in BMM150 2017-06-21 16:25:37 +10:00
Andrew Tridgell 9b093c4a33 AP_Compass: fixed a numerical issue in BMM150 driver
we were getting the following:

  ret=-32768 z=5 rhall=6267 z1=23743 z2=712 z3=-1035 z4=0 xyz1=6264 dividend=163840 dividend2=-1073577207 divisor=5253

the signed/unsigned casts for rhall and xyz1 did not produce the
desired result
2017-06-21 16:25:37 +10:00
Andrew Tridgell 0623db98d6 AP_Compass: cope with bus errors in BMM150
if we have bus errors the BMM150 can get confused, giving rubbish
output. This uses the checked register code to reset, and a full soft
reset after 250ms of no samples.
2017-06-21 16:25:37 +10:00