Commit Graph

475 Commits

Author SHA1 Message Date
Jonathan Challinger d31d385490 AP_Compass: changes and fixes to LMA-based compass calibrate 2015-09-03 16:59:10 +10:00
bugobliterator c66bfc95e1 Compass: Add Levenberg-Marquadt for ellipsoid fit 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 7295537e8a Compass: decrease sphere coverage to 1/3rd
for faster sample collection
2015-09-03 16:59:10 +10:00
bugobliterator a2bd4e8997 Compass: Add less complex equations to calculate jacobians 2015-09-03 16:59:10 +10:00
bugobliterator 2ca0e80dc5 Compass: Add conditions to check sanity of results 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
Jonathan Challinger f20ef69777 Compass: add soft-iron corrections 2015-09-03 16:59:09 +10:00
Jonathan Challinger 5fe6db0dc9 AP_Compass_PX4: use new compass backend interface 2015-09-03 16:59:09 +10:00
Jonathan Challinger ade39abc7f AP_Compass_HMC5843: use new compass backend interface 2015-09-03 16:59:09 +10:00
Jonathan Challinger 8800d03fce AP_Compass_HIL: use new compass backend interface 2015-09-03 16:59:09 +10:00
Jonathan Challinger cd5cf45ba8 AP_Compass_AK8963: use new compass backend interface 2015-09-03 16:59:09 +10:00
Jonathan Challinger add1b8c257 AP_Compass: modify backend interface to push raw samples to frontend 2015-09-03 16:59:09 +10:00
Jonathan Challinger b990eaed68 AP_Compass: add interface for raw and unfiltered field 2015-09-03 16:59:09 +10:00
Lucas De Marchi a66a201bf5 AP_Compass: HMC5843: Add support for MPU6000 auxiliary bus
Allow HMC5843 to be on MPU6000's auxiliary bus.
2015-08-28 12:39:09 +10:00
Lucas De Marchi 628e446e3e AP_Compass: HMC5843: use a struct for raw value
Like is done in AK8963, declare a raw_value struct.
2015-08-28 12:39:09 +10:00
Lucas De Marchi 9ecd1daf81 AP_Compass: HMC5843: remove useless delay
There's no need to add a delay after suspending timer in the
initialization. Also initialize _bus_sem earlier, like is done in
AK8963.
2015-08-28 12:39:09 +10:00
Lucas De Marchi c66c9c41f2 AP_Compass: HMC5843: be agnostic to I2C bus
Like was done to inertial AK8963 and inertial sensor move the decision
regarding the I2C bus to the caller. We don't allow changing the address
because apparently HMC5843 doesn't support different addresses.

Changing only the bus could be more easily done but this prepares the
ground for using HMC5843 on an AuxiliarBus.

