Angle of Attack using internal ADC
No detailed description...
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<module name="AOA_adc">
b'<define name="AOA_SENS" value="(2*3.14)/1024" />\n '
b'<define name="AOA_OFFSET" value="3.14" />\n '
b'<define name="AOA_FILTER" value="0.5" />\n\n\n '
b'<configure name="ADC_AOA" value="ADC_X" />\n '
</module>
Module configuration options
Configure Options
- name:
ADC_AOA
value: ADC_X
Description: select the ADC channel to use
Define Options
- name:
AOA_SENS
value: (2*3.14)/1024
Description: sensor sensitivity
- name:
AOA_OFFSET
value: 3.14
Description: offset in radians
- name:
AOA_FILTER
value: 0.5
Description: filtering parameter between 0 (no filtering) and 1
Module functions
Init Functions
These initialization functions are called once on startup.
Periodic Functions
These functions are called periodically at the specified frequency from the module periodic loop.
- aoa_adc_update()
- Frequency in Hz: 60.
- Autorun: LOCK
Periodic function automatically starts after init and can't be stopped.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw AOA_adc.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="AOA_adc" dir="sensors" task="sensors">
<doc>
<description>Angle of Attack using internal ADC</description>
<configure name="ADC_AOA" value="ADC_X" description="select the ADC channel to use"/>
<define name="AOA_SENS" value="(2*3.14)/1024" description="sensor sensitivity"/>
<define name="AOA_OFFSET" value="3.14" description="offset in radians"/>
<define name="AOA_FILTER" value="0.5" description="filtering parameter between 0 (no filtering) and 1"/>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="AOA">
<dl_setting MAX="4" MIN="-4" STEP="0.0001" VAR="aoa_adc.offset" shortname="AOA_offset" module="modules/sensors/aoa_adc" param="AOA_OFFSET"/>
<dl_setting MAX="0.95" MIN="0" STEP="0.001" VAR="aoa_adc.filter" shortname="AOA_filter" module="modules/sensors/aoa_adc" param="AOA_FILTER"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="h_ctl_pitch_mode" shortname="PITCH_Mode" module="stabilization/stabilization_attitude" />
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="aoa_adc.h"/>
</header>
<init fun="aoa_adc_init()"/>
<periodic fun="aoa_adc_update()" freq="60."/>
<makefile target="ap">
<file name="aoa_adc.c"/>
<define name="ADC_CHANNEL_AOA" value="$(ADC_AOA)"/>
<define name="USE_$(ADC_AOA)"/>
</makefile>
</module>