Commit Graph

1052 Commits

Author SHA1 Message Date
Peter Barker 38abec2133 AP_Compass: rename AP_AHRS::get_position to get_location 2022-01-25 10:47:22 +11:00
Andrew Tridgell 3f2a72f9db AP_Compass: only magcal detected compasses
inflight compass learning with COMPASS_LEARN=3 was not working with
less than 3 compasses, as the force_use parameter was preventing
skipping compasses. This fixes it to calibate all detected compasses
that have USE enabled
2022-01-18 12:01:14 +11:00
Peter Barker ed608d37f6 AP_Compass: add and use AP_SIM_COMPASS_ENABLED 2022-01-17 15:24:02 +11:00
Willian Galvani c285f4c748 AP_Compass: Retry reading MMC5983 ID up to 10 times 2022-01-12 11:03:15 -05:00
Andrew Tridgell 45bfc75e4b AP_Compass: added register checking for AK09916 mode
this allows AK09916 on I2C to recover from a power outage in flight
2021-12-28 16:04:36 +11:00
Jaaaky d27f122295 AP_Compass: Fix multi #include's 2021-12-21 10:38:46 +11:00
bugobliterator 957da68da5 AP_Compass: fix compilation issue with declaring var after goto 2021-12-15 22:11:10 +11:00
Hwurzburg 8ddb12d9cb AP_Compass: change UAVCAN in metadata to DroneCAN 2021-12-15 09:53:21 +11:00
Peter Barker 31dd17a743 AP_Compass: avoid loaded-value checks in case of HAL_USE_EMPTY_STORAGE 2021-12-14 11:13:28 +11:00
Andrew Tridgell 8eb40bafc5 AP_Compass: revert compass parameter changes 2021-12-04 16:51:53 +11:00
Iampete1 7ad1886667 AP_Compass: reinstate MOTCT underscore 2021-12-02 12:27:09 +11:00
Iampete1 bf21ce8af6 AP_Compass: add new line after old param metadata 2021-12-02 12:27:09 +11:00
Iampete1 e24c90a871 AP_Compass: reinstate old param descriptions 2021-11-30 08:14:43 +09:00
Iampete1 6ba87dfe9a AP_Compass: add param conversion 2021-11-30 08:14:43 +09:00
Iampete1 2fa2e70e7e AP_Compass: SITL: use new scale param 2021-11-30 08:14:43 +09:00
Iampete1 071ff39ff8 AP_Compass: move instance params to shared table 2021-11-30 08:14:43 +09:00
Andrew Tridgell a4a0607160 AP_Compass: added AP_RM3100_REVERSAL_MASK
this allows for fixing setups where the RM3100 has been installed on a
board with one or more axes reversed
2021-11-24 07:17:13 +11:00
Patrick José Pereira 91ea129be3 AP_Compass: Add support to AK09915
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2021-11-10 18:11:34 -03:00
Willian Galvani 4c756fd7ef AP_Compass: update MMMC5XX3 driver to support only mmc5983
Registers changed
Product ID changed
Data is now Big endian
Results are now 18 bits instead of 16, but we only consume 16.
Added SPI support

