Commit Graph

286 Commits

Author SHA1 Message Date
Andrew Tridgell 598e2b0762 AP_Compass: remove more exposed params for periph
these parameters are not useful on peripherals which use raw mag field
2023-11-08 18:34:41 +11:00
Andrew Tridgell 422d7cec6e AP_Compass: probe DroneCAN compasses before I2C
it is highly likely that a user with a DroneCAN compass will want it
to be earlier in the dev list than i2c or spi compasses
2023-10-31 10:14:42 +11:00
Andrew Tridgell 36de6613fb AP_Compass: split out probing code into i2c+spi and DroneCAN
this is a NFC to make the PR clearer
2023-10-31 10:14:42 +11:00
Andrew Tridgell 9fc9238c53 AP_Compass: prevent saving of device IDs when not calibrated
this fixes an issue with the following sequence:

 - new board (or board with FORMAT_VERSION reset) starts up with only internal compasses
 - internal compasses are detected and devids saved
 - an external compass is added and the board is rebooted
 - the external compass will not be the first compass
 - user then calibrates and flies, but has internal as primary

this can lead to a very bad experience for new users. At least one
vehicle has crashed due to this sequence.

The fix is to not save device IDs during the Compass::init() if we
have never been calibrated. This means that when an external compass
is added it will come up as the first compass.

