Commit Graph

1045 Commits

Author SHA1 Message Date
Peter Barker dc74f97739 AP_Compass: move logger object up to AP_Vehicle 2024-02-13 10:54:29 +11:00
Peter Barker 0e67209790 AP_Compass: fixed-yaw requires the AP_AHRS library to exist 2024-02-10 11:47:10 +11:00
Peter Barker 084b0aea24 AP_Compass: make compass.mag_cal_fixed_yaw return boolean
this method could be used from a transmitter without GCS enabled, for example
2024-02-06 11:11:27 +11:00
Peter Barker ecc7188d97 AP_Compass: rename COMPASS_TYPEMASK to COMPASS_DISBLMSK
this is a very confusingly named parameter.  I've seen several instances of people treating this as an enable mask rather than a disable mask
2024-01-23 11:54:49 +11:00
Peter Barker cad4bd41e9 AP_Compass: make AHRS attitude member variables private 2024-01-14 12:47:47 +11:00
Peter Barker eec43c204f AP_Compass: cope with AP_INERTIAL_SENSOR being 0 2024-01-03 17:35:54 +11:00
Andrew Tridgell 80730d6c02 AP_Compass: use tesla conversion from AP_Math/definitions.h 2023-12-17 09:47:30 +11:00
Thomas Watson b8d50b112a AP_Compass: fix C++ One Definition Rule violations
Two structs with the same name must have exactly the same definition, no
matter where they occur in the program, otherwise the program is undefined.

Move each sample register struct definition into the associated class
definition so they are in a different namespace and no longer
identically named, thus fixing this issue.
2023-11-21 13:21:03 +11:00
Jonathan Loong 0db1719c8f AP_Compass: Add in QMC5883P Driver 2023-11-15 10:53:38 +11:00
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
Andrew Tridgell aaeee2e7dc AP_Compass: implement SIM_MAG_SAVE_IDS 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
Hayden b237fd9fa4 AP_Compass: fix AK09916 hangup issue 2023-10-20 07:56:56 +11:00
Mykhailo Kuznietsov 633bb159bf AP_Compass: Fix some typos
Fixed some typos found in the code.
2023-10-12 18:30:42 +11:00
Peter Barker 9a054876ff AP_Compass: use AP_GPS_ENABLED to exclude more code when GPS not compiled in 2023-09-27 16:38:15 +10:00
Peter Barker eb05093f34 AP_Compass: compass calibration requires DCM 2023-09-27 08:00:54 +10:00
Peter Barker acf437b258 AP_Compass: correct compilation with COMPASS_CAL_ENABLED off 2023-09-19 16:54:59 +10:00
Peter Barker 275a667d41 AP_Compass: allow more libraries to compile with no HAL_GCS_ENABLED 2023-09-05 22:23:51 +10:00
Andrew Tridgell e6d43811ad AP_Compass: fixes for macos CAN SITL build 2023-08-29 15:09:48 +10:00
Peter Barker d50c429355 AP_Compass: handle mag cal as both COMMAND_LONG and COMMAND_INT 2023-08-08 10:06:13 +10: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
Peter Barker 3f4995068c AP_Compass: add and use AP_COMPASS_ENABLED 2023-06-21 22:28:48 +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 ba450fa08b AP_Compass: text messages and more defines 2023-04-11 10:31:31 +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
Andrew Tridgell 2e8ea6ac47 AP_Compass: rename UAVCAN drivers to DroneCAN 2023-04-11 10:31:31 +10:00
Andrew Tridgell 34f70b98b3 AP_Compass: rename AP_UAVCAN to AP_DroneCAN 2023-04-08 07:11:23 +10:00
bugobliterator 7112d156ed AP_Compass: replace libuavcan with libcanard based driver 2023-03-29 17:16:39 +11:00
Peter Barker 4755f76126 AP_Compass: specify compass feature enables for periph in chibios_hwdef.py 2023-03-12 09:35:35 +11:00
Andrew Tridgell 9cda7b5ccc AP_Compass: drop MMC5xx3 sample rate to 100Hz
this was consuming too much of the I2C bus sampling at 1kHz
2023-03-06 17:24:29 -08:00
Peter Barker 252498fb29 AP_Compass: move removal of BMM150 down into hwdef
There's no reason apart from space to not have this in
2023-03-01 18:28:29 +11:00
Peter Barker 1889d3dea5 AP_Compass: add and use AP_COMPASS_MMC5XX3_ENABLED 2023-02-22 19:40:13 +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 aac6228f58 AP_Compass: add and use AP_COMPASS_MAG3110_ENABLED 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 430f19222a AP_Compass: don't define driver backend type if it is not compiled in
Catches places where code isn't disabled properly
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 fe9461242e AP_Compass: add and use AP_COMPASS_LSM9DS1_ENABLED 2023-02-15 20:03:55 +11:00