Co-authored-by: Patrick Pereira <patrickelectric@gmail.com>
Co-authored-by: Jacob Walser <jwalser90@gmail.com>
2021-11-10 11:38:25 +11:00
Iampete1 1771481779 AP_Compass: never override custom orentation in calabration 2021-11-10 09:28:54 +11:00
Peter Barker 0627ee66c5 AP_Compass: clarify all_configured calculations 2021-11-01 21:28:17 +11:00
Buzz 8d9f161b40 AP_Compass: add support for ICM20948 I2C variant and rename existing one as SPI variant
Author: Charles Villard <charlesvillard10@gmail.com>
Author: Buzz <davidbuzz@gmail.com>
2021-11-01 17:40:31 +11:00
Andrew Tridgell 2b19b8a988 AP_Compass: switched to GSF based compass learning
this makes inflight compass learning faster, more accurate and much
simpler
2021-11-01 09:00:27 +11:00
Andrew Tridgell b0674a2b35 AP_Compass: support 2nd address for ICM20948 compass 2021-10-18 08:29:29 +11:00
Pierre Kancir 12e1f67326 AP_Compass: only update last_update_ms on raw_field update if on calibration 2021-10-13 19:45:03 +11:00
Andrew Tridgell 613f970870 AP_Compass: added AK09918 support
minor update over AK09916
2021-10-06 18:16:00 +11:00
Hwurzburg 3b543a8ceb AP_Compass: Change orientation labels to match order of rotation 2021-10-05 11:22:32 +11:00
Tom Pittenger d45526ff42 AP_Compass: fix periph-heavy compile errors with different things enabled 2021-09-24 10:47:13 -05:00
Peter Barker 224ff97f5c AP_Compass: move from HAL_NO_GCS to HAL_GCS_ENABLED 2021-09-22 21:37:00 +10:00
Peter Barker 875b6331a4 AP_Compass: fix examples for AP_AHRS_DCM becoming backend 2021-08-31 14:28:53 +10:00
Pierre Kancir 4481bc6147 AP_Compass: fix externalAHRS detection
'A = B >= C' kind. The expression is calculated as following: 'A = (B >= C)'
2021-08-25 16:37:13 +09:00
Peter Barker 62f6a5b033 AP_Compass: fail calibration unless at least 1 compass to cal 2021-08-24 10:18:38 +10:00
Andrew Tridgell ffe8add56d AP_Compass: mark logger Write() calls as streaming where appropriate 2021-08-18 10:20:03 +10:00
bugobliterator 33f9c38528 AP_Compass: change class name from SITL::SITL to SITL::SIM 2021-08-05 07:25:31 +10:00
Peter Barker 944b82a7be AP_Compass: make is_calibrating const 2021-07-30 17:37:08 +10:00
Peter Barker d5ea202c20 AP_Compass: mark COMPASS_ENABLED as @RebootRequired 2021-07-30 12:19:42 +10:00
Peter Barker c351150a46 AP_Compass: use AP::compass().available in place of enabled() 2021-07-30 12:19:42 +10:00
Peter Barker 1d9bfdf8dd AP_Compass: stop using AHRS as conduit for Compass pointer 2021-07-30 12:19:42 +10:00
Peter Barker 658c978c9d AP_Compass: add and use compass.available()
Covers both being enabled and initialised
2021-07-30 12:19:42 +10:00
Peter Barker 8bbed968de AP_Compass: remove unused variable 2021-07-30 12:19:42 +10:00
Iampete1 e5d4620372 AP_Compass: update orientation param values 2021-07-28 18:09:05 +10:00
Iampete1 78e025af39 AP_Compass: add Calibrator index test 2021-07-28 18:09:05 +10:00
Iampete1 36a80d46e3 AP_Compass: support auto orientation for new rotations 2021-07-28 18:09:05 +10:00
Andrew Tridgell aa0a77049e AP_Compass: fixed build warning on g++ 10.2 2021-07-27 19:50:21 +10:00
Andrew Tridgell b6dbc618dc AP_Compass: replaced Pixhawk with more appropriate wording in docs 2021-07-22 07:48:12 +10:00
Siddharth Purohit 7cbb3d8a3f AP_Compass: allow compass cal option for AP_Periph if defined 2021-07-02 08:50:16 +10:00
Nicola Grossenbacher 755ca37326 AP_Compass: added probe method for MMC3416 compass 2021-06-22 09:52:49 +10:00
Peter Barker 9791fdeb11 AP_Compass: remove unused setup_earth_field 2021-06-15 09:47:31 +10:00
Peter Barker a9621ed802 AP_Compass: remove HIL support 2021-06-15 09:47:31 +10:00
Andrew Tridgell f2b7d44772 AP_Compass: fixed build with AP_Periph compass 2021-06-09 15:09:46 +10:00
Andrew Tridgell 684e32068b AP_Compass: removed perf counters 2021-06-07 14:29:27 +10:00
Siddharth Purohit 8590bfea63 AP_Compass: use first available compass in priority list 2021-06-02 17:10:19 +10:00
Andrew Tridgell d5dccaa734 AP_Compass: added heater compensation to internal mag for Pix32v5 2021-06-01 08:07:49 +10:00
bugobliterator 0172b867b7 AP_Compass: fix "no detected backends" error with single compass 2021-05-26 18:30:45 +10:00
murata 072a321a01 AP_Compass: Use the value of pi 2021-05-23 16:58:55 +10:00
Siddharth Purohit b31a04e52b AP_Compass: allow single compass configure for autopilot boards 2021-05-19 18:04:20 +10:00
Peter Barker 519a71504f AP_Compass: move from HAL_NO_LOGGING to HAL_LOGGING_ENABLED 2021-05-19 17:38:47 +10:00
Andrew Tridgell 60f60356b8 AP_Common: hide unnecessary params on AP_Periph
we only use raw compass
2021-05-09 06:44:19 +10:00
Kawamura b305b3b074 AP_Compass: Send message to gcs for compass learn 2021-05-07 08:43:20 +10:00
Andrew Tridgell 9cc883a8c0 AP_Compass: fixed the IST8308 on CubeBlack
CubeBlack needs to probe both internal and external buses
2021-04-20 10:42:54 +10:00
Jacob Walser 8defcb9169 AP_Compass: add memsic MMC5883 driver 2021-04-07 16:03:57 +10:00
Randy Mackay 64c4b6a42b AP_Compass: remove unused set_use_for_yaw 2021-03-31 19:16:01 +11:00
Andrew Tridgell 0f5dd40052 AP_Compass: removed assert calls
these waste flash space and do not do us any good
2021-03-25 14:03:40 +11:00
Pierre Kancir 1082a799c2 AP_Compass: fix example 2021-03-03 18:07:38 +11:00
Andrew Tridgell f8e0227c8c AP_Compass: added force_save_calibration() 2021-02-15 07:24:40 +11:00
Andrew Tridgell a90b54ba6e AP_Compass: allow for AK09916 correction by heater duty cycle 2021-02-09 11:32:19 +11:00
Marko 00d0fe876d AP_Compass: Added support for internal i2c bus to VRBrain-v51
Now the internal compass HMC5883 of the VRBrain-v51 is correctly recognized