This also removes the saving of the extra device ID. It was never
intended that these be saved (there is a comment to that effect in the
code), but actually they were saved.
2023-10-31 10:14:42 +11:00
Iampete1 83a31ac371 AP_Compass: add big comment explaining calculate_heading maths, add consts and use wrap_PI helper 2023-10-25 15:57:16 +01:00
Andrew Tridgell e1fad5ee38 AP_Compass: allow override of IST8310 orientation
this allows for vendor GPS modules and internal compass which use a
different orientation
2023-08-06 09:23:45 +10:00
Iampete1 262b11f0c1 AP_Compass: stop auto replacing missing CAN by default, add option to re-enable 2023-06-27 09:24:41 +10:00
Hayden fa800e23e2 AP_Compass: Move health to cpp and add range check
Moved the health check to the cpp file and added checking of max instances
2023-05-24 12:39:47 +10:00
Peter Barker 7088286ebf AP_Compass: use new vector methods to make for more compact code
The check for zero-length magnetic field on the primary is redundant given the one on the loop
2023-04-19 14:25:06 +10:00
Andrew Tridgell e469ed9bd7 AP_Compass: rename more variables, types and defines 2023-04-11 10:31:31 +10:00
Andrew Tridgell dc40e1e7c3 AP_Compass: change UAVCAN_ENABLED to DRONECAN_ENABLED 2023-04-11 10:31:31 +10:00
Andrew Tridgell 992409328f AP_Compass: update header references 2023-04-11 10:31:31 +10:00
bugobliterator 7112d156ed AP_Compass: replace libuavcan with libcanard based driver 2023-03-29 17:16:39 +11:00
Peter Barker 69bc24bc16 AP_Compass: add and use AP_COMPASS_RM3100_ENABLED 2023-02-22 19:40:13 +11:00
Peter Barker 2c93b7809c AP_Compass: use AP_COMPASS_EXTERNALAHRS_ENABLED more
Also rename driver name from serial to externalahrs for consistency
2023-02-22 19:40:13 +11:00
Peter Barker 89a9636c46 AP_Compass: add and use AP_COMPASS_QMC5883L_ENABLED 2023-02-22 19:40:13 +11:00
Peter Barker b6e2586f50 AP_Compass: add and use AP_COMPASS_MMC3416 2023-02-22 19:40:13 +11:00
Peter Barker ee6b44113d AP_Compass: add and use AP_COMPASS_ICM20948_ENABLED 2023-02-22 19:40:13 +11:00
Peter Barker ad9521c1c4 AP_Compass: add and use AP_COMPASS_AK09916_ENABLED 2023-02-22 19:40:13 +11:00
Peter Barker 1abce258e4 AP_Compass: mark all_external as used even if it is not 2023-02-22 19:40:13 +11:00
Peter Barker 7d244e3451 AP_Compass: add and use AP_COMPASS_LIS3MDL_ENABLED 2023-02-17 23:05:48 +11:00
Peter Barker b26d771c9f AP_Compass: add and use AP_COMPASS_IST8310_ENABLED 2023-02-14 12:23:55 +11:00
Peter Barker 9035de80ca AP_Compass: do not detect extra bmm150 instances on SkyViper-v2450 2023-02-09 17:52:52 +11:00
Peter Barker feb809fbb7 AP_Compass: add and use AP_COMPASS_BMM150_ENABLED 2023-02-09 17:52:52 +11:00
Peter Barker 22feb3c08a AP_Compass: add and use AP_COMPASS_AK8963_ENABLED 2023-02-07 10:21:06 +11:00
Peter Barker ff99ff34c7 AP_Compass: add and use AP_COMPASS_HMC5843_ENABLED 2023-02-01 18:47:37 +11:00
Peter Barker cbd1264f90 AP_Compass: add and use AP_COMPASS_LSM303D_ENABLED 2023-01-31 11:08:28 +11:00
Andrew Tridgell 07d56d83e7 AP_Compass: allow enabling of only some ExternalAHRS sensors 2023-01-30 09:22:02 +11:00
Peter Barker e60e646a4e AP_Compass: create and use AP_COMPASS_IST8308_ENABLED 2023-01-25 19:58:02 +11:00
Peter Barker 3adbaddab0 AP_Compass: regularise compass defines
start to make compass backends look like backends from our other libraries
2022-11-15 16:44:38 +11:00
Peter Barker aef745c693 AP_Compass: fix compilation when removing diagonals state 2022-11-09 21:14:04 +11:00
Peter Barker 35afd258ca AP_Compass: change namespace of MultiCopter and FixedWing params
this stops the libraries knowing anything about AP_Vehicle
2022-11-09 19:04:37 +11:00
bugobliterator 61e2e8cd3d AP_Compass: add option to skip auto detect internal mag 2022-11-01 10:41:59 +11:00
Peter Barker d6c5a0ab2b AP_Compass: correct compilation when COMPASS_MAX_INSTANCE>1 and no diagonals 2022-10-06 08:21:03 +11:00
Andrew Tridgell 0b9769e658 AP_Compass: removed diagonals and offdiagonals on AP_Periph 2022-09-30 21:25:36 +10:00
Iampete1 df470f6a34 AP_Compass: params always use set method 2022-08-03 13:43:48 +01:00
Iampete1 cdf930effe AP_Compass: defualt diagonals vector to 1.0 2022-07-28 16:51:33 +10:00
Henry Wurzburg 4c44b6ad1a AP_Compass: expand description of custom orientation parameters 2022-07-21 15:45:28 +01:00
Andrew Tridgell 4d031a0c9e AP_Compass: HAL_COMPASS_DISABLE_IST8310_INTERNAL_PROBE for Pixhawk6C 2022-06-23 12:37:24 +10:00
Ruffalo-sunghwan 499c5dfc96 AP_Compass : correct comment spelling 2022-05-24 20:27:45 +09:00
murata a19d4b65fc AP_Compass: Console output can be disabled 2022-05-17 09:53:06 +10:00
Peter Barker 3ec0e27e4f AP_Compass: move logging of compass ERR flags into AP_Compass 2022-05-10 19:46:40 +10:00
Michael du Breuil 041b2b594b AP_Compass: Fix compass priority instance message to make sense to users 2022-03-08 10:32:05 +11:00
Iampete1 6c48c346c1 AP_Compass: convert param to new custom rotation 2022-03-02 18:16:42 +11:00
Iampete1 209ad965be AP_Compass: remove custom rotations 2022-03-02 18:16:42 +11:00
Joshua Henderson dc8df8f147 AP_Compass: add define for COMPASS_ENABLE 2022-02-08 10:41:02 +11:00
Peter Barker ef2fd1f4ba AP_Compass: remove HAL_COMPASS_DEFAULT define
this doesn't actually allow you to specify a default, despite the name
and a couple of hwdefs trying to use it that way.

This would have stopped being useful when we did the
compass-prority-table stuff - or before.
2022-02-01 12:10:38 +11:00
Peter Barker 38abec2133 AP_Compass: rename AP_AHRS::get_position to get_location 2022-01-25 10:47:22 +11:00
Peter Barker ed608d37f6 AP_Compass: add and use AP_SIM_COMPASS_ENABLED 2022-01-17 15:24:02 +11:00
Hwurzburg 8ddb12d9cb AP_Compass: change UAVCAN in metadata to DroneCAN 2021-12-15 09:53:21 +11:00