Commit Graph

390 Commits

Author SHA1 Message Date
José Roberto de Souza 3888579c07 AP_Compass: HMC5843: Use the correctly spelled method 2015-10-16 10:16:24 +11:00
Randy Mackay 6bdeae97b6 Compass: update param descriptions
offset parameter units are milligauss
User settable parameters should have a User category defined.  Those that should never be set by a user should not have this.
2015-10-15 20:52:38 +09:00
Randy Mackay 131536a3a7 Compass: resolve compiler warning 2015-10-15 20:33:25 +09:00
Gustavo Jose de Sousa 0caaef7394 AP_Compass: mention mag field unit in existing documentation
We are now always using milligauss for mag field unit, so let's update
documentation accordingly.
2015-10-15 19:56:15 +09:00
Gustavo Jose de Sousa 9927cf066f AP_Compass: remove use of milligauss_ratio
Now, we have all current compasses publishing their values already in
milligauss, so there's no need for that variable anymore.
2015-10-15 19:56:14 +09:00
Gustavo Jose de Sousa b603641d7c AP_Compass: AK8963: fix where to apply sensitivity adjustments
The function rotate_field() can change the values axes and the function
correct_field() applies offsets (which are already in milligauss). Thus any
sensitivity adjustment must be done for two reasons:

    (1) The offsets must be applied to the values already in milligauss;
    (2) The factory sensitivity adjustment values are per axis, if any rotation
        that switches axes is applied, that'll mess with the adjustment.

Experiments showed that before this patch the length of the mag field reported
quite different from the expected. After this patch, the same experiments
showed reasonable values.
2015-10-15 19:56:13 +09:00
Gustavo Jose de Sousa 6198e81bb3 AP_Compass: AK8963: scale mag field internally
This is part of the transition to make all mag field values be used in
milligauss.
2015-10-15 19:56:12 +09:00
Gustavo Jose de Sousa 256c9c06c9 AP_Compass: HMC5843: scale mag field internally
This is part of the transition to make all mag field values be used in
milligauss. Additionally the value of _gain_multiple is adapted to the new way
we're using it and corrected accordingly to the datasheets.
2015-10-15 19:56:11 +09:00
Gustavo Jose de Sousa 814442563e AP_Compass: HMC5843: fix _calibrate()
The use of _gain_multiple is not necessary because the values of
expected_{x,yz} and _mag_{x,y,z} are both in sensor raw unit (i.e., lsbs).

That wasn't fixed before in order not to make APM users to recalibrate their
compasses.
2015-10-15 19:56:10 +09:00
Gustavo Jose de Sousa 88a1a928e9 AP_Compass: remove get_{field,offsets}_milligauss() functions
Those functions are not being used anymore.
2015-10-15 19:56:09 +09:00
Gustavo Jose de Sousa 99a55f9379 AP_Compass: use compass get_{field,offsets}() functions
Both functions are equivalent, so we're going to simply use
get_{field,offsets}() instead of get_{field,offsets}_milligauss().
2015-10-15 19:56:02 +09:00
Gustavo Jose de Sousa 4375606eeb AP_Compass: make get_field() and get_offsets() return milligauss
This is part of a transition to make AP_Compass always use a single unit for
magnetic field values, namely milligauss.
2015-10-15 19:55:59 +09:00
Randy Mackay 825abdbedc Compass: example sketch displays in milligauss 2015-10-07 21:35:24 +09:00
mirkix ddb8e67954 AP_Compass: Add support for more then one AK8963 2015-10-06 10:38:21 +11:00
José Roberto de Souza 1a2b5ff677 AP_Compass: AK8963: Remove unused AP_HAL::Semaphore attributes 2015-10-01 10:42:51 -03:00
José Roberto de Souza a9d34ac3bd AP_Compass: AK8963: Rename some SPI/I2C method parameters
On read/write operations the argument is the register that will be read or
write not the address, SPI don't even have the concept of device address.
2015-10-01 10:42:40 -03:00
mirkix eee9522ca5 AP_Compass: Add MPU9250 multiple instance support 2015-09-24 13:11:38 +10:00
raspilot 1b5e6849d9 AP_Compass: fix milligauss code in LSM303D driver 2015-09-16 16:52:17 +09:00
Randy Mackay fff5ec09eb AP_Compass: fix consistent check for less than three compasses
Also use vector functions where available
Use get_field_milligause instead of just get_field
2015-09-16 15:11:01 +09:00
Jonathan Challinger 87bbf1a487 AP_Compass: add consistent() function 2015-09-16 15:10:27 +09:00
Julien BERAUD 5602e4055b AP_Compass_AK8963: Fix Rotation on the Bebop 2015-09-15 14:45:17 +09:00
Andrew Tridgell fa9ff5b604 AP_Compass: added parameter for compass calibration fitness threshold 2015-09-14 17:01:14 +10:00
Lucas De Marchi 309e75f9ac AP_Compass: LSM303D: use c++11 initializer to avoid Wreorder 2015-09-14 14:22:15 +10:00
Lucas De Marchi 3a017c8702 AP_Compass: LSM303D: rename members to follow convention
Make the members have similar names as HMC5843 driver and prepend
underscore on private fields.
2015-09-14 14:22:15 +10:00
raspilot 19b4f5559a AP_Compass: added LSM303D driver 2015-09-14 14:22:15 +10:00
Andrew Tridgell c59bdc12df AP_Compass: fix the milligauss handling
the previous approach assumed a 1:1 mapping between compass backends
and compass instances, which isn't true on PX4.