Co-authored-by: Pierre Kancir <pierre.kancir.emn@gmail.com>
2021-02-03 19:00:48 +11:00
Patrick José Pereira 842360b5e3 AP_Compass: Add missing const in member functions
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2021-02-03 18:45:14 +11:00
Andrew Tridgell d0d480e858 AP_Compass: fixed matrix inverse for new name 2021-01-21 13:09:21 +11:00
Andrew Tridgell 0c156e324b AP_Compass: enable temperature on lsm303d 2021-01-21 13:09:21 +11:00
Andrew Tridgell eeb728237f AP_Compass: removed error on BMM150
it may be probed at multiple addresses, don't throw lots of errors
2021-01-13 18:10:25 +11:00
Andrew Tridgell a068e95a48 AP_Compass: added ExternalAHRS driver 2021-01-05 21:13:12 +11:00
Andrew Tridgell 09603e29ce AP_Compass: fixed external handling for BMM150 2021-01-02 10:31:15 +11:00
Andrew Tridgell 3d4a8829f3 AP_Compass: added BMM150 as available external mag 2021-01-02 10:31:15 +11:00
Andrew Tridgell 353ec29ab6 AP_Compass: removed have_ekf_logging() 2020-11-10 16:15:45 +11:00
Andrew Tridgell f7daa4a93a AP_Compass: raise max scale factor and make symmetric 2020-11-10 10:15:39 +11:00
giacomo892 640990a7c7 AP_Compass: Fix TYPEMASK bitmask 2020-10-27 15:40:25 +11:00
bugobliterator 84f3e70b10 AP_Compass: add set_dev_id when initialising HIL 2020-09-30 17:01:37 +10:00
Siddharth Purohit 72cf040f81 AP_Compass: add option to selectively disable Compass I2C backend 2020-09-24 12:32:19 +10:00
Andrew Tridgell 8920362212 AP_Compass: default SITL compass to having scale factor set 2020-09-20 09:25:57 +10:00
Andrew Tridgell bfa2feb8d8 AP_Compass: fixed build warnings for MSP with AP_Periph 2020-09-15 09:40:03 +10:00
yaapu 5e88a856e9 AP_Compass: support for MSP compass 2020-09-09 06:35:50 +10:00
Andrew Tridgell 37866ec3cf AP_Compass: fixed compass logging when first compass unhealthy
keep logging compasses if any are healthy
2020-09-08 11:01:14 +10:00
Andrew Tridgell c2feebea13 AP_Compass: allow simulation of compass sensor failure 2020-09-08 11:01:14 +10:00
bugobliterator de6b48f922 AP_Compass: set only if changed to save space in param storage 2020-09-02 17:06:05 +10:00
Siddharth Purohit 5cd6175d94 AP_Compass: fix reordering compass devid by priority at boot 2020-08-25 08:30:04 +10:00
Siddharth Purohit bf1a7799f8 AP_Compass: move to using CANManager library 2020-08-19 17:31:09 +10:00
Andrew Tridgell 2a662793c2 AP_Compass: support probing RM3100 on all 4 addresses 2020-08-02 12:25:29 +10:00
Siddharth Purohit f55ee264a7 AP_Compass: reset compass ids not present after compass cal
also implement replacement mechanism for UAVCAN compasses
2020-07-27 19:48:15 +10:00
Andy Piper 88cda25d62 AP_Compass: enable LIS3MDL and friends 2020-06-23 19:59:10 +10:00
Peter Barker 0f2bcea647 AP_Compass: remove use of Vector3 as function 2020-06-16 11:06:47 +10:00
Michael du Breuil f25d20f549 AP_Compass: Only send a single MAG_CAL_* message per poll
this fairly allocates bandwidth between the calibrators
2020-06-16 10:09:14 +10:00
bugobliterator 82480f0a3d AP_Compass: return id of max empty compass state when prio id is 0 2020-06-13 07:52:20 +10:00
Siddharth Purohit c0eb27cc35 AP_Compass: pull compass calibrator out into a separate thread 2020-06-05 09:38:40 +10:00
bugobliterator c914a91be9 AP_Compass: add support for per mag calibration 2020-06-05 09:38:40 +10:00
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
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