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

AirData interface.

Provides an interface for baro absolute and differential pressure as well as airspeed. Subscribes to BARO_ABS, BARO_DIFF and TEMPERATURE ABI messages and calculates QNH and true airspeed from it. Also enables you to fly on "flight levels" using AMSL (AltitudeAboveSeaLevel) calculated from current pressure and QNH.

When using this module to provide airspeed you need a differential pressure sensor module publishing the BARO_DIFF ABI message. Make sure to disable other modules which otherwise directly set the airspeed in the state interface.

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

<module name="air_data">
b'<define name="AIR_DATA_BARO_ABS_ID" value="ABI_SENDER_ID" />\n '
b'<define name="AIR_DATA_BARO_DIFF_ID" value="ABI_SENDER_ID" />\n '
b'<define name="AIR_DATA_TEMPERATURE_ID" value="ABI_SENDER_ID" />\n '
b'<define name="AIR_DATA_AIRSPEED_ID" value="ABI_SENDER_ID" />\n '
b'<define name="AIR_DATA_CALC_AIRSPEED" value="FALSE|TRUE" />\n '
b'<define name="AIR_DATA_CALC_TAS_FACTOR" value="FALSE|TRUE" />\n '
b'<define name="AIR_DATA_CALC_AMSL_BARO" value="FALSE|TRUE" />\n '
b'<define name="USE_AIRSPEED_AIR_DATA" value="TRUE|FALSE" />\n '
</module>

Module configuration options

Define Options

  • name: AIR_DATA_BARO_ABS_ID value: ABI_SENDER_ID
    Description: ABI sender id for absolute baro measurement (default: ABI_BROADCAST)
  • name: AIR_DATA_BARO_DIFF_ID value: ABI_SENDER_ID
    Description: ABI sender id for differential baro measurement (default: ABI_BROADCAST)
  • name: AIR_DATA_TEMPERATURE_ID value: ABI_SENDER_ID
    Description: ABI sender id for temperature measurement (default: ABI_BROADCAST)
  • name: AIR_DATA_AIRSPEED_ID value: ABI_SENDER_ID
    Description: ABI sender id for airspeed measurement (default: ABI_BROADCAST)
  • name: AIR_DATA_CALC_AIRSPEED value: FALSE|TRUE
    Description: Calculate Airspeed from differential pressure (default: TRUE)
  • name: AIR_DATA_CALC_TAS_FACTOR value: FALSE|TRUE
    Description: Calculate TAS factor from temp and pressure (default: TRUE)
  • name: AIR_DATA_CALC_AMSL_BARO value: FALSE|TRUE
    Description: Calculate AMS from baro and QNH (default: FALSE)
  • name: USE_AIRSPEED_AIR_DATA value: TRUE|FALSE
    Description: set airspeed in state interface (defaults to TRUE if USE_AIRSPEED)

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.

  • air_data_periodic()
    • Frequency in Hz: 10
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.

Datalink Functions

Whenever the specified datalink message is received, the corresponing handler function is called.

  • on message WIND_INFO call air_data_parse_WIND_INFO(dev,trans,buf)

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw air_data.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="air_data" task="core">
<doc>
<description>
AirData interface.
Provides an interface for baro absolute and differential pressure as well as airspeed.
Subscribes to BARO_ABS, BARO_DIFF and TEMPERATURE ABI messages and calculates QNH and true airspeed from it.
Also enables you to fly on "flight levels" using AMSL (AltitudeAboveSeaLevel) calculated from current pressure and QNH.
When using this module to provide airspeed you need a differential pressure sensor module publishing the BARO_DIFF ABI message. Make sure to disable other modules which otherwise directly set the airspeed in the state interface.
</description>
<define name="AIR_DATA_BARO_ABS_ID" value="ABI_SENDER_ID" description="ABI sender id for absolute baro measurement (default: ABI_BROADCAST)"/>
<define name="AIR_DATA_BARO_DIFF_ID" value="ABI_SENDER_ID" description="ABI sender id for differential baro measurement (default: ABI_BROADCAST)"/>
<define name="AIR_DATA_TEMPERATURE_ID" value="ABI_SENDER_ID" description="ABI sender id for temperature measurement (default: ABI_BROADCAST)"/>
<define name="AIR_DATA_AIRSPEED_ID" value="ABI_SENDER_ID" description="ABI sender id for airspeed measurement (default: ABI_BROADCAST)"/>
<define name="AIR_DATA_CALC_AIRSPEED" value="FALSE|TRUE" description="Calculate Airspeed from differential pressure (default: TRUE)"/>
<define name="AIR_DATA_CALC_TAS_FACTOR" value="FALSE|TRUE" description="Calculate TAS factor from temp and pressure (default: TRUE)"/>
<define name="AIR_DATA_CALC_AMSL_BARO" value="FALSE|TRUE" description="Calculate AMS from baro and QNH (default: FALSE)"/>
<define name="USE_AIRSPEED_AIR_DATA" value="TRUE|FALSE" description="set airspeed in state interface (defaults to TRUE if USE_AIRSPEED)"/>
</doc>
<settings>
<dl_settings>
<dl_settings name="air_data">
<dl_setting min="800" max="1200" step="1" module="air_data/air_data" var="air_data.qnh" shortname="QNH"/>
<dl_setting min="0.8" max="1.3" step="0.01" module="air_data/air_data" var="air_data.tas_factor" shortname="TASfactor" param="AIR_DATA_TAS_FACTOR" type="float" persistent="true"/>
<dl_setting min="0" max="1" step="1" var="air_data.calc_qnh_once" module="air_data/air_data" shortname="calcQNH"/>
<dl_setting min="0" max="1" step="1" var="air_data.calc_airspeed" module="air_data/air_data" shortname="calcAirspeed" param="AIR_DATA_CALC_AIRSPEED" type="uint8" persistent="true"/>
<dl_setting min="0" max="1" step="1" var="air_data.calc_tas_factor" module="air_data/air_data" shortname="calcTASfactor" param="AIR_DATA_CALC_TAS_FACTOR" type="uint8" persistent="true"/>
<dl_setting min="0" max="1" step="1" var="air_data.calc_amsl_baro" module="air_data/air_data" shortname="calcAMSL" param="AIR_DATA_CALC_AMSL_BARO" type="uint8" persistent="true"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="air_data.h"/>
</header>
<init fun="air_data_init()"/>
<periodic fun="air_data_periodic()" freq="10"/>
<datalink message="WIND_INFO" fun="air_data_parse_WIND_INFO(dev,trans,buf)"/>
<makefile target="!fbw">
<file name="air_data.c"/>
</makefile>
</module>