Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
aoa_adc.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 The Paparazzi Team
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 *
21 */
22
32#include "generated/airframe.h"
33#include "modules/core/abi.h"
34#include "state.h"
35
36// Messages
37#include "mcu_periph/uart.h"
38#include "pprzlink/messages.h"
40
42#ifndef AOA_OFFSET
43#define AOA_OFFSET M_PI
44#endif
46#ifndef AOA_FILTER
47#define AOA_FILTER 0.5
48#endif
50#ifndef AOA_SENS
51#define AOA_SENS ((2.0*M_PI)/1024)
52#endif
53
54
55// Downlink
56
57#ifndef ADC_CHANNEL_AOA
58#error "ADC_CHANNEL_AOA needs to be defined to use AOA_adc module"
59#endif
60
61#ifndef ADC_CHANNEL_AOA_NB_SAMPLES
62#define ADC_CHANNEL_AOA_NB_SAMPLES DEFAULT_AV_NB_SAMPLE
63#endif
64
66
75
77{
78 static float prev_aoa = 0.0;
79
81
82 // PT1 filter and convert to rad
86
87#ifdef USE_AOA
88 uint8_t flag = 1;
89 float foo = 0.f;
92#endif
93
95}
96
Main include for ABI (AirBorneInterface).
#define AOA_ADC_ID
uint32_t sum
Definition adc.h:54
uint8_t av_nb_sample
Definition adc.h:57
void aoa_adc_update(void)
Definition aoa_adc.c:76
#define ADC_CHANNEL_AOA_NB_SAMPLES
Definition aoa_adc.c:62
#define AOA_OFFSET
Default offset value (assuming 0 AOA is in the middle of the range)
Definition aoa_adc.c:43
void aoa_adc_init(void)
Definition aoa_adc.c:67
struct Aoa_Adc aoa_adc
Definition aoa_adc.c:65
#define AOA_SENS
Default sensitivity (2*pi on a 10 bit ADC)
Definition aoa_adc.c:51
#define AOA_FILTER
Default filter value.
Definition aoa_adc.c:47
uint32_t raw
raw ADC value
Definition aoa_adc.h:41
float filter
Filtering value [0-1] 0: no filtering 1: output is a constant value.
Definition aoa_adc.h:50
float offset
Angle of attack offset in radians.
Definition aoa_adc.h:43
struct adc_buf buf
Definition aoa_adc.h:40
float angle
Angle of attack in radians.
Definition aoa_adc.h:42
float sens
sensitiviy, i.e. scale to conver raw to angle
Definition aoa_adc.h:44
Angle of Attack sensor via ADC.
Definition aoa_adc.h:39
void adc_buf_channel(uint8_t adc_channel, struct adc_buf *s, uint8_t av_nb_sample)
Link between ChibiOS ADC drivers and Paparazzi adc_buffers.
Definition adc_arch.c:312
static void stateSetAngleOfAttack_f(uint16_t id, float aoa)
Set angle of attack in radians (float).
Definition state.h:1497
uint16_t foo
Definition main_demo5.c:58
API to get/set the generic vehicle states.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.