It also only setup milligauss offsets on a set_and_save call, which is
not the only way offsets change

this adds a milligauss_ratio per instance, which is considerably
simpler
2015-09-09 14:53:11 +10:00
Andrew Tridgell 3699932417 AP_Compass: fixed SITL compass 2015-09-09 14:53:11 +10:00
Staroselskii Georgii bd7c313bee AP_Compass: fixed Compass::get_raw_field()
It seems as if it were a copy-paste error. A statis analyzer would
definetely be angry.
2015-09-09 10:38:17 +10:00
Staroselskii Georgii e93ff44a97 AP_Compass: make a transition to milligauss in Compass library 2015-09-09 10:38:16 +10:00
Staroselskii Georgii 693613aa0f AP_Compass: convert AK8963 measurements to uT
AK8963 is configured in 16-bit ADC mode which implies sensitivity of 0.15 uT/LSb. Knowing this fact we can convert the measurements to the proper units. The change will make users recalibrate their compasses.
2015-09-09 10:38:16 +10:00
Staroselskii Georgii c207d8c6a8 AP_Compass: add milligauss counterparts to get_field() and get_offsets()
From now on there's a pair get_field_milligauss() and
get_offsets_milligauss() that can make the transition to the common
units across all compasses easier.
2015-09-09 10:38:16 +10:00
Andrew Tridgell 6991a1b9e9 AP_Compass: ensure we have payload space to send MAG_CAL messages 2015-09-07 08:58:11 +10:00
Andrew Tridgell 2baa0ac2f2 AP_Compass: disable COMPASS_LEARN when mag calibration used 2015-09-07 08:07:17 +10:00
Andrew Tridgell 079161ef3a AP_Compass: fixed raw_field init in AK8963 driver
thanks to Peter for spotting this
2015-09-03 21:27:22 +10:00
Andrew Tridgell e4b2fc711d AP_Compass: added message for compass cal when armed 2015-09-03 16:59:22 +10:00
Andrew Tridgell f4cdf57d8f AP_Compass: added handling of compass calibration mavlink messages 2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit 75829f5533 AP_Compass: remove extra compass field correction 2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit 3abdf85796 AP_Compass_Calibrator: remove unrequired variables 2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit c126017035 AP_Compass: reduce to if healthy check from if-else 2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit 2fb002798c generate.sh 2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit 63973bff31 AP_Compass_AK8963: move variable declarations before goto 2015-09-03 16:59:14 +10:00
Siddharth Bharat Purohit 6a603eb594 Compass_cal: implement the concept of auto and mandatory user reboot after cal 2015-09-03 16:59:13 +10: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 cdd8bae6ac AP_Compass: publish raw and unfiltered field for HMC5843 compass 2015-09-03 16:59:13 +10:00
Siddharth Bharat Purohit 8cdc9748b3 AP_Compass: publish raw and unfiltered field for AK8963 compass 2015-09-03 16:59:13 +10:00
Siddharth Bharat Purohit f085e274c7 AP_Compass: add explaination for sample acceptance based on angular distance 2015-09-03 16:59:13 +10:00
Jonathan Challinger f108383c11 AP_Compass: initialize CompassCalibrator _sample_buffer to NULL 2015-09-03 16:59:13 +10:00
Jonathan Challinger 358736a592 AP_Compass: correct calibrator sample acceptance math 2015-09-03 16:59:13 +10:00
Jonathan Challinger bff9b9065e AP_Compass: CompassCalibrator comment update 2015-09-03 16:59:13 +10:00
Siddharth Bharat Purohit 137bd25220 AP_Compass: add info about compass calibrator procedure 2015-09-03 16:59:12 +10:00