Commit Graph

39 Commits

Author SHA1 Message Date
Iampete1
1771481779 AP_Compass: never override custom orentation in calabration 2021-11-10 09:28:54 +11:00
Iampete1
36a80d46e3 AP_Compass: support auto orientation for new rotations 2021-07-28 18:09:05 +10: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
f7daa4a93a AP_Compass: raise max scale factor and make symmetric 2020-11-10 10:15:39 +11:00
Siddharth Purohit
c0eb27cc35 AP_Compass: pull compass calibrator out into a separate thread 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
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
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
lukezhqin
32f11ba863 AP_Compass: fix thin_samples to avoid comparing sample to itself 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
2f2be6afda AP_Compass: use rotation_equal() from AP_Compass 2018-10-01 14:26:56 +09:00
Andrew Tridgell
803f255c73 AP_Compass: fixed handling of duplication rotations
we have some rotations that are duplicated, such as ROLL_180_YAW_90
and PITCH_180_YAW_270. This copes with those in the auto-orientation
code
2018-10-01 14:26:56 +09:00
Andrew Tridgell
196ba0e858 AP_Compass: make COMPASS_ROT_AUTO take 3 values
0 for disabled, 1 for check only, 2 for check and fix
2018-07-18 16:07:19 +10:00
Andrew Tridgell
d15a4ad92a AP_Compass: improved error reporting, check all compasses
this uses extensions to the MAG_CAL_REPORT message to convey failures
of orientation checking.

It also checks all compasses, external or internal. It only tries to
fix the orientation if it is external
2018-07-18 16:07:19 +10:00
Andrew Tridgell
3c2e8baee2 AP_Compass: improved orientation reporting
and fail magcal if we fail orientation detection for an external
compass
2018-07-18 16:07:19 +10:00
Andrew Tridgell
8b0f40b402 AP_Compass: implement automatic compass orientation
this automatically determines the compass orientation when doing a 3D
compass calibration, if COMPASS_ROT_AUTO is enabled.
2018-07-18 16:07:19 +10:00
Andrew Tridgell
ee2afd3242 AP_Compass: added COMPASS_OFFS_MAX
this allows setup of airframes with hatch magnets
2017-04-04 00:49:34 +01:00
Andrew Tridgell
a1bce2b54d AP_Compass: use get_random16() 2016-12-02 09:49:38 +11:00
Michael du Breuil
deec4ec6af Compass: Rework compass calibrator
Summary of significant changes:
  -Autsave doesn't depend on STREAM_EXTRA3
  -Don't risk only saving one compass on copter if CAL_ALWAYS_REBOOT is set
  -Only calibrate compasses that are both health and marked for use (there was a inconsistency in handling the mask)
  -Fix incorrect failure reporting on DO_ACCEPT_MAG_CAL with a mask of 0 if a channel was specifically not started
  -Fix not starting the buzzer if the delay is set to 0 seconds
  -Always send MAG_CAL_REPORT until its acknowledged
  -Correct the field in MAG_CAL_REPORT for autosave to indicate if the compass had actually been saved, rather then being scheduled to be saved
  -Remmove unused public interfaces
2016-10-27 14:04:33 +11:00
Jonathan Challinger
17fb7dc88f AP_Compass: initialize offset before beginning sphere fit 2016-09-23 10:52:51 +10:00
Gustavo Jose de Sousa
0c31354539 AP_Compass: implement completion mask
Fill the completion mask and send that through MAVLink while calibrating the
compass.
2016-05-16 19:08:36 -03:00
Lucas De Marchi
abbe419823 AP_Compass: fix mismatched tag
In file included from /home/lucas/p/dronecode/ardupilot/libraries/AP_Compass/Compass.h:6:
/home/lucas/p/dronecode/ardupilot/libraries/AP_Compass/CompassCalibrator.h:86:5: warning: struct 'param_t' was previously declared as a class [-Wmismatched-tags]
    struct param_t _params;
    ^
/home/lucas/p/dronecode/ardupilot/libraries/AP_Compass/CompassCalibrator.h:44:11: note: previous use is here
    class param_t {
          ^
/home/lucas/p/dronecode/ardupilot/libraries/AP_Compass/CompassCalibrator.h:86:5: note: did you mean class here?
    struct param_t _params;
    ^~~~~~
2016-03-18 22:39:39 -03:00
Gustavo Jose de Sousa
46774136a6 AP_Compass: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-09-03 16:59:13 +10:00
Siddharth Bharat Purohit
f5fbc2fac1 AP_Compass: use AP_Math inverse library 2015-09-03 16:59:12 +10:00
Jonathan Challinger
5a12991d29 CompassCalibrator: remove dependence on AP_Notify 2015-09-03 16:59:12 +10:00
Jonathan Challinger
328cf82c3d CompassCalibrator: update AP_Notify on failure 2015-09-03 16:59:10 +10:00
Jonathan Challinger
bfdbb55528 AP_Compass: make compasscalibrator running() public 2015-09-03 16:59:10 +10:00
Jonathan Challinger
d31d385490 AP_Compass: changes and fixes to LMA-based compass calibrate 2015-09-03 16:59:10 +10:00
bugobliterator
7711dde2ad Compass: implement 9 parameter ellipsoid fit 2015-09-03 16:59:10 +10:00
bugobliterator
35555c7b21 Compass: Add math for 9 parameter fitting 2015-09-03 16:59:10 +10:00
bugobliterator
54bc28c96d Compass: Add Levenberg-Marquadt optimiser for sphere_fit
increase iterations to get good results from LM
better check for convergence, comparison with initial fitness is a better way to determine if convergence occurs, if fitness has not improved compared to initial fitness it means optimiser has failed.
2015-09-03 16:59:10 +10:00
Jonathan Challinger
c0a662c819 AP_Compass: CompassCalibrator initial commit 2015-09-03 16:59:10 +10:00