Commit Graph

857 Commits

Author SHA1 Message Date
Andrew Tridgell a0cf4e158a AP_Compass: revert change to RM3100 scale factor and increase scale limit
This reverts the change from #13895 and instead resolves the issue by
increasing the scale factor limit to 1.4

There is an open question as to why some RM3100 compasses show a
different scale factor (by about 1.25 times) to other versions of the
same sensor. As we haven't resolved this properly it seems the correct
thing to do is follow the datasheet but allow for a wider range of
scale factors to cope with the variation between sensors
2020-05-24 15:06:15 +10:00
Andy Piper 63b5711a4d AP_Compass: use a separate slot for the custom compass rotation 2020-05-24 07:46:17 +10:00
Andy Piper f5320e8816 AP_Compass: make sure SITL rotation gets initialized like all the others
don't remove a custom rotation that has already been set
2020-05-21 16:28:27 +10:00
Andrew Tridgell 4a80313fdd AP_Compass: added get_num_enabled()
used by EKF3
2020-05-09 12:33:33 +10:00
Andy Piper b7b2d9a6ce AP_Compass: add support for custom compass rotation via COMPASS_CUS_{ROLL,PIT,YAW}
add reboot required for parameters that need it
disable custom rotation on AP_Periph devices
2020-05-05 09:25:18 +10:00
Andrew Tridgell 66655212b1 AP_Compass: fixed compass ordering bug with AP_Periph
when a user swaps compasses on AP_Periph we want to immediately
replace it. The compass ordering code was rejecting the new compass
and calling panic as it was out of slots. This changes the AP_Compass
ordering so that when we only have a single compass we operate in a
very simple manner where we always accept the first compass found
2020-04-29 18:51:16 +10:00
Andrew Tridgell 660f65e6b8 AP_Compass: use GCS_SEND_TEXT() 2020-04-29 07:36:55 +10:00
Paul Riseborough 8e9dc1c393 AP_Compass: Add accessor function for COMPASS_AUTODEC 2020-04-28 11:42:31 +09:00
Mark Whitehorn 570aa929ca AP_Compass: handle ROTATION_CUSTOM in SITL 2020-04-28 10:57:26 +10:00
Michael du Breuil 9b404669c8 AP_Compass: Skip rotating the mag data when the board orientation is none 2020-04-28 10:37:00 +10:00
Peter Barker c36e06e7fa AP_Compass: add documentation for COFS, compass-learning message 2020-04-14 07:34:59 +10:00
Peter Barker 851d9ae1ef AP_Compass: log message information for MMC3416 2020-04-12 08:36:48 +10:00
Andrew Tridgell dd4cf6ccdd AP_Compass: change RM3100 device ID
changed scale factor means users need to recalibrate
2020-04-08 11:21:51 +10:00
Andrew Tridgell 18c3efc377 AP_Compass: fixed scaling of RM3100
scale factor was off by 200/256, resulting in COMPASS_SCALE of about
1.28

thanks to Arace for noticing
2020-04-08 11:21:51 +10:00
murata 7ec0cb47a5 AP_Compass: const extern hal reference 2020-04-07 20:45:51 +09:00
Andrew Tridgell 6d42e9502b AP_Compass: fixed unreg compass check for AP_Periph
this fixes detection of compasses on peripherals where
COMPASS_MAX_UNREG_DEV is 0
2020-03-26 18:10:13 +11:00
Peter Barker 0665c379de AP_Compass: correct use of incorrect backend-count macro 2020-03-17 11:25:16 +11:00
Peter Barker 934d05f4ff AP_Compass: correct incorrect and misleading comment 2020-03-11 22:24:36 +11:00
Rishabh cbccdfa8a3 AP_Compass: Alert GCS if user tries to calibrate compass while vehicle is armed 2020-03-03 11:37:19 +11:00
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