Commit Graph

59 Commits

Author SHA1 Message Date
Andrew Tridgell 20aef3a8b8 added a simple DCM library example 2012-01-18 21:25:19 +11:00
Andrew Tridgell f4490b62c7 DCM: prevent a segmentation fault when compass is not enabled
when compass is disabled _compass is NULL
2012-01-13 15:48:07 +11:00
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 669a129175 DCM: don't use compass unless its healthy 2011-12-28 20:41:54 +11:00
Andrew Tridgell 621f21e4f5 DCM: added matrix_reset() method 2011-12-13 21:32:50 +11:00
Andrew Tridgell 43a53aa303 dcm: fixed an uninitialised variable
if no compass and not in motion the DCM we would multiply by an
uninitialised number
2011-12-11 15:21:10 -08:00
Wenyao Xie 9fef8689d8 Fixed baro. 2011-12-06 18:56:16 -05:00
Jason Short 17fbbb4e7b Access to _clamp val. May want to make a private member and write accessor. 2011-12-03 17:57:12 -08:00
Jason Short d54d9b618c Added faster conversion from and to degrees*100 / rads 2011-12-03 17:56:41 -08:00
Doug Weibel d4fff166cf Add an accessor for the DCM drift correction integrator to monitor performance
Also made the get_health accessor an inline function.
2011-11-05 09:02:23 -06:00
Doug Weibel beb6c4dbf4 Changed the DCM drift correction integrator limit to a vector magnitude of 30 degrees/second.
The drift correction integrator limit previously was near/at the gyro saturation limit.  If we have that much drift there is a serious hardware problem.  30 degrees/second is arbitrary but should handle all temperature variation, etc.
2011-11-05 09:01:20 -06:00
Doug Weibel b105e7fd41 In case of DCM renorm "blow-up" reset the drift correction integrators
This should aid in recovery if we loose the AHRS solution and have to force to initial orientation.  Also removed some old commented out code moved to the IMU object
2011-11-05 08:59:16 -06:00
Michael Oborne 1c72598393 Fix HIL DCM to match actual 2011-10-28 17:40:18 +08:00
James Goppert ac3e73f5c0 Optional recursion added. 2011-09-30 17:17:51 -04:00
James Goppert 112d5e9531 Improvements to cmake. 2011-09-29 21:23:26 -04:00
James Goppert 3a00ceb593 Added ArduBoat/ ArduRover/ and APO library. 2011-09-29 14:12:15 -04:00
Andrew Tridgell f1974cac21 fixed ArduCopter HIL build 2011-09-17 14:58:02 +10:00
Andrew Tridgell d96fbf8acf DCM: re-work the DCM to use the new IMU/ADC features
this gives us higher resolution DCM calculations, with much more
accurate timing of the update delta time.
2011-09-17 14:58:02 +10:00
unknown 9f028bb5a0 Adding CMake support 2011-09-14 15:44:55 +02:00
Amilcar Lucas ef955eace4 These changes were meant to be inside commit a14c06adc06b. I'm sorry but reverting stuff is not that easy 2011-09-13 01:54:47 +02:00
Amilcar Lucas dd843d18ec Added support for routing any function to any of the aux. servos.
This is a manual merge from the APM_Camera branch.
It reverts the stuff that Oliver did not menat to do with his commit 6dcbc7f44bc0
2011-09-13 01:24:06 +02:00
Olivier ADLER 7e3983210c Merge branch 'APM_Camera' of https://code.google.com/p/ardupilot-mega/
Conflicts:
	ArduPlane/ArduPlane.pde
	libraries/AP_Camera/AP_Camera.h
	libraries/AP_Mount/AP_Mount.cpp
	libraries/AP_Mount/AP_Mount.h
