Commit Graph

129 Commits

Author SHA1 Message Date
Andrew Tridgell 0da64e98f8 Compass: don't save the orientation to EEPROM
there is no point in saving this, the value is only configurable at
compile time for now, and is always set
2012-03-11 15:37:07 +11:00
Andrew Tridgell cb96dd975f Compass: update the compass driver to use the new vector.rotate() method 2012-03-11 15:37:07 +11:00
Andrew Tridgell 6eff9107ea Compass: change last_update to be in microseconds 2012-03-10 10:34:32 +11:00
Andrew Tridgell d0a6359b37 Compass: use constructor to set initial values for _learn and _use_for_yaw
this ensures they are set if you have MAG_ENABLE==0
2012-02-25 17:36:31 +11:00
Andrew Tridgell f59297d7a7 Compass: catch the case of a user enabling a compass mid-flight
if a compass has not been initialised at startup we can't enable it
mid-flight, as we don't have the orientation
2012-02-25 14:51:09 +11:00
Andrew Tridgell 664622523d Compass: added COMPASS_LEARN and COMPASS_USE parameters
these allow you to control if the compass should be used for yaw and
if it should learn its offsets. This is useful for locking in compass
offsets once they are confirmed to be good, and for learning offsets
without using them in flights.

The default is to behave the same as previously, which is
COMPASS_LEARN=1 and COMPASS_USE=1
2012-02-25 14:51:08 +11:00
Andrew Tridgell 8c58d95187 modify the compass code for AP_Param 2012-02-13 16:22:51 +11:00
Randy Mackay ed19c25a97 Arduino 1.0 - changed all #includes of "WProgram.h", "wiring.h" and "WConstants.h to "Arduino.h".
Modified FastSerial's write function to return size_t (number of bytes written).
2012-01-28 12:25:47 +09:00
Andrew Tridgell 60185509f4 AP_Compass: when I2c fails, don't retry for 1s 2012-01-04 16:35:47 +11:00
Andrew Tridgell acf4e9b61d I2C: convert compass code to new I2C library
this also adds a healthy attribute, and error checking on all I2C
calls
2011-12-28 20:41:53 +11:00
tridge60@gmail.com 0bf026e6ad Compass: added a gain multiplier
this adjusts the calibration based on the change in gain between
calibration and runtime

git-svn-id: https://arducopter.googlecode.com/svn/trunk@3090 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-08-13 10:39:11 +00:00
tridge60@gmail.com ab04055c35 Compass: several fixes to compass calibration code
this changes the calibration code to require at least 5 good reads
from the compass during initialisation. The calibration is taken as
the average of the 5 values.

This also fixes the expected values for the 3 axes for the 5883 to
match reality.

We also save a bit of code space by adding a common rotate_for_5883L()
routine.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@3087 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-08-13 08:17:25 +00:00
tridge60@gmail.com a604e30c7c cope with double initialisation of the compass
if we've already initialised, then the orientation matrix will already
be right

git-svn-id: https://arducopter.googlecode.com/svn/trunk@3072 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-08-10 14:07:15 +00:00
tridge60@gmail.com 7d58916a9d compass: add a small delay in compass init
this adds a 50ms delay after setting the compass gains before reading
the compass. Added as paranoia after some strange results on a 5843

git-svn-id: https://arducopter.googlecode.com/svn/trunk@3070 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-08-10 12:47:25 +00:00
tridge60@gmail.com 48f010f80c compass: fixed a compiler warning
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2844 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-13 09:10:24 +00:00
tridge60@gmail.com 165643c307 fixed 5843 detection code
we were looking for the wrong regA value

Thanks to Chris for the debugging help! (and happy birthday!)

git-svn-id: https://arducopter.googlecode.com/svn/trunk@2828 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-09 22:27:15 +00:00
tridge60@gmail.com 7b803a9e1a compass: added error checking on I2C transactions
this adds error checking to all operations on the compass, to ensure
that we don't accept invalid data

This also fixes the calibration values for the 5883L to match the
recommended values in the spec

git-svn-id: https://arducopter.googlecode.com/svn/trunk@2815 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-09 12:10:00 +00:00
tridge60@gmail.com 90b0d769f8 compass: fixed normal operation mode change for 5883L
We need to set the right rates after config too. Thanks to Randy for
spotting this one

git-svn-id: https://arducopter.googlecode.com/svn/trunk@2737 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-03 12:00:45 +00:00
tridge60@gmail.com d46536e142 compass: fixed output rate and averaging for 5883L
we need to setup the right output rate, or the compass gets very laggy

git-svn-id: https://arducopter.googlecode.com/svn/trunk@2736 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-03 08:32:58 +00:00
tridge60@gmail.com 2605c4b4b2 AP_Compass: fixed calibration of 5883L compass
this fixes a compass initialisation bug where if the first value from
the compass isn't in the right range we would set bad calibration
scaling factors.

This also changes the maximum acceptable calibration values to 2000,
which is needed for the 5883 compass

pair-programmed-with: Randy Mackay

git-svn-id: https://arducopter.googlecode.com/svn/trunk@2718 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-02 11:31:38 +00:00
rmackay9@yahoo.com 8ce403cbe4 AP_Compass - added auto detect of 5843 vs 5883L to AP_Compass_HMC5843 class
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2700 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-28 16:47:53 +00:00
rmackay9@yahoo.com da7a13128a AP_Compass - added auto detect of 5843 vs 5883L to AP_Compass_HMC5843 class
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2699 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-28 16:30:42 +00:00
james.goppert 7809b0ca2a Massive warning fixes.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2089 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-04 19:12:27 +00:00
DrZiplok@gmail.com a4e791dc92 Line ending property changes.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1649 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:27:07 +00:00
DrZiplok@gmail.com cc06f07067 Major update including AP_Var support.
Most of the compass functionality is now abstracted in a base class, with the various sub-classes implementing just their unique functionality.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1647 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:25:20 +00:00
deweibel 8c76c8c936 Add code for auto magnetometer offset nulling.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1615 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-08 20:17:16 +00:00
james.goppert b66b0f6cce Fixed issues with AP_Compass
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1003 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-02 06:23:56 +00:00
jasonshort 729cf47b3c needs some help
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1001 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-02 05:54:02 +00:00
james.goppert 559229a667 Added HIL and HMC5843 compass libs.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@998 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-02 05:19:38 +00:00