@ -73,8 +73,7 @@ http://code.google.com/p/ardupilot-mega/downloads/list
@@ -73,8 +73,7 @@ http://code.google.com/p/ardupilot-mega/downloads/list
#include <AP_PeriodicProcess.h> // Parent header of Timer
// (only included for makefile libpath to work)
#include <AP_TimerProcess.h> // TimerProcess is the scheduler for MPU6000 reads.
#include <AP_Quaternion.h> // Madgwick quaternion system
#include <AP_DCM.h> // ArduPilot Mega DCM Library
#include <AP_AHRS.h>
#include <APM_PI.h> // PI library
#include <AC_PID.h> // PID library
#include <RC_Channel.h> // RC Channel Library
@ -235,12 +234,9 @@ AP_IMU_INS imu(&ins);
@@ -235,12 +234,9 @@ AP_IMU_INS imu(&ins);
static GPS *g_gps_null;
#if QUATERNION_ENABLE == ENABLED
// this shouldn't be called dcm of course, but until we
// decide to actually use something else, I don't want the patch
// size to be huge
AP_Quaternion dcm(&imu, g_gps_null);
AP_AHRS_Quaternion ahrs(&imu, g_gps_null);
#else
AP_DCM dcm (&imu, g_gps_null);
AP_AHRS_DCM ahrs(&imu, g_gps_null);
#endif
AP_TimerProcess timer_scheduler;
@ -251,7 +247,7 @@ AP_TimerProcess timer_scheduler;
@@ -251,7 +247,7 @@ AP_TimerProcess timer_scheduler;
AP_Compass_HIL compass;
AP_GPS_HIL g_gps_driver(NULL);
AP_IMU_Shim imu;
AP_DCM dcm (&imu, g_gps);
AP_AHRS_DCM ahrs (&imu, g_gps);
AP_PeriodicProcessStub timer_scheduler;
AP_InertialSensor_Stub ins;
@ -259,11 +255,11 @@ AP_TimerProcess timer_scheduler;
@@ -259,11 +255,11 @@ AP_TimerProcess timer_scheduler;
#elif HIL_MODE == HIL_MODE_ATTITUDE
AP_ADC_HIL adc;
AP_DCM_HIL dcm;
AP_IMU_Shim imu; // never used
AP_AHRS_HIL ahrs(&imu, g_gps);
AP_GPS_HIL g_gps_driver(NULL);
AP_Compass_HIL compass; // never used
AP_Baro_BMP085_HIL barometer;
AP_IMU_Shim imu; // never used
AP_InertialSensor_Stub ins;
AP_PeriodicProcessStub timer_scheduler;
#ifdef OPTFLOW_ENABLED
@ -984,7 +980,7 @@ static void medium_loop()
@@ -984,7 +980,7 @@ static void medium_loop()
if(g.compass_enabled){
if (compass.read()) {
// Calculate heading
Matrix3f m = dcm .get_dcm_matrix();
Matrix3f m = ahrs .get_dcm_matrix();
compass.calculate(m);
compass.null_offsets(m);
}
@ -1297,7 +1293,7 @@ static void update_optical_flow(void)
@@ -1297,7 +1293,7 @@ static void update_optical_flow(void)
static int log_counter = 0;
optflow.update();
optflow.update_position(dcm.roll, dcm .pitch, cos_yaw_x, sin_yaw_y, current_loc.alt); // updates internal lon and lat with estimation based on optical flow
optflow.update_position(ahrs.roll, ahrs .pitch, cos_yaw_x, sin_yaw_y, current_loc.alt); // updates internal lon and lat with estimation based on optical flow
// write to log
log_counter++;
@ -1555,7 +1551,7 @@ void update_simple_mode(void)
@@ -1555,7 +1551,7 @@ void update_simple_mode(void)
// which improves speed of function
simple_counter++;
int delta = wrap_360(dcm .yaw_sensor - initial_simple_bearing)/100;
int delta = wrap_360(ahrs .yaw_sensor - initial_simple_bearing)/100;
if (simple_counter == 1){
// roll
@ -1863,17 +1859,17 @@ static void read_AHRS(void)
@@ -1863,17 +1859,17 @@ static void read_AHRS(void)
// Perform IMU calculations and get attitude info
//-----------------------------------------------
#if HIL_MODE != HIL_MODE_DISABLED
// update hil before dcm update
// update hil before ahrs update
gcs_update();
#endif
dcm.update_DCM ();
ahrs.update ();
omega = imu.get_gyro();
}
static void update_trig(void){
Vector2f yawvector;
Matrix3f temp = dcm .get_dcm_matrix();
Matrix3f temp = ahrs .get_dcm_matrix();
yawvector.x = temp.a.x; // sin
yawvector.y = temp.b.x; // cos