2011-09-12 00:31:18 +02:00
Amilcar Lucas b8832fe9ab Use G_RC_AUX macro to simplify accessing the auxiliary servos 2011-09-12 00:02:47 +02:00
Jason Short e8fcf72966 Added a state machine intended to run at 250hz to the DCM. Spread load of DCM out to lower CPU. 2011-09-11 11:03:55 -07:00
jasonshort 39677e7e66 Added some missing functions needed to get HIL to compile
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2964 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-30 20:34:23 +00:00
jasonshort ce7dc48026 added ki_Yaw private variable and accessors.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2778 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-08 03:57:12 +00:00
jasonshort db0e5760a4 removed redundant FP calcs for speed up.
added ability to alternate normalization and drift correction. Not fully implemented, needs further testing.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@2691 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-26 22:54:08 +00:00
tridge60@gmail.com 88b00edaf3 fixed warnings in AP_DCM
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2559 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-15 12:24:51 +00:00
jasonshort 153c166ef3 Based on Doug's recommendation - increased Accel weighting to .66 – 1.33 Gs
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2557 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-14 23:37:43 +00:00
jasonshort b07c32acd0 Added dynamic setting of kp_rollpitch, ki_rollpitch, kp_yaw.
Added three constants for kp_rollpitch, (high, med -default, low)
Functionally equivalent to prior version.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@2550 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-12 23:49:01 +00:00
DrZiplok d257e12dc0 Re-order initialisers to suppress warnings
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2072 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-02 05:55:59 +00:00
james.goppert a840314b97 APO merge.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1935 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-01 02:05:17 +00:00
deweibel@gmail.com 967130ed7e Add method definition for set_centripetal()
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1756 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-08 01:47:43 +00:00
deweibel@gmail.com 0642e1144d Fix imu_health metric
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1728 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-25 20:09:00 +00:00
DrZiplok@gmail.com ad13b691de DCM needs a reference to a pointer so that we can change the GPS under it during init.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1662 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-16 07:54:48 +00:00
DrZiplok@gmail.com 19f6c999ce We should call imu.update() before asking for accel/gyro values so that we get timely, fresh numbers.
Most other consumers of the accel/gyro values should be asking us for them anyway.  At that point, what they are getting are the values we sampled here.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1376 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-30 07:52:35 +00:00
DrZiplok@gmail.com d5ffec8119 Update for changes to AP_IMU
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1343 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 23:41:26 +00:00
jasonshort 9abc190940 cosmetic
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1313 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 18:34:55 +00:00
deweibel 1da23bc3c0 Fix bug in transposed DCM matrix accessor
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1134 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-14 18:39:02 +00:00
jasonshort 7945937874 added ability to get the transpose of the DCM
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1116 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-13 04:01:26 +00:00
james.goppert 21634dad19 Added AP_DCM_HIL class.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1103 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-10 10:17:27 +00:00
jasonshort 2f2aaa88fd Added dynamic setting of compass
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1010 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-04 06:24:21 +00:00
jasonshort a142d8ee7d imu enhancements
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1007 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-02 22:09:25 +00:00
jasonshort b62c287f5e git-svn-id: https://arducopter.googlecode.com/svn/trunk@1002 f9c3cf11-9bcb-44bc-f272-b75c42450872 2010-12-02 05:54:36 +00:00
james.goppert 110685f880 Updated DCM library.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@996 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-02 05:13:35 +00:00
jasonshort 93206020cb Moved Health to DCM, Centripetal correct
git-svn-id: https://arducopter.googlecode.com/svn/trunk@988 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-01 22:52:11 +00:00
jasonshort 275624358d boolean to disable centrifugal correction.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@987 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-01 19:53:40 +00:00
jasonshort d209f3d59e update - See ArducopterMega in Branch for implementation details
git-svn-id: https://arducopter.googlecode.com/svn/trunk@986 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-01 07:58:04 +00:00
DrZiplok@gmail.com d159986be4 Use fabs() for floating point values, not abs(). The latter causes truncation (cast to int) and generates a lot more code.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@956 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-27 09:24:06 +00:00
james.goppert da9ecf342c Updated AP_DCM to use AP_ADC, fixes HIL bugs.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@948 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-27 04:44:34 +00:00