Added dynamic setting of compass

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1010 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
jasonshort 2010-12-04 06:24:21 +00:00
parent 126383fe43
commit 2f2aaa88fd
3 changed files with 12 additions and 6 deletions

View File

@ -31,8 +31,11 @@
#define ADC_CONSTRAINT 900
// Constructors ////////////////////////////////////////////////////////////////
void
AP_DCM::set_compass(Compass *compass)
{
_compass = compass;
}
/**************************************************/
void
@ -264,7 +267,9 @@ AP_DCM::drift_correction(void)
if (_compass) {
// We make the gyro YAW drift correction based on compass magnetic heading
error_course = (_dcm_matrix.a.x * _compass->heading_y) - (_dcm_matrix.b.x * _compass->heading_x); // Equation 23, Calculating YAW error
} else {
// Use GPS Ground course to correct yaw gyro drift
if (_gps->ground_speed >= SPEEDFILT) {
_course_over_ground_x = cos(ToRad(_gps->ground_course/100.0));

View File

@ -43,6 +43,7 @@ public:
Matrix3f get_dcm_matrix(void);
void set_centripetal(bool b);
void set_compass(Compass *compass);
// Methods
void update_DCM(float _G_Dt);

View File

@ -54,15 +54,15 @@ const float AP_IMU::_gyro_temp_curve[3][3] = {
{1665,0,0}
}; // To Do - make additional constructors to pass this in.
void
AP_IMU::init(void)
{
init_gyro();
init_accel();
}
/**************************************************/
void
AP_IMU::init_gyro(void)
{