Commit Graph

1062 Commits

Author SHA1 Message Date
Peter Barker 42b8ee78cf AP_Compass: remove use of AP_AHRS from most headers
don't need to know the details, just that it is a class
2024-09-03 10:35:54 +10:00
Peter Barker 60c2e4278c AP_Compass: avoid use of MAV_RESULT if mavlink bindings not used 2024-08-14 19:40:31 +10:00
Peter Barker 27a7a21805 AP_Compass: correct compilation when logging disabled 2024-08-12 18:28:07 +10:00
Peter Barker fa4e90a3bb AP_Compass: use GCS_SEND_TEXT rather than gcs().send_text
Co-authored-by: muramura <ma2maru@gmail.com>
2024-08-07 18:33:16 +10:00
Andrew Tridgell 991ea6326d AP_Compass: cleanup warnings in printf calls 2024-07-11 09:34:29 +10:00
Peter Barker 4231275f50 AP_Compass: remove default clause from set_status switch
forces someone to consider what they need to do for any new state
2024-07-10 18:18:31 +10:00
Peter Barker afd8d8255f AP_Compass: use switch statement in failed() method 2024-07-10 18:18:31 +10:00
Willian Galvani 64e859ecc5 AP_Compass: warn user if fix_radius() is skipped 2024-07-09 10:13:34 +10:00
Willian Galvani 325d6f6c94 AP_Compass: use ahrs for location instead of GPS directly for calibration 2024-07-09 10:13:34 +10:00
Simon Hancock 43c604f1db AP_Compass: Fix fewer multipliers than params on MAGH log message 2024-06-19 09:38:59 +10:00
Andrew Tridgell 0f08b47322 AP_Compass: use NEW_NOTHROW for new(std::nothrow) 2024-06-04 09:20:21 +10:00
Andrew Tridgell 5fd4e23fa9 AP_Compass: removed IST8310 overrun message
this is not useful and just causes concern to users. Any small bus
delay can trigger this. We have health monitoring at a higher level
2024-05-22 14:51:15 +10:00
Andrew Tridgell 68b58d5435 AP_Compass: workaround hardware bug in IST8310 whoami
the WAI (whoami) register is writeable. Not only is it writeable, but
the written value is persistent across a power cycle. You have to
remove power for about 30s for it to finally go back to the right
default value of 0x10

this makes using WAI as a test for finding a IST8310 problematic. The
best we can do is send a soft reset which will reset it to default for
us to then check
2024-05-01 09:24:54 +10:00
Andrew Tridgell 76343f5e6f AP_Compass: log Hires magnetic field on DroneCAN 2024-03-16 20:10:35 +11:00
Patrick José Pereira 84a5a52351 AP_Compass: Use new default for reboot
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2024-03-12 21:13:41 +11:00
Peter Barker 093deed610 AP_Compass: add and use AP_CUSTOMROTATIONS_ENABLED
also add to build_options.py
2024-03-03 08:22:46 +11:00
Peter Barker c36b57acba AP_Compass: exclude cpp files if not AP_COMPASS_ENABLED 2024-02-27 11:02:48 +11:00
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