Follow a ground based object which is transmitting the TARGET_POS datalink message or using RTK GPS.
This can be done using gpsd2ivy or ublox2ivy.
Example for airframe file
Add to your firmware section:
<module name="follow_me"/>
Module configuration options
Airframe file section
- section name:
FOLLOW_ME
prefix: FOLLOW_ME_
- name
TIMEOUT
value: 10.
Description: timeout of the ground GPS
- name
DISTANCE
value: 5.
Description: distance to hover from the ground GPS
- name
HEIGHT
value: 60
Description: height to hover above the ground GPS
- name
GPS_TIMEOUT
value: 5000
Description: RTK relative position timeout in ms
- name
GROUND_TIMEOUT
value: 5000
Description: ground position timeout in ms
- name
FILT
value: 0.9
Description: filtering of the heading cos/sin (higher is harder)
- name
MOVING_WPS
value:
Description: list of waypoints comma seperated which should move
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.
- follow_me_periodic()
- Frequency in Hz: 1
- 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 TARGET_POS call follow_me_parse_target_pos(buf)
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw follow_me.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="follow_me" dir="ctrl">
<doc>
<description>
Follow a ground based object which is transmitting the TARGET_POS datalink message or using RTK GPS.
This can be done using gpsd2ivy or ublox2ivy.
</description>
<section name="FOLLOW_ME" prefix="FOLLOW_ME_">
<define name="TIMEOUT" value="10." description="timeout of the ground GPS"/>
<define name="DISTANCE" value="5." description="distance to hover from the ground GPS"/>
<define name="HEIGHT" value="60" description="height to hover above the ground GPS"/>
<define name="GPS_TIMEOUT" value="5000" description="RTK relative position timeout in ms"/>
<define name="GROUND_TIMEOUT" value="5000" description="ground position timeout in ms"/>
<define name="FILT" value="0.9" description="filtering of the heading cos/sin (higher is harder)"/>
<define name="MOVING_WPS" value="" description="list of waypoints comma seperated which should move"/>
</section>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="FollowMe">
<dl_setting var="follow_me_distance" min="0." max="400" step="1.0" shortname="distance" unit="m"/>
<dl_setting var="follow_me_height" min="0." max="100." step="0.1" shortname="height" unit="m"/>
<dl_setting var="follow_me_heading" min="0." max="360." step="1.0" shortname="heading"/>
<dl_setting var="follow_me_filt" min="0." max="1.0" step="0.01" shortname="filt_val"/>
<dl_setting var="follow_me_diag_speed" min="0." max="1.0" step="0.01" shortname="diag_speed"/>
<dl_setting var="follow_me_gps_delay" min="0." max="10000.0" step="1.0" shortname="gps_delay" unit="ms"/>
<dl_setting var="follow_me_datalink_delay" min="0." max="20000.0" step="1.0" shortname="dlink_delay" unit="ms"/>
<dl_setting var="follow_me_advance_ms" min="0." max="10000.0" step="1.0" shortname="advance" unit="ms"/>
<dl_setting var="follow_me_min_dist" min="0." max="100.0" step="0.1" shortname="min_dist" unit="m"/>
<dl_setting var="follow_me_min_height" min="0." max="100.0" step="0.1" shortname="min_height" unit="m"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="follow_me.h"/>
</header>
<init fun="follow_me_init()"/>
<periodic fun="follow_me_periodic()" freq="1"/>
<datalink message="TARGET_POS" fun="follow_me_parse_target_pos(buf)"/>
<makefile>
<file name="follow_me.c"/>
</makefile>
</module>