Avoid all objects that are orange!
This example module shows how you can use the camera stream and colorfilter to detect orange objects. By adding this module to your flightplan and flying in the cyberzoo with the flightplan tudelft/course2017_avoid_orange_cyberzoo.xml you will avoid every obstacle that is orange.
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="cv_colorfilter.xml"/>
2 <module name="orange_avoider">
3 <define name="ORANGE_AVOIDER_LUM_MIN" value="0-255" />
4 <define name="ORANGE_AVOIDER_LUM_MAX" value="0-255" />
5 <define name="ORANGE_AVOIDER_CR_MIN" value="0-255" />
6 <define name="ORANGE_AVOIDER_CR_MAX" value="0-255" />
7 <define name="ORANGE_AVOIDER_CB_MIN" value="0-255" />
8 <define name="ORANGE_AVOIDER_CB_MAX" value="0-255" />
Module configuration options
Define Options
- name:
ORANGE_AVOIDER_LUM_MIN
value: 0-255
Description: Minimum Luminance To select pixel as object
- name:
ORANGE_AVOIDER_LUM_MAX
value: 0-255
Description: Minimum Luminance To select pixel as object
- name:
ORANGE_AVOIDER_CR_MIN
value: 0-255
Description: Minimum CR To select pixel as object
- name:
ORANGE_AVOIDER_CR_MAX
value: 0-255
Description: Minimum CR To select pixel as object
- name:
ORANGE_AVOIDER_CB_MIN
value: 0-255
Description: Minimum CB To select pixel as object
- name:
ORANGE_AVOIDER_CB_MAX
value: 0-255
Description: Minimum CB To select pixel as object
Dependencies
- module__cv_colorfilter_xml
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.
- orange_avoider_periodic()
- Frequency in Hz: 4
- 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 orange_avoider.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="orange_avoider">
<doc>
<description>
Avoid all objects that are orange!
This example module shows how you can use the camera stream and colorfilter to detect orange objects.
By adding this module to your flightplan and flying in the cyberzoo with the flightplan tudelft/course2017_avoid_orange_cyberzoo.xml you will avoid every obstacle that is orange.
</description>
<define name="ORANGE_AVOIDER_LUM_MIN" value="0-255" description="Minimum Luminance To select pixel as object"/>
<define name="ORANGE_AVOIDER_LUM_MAX" value="0-255" description="Minimum Luminance To select pixel as object"/>
<define name="ORANGE_AVOIDER_CR_MIN" value="0-255" description="Minimum CR To select pixel as object"/>
<define name="ORANGE_AVOIDER_CR_MAX" value="0-255" description="Minimum CR To select pixel as object"/>
<define name="ORANGE_AVOIDER_CB_MIN" value="0-255" description="Minimum CB To select pixel as object"/>
<define name="ORANGE_AVOIDER_CB_MAX" value="0-255" description="Minimum CB To select pixel as object"/>
</doc>
<depends>cv_colorfilter.xml</depends>
<header>
<file name="orange_avoider.h"/>
</header>
<init fun="orange_avoider_init()"/>
<periodic fun="orange_avoider_periodic()" freq="4"/>
<makefile >
<file name="orange_avoider.c"/>
</makefile>
</module>