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

This module is an example module for the course AE4317 Autonomous Flight of Micro Air Vehicles at the TU Delft.

This module is used in combination with a color filter (cv_detect_color_object) and the guided mode of the autopilot. The avoidance strategy is to simply count the total number of orange pixels. When above a certain percentage threshold, (given by color_count_frac) we assume that there is an obstacle and we turn.

The color filter settings are set using the cv_detect_color_object. This module can run multiple filters simultaneously so you have to define which filter to use with the ORANGE_AVOIDER_VISUAL_DETECTION_ID setting. This module differs from the simpler orange_avoider.xml in that this is flown in guided mode. This flight mode is less dependent on a global positioning estimate as with the navigation mode. This module can be used with a simple speed estimate rather than a global position.

Here we also need to use our onboard sensors to stay inside of the cyberzoo and not collide with the nets. For this we employ a simple color detector, similar to the orange poles but for green to detect the floor. When the total amount of green drops below a given threshold (given by floor_count_frac) we assume we are near the edge of the zoo and turn around. The color detection is done by the cv_detect_color_object module, use the FLOOR_VISUAL_DETECTION_ID setting to define which filter to use.

Example for airframe file

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

<module name="orange_avoider_guided">
b'<define name="ORANGE_AVOIDER_VISUAL_DETECTION_ID" value="ABI_BROADCAST" />\n '
b'<define name="FLOOR_VISUAL_DETECTION_ID" value="ABI_BROADCAST" />\n '
</module>

Module configuration options

Define Options

  • name: ORANGE_AVOIDER_VISUAL_DETECTION_ID value: ABI_BROADCAST
    Description: which VISUAL_DETECTION message to recieve for orange pole detection.
  • name: FLOOR_VISUAL_DETECTION_ID value: ABI_BROADCAST
    Description: which VISUAL_DETECTION message to recieve for floor detection.

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.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw orange_avoider_guided.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="orange_avoider_guided" dir="orange_avoider">
<doc>
<description>
This module is an example module for the course AE4317 Autonomous Flight of Micro Air Vehicles at the TU Delft.
This module is used in combination with a color filter (cv_detect_color_object) and the guided mode of the autopilot.
The avoidance strategy is to simply count the total number of orange pixels. When above a certain percentage threshold,
(given by color_count_frac) we assume that there is an obstacle and we turn.
The color filter settings are set using the cv_detect_color_object. This module can run multiple filters simultaneously
so you have to define which filter to use with the ORANGE_AVOIDER_VISUAL_DETECTION_ID setting.
This module differs from the simpler orange_avoider.xml in that this is flown in guided mode. This flight mode is
less dependent on a global positioning estimate as with the navigation mode. This module can be used with a simple
speed estimate rather than a global position.
Here we also need to use our onboard sensors to stay inside of the cyberzoo and not collide with the nets. For this
we employ a simple color detector, similar to the orange poles but for green to detect the floor. When the total amount
of green drops below a given threshold (given by floor_count_frac) we assume we are near the edge of the zoo and turn
around. The color detection is done by the cv_detect_color_object module, use the FLOOR_VISUAL_DETECTION_ID setting to
define which filter to use.
</description>
<define name="ORANGE_AVOIDER_VISUAL_DETECTION_ID" value="ABI_BROADCAST" description="which VISUAL_DETECTION message to recieve for orange pole detection."/>
<define name="FLOOR_VISUAL_DETECTION_ID" value="ABI_BROADCAST" description="which VISUAL_DETECTION message to recieve for floor detection."/>
</doc>
<settings>
<dl_settings>
<dl_settings name="OrangeAvoiderGuided">
<dl_setting var="oag_color_count_frac" min="0" step="0.01" max="0.5"/>
<dl_setting var="oag_floor_count_frac" min="0" step="0.01" max="0.5"/>
<dl_setting var="oag_max_speed" min="0" step="0.1" max="1"/>
<dl_setting var="oag_heading_rate" min="0" step="5" max="45" unit="rad" alt_unit="deg"/>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>cv_detect_color_object</depends>
</dep>
<header>
<file name="orange_avoider_guided.h"/>
</header>
<init fun="orange_avoider_guided_init()"/>
<periodic fun="orange_avoider_guided_periodic()" freq="4"/>
<makefile target="ap|nps">
<file name="orange_avoider_guided.c"/>
</makefile>
</module>