Get sonar values from ABI and store last and filtered values
Output values are stored in global variables that can be used in flight plans
Example for airframe file
Add to your firmware section:
<module name="agl_dist"/>
Module configuration options
Airframe file section
- section name:
AGL prefix: AGL_DIST_
- name
ID value: ABI_BROADCAST
Description: Sonar ABI ID
- name
MAX_RANGE value: 5.
Description: Max detection range in meters
- name
MIN_RANGE value: 0.001
Description: Min detection range in meters
- name
FILTER value: 0.1
Description: Low pass filter time constant
- name
TIMEOUT value: 1.
Description: AGL dist valid timeout in seconds
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.
- agl_dist_timeout()
- Frequency in Hz: 10
- Autorun: LOCK
Periodic function automatically starts after init and can't be stopped.
- agl_dist_report()
- Frequency in Hz: 2
- Autorun: FALSE
Periodic function is started by user command.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw agl_dist.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="agl_dist" dir="sonar">
<doc>
<description>
Get sonar values from ABI and store last and filtered values
Output values are stored in global variables that can be used in flight plans
</description>
<section name="AGL" prefix="AGL_DIST_">
<define name="ID" value="ABI_BROADCAST" description="Sonar ABI ID"/>
<define name="MAX_RANGE" value="5." description="Max detection range in meters"/>
<define name="MIN_RANGE" value="0.001" description="Min detection range in meters"/>
<define name="FILTER" value="0.1" description="Low pass filter time constant"/>
<define name="TIMEOUT" value="1." description="AGL dist valid timeout in seconds"/>
</section>
</doc>
<header>
<file name="agl_dist.h"/>
</header>
<init fun="agl_dist_init()"/>
<periodic fun="agl_dist_timeout()" freq="10"/>
<periodic fun="agl_dist_report()" freq="2" autorun="FALSE"/>
<makefile>
<file name="agl_dist.c"/>
<test>
<define name="DOWNLINK_TRANSPORT" value="pprz_tp"/>
<define name="DOWNLINK_DEVICE" value="uart0"/>
<define name="USE_UART0"/>
</test>
</makefile>
</module>