The need for a more generic abstraction is evidenced by this commit: a
"SerialBus" in AP_HAL would be a nice addition rather than letting each
driver to provide its own. However the methods are a little bit
different from what we have in AK8963. It's safer to do the simple
conversion now and later on to add the abstraction changing everybody to
use it.
2015-08-28 12:39:09 +10:00
Staroselskii Georgii 3eb6be64c9 AP_Compass: ignore first two readings in a clearer way
This way we don't mix two different conditionals: settling and data validation.
2015-08-28 12:39:09 +10:00
Staroselskii Georgii 633330db14 AP_Compass: rename calibration array in HMC
I think naming the variable "scaling" makes more sense.
2015-08-28 12:39:09 +10:00
Staroselskii Georgii d8bddcbf3a AP_Compass: fix indentation in HMC's driver 2015-08-28 12:39:09 +10:00
Staroselskii Georgii 79ffddc6db AP_Compass: add a macro for checking calibration values in HMC 2015-08-28 12:39:08 +10:00
Lucas De Marchi f61386ae43 AP_Compass: HMC5843: release the lock before read
read() calls accumulate() which takes the lock by itself so we must
release it like we were doing before 669ae26 ("AP_Compass: encapsulated
calibration in HMC").
2015-08-28 12:39:08 +10:00
Staroselskii Georgii a9e8c1c464 AP_Compass: encapsulated calibration in HMC 2015-08-28 12:39:08 +10:00
Staroselskii Georgii 0fbc295d97 AP_Compass: encapsulated version detection in HMC driver 2015-08-28 12:39:08 +10:00
Lucas De Marchi 868d0bf3c3 AP_Compass: AK8963: refactor constructors
Declare a common constructor that others can call.
2015-08-28 12:39:08 +10:00
Lucas De Marchi a5df93bf10 AP_Compass: AK8963: be agnostic to I2C bus/address
This decision is better made by the caller rather than polluting the
driver with board-specific details.
2015-08-28 12:39:08 +10:00
Lucas De Marchi d92c2ac9f5 AP_Compass: pass backend instead of pointer to function
Just like was done for inertial sensor, different detect() functions
might need different arguments and passing a pointer to function here is
cumbersome. For example, it forces to have a method like "detect_i2c2"
rather than allowing hal.i2c2 to be passed as parameter.
2015-08-28 12:39:08 +10:00
Lucas De Marchi 7e997564bf AP_Compass: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-18 17:12:51 +10:00
Andrew Tridgell 69a86a78a6 AP_Compass: removed AVR1280 specific ifdef 2015-08-11 16:47:41 +10:00
Gustavo Jose de Sousa 58f300e78e 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-08-11 16:28:42 +10:00
Randy Mackay 66469d7529 Compass_HMC5843: remove unnecessary i2c semaphore give 2015-08-07 15:50:36 +09:00
Julien BERAUD 39b42a4e6e AP_Compass_AK8963: suspend timer while reading
Protection in case a timer falls while reading data, because it could end up
with corrupted data
2015-08-03 22:50:08 +09:00
Julien BERAUD 0aa2fe7a0b AP_Compass_AK8963: fix sem handling
In case of error or zeroed data, the i2c semaphore wasn't given.
It happened at first startup on Bebop and caused a failure:
"PANIC: failed to take _bus->sem 100 times in a row..."
2015-08-03 20:57:46 +09:00
Lucas De Marchi 8240e5ae65 AP_Compass: AK8963: reduce bytes read
We are not using INFO and ST1 registers, so there's no need to read
extra 2 bytes for each transaction.
2015-07-23 17:44:36 +10:00
Lucas De Marchi 2b9c46e1ff AP_Compass: AK8963: don't oversample AK8963
Reduce the frequency with which MPU9250 reads AK8963 to reduce the
chance of errors.
2015-07-23 17:44:36 +10:00
Lucas De Marchi 6c2ceea165 AP_Compass: AK8963: remove author and connection comment
Authorship and how sensor is connected get outdated (as it already is).
Our code is on git so let it track who wrote each line.
2015-07-23 17:44:36 +10:00
Staroselskii Georgii 8ab33c46ce AP_Compass: revisited AK8963 code
Reduced duplication a bit and revisited the update method which is now
split into several logical hunks.
2015-07-23 17:44:36 +10:00
Lucas De Marchi fffedae3e0 AP_Compass: AK8963: reduce stack usage and zero out buffers
Since we are not using MPU9250's fifo to get samples from AK8963 we will
always read only 1 sample (+ control registers).
2015-07-23 17:44:35 +10:00
Lucas De Marchi 37734886a5 AP_Compass: AK8963: remove repeated comments
No need to repeat the same comments on 3 different places. Instead add a
single comment to explain how start_measurements() and read_raw() are
related.
2015-07-23 17:44:35 +10:00
Lucas De Marchi 27d95b67a8 AP_Compass: AK8963: remove state machine
Don't use a state machine in AK8963: the start_measurements() method
should be called only once.  Even if there's a magnetic sensor overflow
the only thing we should do is to discard the new data.

This also moves the _collect_samples() method to be inside _update()
since it's the only place it should be called from, the one running on
the timer thread.
2015-07-23 17:44:35 +10:00
Lucas De Marchi e232543fca AP_Compass: AK8963: change initialization and rename methods
We need to check the AK8963's id before anything else Here we are
reordering the calls to _calibrate() and _check_id(). After that we
don't need to read and write again the AK8963_CNTL1 register.

While at it do some renames as well:
	- _configure() -> _setup_mode(): since now there's a
 	  _bus->configure() it became confusing what actually it's
	  doing.
	- make error messages say what we were actually trying to do but
	  couldn't. Also remove PSTR since this is linux-only.
	- start_conversion() -> start_measurements():  We are instructing the
          bus to start to get the samples, not to tell the chip to start an
          analog->digital conversion like in other sensors.
2015-07-23 17:44:35 +10:00
Lucas De Marchi ae5d9baddb AP_Compass: AK8963: remove defines not used anymore
The MPUREG_PWR_MGMT_1 defines were used when we cared about the MPU9250
initialization code. Now all initialization is done by the MPU9250 class
itself, so remove these defines.

Also remove AK8983_SELFTEST_MAGNETIC_FIELD_ON that is never used and let
the defines always with 2 bytes to improve readability.
2015-07-23 17:44:34 +10:00
Lucas De Marchi cae895bfdf AP_Compass: AK8963: group members together
Besides being semantically related, this removes the hole due to
alignment. The size is the same since the hole is actually turned into
padding.
2015-07-23 17:44:34 +10:00
Lucas De Marchi 28d3d775a4 AP_Compass: AK8963: remove resolution member
We only use the highest one and there's no intention to support the
14bits one. Just use the define rather than saving it as a member.
2015-07-23 17:44:34 +10:00
Lucas De Marchi 86b3312112 AP_Compass: AK8963: factor out common code of read_raw()
Similar code was added in the read_raw() implementation for each bus.
Add a new POD struct read_raw to contain the registers from the AK8963
and use it instead as argument.
2015-07-23 17:44:33 +10:00
dgrat d941174978 AP_Compass: AK8963: enhance the readability
Reduce the deepness of indentation and fix coding style.
2015-07-23 17:44:33 +10:00
Lucas De Marchi fd5d25b1d5 AP_Compass: use ARRAY_SIZE macro 2015-07-21 14:25:17 +09:00
Randy Mackay cedc9a8670 Compass: add last_update_usec per instance 2015-07-17 10:02:41 +09:00
Julien BERAUD 51c3c499e2 AP_Compass: support AK8963 on I2C 2015-07-10 16:46:30 +10:00
Julien BERAUD 0b41da0dea AP_Compass: rework to make the bus generic for AK8963
Supporting only MPU9250, prepare to implement another bus, i.e i2c on the
bebop
2015-07-10 16:46:29 +10:00
Julien BERAUD 0cd584c293 AP_Compass: fix rotation for bebop AK8963
Set the correct rotation for bebop
2015-07-10 16:46:29 +10:00
Julien BERAUD 7dd0b5fae6 AP_Compass: removed _spi_sem and _spi 2015-07-10 16:46:29 +10:00
Andrew Tridgell c83d5b1f08 AP_Compass: only build AK8963 driver on Linux
must match MPU9250 build
2015-07-09 11:57:27 +10:00
Randy Mackay d192b3ccea Compass: set device id for ak8963 and hmc5843 2015-07-06 21:04:46 +09:00
dgrat f56f584233 Compass: Improved field rounding in learning
Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2015-07-06 11:31:58 +10:00
Lucas De Marchi 1deb837e70 AP_Compass: Use common function in MPU9250 for initialization 2015-07-06 10:48:07 +10:00
Staroselskii Georgii 26c8007c96 AP_Compass: updated backend detect method
Uses reimplemented AK8963 driver. There's also no need trying to detect this
compass twice. Actually, it might even be bad, because the current code can
allocate an AK8963 object twice.
2015-07-06 10:48:06 +10:00
Staroselskii Georgii 7a417d1151 AP_Compass: AK8963 rework
Got rid of extra abstraction layer. There is no need for that now.
2015-07-06 10:48:06 +10:00
Randy Mackay 43b1694c76 Compass: add third compass to PRIMARY param description 2015-07-02 14:19:30 +09:00
Andrew Tridgell 5b0394eb05 AP_Compass: start MPU9250 driver at low speed
this raises the chances of successful init of the MPU9250
2015-07-02 08:48:06 +10:00
Andrew Tridgell d6a1bd98e6 AP_Compass: convert example from .pde to .cpp 2015-06-01 16:58:11 +10:00
Andrew Tridgell edc21cfa38 AP_Compass: make having no compass backends non-fatal
thanks to Daniel for spotting this
2015-05-26 14:23:40 +10:00
Lucas De Marchi 95627cf412 AP_Compass: use functor macros
Functor is not yet being used but let's make is macro fallback to the
previous Delegate implementation for easy of transition between the two.
2015-05-26 13:46:52 +10:00
Andrew Tridgell 2475ee9630 AP_Compass: setup HIL/SITL for two compasses 2015-05-16 07:06:04 +10:00
Andrew Tridgell 91b4ba3588 AP_Compass: allow for more than one compass in HIL/SITL 2015-05-15 14:25:44 +10:00
Randy Mackay ade4f81c77 Compass: fix example sketch 2015-05-15 11:53:28 +09:00
Andrew Tridgell 015fce5183 AP_Compass: revert AP_Math class change 2015-05-05 13:27:06 +10:00
Tom Pittenger d09ef4783d AP_Compass: compiler warnings: reorder constructors 2015-05-05 13:26:52 +10:00
Tom Pittenger ad11a57f57 AP_Compass: compiler warnings: apply is_zero(float) or is_equal(float) 2015-05-05 13:26:51 +10:00
Andrew Tridgell be3d6c924e AP_Compass: rename enum values to avoid header conflicts for 'ERROR' 2015-05-05 09:45:53 +10:00
Tom Pittenger 16e71ec1ce Compass: fix compile warning re member init order 2015-04-24 14:15:00 +09:00
Tom Pittenger bf1d128d70 Compass: fix compile warnings re float constants
Also fix example sketch
2015-04-24 12:29:07 +09:00
Andrew Tridgell dcb25632fb AP_Compass: removed old setHIL compass offset 2015-04-21 08:30:05 +10:00
Andrew Tridgell d7000c4105 AP_Compass: fixed compass timestamps in Replay 2015-04-20 15:12:51 +10:00
Lucas De Marchi 996739df12 AP_Compass: Do not panic if compass is not found
Copter uses 2 compasses for linux configuration, but one of them may not
be available. Do not panic if a AK8963 isn't found.
2015-04-14 09:29:12 +10:00
Andrew Tridgell c8b0970e61 AP_Compass: show compass count in example 2015-03-14 20:00:29 +11:00
Andrew Tridgell f4455d063e AP_Compass: fixed example 2015-03-14 17:07:39 +11:00
Andrew Tridgell 1962706a33 AP_Compass: fixed last_update, using last_update_usec()
this broke use of compass in the EKF
2015-03-14 12:31:23 +11:00
Andrew Tridgell 86fc90f54c AP_Compass: removed spurious rotation in PX4 backend
and cleanup rotation macros
2015-03-14 08:52:37 +11:00
Andrew Tridgell d7bac39539 AP_Compass: removed two unused functions 2015-03-14 08:52:37 +11:00
Andrew Tridgell fec2025469 AP_Compass: added set_hil_mode() 2015-03-13 22:52:55 +11:00
Andrew Tridgell 8f6982860f AP_Compass: fixed devid for 2nd compass 2015-03-13 20:46:32 +11:00
Andrew Tridgell 7b51c907f5 AP_Compass: zero some more variables in constructor and init 2015-03-13 19:22:11 +11:00
Andrew Tridgell 4bc92b6373 AP_Compass: removed _product_id var 2015-03-13 18:59:52 +11:00
Andrew Tridgell 0efd3bacea AP_Compass: make new backend match old PX4 behaviour
when a compass is internal only apply board orientation, not user
specified rotation
2015-03-13 18:46:15 +11:00
Andrew Tridgell a871c87cad AP_Compass: use state array for compass variables 2015-03-13 18:46:15 +11:00
Víctor Mayoral Vilches 13f0aa5ecd AP_Compass: Separate common code into backend
_copy_to_frontend function takes care of abstracting
this code from the driver. For now the function takes
care of the offset and rotation that is common.
2015-03-13 18:46:15 +11:00
Víctor Mayoral Vilches d3b76cd8d3 AP_Compass: split compass into frontend/backend 2015-03-13 18:46:15 +11:00
Andrew Tridgell 99ed508903 AP_Compass: change for new PX4 paths 2015-02-14 12:25:43 +11:00
Grant Morphett 52c5db8440 AP_Compass: Changes to fix the warnings in rover sitl build.
We are starting the process of resolving all the warnings in the
ardupilot builds of all vehicles and platforms.
2015-02-11 18:16:45 +11:00
Emile Castelnuovo 5e8c1b61b5 AP_Compass: AP_Compass_VRBRAIN.cpp added _is_external overwrite to deal with external compass attached to internal I2C BUS 2015-02-02 08:44:00 +11:00
Randy Mackay 635ff92d6b Compass: fix example sketch 2015-01-28 17:15:39 +09:00
mirkix 9a65a8c8fb AP_Compass: add AK8963 to auto-detect in test suite 2015-01-22 14:34:23 +11:00
mirkix e9d4165a8d AP_Compass: add AK8963 support to test suite 2015-01-22 14:34:17 +11:00
Staroselskii Georgii c16eb5d330 AP_Compass: fixed corrections for AK8963 2015-01-09 06:38:22 +11:00
Staroselskii Georgii 4394f0cf75 AP_Compass: fixed external compass detection for AK8963 2015-01-09 06:38:22 +11:00
Staroselskii Georgii f0753e965e AP_Compass: eliminated possible division by zero in AK8963 2015-01-09 06:38:22 +11:00
Staroselskii Georgii b804430276 AP_Compass: changed default orientation for AK8963 on Navio 2015-01-09 06:38:22 +11:00
Andrew Tridgell 9835544163 AP_Compass: fixed build on non-Linux platforms 2015-01-07 08:41:14 +11:00
Staroselskii Georgii 0d1cf347c7 AP_Compass: added AK8963 support 2015-01-07 08:41:12 +11:00
Randy Mackay ffbc3862bd Compass: update compass orient param description
Update rotation 38 to Yaw293Pitch68Roll90
2015-01-02 17:19:12 +09:00
Andrew Tridgell a686494127 AP_Compass: fixed example build 2014-11-28 10:40:34 +11:00
Randy Mackay 20f3f19285 Compass: add new rotation to ORIENT param description 2014-11-22 14:13:25 +09:00
Staroselskii Georgii 7f00dd413f AP_Compass: fixed HMC5883's initialisation code 2014-11-14 10:21:04 +11:00
Randy Mackay 31087e4f20 Compass: shorten EXTERNAL2/3 to EXTERN2/3
Bug discovered by Michael Day
2014-11-08 10:21:22 +09:00
Andrew Tridgell 7db0244dac AP_Compass: added some comments 2014-10-19 17:02:45 +11:00
Jonathan Challinger 9054dd3f9a AP_Compass: use apply_correction_function to eliminate duplication 2014-10-19 17:02:45 +11:00
Andrew Tridgell b437977547 AP_Compass: added set_offsets() interface
this will be used by Replay to prevent the need for saving parameters
2014-10-15 09:16:31 +11:00
Randy Mackay 7caa611eb1 Compass_HIL: use instance specific orient and external 2014-10-01 13:02:03 +10:00
Randy Mackay 86aac4f40c Compass_HMC5843: use instance specific orient and external 2014-10-01 13:02:03 +10:00
Randy Mackay 900896977c Compass_VRBrain: use instance specific orient and external 2014-10-01 13:02:03 +10:00
Randy Mackay 85e82a0399 Compass_PX4: use instance specific orient and external 2014-10-01 13:02:03 +10:00
Randy Mackay 023b6afe8b Compass: add ORIENT2 and EXTERNAL2 params 2014-10-01 13:02:03 +10:00
Randy Mackay 16058cb730 Compass_VRBrain: primary compass based on use_for_yaw 2014-10-01 13:02:02 +10:00
Randy Mackay 01fa4ba619 Compass_PX4: primary compass based on use_for_yaw 2014-10-01 13:02:02 +10:00
Randy Mackay 798cc36e64 Compass: use_for_yaw for each compass 2014-10-01 13:02:02 +10:00
Randy Mackay 84d792216e Compass: use_for_yaw to use primary compass health
This allows the internal compass to be used if the external compass
fails.
2014-10-01 13:02:02 +10:00
Randy Mackay e14ae0c0b1 Compass: param descriptions for OFS2, MOT2 2014-09-27 17:59:26 +09:00
Randy Mackay c2c5807ec7 Compass: always default devid to zero 2014-09-23 20:35:18 +09:00
Andrew Tridgell 9f6d1f987b AP_Compass: removed use of hrt_absolute_time() 2014-08-20 08:41:28 +10:00
Andrew Tridgell 41e65c2415 AP_Compass: fixed default orientation for PXF 2014-08-19 10:08:17 +10:00
Emile Castelnuovo 3b53c167a0 AP_Compass: VRBRAIN. Deal with external mag connected on internal I2C on VRBRAIN 4.5
This enables user to set the external parameter to true even if only one compass is connected
2014-08-16 20:28:50 +10:00
Andrew Tridgell c49981c03d AP_Compass: fixed example build 2014-08-13 22:11:25 +10:00
Emile Castelnuovo 1092447360 AP_Compass_VRBrain: add support for two compasses 2014-07-23 20:51:12 +09:00
Emile Castelnuovo 4deafffb3e AP_Compass: VRBRAIN corrected function definition
Add support for two compasses.
2014-07-23 20:47:19 +09:00
Randy Mackay a6c29ba1c3 Compass_PX4: get_primary made public 2014-07-22 22:01:23 +09:00
Randy Mackay c16672a529 Compass_VRBrain: get_primary made public 2014-07-22 22:01:22 +09:00
Randy Mackay d291594d7c Compass: get_primary method made public 2014-07-22 22:01:09 +09:00
Randy Mackay 1f579563e6 Compass: set_motor_compensation takes instance as first parameter
Also get_motor_compensation uses primary compass
2014-07-22 21:59:04 +09:00
Randy Mackay 47801a6c4d Compass: bug fix to init of device id
Also init members to reduce compiler warnings
2014-07-16 14:29:10 +09:00
Markus Koetter 701aa9ac4c AP_Compass: DEVIOCGDEVICEID is (currently) not defined in VRNuttX 2014-07-15 11:42:37 +10:00
Andrew Tridgell 1e20f89f90 AP_Compass: use HAL_COMPASS_DEFAULT in example code 2014-07-14 09:44:36 +10:00
Randy Mackay bbf4805b0e Compass: update pixhawk expected device ids 2014-07-11 11:10:18 +09:00
Craig Elder c9f3adcb5c Compass: Updated COMPASS_PRIMARY parameter description 2014-07-10 15:32:06 -07:00
Craig Elder 0ecd12b1c6 AP_Compass: Corrected typo in parameter description
Corrected typo in parameter description
2014-07-10 14:19:19 -07:00
Randy Mackay 4995b9ada8 Compass: default device id to zero 2014-07-10 20:25:36 +09:00
Randy Mackay 16d4af8346 Compass: sanity check instance in set_and_save_offsets 2014-07-10 20:25:32 +09:00
Randy Mackay cf7e1a6339 Compass: example sketch update for set_and_save_offsets 2014-07-10 20:25:13 +09:00
Randy Mackay a778522cef Compass: add learn_offsets_enabled accessor method 2014-07-10 20:25:11 +09:00
Randy Mackay 108c878b04 Compass: set_offsets modified to also save offsets 2014-07-10 20:25:08 +09:00
Randy Mackay 124bd4b489 Compass: save_offsets accepts compass instance 2014-07-10 20:25:05 +09:00
Randy Mackay 070f1c1bbb Compass: add dev_id for VRBrain 2014-07-10 20:24:49 +09:00
Randy Mackay f42c9579d7 Compass: add dev_id for PX4
dev_id is retrieved from PX4Firmware via ioctl call
2014-07-10 20:24:46 +09:00
Randy Mackay b7f33d81ad Compass: add DEV_ID param and configured method
These allow checking the offsets were created with the current compass
device.
2014-07-10 20:24:44 +09:00
Andrew Tridgell c138244155 AP_Compass: support 3 mags on PX4 2014-07-04 12:07:47 +10:00
Emile Castelnuovo 8f3a4bc88b VRBRAIN: correction to AP_Compass_VRBRAIN.cpp 2014-06-19 11:27:45 +02:00
LukeMike 8f552d5758 VRBRAIN: Changed the management of VirtualRobotix's boards. 2014-06-19 11:27:38 +02:00
Andrew Tridgell e9e1799700 AP_Compass: fixed VRBrain build 2014-06-02 10:42:37 +10:00
Andrew Tridgell 2d9e9d9bc3 AP_Compass: added COMPASS_PRIMARY parameter
this allows selection of which compass is the primary. Useful if the
first compass starts giving spurious data (as happened in our plane)
2014-05-25 22:03:44 +10:00
Jonathan Challinger e883b889b6 SITL: Add compassmot interference 2014-05-15 21:14:20 +10:00
Kevin Hester b7bed437c2 Compass: fixup line endings 2014-04-15 15:56:57 +09:00
Emile Castelnuovo 1bc199c5bd AP_Compass: new files and definition for VRBRAIN board 2014-04-08 16:19:19 +10:00
Andrew Tridgell 485ae596fc AP_Compass: fixed last_update for secondary compass with primary failed
this ensures EKF and DCM will use a secondary compass if the primary
fails
2014-03-23 22:05:17 +11:00
Matthew Lloyd 60a4f74de6 AP_Compass: avoid division by zero if we haven't received any mag reports
Otherwise, get_field() will return NaNs after once every few calls to
read() during compassmot on PX4 platforms, which causes compassmot to fail.

This is a quick hack around the deeper issue, which could be something
like the PX4 mag driver experiencing starvation and skipping mag reports,
buffer overrun or something else that causes mag reports to be dropped.
Or perhaps we should never expect in the first place that we will always
receive at least one mag report between calls to read().
2014-03-23 21:22:32 +11:00
Andrew Tridgell db48ed9218 AP_Compass: fixed showing of is_external for 2nd compass 2014-03-13 16:26:43 +11:00
Andrew Tridgell cf148fa76c AP_Compass: improved COMPASS_ORIENT and COMPASS_EXTERNAL for Pixhawk 2014-02-27 12:46:27 +11:00
Andrew Tridgell 189d635493 AP_Compass: constrain compass offsets to +/- 2000
this is prompted by a user log showing NaN compass offsets, resulting
in a crash. The patch ensures we never end up with NaN offsets, and
also constrains the offsets to a reasonable limit
2014-02-16 13:33:41 +11:00
Andrew Tridgell 9bb8f73d56 Compass: split compass learning out to its own C++ file 2014-02-16 13:21:06 +11:00
Andrew Tridgell 54562b0b9a AP_Compass: prevent bad initial values from affecting HMC5883 calibration
the first couple of values after we enter strap mode may be low, but
just above our 0.7 threshold. We now discard the first two values to
prevent these affecting the average.

Also added some commented out debug code and a comment on the scaling
of the calibration code
2014-01-22 17:15:34 +11:00
Andrew Tridgell bc2d17e76e AP_Compass: added vector compass setHIL method 2013-12-30 14:35:24 +11:00
Andrew Tridgell c44d8b45ce AP_Compass: auto-select healthy compass 2013-12-09 20:01:42 +11:00
Andrew Tridgell 61f564d7c9 AP_Compass: support motor compensation for multiple compasses
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-12-09 19:45:31 +11:00
Andrew Tridgell 0a7a935f63 AP_Compass: fixup 2013-12-09 17:54:54 +11:00
Andrew Tridgell c538816825 AP_Compass: support compass health status on multiple compasses 2013-12-09 17:46:41 +11:00
Andrew Tridgell bde89fd4e2 AP_Compass: added compass offsets for 2nd compass 2013-12-09 17:34:07 +11:00
Andrew Tridgell 8a97042fb1 AP_Compass: updates to support multiple compasses 2013-12-09 17:34:07 +11:00
Andrew Tridgell cb16733918 AP_Compass: switched to a vector based interface
this is more consistent with other APIs and makes multi-device support
easier
2013-12-09 17:34:06 +11:00
Randy Mackay 84fdff4cd6 Compass: slightly relax HMC5843 calibration limits
Some users have reported Z axis values as high as 1.33.  Their compasses
seem otherwise health so extending the limits slightly.
2013-11-27 15:36:34 +09:00
Andrew Tridgell 1ccd6bb7ef AP_Compass: don't wait more than 1ms for compass sample
this prevents 5ms delays in compass accumulate
2013-10-08 11:50:54 +11:00
Andrew Tridgell f286369990 AP_Compass: fixed orientation on Linux 2013-10-08 11:50:54 +11:00
Andrew Tridgell 83c942a512 AP_Compass: prevent NULL deref on enable mag while running 2013-10-08 11:50:53 +11:00
Andrew Tridgell da14ad2e2d AP_Compass: neaten up HMC5883 debug 2013-09-28 21:24:02 +10:00
Andrew Tridgell ce7d458855 AP_Compass: added Linux support to the compass test 2013-09-28 21:24:02 +10:00
Andrew Tridgell 6fc5b06043 AP_Compass: fixed some old Serial.print calls 2013-09-28 21:24:02 +10:00
Andrew Tridgell 1243ab9e63 AP_Compass: added HAL_Linux support 2013-09-28 21:24:02 +10:00
Andrew Tridgell 3f0f8dfa62 AP_Compass: removed SMACCM support 2013-09-26 22:38:31 +10:00
Mike McCauley 2fa0c39f3a AP_Compass: added Flymaple orientation 2013-09-24 13:18:35 +10:00
Mike McCauley 4c65c42411 AP_Compass: fixed ARM 32 bit compatibility 2013-09-23 18:10:21 +10:00
Andrew Tridgell 229841052a AP_Compass_PX4: removed MAGIOCSSAMPLERATE call 2013-09-09 18:04:41 +10:00
Andrew Tridgell db14a85fc5 AP_Compass: added more debugging to AP_Compass_PX4 driver
this helps debug compass initialisation issues
2013-09-09 18:04:40 +10:00
Andrew Tridgell b8b72819c1 AP_Compass: ignore COMPASS_ORIENT for internal compass
this means if COMPASS_ORIENT is not 0 and the external compass fails
to start on boot we don't end up with a bad compass orientation
2013-09-07 16:49:51 +10:00
Andrew Tridgell 9320e82ac2 AP_Compass: added in new orientations 2013-08-30 14:19:03 +10:00
Andrew Tridgell fbf79c07f0 AP_Compass: added COMPASS_EXTERNAL option
this allows configuring of a compass as being externally attached
2013-08-30 14:02:09 +10:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell 1ff669eb97 AP_Compass: simplify PX4 compass driver
we can now rely on queueing in the NuttX driver
2013-08-30 13:01:34 +10:00
Andrew Tridgell feac9d1306 AP_Compass: fixed a bug in the tilt compass calculation
The simplification applied a few months ago was incorrect
2013-08-18 21:08:52 +10:00
Tobias ab311d1dd4 AP_Compass: removed comparison out of range compiler warning
uint_ >= 0 (-Wtype-limits)
2013-07-08 14:57:25 +10:00
Andrew Tridgell a6c7bd3612 AP_Compass: fixed rotations for COMPASS_ORIENT
this matches AHRS_ORIENTATION again
2013-07-08 12:17:59 +10:00
Craig@3DR 1a3ed2d80b AP_Compass: Corrected COMPASS_ORIENT Parameter Description 2013-06-26 19:14:24 -07:00
Andrew Tridgell 4007b7b1e9 AP_Compass: fixed indent-tabs-mode 2013-05-30 09:52:30 +10:00
Randy Mackay 80bd458f29 Compass: update parameter description
We do not want people modifying the COMPASS_MOTCT manually
2013-05-11 14:50:36 +09:00
Andrew Tridgell 9a87b3f3c1 AP_Compass: use const on more functions and remove old calculate_heading()
the calculate_heading() based on roll/pitch is not needed anywhere
2013-05-09 09:24:06 +10:00
Andrew Tridgell f78de63a09 AP_Compass: more efficient calculate_heading() implementation
Thanks to piersh for this improvement. See

b5f0635455 (commitcomment-3171806)
2013-05-09 09:24:06 +10:00
Andrew Tridgell c90d44c121 AP_Compass_HIL: fixed indentation 2013-05-02 21:31:17 +10:00
Andrew Tridgell f72dd560cb AP_Compass: fixed the HIL sensors compass
this sets up good compass values for HIL sensors
2013-05-02 14:59:33 +10:00
Andrew Tridgell 86027f6e0f AP_Compass: fixed PX4 build 2013-05-02 13:00:52 +10:00
Andrew Tridgell af50b652f8 AP_Compass: removed old orientation defines
we now use the rotations in libraries/AP_Math/rotations.h
2013-05-02 12:48:14 +10:00