Remote GPS via datalink.
Parses the REMOTE_GPS and REMOTE_GPS_SMALL datalink messages and publishes it onboard via ABI.
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<module name="gps_datalink">
b'<define name="GPS_DATALINK_USE_MAG" value="1" />\n '
</module>
Module configuration options
Define Options
- name:
GPS_DATALINK_USE_MAG
value: 1
Description: Choose to receive also GPS extracted magnetometer messages
Auto-loaded modules
The following modules are automatically loaded (just as if you had added them in the airframe file)
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.
Datalink Functions
Whenever the specified datalink message is received, the corresponing handler function is called.
- on message REMOTE_GPS call gps_datalink_parse_REMOTE_GPS(buf)
- on message REMOTE_GPS_SMALL call gps_datalink_parse_REMOTE_GPS_SMALL(buf)
- on message REMOTE_GPS_LOCAL call gps_datalink_parse_REMOTE_GPS_LOCAL(buf)
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw gps_datalink.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="gps_datalink" dir="gps" task="sensors">
<doc>
<description>
Remote GPS via datalink.
Parses the REMOTE_GPS and REMOTE_GPS_SMALL datalink messages and publishes it onboard via ABI.
</description>
<define name="GPS_DATALINK_USE_MAG" value="1" description="Choose to receive also GPS extracted magnetometer messages"/>
</doc>
<dep>
<depends>gps,@datalink</depends>
<provides>gps</provides>
</dep>
<autoload name="gps_nps"/>
<autoload name="gps_sim"/>
<header>
<file name="gps.h"/>
</header>
<init fun="gps_datalink_init()"/>
<periodic fun="gps_datalink_periodic_check()" freq="1." autorun="TRUE"/>
<datalink message="REMOTE_GPS" fun="gps_datalink_parse_REMOTE_GPS(buf)"/>
<datalink message="REMOTE_GPS_SMALL" fun="gps_datalink_parse_REMOTE_GPS_SMALL(buf)"/>
<datalink message="REMOTE_GPS_LOCAL" fun="gps_datalink_parse_REMOTE_GPS_LOCAL(buf)"/>
<makefile target="ap|fbw">
<file name="gps_datalink.c"/>
<raw>
ifdef SECONDARY_GPS
ifneq (,$(findstring $(SECONDARY_GPS), datalink))
# this is the secondary GPS
$(TARGET).CFLAGS += -DGPS_SECONDARY_TYPE_H=\"modules/gps/gps_datalink.h\"
$(TARGET).CFLAGS += -DSECONDARY_GPS=GPS_DATALINK
else
$(TARGET).CFLAGS += -DGPS_TYPE_H=\"modules/gps/gps_datalink.h\"
$(TARGET).CFLAGS += -DPRIMARY_GPS=GPS_DATALINK
endif
else
# plain old single GPS usage
$(TARGET).CFLAGS += -DGPS_TYPE_H=\"modules/gps/gps_datalink.h\"
endif
</raw>
<test firmware="rotorcraft">
<define name="PRIMARY_GPS" value="GPS_DATALINK"/>
</test>
</makefile>
<makefile target="fbw">
<define name="USE_GPS"/>
</makefile>
</module>