[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [5113] MEASURE_AIRSPEED define to make calibration f
From: |
Christophe De Wagter |
Subject: |
[paparazzi-commits] [5113] MEASURE_AIRSPEED define to make calibration flight not yet using the airspeed sensor |
Date: |
Thu, 22 Jul 2010 10:59:53 +0000 |
Revision: 5113
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5113
Author: dewagter
Date: 2010-07-22 10:59:53 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
MEASURE_AIRSPEED define to make calibration flight not yet using the airspeed
sensor
Modified Paths:
--------------
paparazzi3/trunk/sw/airborne/airspeed.c
paparazzi3/trunk/sw/airborne/airspeed.h
paparazzi3/trunk/sw/airborne/estimator.h
Modified: paparazzi3/trunk/sw/airborne/airspeed.c
===================================================================
--- paparazzi3/trunk/sw/airborne/airspeed.c 2010-07-22 10:43:06 UTC (rev
5112)
+++ paparazzi3/trunk/sw/airborne/airspeed.c 2010-07-22 10:59:53 UTC (rev
5113)
@@ -10,10 +10,8 @@
#include "airspeed_ets.h"
#endif
-#ifdef USE_AIRSPEED
+#if defined USE_AIRSPEED || defined MEASURE_AIRSPEED
uint16_t adc_airspeed_val;
-#else
-#error "You compiled the airspeed.c file but did not USE_AIRSPEED, which is
needed in other *.c files"
#endif
#ifdef ADC_CHANNEL_AIRSPEED
@@ -42,8 +40,15 @@
void airspeed_update( void ) {
#ifndef SITL
#ifdef ADC_CHANNEL_AIRSPEED
- adc_airspeed_val = (buf_airspeed.sum / buf_airspeed.av_nb_sample) -
AIRSPEED_ZERO;
- float airspeed = AIRSPEED_SCALE * adc_airspeed_val;
+ adc_airspeed_val = buf_airspeed.sum / buf_airspeed.av_nb_sample;
+#ifdef AIRSPEED_QUADRATIC_SCALE
+ float airspeed = (adc_airspeed_val - AIRSPEED_BIAS);
+ if (airspeed <= 0.0f)
+ airspeed = 0.0f;
+ airspeed = sqrt(airspeed) * AIRSPEED_QUADRATIC_SCALE;
+#else
+ float airspeed = AIRSPEED_SCALE * (adc_airspeed_val - AIRSPEED_BIAS);
+#endif
EstimatorSetAirspeed(airspeed);
#elif defined(USE_AIRSPEED_ETS)
EstimatorSetAirspeed(airspeed_ets);
Modified: paparazzi3/trunk/sw/airborne/airspeed.h
===================================================================
--- paparazzi3/trunk/sw/airborne/airspeed.h 2010-07-22 10:43:06 UTC (rev
5112)
+++ paparazzi3/trunk/sw/airborne/airspeed.h 2010-07-22 10:59:53 UTC (rev
5113)
@@ -3,7 +3,7 @@
#include <inttypes.h>
-#ifdef USE_AIRSPEED
+#if defined USE_AIRSPEED || defined MEASURE_AIRSPEED
extern uint16_t adc_airspeed_val;
#endif
Modified: paparazzi3/trunk/sw/airborne/estimator.h
===================================================================
--- paparazzi3/trunk/sw/airborne/estimator.h 2010-07-22 10:43:06 UTC (rev
5112)
+++ paparazzi3/trunk/sw/airborne/estimator.h 2010-07-22 10:59:53 UTC (rev
5113)
@@ -120,7 +120,7 @@
#endif
-#ifdef USE_AIRSPEED
+#if defined USE_AIRSPEED || defined MEASURE_AIRSPEED
#define EstimatorSetAirspeed(airspeed) { estimator_airspeed = airspeed; }
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [5113] MEASURE_AIRSPEED define to make calibration flight not yet using the airspeed sensor,
Christophe De Wagter <=