Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
aoa_pwm module

Angle of Attack sensor using PWM input

Driver for a PWM based angle of attack sensor A second sensor can be defined for the sideslip angle It is assumed that both sensors are the same, only sensitivity, offset and direction can differ.

Sensor example: US DIGITAL MA3-P12-125-B

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_pwm">
b'<define name="AOA_SENS" value="(2*3.14)/AOA_PWM_PERIOD" />\n '
b'<define name="AOA_OFFSET" value="0." />\n '
b'<define name="AOA_ANGLE_OFFSET" value="3.14" />\n '
b'<define name="AOA_REVERSE" value="TRUE|FALSE" />\n '
b'<define name="AOA_PWM_PERIOD" value="4096" />\n '
b'<define name="AOA_PWM_OFFSET" value="1" />\n '
b'<define name="SEND_AOA" value="TRUE|FALSE" />\n '
b'<define name="LOG_AOA" value="TRUE|FALSE" />\n '
b'<define name="SSA_SENS" value="(2*3.14)/AOA_PWM_PERIOD" />\n '
b'<define name="SSA_OFFSET" value="0." />\n '
b'<define name="SSA_REVERSE" value="TRUE|FALSE" />\n '
b'<configure name="AOA_PWM_CHANNEL" value="PWM_INPUTX" />\n '
b'<configure name="SSA_PWM_CHANNEL" value="PWM_INPUTX" />\n '
</module>

Module configuration options

Configure Options

  • name: AOA_PWM_CHANNEL value: PWM_INPUTX
    Description: Select PWM input channel for AOA sensor
  • name: SSA_PWM_CHANNEL value: PWM_INPUTX
    Description: Select PWM input channel for Sideslip sensor (optional)

Define Options

  • name: AOA_SENS value: (2*3.14)/AOA_PWM_PERIOD
    Description: sensor sensitivity
  • name: AOA_OFFSET value: 0.
    Description: offset in radian that can be set from settings
  • name: AOA_ANGLE_OFFSET value: 3.14
    Description: global offset in radian corresponding to the sensor mounting (default: 3.14)
  • name: AOA_REVERSE value: TRUE|FALSE
    Description: set to TRUE to reverse rotation direction
  • name: AOA_PWM_PERIOD value: 4096
    Description: period in microsec (e.g. 4096 for 12 bits sensor)
  • name: AOA_PWM_OFFSET value: 1
    Description: initial offset on the raw pwm signal if needed (default: 1usec)
  • name: SEND_AOA value: TRUE|FALSE
    Description: enable telemetry report (default: TRUE)
  • name: LOG_AOA value: TRUE|FALSE
    Description: enable logging on SD card (default: FALSE)
  • name: SSA_SENS value: (2*3.14)/AOA_PWM_PERIOD
    Description: sensor sensitivity
  • name: SSA_OFFSET value: 0.
    Description: offset in radian that can be set from settings
  • name: SSA_REVERSE value: TRUE|FALSE
    Description: set to TRUE to reverse rotation direction

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_pwm_update()
    • Frequency in Hz: 20
    • 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_pwm.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="AOA_pwm" dir="sensors" task="sensors">
<doc>
<description>
Angle of Attack sensor using PWM input
Driver for a PWM based angle of attack sensor
A second sensor can be defined for the sideslip angle
It is assumed that both sensors are the same, only sensitivity, offset and direction can differ.
Sensor example: US DIGITAL MA3-P12-125-B
</description>
<configure name="AOA_PWM_CHANNEL" value="PWM_INPUTX" description="Select PWM input channel for AOA sensor"/>
<define name="AOA_SENS" value="(2*3.14)/AOA_PWM_PERIOD" description="sensor sensitivity"/>
<define name="AOA_OFFSET" value="0." description="offset in radian that can be set from settings"/>
<define name="AOA_ANGLE_OFFSET" value="3.14" description="global offset in radian corresponding to the sensor mounting (default: 3.14)"/>
<define name="AOA_REVERSE" value="TRUE|FALSE" description="set to TRUE to reverse rotation direction"/>
<define name="AOA_PWM_PERIOD" value="4096" description="period in microsec (e.g. 4096 for 12 bits sensor)"/>
<define name="AOA_PWM_OFFSET" value="1" description="initial offset on the raw pwm signal if needed (default: 1usec)"/>
<define name="SEND_AOA" value="TRUE|FALSE" description="enable telemetry report (default: TRUE)"/>
<define name="LOG_AOA" value="TRUE|FALSE" description="enable logging on SD card (default: FALSE)"/>
<configure name="SSA_PWM_CHANNEL" value="PWM_INPUTX" description="Select PWM input channel for Sideslip sensor (optional)"/>
<define name="SSA_SENS" value="(2*3.14)/AOA_PWM_PERIOD" description="sensor sensitivity"/>
<define name="SSA_OFFSET" value="0." description="offset in radian that can be set from settings"/>
<define name="SSA_REVERSE" value="TRUE|FALSE" description="set to TRUE to reverse rotation direction"/>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="AOA">
<dl_setting MAX="1" MIN="0" STEP="1" VAR="aoa_send_type" shortname="send type" module="modules/sensors/aoa_pwm" values="AOA|SIDESLIP"/>
<dl_setting MAX="180" MIN="-180" STEP="0.1" VAR="aoa_pwm.offset" shortname="AOA_offset" module="modules/sensors/aoa_pwm" param="AOA_OFFSET" unit="rad" alt_unit="deg"/>
<dl_setting MAX="0.95" MIN="0" STEP="0.001" VAR="aoa_pwm.filter" shortname="AOA_filter" module="modules/sensors/aoa_pwm" param="AOA_FILTER"/>
<dl_setting MAX="180" MIN="-180" STEP="0.1" VAR="ssa_pwm.offset" shortname="SSA_offset" module="modules/sensors/aoa_pwm" param="SSA_OFFSET" unit="rad" alt_unit="deg"/>
<dl_setting MAX="0.95" MIN="0" STEP="0.001" VAR="ssa_pwm.filter" shortname="SSA_filter" module="modules/sensors/aoa_pwm" param="SSA_FILTER"/>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>pwm_meas</depends>
</dep>
<header>
<file name="aoa_pwm.h" />
</header>
<init fun="aoa_pwm_init()" />
<periodic fun="aoa_pwm_update()" freq="20" />
<makefile target="ap">
<file name="aoa_pwm.c" />
<define name="AOA_PWM_CHANNEL" value="$(AOA_PWM_CHANNEL)" cond="ifdef AOA_PWM_CHANNEL" />
<define name="$(AOA_PWM_CHANNEL)_TICKS_PER_USEC" value="1" />
<define name="USE_$(AOA_PWM_CHANNEL)" value="PWM_PULSE_TYPE_ACTIVE_LOW" />
<define name="SSA_PWM_CHANNEL" value="$(SSA_PWM_CHANNEL)" cond="ifdef SSA_PWM_CHANNEL" />
<define name="$(SSA_PWM_CHANNEL)_TICKS_PER_USEC" value="1" cond="ifdef SSA_PWM_CHANNEL" />
<define name="USE_$(SSA_PWM_CHANNEL)" value="PWM_PULSE_TYPE_ACTIVE_LOW" cond="ifdef SSA_PWM_CHANNEL" />
<define name="USE_SIDESLIP" cond="ifdef SSA_PWM_CHANNEL" />
</makefile>
</module>