Generic GPS functions.
This provides generic GPS functions and multi GPS support. Still requires at least one module providing the actual GPS implementation.
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">
b'<define name="GPS_POS_BROADCAST" value="FALSE|TRUE" />\n '
b'<define name="GPS_LOSS_TEST_TIMER" value="FALSE|TRUE" />\n '
b'<configure name="GPS_LED" value="2" />\n '
</module>
Module configuration options
Configure Options
- name:
GPS_LED
value: 2
Description: LED number to indicate fix or none
Define Options
- name:
GPS_POS_BROADCAST
value: FALSE|TRUE
Description: Broadcast GPS position instead of sending it to the ground station only. This requires to use PPRZLINK version 2 and a capable modem
- name:
GPS_LOSS_TEST_TIMER
value: FALSE|TRUE
Description: If defined TRUE, this allows the GPS module to simulate GPS loss for a few seconds for testing purposes.
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.
- gps_periodic_fix_counter()
- Frequency in Hz: 1.0
- 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 GPS_INJECT call gps_parse_GPS_INJECT(buf)
- on message RTCM_INJECT call gps_parse_RTCM_INJECT(buf)
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw gps.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="gps" dir="gps" task="sensors">
<doc>
<description>
Generic GPS functions.
This provides generic GPS functions and multi GPS support.
Still requires at least one module providing the actual GPS implementation.
</description>
<configure name="GPS_LED" value="2" description="LED number to indicate fix or none"/>
<define name="GPS_POS_BROADCAST" value="FALSE|TRUE" description="Broadcast GPS position instead of sending it to the ground station only. This requires to use PPRZLINK version 2 and a capable modem"/>
<define name="GPS_LOSS_TEST_TIMER" value="FALSE|TRUE" description="If defined TRUE, this allows the GPS module to simulate GPS loss for a few seconds for testing purposes."/>
</doc>
<settings>
<dl_settings>
<dl_settings name="gps">
<dl_setting MAX="2" MIN="0" STEP="1" values="AUTO|PRIMARY|SECONDARY" module="modules/gps/gps" VAR="multi_gps_mode" shortname="multi_mode" param="MULTI_GPS_MODE">
</dl_setting>
<dl_setting var="gps_disable_fix" min="0" step="1" max="180" shortname="disable_fix"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="gps.h"/>
</header>
<init fun="gps_init()"/>
<periodic fun="gps_periodic_fix_counter()" freq="1.0"/>
<datalink message="GPS_INJECT" fun="gps_parse_GPS_INJECT(buf)"/>
<datalink message="RTCM_INJECT" fun="gps_parse_RTCM_INJECT(buf)"/>
<makefile target="fbw|ap|sim|nps">
<configure name="GPS_LED" default="none"/>
<file name="gps.c"/>
<define name="USE_GPS"/>
<define name="GPS_LED" value="$(GPS_LED)" cond="ifneq ($(GPS_LED),none)"/>
<test>
<define name="PRIMARY_GPS" value="GPS_DATALINK"/>
</test>
</makefile>
</module>