Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sonar_adc module

Sonar ADC driver.

Reads an anlog sonar sensor and outputs sonar distance in [m]

Example for airframe file

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

1 <module name="sonar_adc">
2  <define name="SONAR_OFFSET" value="0" />
3  <define name="SONAR_SCALE" value="0.0166" />
4  <define name="USE_SONAR" value="" />
5  <configure name="ADC_SONAR" value="ADC_X" />
6 </module>

Module configuration options

Configure Options

  • name: ADC_SONAR value: ADC_X
    Description: select ADC to use with the sonar

Define Options

  • name: SONAR_OFFSET value: 0
    Description: sensor offset in [adc] - default is 0
  • name: SONAR_SCALE value: 0.0166
    Description: sensor scale factor [m/adc] - default is 0.0166
  • name: USE_SONAR value:
    Description: activate use of sonar in INS extended filter (only rotorcraft)

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.

  • sonar_adc_read()
    • 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 sonar_adc.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="sonar">
<doc>
<description>
Sonar ADC driver.
Reads an anlog sonar sensor and outputs sonar distance in [m]
</description>
<configure name="ADC_SONAR" value="ADC_X" description="select ADC to use with the sonar"/>
<define name="SONAR_OFFSET" value="0" description="sensor offset in [adc] - default is 0"/>
<define name="SONAR_SCALE" value="0.0166" description="sensor scale factor [m/adc] - default is 0.0166"/>
<define name="USE_SONAR" value="" description="activate use of sonar in INS extended filter (only rotorcraft)"/>
</doc>
<header>
<file name="sonar_adc.h"/>
</header>
<init fun="sonar_adc_init()"/>
<periodic fun="sonar_adc_read()" freq="20"/>
<makefile target="ap|sim">
<file name="sonar_adc.c"/>
</makefile>
<makefile target="ap">
<define name="ADC_CHANNEL_SONAR" value="$(ADC_SONAR)"/>
<define name="USE_$(ADC_SONAR)"/>
</makefile>
</module>