Commit Graph

21 Commits

Author SHA1 Message Date
Doug Weibel 622217357c Bug fix for compass.
This is a fix for an interesting bug when a DCM matrix reset was added to the ground start.  This bug only showed up if (A) a ground start were performed after an air start or due to use of the "Calibrate Gryo" action, (B) if the current orientation were sufficiently different from 0/0/0, and (C.) if the particular magnetometer had sufficiently large offsets.  Why did resetting the DCM matrix to 0/0/0 pitch/roll/yaw at ground start cause a bug?  The magnetometer offset nulling determines the proper offsets for the magnetometer by comparing the observed change in the magnetic field vector with the expected change due to rotation as calculated from the rotation in the DCM matrix.  This comparison is made at 10Hz, and then filtered with a weight based on the amount of rotation to estimate the offsets. Normally it would take considerable time at normal in-flight rotation rates for the offset estimate to converge. 

If a DCM matrix reset occurs when the offset nulling algorithm is up and running, the algorithm sees the DCM reset as a instantaneous rotation, however the magnetic field vector did not change at all.  Under certain conditions the algorithm would interpret this as indicating that the offset(s) should be very large.  Since the "rotation" could also have been large the filter weighting would be large and it was possible for a large erroneous estimate of the offset(s) to be made based on this single (bad) data point.

To fix this bug methods were added to the compass object to start and stop the offset nulling algorithm.  Further, when the algorithm is started, it is set up to get fresh samples.  The DCM matrix reset method now calls these new methods to stop the offset nulling before resetting the matrix, and resume after the matrix has been reset.
2012-01-12 14:44:24 -07:00
Andrew Tridgell 5aca951438 APM: added error checking on barometer read
if the barometer is dead and the GPS has a fix, use the GPS for
altitude
2011-12-28 20:41:53 +11:00
Andrew Tridgell 2c41264a9b APM: added error checking on compass read 2011-12-28 20:41:53 +11:00
Andrew Tridgell b108b907e0 APM: Update for DataFlash changes 2011-12-28 16:00:49 +11:00
Andrew Tridgell 73146bae5d APM: show temperature in airpressure test
useful for tracking down baro bugs
2011-12-19 18:52:56 +11:00
Andrew Tridgell 5d2301ef47 fixed airspeed sensor for ArduPlane on APM2
we were trying to use a non-existant ADC chip!
2011-12-17 07:29:09 +11:00
Andrew Tridgell e8617fc929 DCM: reset the DCM matrix after a ground start 2011-12-13 21:33:07 +11:00
Andrew Tridgell d416013bd8 fixed a hang on 2nd run of IMU test
we should not try to initialise the ISR handlers twice
2011-12-13 18:28:50 +11:00
Andrew Tridgell c007fb49b8 IMU: update ACM and APM for flash_leds change in IMU init 2011-12-13 18:19:41 +11:00
Andrew Tridgell faf58a355b airspeed: use floating point values and better averaging in zero_airspeed()
this makes the calibration of airspeed a bit more accurate, and
prevents truncation of airspeed values
2011-12-12 15:14:55 +11:00
Andrew Tridgell 899c1364cc test: removed the broken gyro test and merge it into the imu test
the gyro test assumed APM1 hardware, and would hang on APM2. The imu
test can just as easily display gyro and accelerometer data as well as
roll/pitch/yaw, so combine it in one test
2011-12-03 14:08:20 +11:00
Pat Hickey a6bf2d9cd6 ArduPlane: LED digital writes use LED_OFF and LED_ON 2011-11-25 20:00:19 -08:00
Andrew Tridgell 7467bf649c ArduPlane: rename purple to APM2 2011-11-25 20:00:19 -08:00
Andrew Tridgell c8b592f8a7 purple: there are no dipswitches on the purple board 2011-11-25 20:00:18 -08:00
Andrew Tridgell b6bab1d92d purple: adc test not useful if no ADC 2011-11-25 20:00:18 -08:00
Pat Hickey c93d7a9560 purple: added new parameters to Init() functions
this adapts the test code for the purple API changes
2011-11-25 20:00:17 -08:00
Pat Hickey ed74d1c987 test: added new passthru test
this passes radio inputs direct to servo outputs, which is useful for
hardware testing
2011-11-25 20:00:17 -08:00
Doug Weibel 1cd3c21774 Initial rewrite of command logic.
Changes mission structure so that conditional and immediate commands are located between associated waypoints instead of after the second waypoint.
2011-10-27 13:45:52 -06:00
Amilcar Lucas 101dc83239 Fix compilation 2011-10-02 14:52:02 +02:00
Andrew Tridgell 4fed88ffbf ArduPilot updates for new DCM code
G_Dt is no longer needed, and scale ADC values by 8 to match old
constants
2011-09-17 14:58:02 +10:00
Andrew Tridgell 89fa70520f imported ArduPlane from ArduPilotMega svn 2011-09-09 11:29:39 +10:00