From 76971a807cbb73914c9686cbebbf8d519bed84a0 Mon Sep 17 00:00:00 2001 From: peabody124 Date: Sun, 12 Sep 2010 22:18:18 +0000 Subject: [PATCH] AHRS: Some more tweaking of the timings. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1603 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/AHRS/ahrs.c | 3 ++- flight/AHRS/inc/insgps.h | 1 + flight/AHRS/insgps.c | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/flight/AHRS/ahrs.c b/flight/AHRS/ahrs.c index 63275aa66..7db022498 100644 --- a/flight/AHRS/ahrs.c +++ b/flight/AHRS/ahrs.c @@ -69,7 +69,7 @@ void DMA1_Channel1_IRQHandler() __attribute__ ((alias ("AHRS_ADC_DMA_Handler"))) * @{ */ // Currently analog acquistion hard coded at 480 Hz -#define ADC_OVERSAMPLE 40 +#define ADC_OVERSAMPLE 48 #define EKF_RATE ((float) 4*480 / ADC_OVERSAMPLE) #define ADC_CONTINUOUS_CHANNELS PIOS_ADC_NUM_PINS #define CORRECTION_COUNT 4 @@ -388,6 +388,7 @@ int main() vel[1] = 0; vel[2] = 0; VelBaroCorrection(vel,altitude_data.altitude); +// MagVelBaroCorrection(mag,vel,altitude_data.altitude); // only trust mags if outdoors } attitude_data.quaternion.q1 = Nav.q[0]; diff --git a/flight/AHRS/inc/insgps.h b/flight/AHRS/inc/insgps.h index b41e87645..22f6d38a6 100644 --- a/flight/AHRS/inc/insgps.h +++ b/flight/AHRS/inc/insgps.h @@ -59,6 +59,7 @@ void INSSetMagNorth(float B[3]); void INSSetMagVar(float scaled_mag_var[3]); void MagCorrection(float mag_data[3]); +void MagVelBaroCorrection(float mag_data[3], float Vel[3], float BaroAlt); void FullCorrection(float mag_data[3], float Pos[3], float Vel[3], float BaroAlt); void GpsMagCorrection(float mag_data[3], float Pos[3], float Vel[2]); void VelBaroCorrection(float Vel[3], float BaroAlt); diff --git a/flight/AHRS/insgps.c b/flight/AHRS/insgps.c index d592315d8..6e716e570 100644 --- a/flight/AHRS/insgps.c +++ b/flight/AHRS/insgps.c @@ -173,6 +173,11 @@ void MagCorrection(float mag_data[3]) INSCorrection(mag_data, zeros, zeros, zeros[0], MAG_SENSORS); } +void MagVelBaroCorrection(float mag_data[3], float Vel[3], float BaroAlt) +{ + INSCorrection(mag_data, zeros, Vel, BaroAlt, MAG_SENSORS | HORIZ_SENSORS | VERT_SENSORS | BARO_SENSOR); +} + void FullCorrection(float mag_data[3], float Pos[3], float Vel[3], float BaroAlt) { INSCorrection(mag_data, Pos, Vel, BaroAlt, FULL_SENSORS);