From 8fb57b97b4b79e382f39a946c06a385e5d61b31a Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 20 Apr 2016 22:21:37 +0200 Subject: [PATCH 01/11] [gps] convert gps subsystems to modules and remove obsolete/non-functional gps_ublox_hitl and gps_ardrone2 GPS functions still need to be called from main... --- .../fixedwing/gps_ublox_hitl.makefile | 8 --- .../rotorcraft/gps_ardrone2.makefile | 20 ------ .../rotorcraft/gps_sim_hitl.makefile | 17 +---- .../subsystems/rotorcraft/gps_sirf.makefile | 41 +----------- .../rotorcraft/gps_ublox_utm.makefile | 1 - .../subsystems/rotorcraft/gps_udp.makefile | 31 +-------- .../subsystems/shared/gps_furuno.makefile | 48 +------------- .../shared/gps_mediatek_diy.makefile | 46 +------------ .../subsystems/shared/gps_nmea.makefile | 46 +------------ .../subsystems/shared/gps_piksi.makefile | 49 +------------- .../subsystems/shared/gps_skytraq.makefile | 44 +------------ .../gps_ublox_utm.makefile | 0 conf/modules/gps_furuno.xml | 65 +++++++++++++++++++ conf/modules/gps_mediatek_diy.xml | 61 +++++++++++++++++ conf/modules/gps_nmea.xml | 61 +++++++++++++++++ conf/modules/gps_piksi.xml | 64 ++++++++++++++++++ conf/modules/gps_sirf.xml | 61 +++++++++++++++++ conf/modules/gps_skytraq.xml | 61 +++++++++++++++++ conf/modules/gps_ublox.xml | 11 ++-- conf/modules/gps_udp.xml | 55 ++++++++++++++++ 20 files changed, 442 insertions(+), 348 deletions(-) delete mode 100644 conf/firmwares/subsystems/fixedwing/gps_ublox_hitl.makefile delete mode 100644 conf/firmwares/subsystems/rotorcraft/gps_ardrone2.makefile delete mode 100644 conf/firmwares/subsystems/rotorcraft/gps_ublox_utm.makefile rename conf/firmwares/subsystems/{fixedwing => shared}/gps_ublox_utm.makefile (100%) create mode 100644 conf/modules/gps_furuno.xml create mode 100644 conf/modules/gps_mediatek_diy.xml create mode 100644 conf/modules/gps_nmea.xml create mode 100644 conf/modules/gps_piksi.xml create mode 100644 conf/modules/gps_sirf.xml create mode 100644 conf/modules/gps_skytraq.xml create mode 100644 conf/modules/gps_udp.xml diff --git a/conf/firmwares/subsystems/fixedwing/gps_ublox_hitl.makefile b/conf/firmwares/subsystems/fixedwing/gps_ublox_hitl.makefile deleted file mode 100644 index 7f5c4958962..00000000000 --- a/conf/firmwares/subsystems/fixedwing/gps_ublox_hitl.makefile +++ /dev/null @@ -1,8 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- - -# UBlox Hardware In The Loop - - -ap.CFLAGS += -DUSE_GPS -DUBX -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_ubx.h\" -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_ubx.c $(SRC_SUBSYSTEMS)/gps.c diff --git a/conf/firmwares/subsystems/rotorcraft/gps_ardrone2.makefile b/conf/firmwares/subsystems/rotorcraft/gps_ardrone2.makefile deleted file mode 100644 index e95dc528742..00000000000 --- a/conf/firmwares/subsystems/rotorcraft/gps_ardrone2.makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- - -# ARDrone 2 Flightrecorder GPS unit - -GPS_LED ?= none - -ap.CFLAGS += -DUSE_GPS -DUSE_GPS_ARDRONE2 - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_ardrone2.h\" -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_ardrone2.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c - -nps.CFLAGS += -DUSE_GPS -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c diff --git a/conf/firmwares/subsystems/rotorcraft/gps_sim_hitl.makefile b/conf/firmwares/subsystems/rotorcraft/gps_sim_hitl.makefile index c49b7239c6e..f0146d29011 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_sim_hitl.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_sim_hitl.makefile @@ -1,16 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -ap.CFLAGS += -DUSE_GPS -DHITL -ap.CFLAGS += -DGPS_TYPE=\"subsystems/gps/gps_sim_hitl.h\" -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_hitl.c - -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -nps.CFLAGS += -DUSE_GPS -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c -nps.CFLAGS += -DGPS_TYPE=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c +$(error Error: replace by ) diff --git a/conf/firmwares/subsystems/rotorcraft/gps_sirf.makefile b/conf/firmwares/subsystems/rotorcraft/gps_sirf.makefile index 238c74afca2..b48a3d6eec0 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_sirf.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_sirf.makefile @@ -1,40 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -# Sirf GPS unit - -GPS_LED ?= none -SIRF_GPS_PORT ?= $(GPS_PORT) -SIRF_GPS_BAUD ?= $(GPS_BAUD) - -SIRF_GPS_PORT_LOWER=$(shell echo $(SIRF_GPS_PORT) | tr A-Z a-z) - -ap.CFLAGS += -DUSE_GPS -ap.CFLAGS += -DSIRF_GPS_LINK=$(SIRF_GPS_PORT_LOWER) -ap.CFLAGS += -DUSE_$(SIRF_GPS_PORT) -ap.CFLAGS += -D$(SIRF_GPS_PORT)_BAUD=$(SIRF_GPS_BAUD) - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ifdef SECONDARY_GPS -ifneq (,$(findstring $(SECONDARY_GPS), sirf)) -# this is the secondary GPS -ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_sirf.h\" -ap.CFLAGS += -DSECONDARY_GPS=gps_sirf -else -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sirf.h\" -ap.CFLAGS += -DPRIMARY_GPS=gps_sirf -endif -else -# plain old single GPS usage -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sirf.h\" -endif - -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sirf.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c - -nps.CFLAGS += -DUSE_GPS -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c +$(error Error: The gps sirf subsystem has been converted to a module, replace by ) diff --git a/conf/firmwares/subsystems/rotorcraft/gps_ublox_utm.makefile b/conf/firmwares/subsystems/rotorcraft/gps_ublox_utm.makefile deleted file mode 100644 index cf640ed0d83..00000000000 --- a/conf/firmwares/subsystems/rotorcraft/gps_ublox_utm.makefile +++ /dev/null @@ -1 +0,0 @@ -$(error The gps_ublox_utm subsystem does not exist for the rotorcraft firmware, please replace with in your airframe file.) diff --git a/conf/firmwares/subsystems/rotorcraft/gps_udp.makefile b/conf/firmwares/subsystems/rotorcraft/gps_udp.makefile index 0714dce4b1d..be8db05458c 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_udp.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_udp.makefile @@ -1,30 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -GPS_LED ?= none - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ifdef SECONDARY_GPS -ifneq (,$(findstring $(SECONDARY_GPS), udp)) -# this is the secondary GPS -ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_udp.h\" -ap.CFLAGS += -DSECONDARY_GPS=gps_udp -else -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_udp.h\" -ap.CFLAGS += -DPRIMARY_GPS=gps_udp -endif -else -# plain old single GPS usage -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_udp.h\" -endif - -ap.CFLAGS += -DUSE_GPS -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_udp.c - -nps.CFLAGS += -DUSE_GPS -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c +$(error Error: The gps udp subsystem has been converted to a module, replace by ) diff --git a/conf/firmwares/subsystems/shared/gps_furuno.makefile b/conf/firmwares/subsystems/shared/gps_furuno.makefile index 0545d34208d..b161586dd03 100644 --- a/conf/firmwares/subsystems/shared/gps_furuno.makefile +++ b/conf/firmwares/subsystems/shared/gps_furuno.makefile @@ -1,47 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -# Furuno NMEA GPS unit - -GPS_LED ?= none -FURUNO_GPS_PORT ?= $(GPS_PORT) -FURUNO_GPS_BAUD ?= $(GPS_BAUD) - -FURUNO_GPS_PORT_LOWER=$(shell echo $(FURUNO_GPS_PORT) | tr A-Z a-z) - -ap.CFLAGS += -DUSE_GPS -ap.CFLAGS += -DNMEA_GPS_LINK=$(FURUNO_GPS_PORT_LOWER) -ap.CFLAGS += -DUSE_$(FURUNO_GPS_PORT) -ap.CFLAGS += -D$(FURUNO_GPS_PORT)_BAUD=$(FURUNO_GPS_BAUD) -ap.CFLAGS += -DNMEA_PARSE_PROP - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ifdef SECONDARY_GPS -ifneq (,$(findstring $(SECONDARY_GPS), nmea furuno)) -# this is the secondary GPS -ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_nmea.h\" -ap.CFLAGS += -DSECONDARY_GPS=gps_nmea -else -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" -ap.CFLAGS += -DPRIMARY_GPS=gps_nmea -endif -else -# plain old single GPS usage -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" -endif - -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_nmea.c $(SRC_SUBSYSTEMS)/gps/gps_furuno.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c - -sim.CFLAGS += -DUSE_GPS -sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim.c -sim.srcs += $(SRC_SUBSYSTEMS)/gps.c - -nps.CFLAGS += -DUSE_GPS -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c +$(error Error: The gps furuno subsystem has been converted to a module, replace by ) diff --git a/conf/firmwares/subsystems/shared/gps_mediatek_diy.makefile b/conf/firmwares/subsystems/shared/gps_mediatek_diy.makefile index d3df31cd5e9..161c8a363cb 100644 --- a/conf/firmwares/subsystems/shared/gps_mediatek_diy.makefile +++ b/conf/firmwares/subsystems/shared/gps_mediatek_diy.makefile @@ -1,45 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -# Mediatek MT3329, DIYDrones V1.4/1.6 protocol - -GPS_LED ?= none -MTK_GPS_PORT ?= $(GPS_PORT) -MTK_GPS_BAUD ?= $(GPS_BAUD) - -MTK_GPS_PORT_LOWER=$(shell echo $(MTK_GPS_PORT) | tr A-Z a-z) - -ap.CFLAGS += -DUSE_GPS -DGPS_CONFIGURE -ap.CFLAGS += -DMTK_GPS_LINK=$(MTK_GPS_PORT_LOWER) -ap.CFLAGS += -DUSE_$(MTK_GPS_PORT) -ap.CFLAGS += -D$(MTK_GPS_PORT)_BAUD=$(MTK_GPS_BAUD) - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ifdef SECONDARY_GPS -ifneq (,$(findstring $(SECONDARY_GPS), mtk mediatek)) -# this is the secondary GPS -ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_mtk.h\" -ap.CFLAGS += -DSECONDARY_GPS=gps_mtk -else -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_mtk.h\" -ap.CFLAGS += -DPRIMARY_GPS=gps_mtk -endif -else -# plain old single GPS usage -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_mtk.h\" -endif - -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_mtk.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c - -sim.CFLAGS += -DUSE_GPS -sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim.c -sim.srcs += $(SRC_SUBSYSTEMS)/gps.c - -nps.CFLAGS += -DUSE_GPS -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c +$(error Error: The gps mediatek subsystem has been converted to a module, replace by ) diff --git a/conf/firmwares/subsystems/shared/gps_nmea.makefile b/conf/firmwares/subsystems/shared/gps_nmea.makefile index 235260b62e5..e7744d5c32c 100644 --- a/conf/firmwares/subsystems/shared/gps_nmea.makefile +++ b/conf/firmwares/subsystems/shared/gps_nmea.makefile @@ -1,45 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -# NMEA GPS unit - -GPS_LED ?= none -NMEA_GPS_PORT ?= $(GPS_PORT) -NMEA_GPS_BAUD ?= $(GPS_BAUD) - -NMEA_GPS_PORT_LOWER=$(shell echo $(NMEA_GPS_PORT) | tr A-Z a-z) - -ap.CFLAGS += -DUSE_GPS -ap.CFLAGS += -DNMEA_GPS_LINK=$(NMEA_GPS_PORT_LOWER) -ap.CFLAGS += -DUSE_$(NMEA_GPS_PORT) -ap.CFLAGS += -D$(NMEA_GPS_PORT)_BAUD=$(NMEA_GPS_BAUD) - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ifdef SECONDARY_GPS -ifneq (,$(findstring $(SECONDARY_GPS), nmea)) -# this is the secondary GPS -ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_nmea.h\" -ap.CFLAGS += -DSECONDARY_GPS=gps_nmea -else -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" -ap.CFLAGS += -DPRIMARY_GPS=gps_nmea -endif -else -# plain old single GPS usage -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" -endif - -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_nmea.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c - -sim.CFLAGS += -DUSE_GPS -sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim.c -sim.srcs += $(SRC_SUBSYSTEMS)/gps.c - -nps.CFLAGS += -DUSE_GPS -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c +$(error Error: The gps nmea subsystem has been converted to a module, replace with ) diff --git a/conf/firmwares/subsystems/shared/gps_piksi.makefile b/conf/firmwares/subsystems/shared/gps_piksi.makefile index 2ec494afb28..4d1356025d8 100644 --- a/conf/firmwares/subsystems/shared/gps_piksi.makefile +++ b/conf/firmwares/subsystems/shared/gps_piksi.makefile @@ -1,48 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -# Swift-Nav Piksi RTK module - -GPS_LED ?= none -PIKSI_GPS_PORT ?= $(GPS_PORT) -PIKSI_GPS_BAUD ?= $(GPS_BAUD) - -PIKSI_GPS_PORT_LOWER=$(shell echo $(PIKSI_GPS_PORT) | tr A-Z a-z) - -ap.CFLAGS += -DUSE_GPS -ap.CFLAGS += -DUSE_$(PIKSI_GPS_PORT) -D$(PIKSI_GPS_PORT)_BAUD=B115200 -ap.CFLAGS += -DPIKSI_GPS_LINK=$(PIKSI_GPS_PORT_LOWER) - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ifdef SECONDARY_GPS -ifneq (,$(findstring $(SECONDARY_GPS), piksi)) -# this is the secondary GPS -ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_piksi.h\" -ap.CFLAGS += -DSECONDARY_GPS=gps_piksi -else -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_piksi.h\" -ap.CFLAGS += -DPRIMARY_GPS=gps_piksi -endif -else -# plain old single GPS usage -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_piksi.h\" -endif - -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_piksi.c - -# libsbp -ap.CFLAGS += -I$(PAPARAZZI_SRC)/sw/ext/libsbp/c/include -ap.srcs += $(PAPARAZZI_SRC)/sw/ext/libsbp/c/src/sbp.c $(PAPARAZZI_SRC)/sw/ext/libsbp/c/src/edc.c - -sim.CFLAGS += -DUSE_GPS -sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim.c -sim.srcs += $(SRC_SUBSYSTEMS)/gps.c - -nps.CFLAGS += -DUSE_GPS -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c +$(error Error: The gps piksi subsystem has been converted to a module, replace by ) diff --git a/conf/firmwares/subsystems/shared/gps_skytraq.makefile b/conf/firmwares/subsystems/shared/gps_skytraq.makefile index 2c5bb008844..8cc0c8abd60 100644 --- a/conf/firmwares/subsystems/shared/gps_skytraq.makefile +++ b/conf/firmwares/subsystems/shared/gps_skytraq.makefile @@ -1,43 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -GPS_LED ?= none -SKYTRAQ_GPS_PORT ?= $(GPS_PORT) -SKYTRAQ_GPS_BAUD ?= $(GPS_BAUD) - -SKYTRAQ_GPS_PORT_LOWER=$(shell echo $(SKYTRAQ_GPS_PORT) | tr A-Z a-z) - -ap.CFLAGS += -DUSE_GPS -ap.CFLAGS += -DSKYTRAQ_GPS_LINK=$(SKYTRAQ_SKYTRAQ_GPS_PORT_LOWER) -ap.CFLAGS += -DUSE_$(SKYTRAQ_GPS_PORT) -ap.CFLAGS += -D$(SKYTRAQ_GPS_PORT)_BAUD=$(SKYTRAQ_GPS_BAUD) - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ifdef SECONDARY_GPS -ifneq (,$(findstring $(SECONDARY_GPS), skytraq)) -# this is the secondary GPS -ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_skytraq.h\" -ap.CFLAGS += -DSECONDARY_GPS=gps_skytraq -else -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_skytraq.h\" -ap.CFLAGS += -DPRIMARY_GPS=gps_skytraq -endif -else -# plain old single GPS usage -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_skytraq.h\" -endif - -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_skytraq.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c - -sim.CFLAGS += -DUSE_GPS -sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim.c -sim.srcs += $(SRC_SUBSYSTEMS)/gps.c - -nps.CFLAGS += -DUSE_GPS -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c +$(error Error: The gps skytraq subsystem has been converted to a module, replace by ) diff --git a/conf/firmwares/subsystems/fixedwing/gps_ublox_utm.makefile b/conf/firmwares/subsystems/shared/gps_ublox_utm.makefile similarity index 100% rename from conf/firmwares/subsystems/fixedwing/gps_ublox_utm.makefile rename to conf/firmwares/subsystems/shared/gps_ublox_utm.makefile diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml new file mode 100644 index 00000000000..5592a9802a1 --- /dev/null +++ b/conf/modules/gps_furuno.xml @@ -0,0 +1,65 @@ + + + + + + Furuno GPS (UART) + Driver for Furuno GPS modules parsing the NMEA protocol with Furuno extensions. + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + ifdef SECONDARY_GPS + ifneq (,$(findstring $(SECONDARY_GPS), nmea furuno)) + # this is the secondary GPS + ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_nmea.h\" + ap.CFLAGS += -DSECONDARY_GPS=gps_nmea + else + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" + ap.CFLAGS += -DPRIMARY_GPS=gps_nmea + endif + else + # plain old single GPS usage + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" + endif + + + + + + + + + + + + + + +
diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml new file mode 100644 index 00000000000..52f31889981 --- /dev/null +++ b/conf/modules/gps_mediatek_diy.xml @@ -0,0 +1,61 @@ + + + + + + Mediatek MT3329 GPS (UART) + Driver for Mediatek MT3329 GPS, DIYDrones V1.4/1.6 protocol + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + ifdef SECONDARY_GPS + ifneq (,$(findstring $(SECONDARY_GPS), mtk mediatek)) + # this is the secondary GPS + ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_mtk.h\" + ap.CFLAGS += -DSECONDARY_GPS=gps_mtk + else + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_mtk.h\" + ap.CFLAGS += -DPRIMARY_GPS=gps_mtk + endif + else + # plain old single GPS usage + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_mtk.h\" + endif + + + + + + + + + + + + + + +
diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml new file mode 100644 index 00000000000..ca4a48275d0 --- /dev/null +++ b/conf/modules/gps_nmea.xml @@ -0,0 +1,61 @@ + + + + + + NMEA GPS (UART) + Driver for GPS modules using the NMEA protocol. + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + ifdef SECONDARY_GPS + ifneq (,$(findstring $(SECONDARY_GPS), nmea)) + # this is the secondary GPS + ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_nmea.h\" + ap.CFLAGS += -DSECONDARY_GPS=gps_nmea + else + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" + ap.CFLAGS += -DPRIMARY_GPS=gps_nmea + endif + else + # plain old single GPS usage + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" + endif + + + + + + + + + + + + + + +
diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml new file mode 100644 index 00000000000..1be2b2393d3 --- /dev/null +++ b/conf/modules/gps_piksi.xml @@ -0,0 +1,64 @@ + + + + + + Swift-Nav Piksi RTK GPS. + Driver for Swift-Nav Piksi RTK GPS connected via UART. + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + ifdef SECONDARY_GPS + ifneq (,$(findstring $(SECONDARY_GPS), piksi)) + # this is the secondary GPS + ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_piksi.h\" + ap.CFLAGS += -DSECONDARY_GPS=gps_piksi + else + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_piksi.h\" + ap.CFLAGS += -DPRIMARY_GPS=gps_piksi + endif + else + # plain old single GPS usage + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_piksi.h\" + endif + + + + + + + + + + + + + + +
diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml new file mode 100644 index 00000000000..8984e986d48 --- /dev/null +++ b/conf/modules/gps_sirf.xml @@ -0,0 +1,61 @@ + + + + + + Sirf GPS (UART) + Driver for GPS modules using the Sirf binary protocol. + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + ifdef SECONDARY_GPS + ifneq (,$(findstring $(SECONDARY_GPS), sirf)) + # this is the secondary GPS + ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_sirf.h\" + ap.CFLAGS += -DSECONDARY_GPS=gps_sirf + else + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sirf.h\" + ap.CFLAGS += -DPRIMARY_GPS=gps_sirf + endif + else + # plain old single GPS usage + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sirf.h\" + endif + + + + + + + + + + + + + + +
diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml new file mode 100644 index 00000000000..f9fc54bcc13 --- /dev/null +++ b/conf/modules/gps_skytraq.xml @@ -0,0 +1,61 @@ + + + + + + Skytraq GPS (UART) + Driver for GPS modules using the Skytraq binary protocol. + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + ifdef SECONDARY_GPS + ifneq (,$(findstring $(SECONDARY_GPS), skytraq)) + # this is the secondary GPS + ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_skytraq.h\" + ap.CFLAGS += -DSECONDARY_GPS=gps_skytraq + else + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_skytraq.h\" + ap.CFLAGS += -DPRIMARY_GPS=gps_skytraq + endif + else + # plain old single GPS usage + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_skytraq.h\" + endif + + + + + + + + + + + + + + +
diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index 887f886b29b..81214a6d97d 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -6,8 +6,8 @@ U-blox GPS (UART) Driver for u-blox GPS modules parsing the binary UBX protocol. - - + +
@@ -16,18 +16,19 @@ - + + + + - - ifdef SECONDARY_GPS diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml new file mode 100644 index 00000000000..ae019deab9c --- /dev/null +++ b/conf/modules/gps_udp.xml @@ -0,0 +1,55 @@ + + + + + + GPS via UDP. + Read GPS messages from UDP port 7000. + + + + +
+ +
+ + + + + + + + + + + + + + ifdef SECONDARY_GPS + ifneq (,$(findstring $(SECONDARY_GPS), udp)) + # this is the secondary GPS + ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_udp.h\" + ap.CFLAGS += -DSECONDARY_GPS=gps_udp + else + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_udp.h\" + ap.CFLAGS += -DPRIMARY_GPS=gps_udp + endif + else + # plain old single GPS usage + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_udp.h\" + endif + + + + + + + + + + + + + + +
From 8afa5f01b22a9f584b2c2f36dc7459410a5d3111 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 20 Apr 2016 22:49:06 +0200 Subject: [PATCH 02/11] [gps] call gps_x_init and event directly from module and get rid of need for GPS registering. PRIMARY_GPS (and SECONDARY_GPS) now needs to be UPPERCASE (the first part of the ABI id, e.g. GPS_UBX) This is now only used/needed to resolve GpsId(PRIMARY_GPS) to e.g. GPS_UBX_ID sim and nps are now failing, since the init and event functions are wrong for those targets. Next step is to make gps_sim and gps_nps modules and remove those targets from the "normal" modules. But maybe add the sim modules as dependencies so they can be auto-loaded? --- conf/modules/gps_furuno.xml | 9 ++- conf/modules/gps_mediatek_diy.xml | 9 ++- conf/modules/gps_nmea.xml | 9 ++- conf/modules/gps_piksi.xml | 8 +-- conf/modules/gps_sirf.xml | 9 ++- conf/modules/gps_skytraq.xml | 9 ++- conf/modules/gps_ublox.xml | 8 +-- conf/modules/gps_udp.xml | 8 +-- sw/airborne/arch/sim/sim_gps.c | 2 +- sw/airborne/firmwares/fixedwing/main_ap.c | 4 -- sw/airborne/firmwares/rotorcraft/main.c | 4 -- sw/airborne/modules/ins/ins_xsens.c | 9 --- sw/airborne/modules/ins/ins_xsens.h | 3 +- sw/airborne/modules/ins/ins_xsens700.c | 11 --- sw/airborne/modules/ins/ins_xsens700.h | 3 +- sw/airborne/subsystems/gps.c | 68 ++----------------- sw/airborne/subsystems/gps.h | 11 --- sw/airborne/subsystems/gps/gps_datalink.c | 9 --- sw/airborne/subsystems/gps/gps_datalink.h | 3 +- sw/airborne/subsystems/gps/gps_mtk.c | 8 --- sw/airborne/subsystems/gps/gps_mtk.h | 5 +- sw/airborne/subsystems/gps/gps_nmea.c | 8 --- sw/airborne/subsystems/gps/gps_nmea.h | 4 +- sw/airborne/subsystems/gps/gps_piksi.c | 8 --- sw/airborne/subsystems/gps/gps_piksi.h | 3 +- sw/airborne/subsystems/gps/gps_sim.c | 8 --- sw/airborne/subsystems/gps/gps_sim.h | 3 +- sw/airborne/subsystems/gps/gps_sim_hitl.c | 7 -- sw/airborne/subsystems/gps/gps_sim_hitl.h | 5 +- sw/airborne/subsystems/gps/gps_sim_nps.c | 8 --- sw/airborne/subsystems/gps/gps_sim_nps.h | 4 +- sw/airborne/subsystems/gps/gps_sirf.c | 9 --- sw/airborne/subsystems/gps/gps_sirf.h | 4 +- sw/airborne/subsystems/gps/gps_skytraq.c | 8 --- sw/airborne/subsystems/gps/gps_skytraq.h | 3 +- sw/airborne/subsystems/gps/gps_ubx.c | 4 -- sw/airborne/subsystems/gps/gps_ubx.h | 7 +- sw/airborne/subsystems/gps/gps_udp.c | 8 --- sw/airborne/subsystems/gps/gps_udp.h | 3 +- sw/airborne/subsystems/ins/ins_alt_float.c | 2 +- .../subsystems/ins/ins_vectornav_wrapper.c | 6 -- .../subsystems/ins/ins_vectornav_wrapper.h | 3 +- 42 files changed, 61 insertions(+), 263 deletions(-) diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index 5592a9802a1..b7d9f792abb 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -13,10 +13,9 @@
- - + - + @@ -39,10 +38,10 @@ ifneq (,$(findstring $(SECONDARY_GPS), nmea furuno)) # this is the secondary GPS ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_nmea.h\" - ap.CFLAGS += -DSECONDARY_GPS=gps_nmea + ap.CFLAGS += -DSECONDARY_GPS=GPS_NMEA else ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" - ap.CFLAGS += -DPRIMARY_GPS=gps_nmea + ap.CFLAGS += -DPRIMARY_GPS=GPS_NMEA endif else # plain old single GPS usage diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index 52f31889981..3c9a8c89730 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -13,10 +13,9 @@
- - + - + @@ -35,10 +34,10 @@ ifneq (,$(findstring $(SECONDARY_GPS), mtk mediatek)) # this is the secondary GPS ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_mtk.h\" - ap.CFLAGS += -DSECONDARY_GPS=gps_mtk + ap.CFLAGS += -DSECONDARY_GPS=GPS_MTK else ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_mtk.h\" - ap.CFLAGS += -DPRIMARY_GPS=gps_mtk + ap.CFLAGS += -DPRIMARY_GPS=GPS_MTK endif else # plain old single GPS usage diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index ca4a48275d0..5e4d8a18ced 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -13,10 +13,9 @@
- - + - + @@ -35,10 +34,10 @@ ifneq (,$(findstring $(SECONDARY_GPS), nmea)) # this is the secondary GPS ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_nmea.h\" - ap.CFLAGS += -DSECONDARY_GPS=gps_nmea + ap.CFLAGS += -DSECONDARY_GPS=GPS_NMEA else ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" - ap.CFLAGS += -DPRIMARY_GPS=gps_nmea + ap.CFLAGS += -DPRIMARY_GPS=GPS_NMEA endif else # plain old single GPS usage diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index 1be2b2393d3..e5e269ea708 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -14,9 +14,9 @@
- + - + @@ -38,10 +38,10 @@ ifneq (,$(findstring $(SECONDARY_GPS), piksi)) # this is the secondary GPS ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_piksi.h\" - ap.CFLAGS += -DSECONDARY_GPS=gps_piksi + ap.CFLAGS += -DSECONDARY_GPS=GPS_PIKSI else ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_piksi.h\" - ap.CFLAGS += -DPRIMARY_GPS=gps_piksi + ap.CFLAGS += -DPRIMARY_GPS=GPS_PIKSI endif else # plain old single GPS usage diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index 8984e986d48..b892f1652d9 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -13,10 +13,9 @@
- - + - + @@ -35,10 +34,10 @@ ifneq (,$(findstring $(SECONDARY_GPS), sirf)) # this is the secondary GPS ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_sirf.h\" - ap.CFLAGS += -DSECONDARY_GPS=gps_sirf + ap.CFLAGS += -DSECONDARY_GPS=GPS_SIRF else ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sirf.h\" - ap.CFLAGS += -DPRIMARY_GPS=gps_sirf + ap.CFLAGS += -DPRIMARY_GPS=GPS_SIRF endif else # plain old single GPS usage diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index f9fc54bcc13..969710ebf86 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -13,10 +13,9 @@
- - + - + @@ -35,10 +34,10 @@ ifneq (,$(findstring $(SECONDARY_GPS), skytraq)) # this is the secondary GPS ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_skytraq.h\" - ap.CFLAGS += -DSECONDARY_GPS=gps_skytraq + ap.CFLAGS += -DSECONDARY_GPS=GPS_SKYTRAQ else ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_skytraq.h\" - ap.CFLAGS += -DPRIMARY_GPS=gps_skytraq + ap.CFLAGS += -DPRIMARY_GPS=GPS_SKYTRAQ endif else # plain old single GPS usage diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index 81214a6d97d..71ff25105b6 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -14,9 +14,9 @@ - + - + @@ -35,10 +35,10 @@ ifneq (,$(findstring $(SECONDARY_GPS), ublox)) # this is the secondary GPS ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_ubx.h\" - ap.CFLAGS += -DSECONDARY_GPS=gps_ubx + ap.CFLAGS += -DSECONDARY_GPS=GPS_UBX else ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_ubx.h\" - ap.CFLAGS += -DPRIMARY_GPS=gps_ubx + ap.CFLAGS += -DPRIMARY_GPS=GPS_UBX endif else # plain old single GPS usage diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index ae019deab9c..241f64ce8b5 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -12,10 +12,8 @@
- - + - @@ -29,10 +27,10 @@ ifneq (,$(findstring $(SECONDARY_GPS), udp)) # this is the secondary GPS ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_udp.h\" - ap.CFLAGS += -DSECONDARY_GPS=gps_udp + ap.CFLAGS += -DSECONDARY_GPS=GPS_UDP else ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_udp.h\" - ap.CFLAGS += -DPRIMARY_GPS=gps_udp + ap.CFLAGS += -DPRIMARY_GPS=GPS_UDP endif else # plain old single GPS usage diff --git a/sw/airborne/arch/sim/sim_gps.c b/sw/airborne/arch/sim/sim_gps.c index e99c70fe406..a338236ae10 100644 --- a/sw/airborne/arch/sim/sim_gps.c +++ b/sw/airborne/arch/sim/sim_gps.c @@ -7,7 +7,7 @@ /** From airborne/autopilot/ */ #include "generated/airframe.h" #include "generated/flight_plan.h" -#include "subsystems/gps.h" +#include "subsystems/gps/gps_sim.h" #include "math/pprz_geodetic_float.h" #include "math/pprz_geodetic_int.h" diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 42c65df232f..11836ad7e33 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -719,10 +719,6 @@ void event_task_ap(void) InsEvent(); #endif -#if USE_GPS - GpsEvent(); -#endif /* USE_GPS */ - #if USE_BARO_BOARD BaroEvent(); #endif diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index 550297dea39..607c526bfbc 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -383,10 +383,6 @@ STATIC_INLINE void main_event(void) BaroEvent(); #endif -#if USE_GPS - GpsEvent(); -#endif - #if FAILSAFE_GROUND_DETECT || KILL_ON_GROUND_DETECT DetectGroundEvent(); #endif diff --git a/sw/airborne/modules/ins/ins_xsens.c b/sw/airborne/modules/ins/ins_xsens.c index b8f709d3bf0..cd4fdb11087 100644 --- a/sw/airborne/modules/ins/ins_xsens.c +++ b/sw/airborne/modules/ins/ins_xsens.c @@ -186,12 +186,3 @@ static void handle_ins_msg(void) #endif // USE_GPS_XSENS } -#ifdef USE_GPS_XSENS -/* - * register callbacks & structs - */ -void gps_xsens_register(void) -{ - gps_register_impl(gps_xsens_init, NULL, GPS_XSENS_ID); -} -#endif diff --git a/sw/airborne/modules/ins/ins_xsens.h b/sw/airborne/modules/ins/ins_xsens.h index 9e55c00136c..b590034d174 100644 --- a/sw/airborne/modules/ins/ins_xsens.h +++ b/sw/airborne/modules/ins/ins_xsens.h @@ -49,10 +49,9 @@ extern void ins_xsens_event(void); #if USE_GPS_XSENS #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_xsens +#define PRIMARY_GPS GPS_XSENS #endif extern void gps_xsens_init(void); -extern void gps_xsens_register(void); #endif #else // SITL diff --git a/sw/airborne/modules/ins/ins_xsens700.c b/sw/airborne/modules/ins/ins_xsens700.c index 1ead510db06..4e5ddde7a51 100644 --- a/sw/airborne/modules/ins/ins_xsens700.c +++ b/sw/airborne/modules/ins/ins_xsens700.c @@ -193,14 +193,3 @@ void handle_ins_msg(void) } #endif // USE_GPS_XSENS } - - -#ifdef USE_GPS_XSENS -/* - * register callbacks & structs - */ -void gps_xsens700_register(void) -{ - gps_register_impl(gps_xsens700_init, NULL, GPS_XSENS_ID); -} -#endif diff --git a/sw/airborne/modules/ins/ins_xsens700.h b/sw/airborne/modules/ins/ins_xsens700.h index ae52489082c..7ac88a45d6b 100644 --- a/sw/airborne/modules/ins/ins_xsens700.h +++ b/sw/airborne/modules/ins/ins_xsens700.h @@ -49,10 +49,9 @@ extern void ins_xsens700_event(void); #if USE_GPS_XSENS #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_xsens700 +#define PRIMARY_GPS GPS_XSENS #endif extern void gps_xsens700_init(void); -extern void gps_xsens700_register(void); #endif #else // SITL diff --git a/sw/airborne/subsystems/gps.c b/sw/airborne/subsystems/gps.c index 4cf19b3ad58..bc068a9aba9 100644 --- a/sw/airborne/subsystems/gps.c +++ b/sw/airborne/subsystems/gps.c @@ -40,19 +40,11 @@ PRINT_CONFIG_VAR(PRIMARY_GPS) PRINT_CONFIG_VAR(SECONDARY_GPS) #endif -#define __RegisterGps(_x) _x ## _register() -#define _RegisterGps(_x) __RegisterGps(_x) -#define RegisterGps(_x) _RegisterGps(_x) +/* expand GpsId(PRIMARY_GPS) to e.g. GPS_UBX_ID */ +#define __GpsId(_x) _x ## _ID +#define _GpsId(_x) __GpsId(_x) +#define GpsId(_x) _GpsId(_x) -/** maximum number of GPS implementations that can register */ -#ifdef SECONDARY_GPS -#define GPS_NB_IMPL 2 -#else -#define GPS_NB_IMPL 1 -#endif - -#define PRIMARY_GPS_INSTANCE 0 -#define SECONDARY_GPS_INSTANCE 1 #ifdef GPS_POWER_GPIO #include "mcu_periph/gpio.h" @@ -75,14 +67,6 @@ static uint8_t current_gps_id = 0; uint8_t multi_gps_mode; -/* gps structs */ -struct GpsInstance { - ImplGpsInit init; - ImplGpsEvent event; - uint8_t id; -}; - -struct GpsInstance GpsInstances[GPS_NB_IMPL]; #if PERIODIC_TELEMETRY #include "subsystems/datalink/telemetry.h" @@ -188,9 +172,9 @@ static uint8_t gps_multi_switch(struct GpsState *gps_s) { static uint32_t time_since_last_gps_switch = 0; if (multi_gps_mode == GPS_MODE_PRIMARY){ - return GpsInstances[PRIMARY_GPS_INSTANCE].id; + return GpsId(PRIMARY_GPS); } else if (multi_gps_mode == GPS_MODE_SECONDARY){ - return GpsInstances[SECONDARY_GPS_INSTANCE].id; + return GpsId(SECONDARY_GPS); } else{ if (gps_s->fix > gps.fix){ return gps_s->comp_id; @@ -217,6 +201,7 @@ static void gps_cb(uint8_t sender_id, uint32_t stamp __attribute__((unused)), struct GpsState *gps_s) { + /* ignore callback from own AbiSendMsgGPS */ if (sender_id == GPS_MULTI_ID) { return; } @@ -238,34 +223,6 @@ static void gps_cb(uint8_t sender_id, } } -/* - * handle gps switching and updating gps instances - */ -void GpsEvent(void) { - // run each gps event - for (int i = 0 ; i < GPS_NB_IMPL ; i++) { - if (GpsInstances[i].event != NULL) { - GpsInstances[i].event(); - } - } -} - -/* - * register gps structs for callback - */ -void gps_register_impl(ImplGpsInit init, ImplGpsEvent event, uint8_t id) -{ - int i; - for (i=0; i < GPS_NB_IMPL; i++) { - if (GpsInstances[i].init == NULL) { - GpsInstances[i].init = init; - GpsInstances[i].event = event; - GpsInstances[i].id = id; - break; - } - } - -} void gps_init(void) { @@ -290,17 +247,6 @@ void gps_init(void) LED_OFF(GPS_LED); #endif - RegisterGps(PRIMARY_GPS); -#ifdef SECONDARY_GPS - RegisterGps(SECONDARY_GPS); -#endif - - for (int i=0; i < GPS_NB_IMPL; i++) { - if (GpsInstances[i].init != NULL) { - GpsInstances[i].init(); - } - } - AbiBindMsgGPS(ABI_BROADCAST, &gps_ev, gps_cb); #if PERIODIC_TELEMETRY diff --git a/sw/airborne/subsystems/gps.h b/sw/airborne/subsystems/gps.h index 6295f279432..56e190d7594 100644 --- a/sw/airborne/subsystems/gps.h +++ b/sw/airborne/subsystems/gps.h @@ -120,17 +120,6 @@ struct GpsTimeSync { /** global GPS state */ extern struct GpsState gps; -typedef void (*ImplGpsInit)(void); -typedef void (*ImplGpsEvent)(void); - - -extern void GpsEvent(void); - -/** - * register callbacks and state pointers - */ -extern void gps_register_impl(ImplGpsInit init, ImplGpsEvent event, uint8_t id); - #ifdef GPS_TYPE_H #include GPS_TYPE_H #endif diff --git a/sw/airborne/subsystems/gps/gps_datalink.c b/sw/airborne/subsystems/gps/gps_datalink.c index f2cc999783d..7241375c5b3 100644 --- a/sw/airborne/subsystems/gps/gps_datalink.c +++ b/sw/airborne/subsystems/gps/gps_datalink.c @@ -166,12 +166,3 @@ void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, int32_t e AbiSendMsgGPS(GPS_DATALINK_ID, now_ts, &gps_datalink); } - - -/* - * register callbacks & structs - */ -void gps_datalink_register(void) -{ - gps_register_impl(gps_datalink_init, NULL, GPS_DATALINK_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_datalink.h b/sw/airborne/subsystems/gps/gps_datalink.h index 93fa1dcf6af..1b01bbac741 100644 --- a/sw/airborne/subsystems/gps/gps_datalink.h +++ b/sw/airborne/subsystems/gps/gps_datalink.h @@ -35,13 +35,12 @@ #include "subsystems/gps.h" #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_datalink +#define PRIMARY_GPS GPS_DATALINK #endif extern struct GpsState gps_datalink; extern void gps_datalink_init(void); -extern void gps_datalink_register(void); extern void parse_gps_datalink_small(int16_t heading, uint32_t pos_xyz, uint32_t speed_xyz, uint32_t tow); diff --git a/sw/airborne/subsystems/gps/gps_mtk.c b/sw/airborne/subsystems/gps/gps_mtk.c index a0e7dad7804..523e486688d 100644 --- a/sw/airborne/subsystems/gps/gps_mtk.c +++ b/sw/airborne/subsystems/gps/gps_mtk.c @@ -407,14 +407,6 @@ void gps_mtk_parse(uint8_t c) } -/* - * register callbacks & structs - */ -void gps_mtk_register(void) -{ - gps_register_impl(gps_mtk_init, gps_mtk_event, GPS_MTK_ID); -} - /* * * diff --git a/sw/airborne/subsystems/gps/gps_mtk.h b/sw/airborne/subsystems/gps/gps_mtk.h index b20f7b3da3f..7846ab1e9bc 100644 --- a/sw/airborne/subsystems/gps/gps_mtk.h +++ b/sw/airborne/subsystems/gps/gps_mtk.h @@ -42,6 +42,10 @@ #define GPS_MTK_MAX_PAYLOAD 255 +#ifndef PRIMARY_GPS +#define PRIMARY_GPS GPS_MTK +#endif + struct GpsMtk { bool msg_available; uint8_t msg_buf[GPS_MTK_MAX_PAYLOAD] __attribute__((aligned)); @@ -66,7 +70,6 @@ extern struct GpsMtk gps_mtk; extern void gps_mtk_event(void); extern void gps_mtk_init(void); -extern void gps_mtk_register(void); #ifdef GPS_CONFIGURE extern void gps_configure(void); diff --git a/sw/airborne/subsystems/gps/gps_nmea.c b/sw/airborne/subsystems/gps/gps_nmea.c index d6aa6b24fa8..190e8fda041 100644 --- a/sw/airborne/subsystems/gps/gps_nmea.c +++ b/sw/airborne/subsystems/gps/gps_nmea.c @@ -561,11 +561,3 @@ static bool nmea_parse_GSV(void) /* indicate that msg was valid and gps_nmea.state updated */ return true; } - - /* - * register callbacks & structs - */ -void gps_nmea_register(void) -{ - gps_register_impl(gps_nmea_init, gps_nmea_event, GPS_NMEA_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_nmea.h b/sw/airborne/subsystems/gps/gps_nmea.h index 08f02ae62ee..26f634946b5 100644 --- a/sw/airborne/subsystems/gps/gps_nmea.h +++ b/sw/airborne/subsystems/gps/gps_nmea.h @@ -38,12 +38,12 @@ #define NMEA_MAXLEN 255 #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_nmea +#define PRIMARY_GPS GPS_NMEA #endif extern void gps_nmea_init(void); extern void gps_nmea_event(void); -extern void gps_nmea_register(void); + struct GpsNmea { bool msg_available; ///< flag set to TRUE if a new msg/sentence is available to be parsed diff --git a/sw/airborne/subsystems/gps/gps_piksi.c b/sw/airborne/subsystems/gps/gps_piksi.c index db5430b10d6..4f7c6780996 100644 --- a/sw/airborne/subsystems/gps/gps_piksi.c +++ b/sw/airborne/subsystems/gps/gps_piksi.c @@ -409,11 +409,3 @@ void gps_inject_data(uint8_t packet_id, uint8_t length, uint8_t *data) { sbp_send_message(&sbp_state, packet_id, SBP_SENDER_ID, length, data, gps_piksi_write); } - -/* - * register callbacks & structs - */ -void gps_piksi_register(void) -{ - gps_register_impl(gps_piksi_init, gps_piksi_event, GPS_PIKSI_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_piksi.h b/sw/airborne/subsystems/gps/gps_piksi.h index 272db2694bd..cbe2b0a5782 100644 --- a/sw/airborne/subsystems/gps/gps_piksi.h +++ b/sw/airborne/subsystems/gps/gps_piksi.h @@ -33,12 +33,11 @@ #define GPS_PIKSI_H #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_piksi +#define PRIMARY_GPS GPS_PIKSI #endif extern void gps_piksi_event(void); extern void gps_piksi_init(void); -extern void gps_piksi_register(void); /* * Reset base station position diff --git a/sw/airborne/subsystems/gps/gps_sim.c b/sw/airborne/subsystems/gps/gps_sim.c index a4517f1d890..a3f70a90c57 100644 --- a/sw/airborne/subsystems/gps/gps_sim.c +++ b/sw/airborne/subsystems/gps/gps_sim.c @@ -38,11 +38,3 @@ void gps_sim_publish(void) } AbiSendMsgGPS(GPS_SIM_ID, now_ts, &gps); } - -/* - * register callbacks & structs - */ -void gps_sim_register(void) -{ - gps_register_impl(gps_sim_init, NULL, GPS_SIM_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_sim.h b/sw/airborne/subsystems/gps/gps_sim.h index d8912678e58..88e955ca47d 100644 --- a/sw/airborne/subsystems/gps/gps_sim.h +++ b/sw/airborne/subsystems/gps/gps_sim.h @@ -5,12 +5,11 @@ #include "subsystems/gps.h" #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_sim +#define PRIMARY_GPS GPS_SIM #endif extern void gps_sim_publish(void); extern void gps_sim_init(void); -extern void gps_sim_register(void); #endif /* GPS_SIM_H */ diff --git a/sw/airborne/subsystems/gps/gps_sim_hitl.c b/sw/airborne/subsystems/gps/gps_sim_hitl.c index 6ab0a248322..76515ff2a7a 100644 --- a/sw/airborne/subsystems/gps/gps_sim_hitl.c +++ b/sw/airborne/subsystems/gps/gps_sim_hitl.c @@ -95,10 +95,3 @@ void gps_sim_hitl_event(void) } } -/* - * register callbacks & structs - */ -void gps_sim_hitl_register(void) -{ - gps_register_impl(gps_sim_hitl_init, gps_sim_hitl_event, GPS_SIM_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_sim_hitl.h b/sw/airborne/subsystems/gps/gps_sim_hitl.h index cea939aee0e..ecba3bdd24b 100644 --- a/sw/airborne/subsystems/gps/gps_sim_hitl.h +++ b/sw/airborne/subsystems/gps/gps_sim_hitl.h @@ -28,11 +28,10 @@ #define GPS_SIM_HITL_H #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_sim_hitl +#define PRIMARY_GPS GPS_SIM #endif extern void gps_sim_hitl_event(void); -extern void gps_sim_hitl_impl_init(void); -extern void gps_sim_hitl_register(void); +extern void gps_sim_hitl_init(void); #endif /* GPS_SIM_HITL_H */ diff --git a/sw/airborne/subsystems/gps/gps_sim_nps.c b/sw/airborne/subsystems/gps/gps_sim_nps.c index b5bddfbb639..1959ca41f82 100644 --- a/sw/airborne/subsystems/gps/gps_sim_nps.c +++ b/sw/airborne/subsystems/gps/gps_sim_nps.c @@ -91,11 +91,3 @@ void gps_nps_init(void) { gps_has_fix = true; } - -/* - * register callbacks & structs - */ -void gps_nps_register(void) -{ - gps_register_impl(gps_nps_init, NULL, GPS_SIM_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_sim_nps.h b/sw/airborne/subsystems/gps/gps_sim_nps.h index ab5fe8ab3bb..d4fc18bbe81 100644 --- a/sw/airborne/subsystems/gps/gps_sim_nps.h +++ b/sw/airborne/subsystems/gps/gps_sim_nps.h @@ -4,7 +4,7 @@ #include "std.h" #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_nps +#define PRIMARY_GPS GPS_SIM #endif extern bool gps_has_fix; @@ -12,7 +12,5 @@ extern bool gps_has_fix; extern void gps_feed_value(); extern void gps_nps_impl_init(); -extern void gps_nps_register(void); - #endif /* GPS_SIM_NPS_H */ diff --git a/sw/airborne/subsystems/gps/gps_sirf.c b/sw/airborne/subsystems/gps/gps_sirf.c index 73afe5e032d..59cde02c50d 100644 --- a/sw/airborne/subsystems/gps/gps_sirf.c +++ b/sw/airborne/subsystems/gps/gps_sirf.c @@ -295,12 +295,3 @@ void gps_sirf_event(void) } } } - - -/* - * register callbacks & structs - */ -void gps_sirf_register(void) -{ - gps_register_impl(gps_sirf_init, gps_sirf_event, GPS_SIRF_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_sirf.h b/sw/airborne/subsystems/gps/gps_sirf.h index 84492d111b4..6ddfc71b623 100644 --- a/sw/airborne/subsystems/gps/gps_sirf.h +++ b/sw/airborne/subsystems/gps/gps_sirf.h @@ -33,7 +33,7 @@ #include "subsystems/gps.h" #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_sirf +#define PRIMARY_GPS GPS_SIRF #endif #define SIRF_GPS_NB_CHANNELS 16 @@ -58,7 +58,5 @@ extern struct GpsSirf gps_sirf; extern void gps_sirf_init(void); extern void gps_sirf_event(void); -extern void gps_sirf_register(void); - #endif /* GPS_SIRF_H */ diff --git a/sw/airborne/subsystems/gps/gps_skytraq.c b/sw/airborne/subsystems/gps/gps_skytraq.c index 5b1e7f8c4e6..2a2feb70843 100644 --- a/sw/airborne/subsystems/gps/gps_skytraq.c +++ b/sw/airborne/subsystems/gps/gps_skytraq.c @@ -287,11 +287,3 @@ static int distance_too_great(struct EcefCoor_i *ecef_ref, struct EcefCoor_i *ec return false; } - -/* - * register callbacks & structs - */ -void gps_skytraq_register(void) -{ - gps_register_impl(gps_skytraq_init, gps_skytraq_event, GPS_SKYTRAQ_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_skytraq.h b/sw/airborne/subsystems/gps/gps_skytraq.h index 45ff59c233c..006385a3447 100644 --- a/sw/airborne/subsystems/gps/gps_skytraq.h +++ b/sw/airborne/subsystems/gps/gps_skytraq.h @@ -27,7 +27,7 @@ #define SKYTRAQ_ID_NAVIGATION_DATA 0XA8 #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_skytraq +#define PRIMARY_GPS GPS_SKYTRAQ #endif /* last error type */ @@ -62,6 +62,5 @@ extern struct GpsSkytraq gps_skytraq; extern void gps_skytraq_init(void); extern void gps_skytraq_event(void); -extern void gps_skytraq_register(void); #endif /* GPS_SKYTRAQ_H */ diff --git a/sw/airborne/subsystems/gps/gps_ubx.c b/sw/airborne/subsystems/gps/gps_ubx.c index 7ea21c35c80..4143f1866f4 100644 --- a/sw/airborne/subsystems/gps/gps_ubx.c +++ b/sw/airborne/subsystems/gps/gps_ubx.c @@ -346,7 +346,3 @@ void gps_ubx_msg(void) gps_ubx.msg_available = false; } -void gps_ubx_register(void) -{ - gps_register_impl(gps_ubx_init, gps_ubx_event, GPS_UBX_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_ubx.h b/sw/airborne/subsystems/gps/gps_ubx.h index 09bbfb381b5..ab1cd3b21f2 100644 --- a/sw/airborne/subsystems/gps/gps_ubx.h +++ b/sw/airborne/subsystems/gps/gps_ubx.h @@ -40,12 +40,11 @@ #include "mcu_periph/uart.h" #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_ubx +#define PRIMARY_GPS GPS_UBX #endif -void gps_ubx_init(void); -void gps_ubx_event(void); -extern void gps_ubx_register(void); +extern void gps_ubx_init(void); +extern void gps_ubx_event(void); #define GPS_UBX_NB_CHANNELS 16 diff --git a/sw/airborne/subsystems/gps/gps_udp.c b/sw/airborne/subsystems/gps/gps_udp.c index fc8868a075b..0cd86d7fb08 100644 --- a/sw/airborne/subsystems/gps/gps_udp.c +++ b/sw/airborne/subsystems/gps/gps_udp.c @@ -93,11 +93,3 @@ void gps_udp_parse(void) memset(&gps_udp_read_buffer[0], 0, sizeof(gps_udp_read_buffer)); } } - -/* - * register callbacks & structs - */ -void gps_udp_register(void) -{ - gps_register_impl(gps_udp_init, gps_udp_parse, GPS_UDP_ID); -} diff --git a/sw/airborne/subsystems/gps/gps_udp.h b/sw/airborne/subsystems/gps/gps_udp.h index b530687e0b3..22c9725570e 100644 --- a/sw/airborne/subsystems/gps/gps_udp.h +++ b/sw/airborne/subsystems/gps/gps_udp.h @@ -5,13 +5,12 @@ #include "subsystems/gps.h" #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_udp +#define PRIMARY_GPS GPS_UDP #endif extern struct GpsState gps_udp; extern void gps_udp_parse(void); extern void gps_udp_init(void); -extern void gps_udp_register(void); #endif /* GPS_UDP_H */ diff --git a/sw/airborne/subsystems/ins/ins_alt_float.c b/sw/airborne/subsystems/ins/ins_alt_float.c index e14b08c81e7..a74293b95be 100644 --- a/sw/airborne/subsystems/ins/ins_alt_float.c +++ b/sw/airborne/subsystems/ins/ins_alt_float.c @@ -201,7 +201,7 @@ void ins_alt_float_update_baro(float pressure __attribute__((unused))) #endif -void ins_alt_float_update_gps(struct GpsState *gps_s) +void ins_alt_float_update_gps(struct GpsState *gps_s __attribute__((unused))) { #if USE_GPS if (gps_s->fix < GPS_FIX_3D) { diff --git a/sw/airborne/subsystems/ins/ins_vectornav_wrapper.c b/sw/airborne/subsystems/ins/ins_vectornav_wrapper.c index b98ecec0e24..fd71a4e5a09 100644 --- a/sw/airborne/subsystems/ins/ins_vectornav_wrapper.c +++ b/sw/airborne/subsystems/ins/ins_vectornav_wrapper.c @@ -38,9 +38,3 @@ void gps_vectornav_init(void) { gps.nb_channels = 0; } - -void gps_vectornav_register(void) -{ - gps_register_impl(gps_vectornav_init, NULL, GPS_VECTORNAV_ID); -} - diff --git a/sw/airborne/subsystems/ins/ins_vectornav_wrapper.h b/sw/airborne/subsystems/ins/ins_vectornav_wrapper.h index 45289ca9c2a..bc3526631e5 100644 --- a/sw/airborne/subsystems/ins/ins_vectornav_wrapper.h +++ b/sw/airborne/subsystems/ins/ins_vectornav_wrapper.h @@ -40,9 +40,8 @@ extern void ins_vectornav_register(void); #ifndef PRIMARY_GPS -#define PRIMARY_GPS gps_vectornav +#define PRIMARY_GPS GPS_VECTORNAV #endif extern void gps_vectornav_init(void); -extern void gps_vectornav_register(void); #endif /* INS_VECTORNAV_WRAPPER_H */ From 2374f82a98c17430d4a8d6f40167ae36ad5b2c29 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Sat, 23 Apr 2016 16:21:10 +0200 Subject: [PATCH 03/11] [gps][sim] separate gps_sim and gps_nps modules --- conf/airframes/examples/quadrotor_lisa_mx.xml | 1 + conf/modules/gps_furuno.xml | 12 -------- conf/modules/gps_mediatek_diy.xml | 12 -------- conf/modules/gps_nmea.xml | 12 -------- conf/modules/gps_nps.xml | 22 +++++++++++++++ conf/modules/gps_piksi.xml | 12 -------- conf/modules/gps_sim.xml | 21 ++++++++++++++ conf/modules/gps_sim_hitl.xml | 28 +++++++++++++++++++ conf/modules/gps_sirf.xml | 12 -------- conf/modules/gps_skytraq.xml | 12 -------- conf/modules/gps_ublox.xml | 12 -------- conf/modules/gps_ubx_i2c.xml | 3 +- conf/modules/gps_udp.xml | 12 -------- sw/airborne/subsystems/gps/gps_sim_nps.h | 2 +- 14 files changed, 75 insertions(+), 98 deletions(-) create mode 100644 conf/modules/gps_nps.xml create mode 100644 conf/modules/gps_sim.xml create mode 100644 conf/modules/gps_sim_hitl.xml diff --git a/conf/airframes/examples/quadrotor_lisa_mx.xml b/conf/airframes/examples/quadrotor_lisa_mx.xml index 30341971ab6..f9bb6197870 100644 --- a/conf/airframes/examples/quadrotor_lisa_mx.xml +++ b/conf/airframes/examples/quadrotor_lisa_mx.xml @@ -17,6 +17,7 @@ + diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index b7d9f792abb..dc5c3d84d80 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -49,16 +49,4 @@ endif - - - - - - - - - - - -
diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index 3c9a8c89730..b79ef51feca 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -45,16 +45,4 @@ endif - - - - - - - - - - - -
diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index 5e4d8a18ced..367c53d9779 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -45,16 +45,4 @@ endif - - - - - - - - - - - -
diff --git a/conf/modules/gps_nps.xml b/conf/modules/gps_nps.xml new file mode 100644 index 00000000000..5ebd63cd074 --- /dev/null +++ b/conf/modules/gps_nps.xml @@ -0,0 +1,22 @@ + + + + + + Simulated GPS for NPS. + For NPS simulator. Can model GPS noise, bias and latency. + The GPS sensor configuration is done in the header file referenced by NPS_SENSORS_PARAMS. + + +
+ +
+ + + + + + + + +
diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index e5e269ea708..3970c277940 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -49,16 +49,4 @@ endif - - - - - - - - - - - -
diff --git a/conf/modules/gps_sim.xml b/conf/modules/gps_sim.xml new file mode 100644 index 00000000000..ff98572b9bc --- /dev/null +++ b/conf/modules/gps_sim.xml @@ -0,0 +1,21 @@ + + + + + + Simulated GPS + For simple fixedwing OCaml simulator. Does not model any GPS inaccuracies/noise. + + +
+ +
+ + + + + + + + +
diff --git a/conf/modules/gps_sim_hitl.xml b/conf/modules/gps_sim_hitl.xml new file mode 100644 index 00000000000..e92f600904e --- /dev/null +++ b/conf/modules/gps_sim_hitl.xml @@ -0,0 +1,28 @@ + + + + + + Sim HITL GPS + Simulate GPS for HITL (HardwareInTheLoop) from rotorcrafts horizontal/vertical reference system. + + + +
+ +
+ + + + + + + + + + + + + + +
diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index b892f1652d9..dca29eadfce 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -45,16 +45,4 @@ endif - - - - - - - - - - - -
diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index 969710ebf86..cb26f6bec85 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -45,16 +45,4 @@ endif - - - - - - - - - - - -
diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index 71ff25105b6..988437c20b7 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -46,17 +46,5 @@ endif - - - - - - - - - - - -
diff --git a/conf/modules/gps_ubx_i2c.xml b/conf/modules/gps_ubx_i2c.xml index ab1e733f3cf..760231411c2 100644 --- a/conf/modules/gps_ubx_i2c.xml +++ b/conf/modules/gps_ubx_i2c.xml @@ -4,6 +4,7 @@ U-blox GPS (I2C) + Extends the gps_ublox to provide I2C connectivity. @@ -17,7 +18,7 @@ - + diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index 241f64ce8b5..3bde0c132df 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -38,16 +38,4 @@ endif - - - - - - - - - - - -
diff --git a/sw/airborne/subsystems/gps/gps_sim_nps.h b/sw/airborne/subsystems/gps/gps_sim_nps.h index d4fc18bbe81..c1de3eee0d8 100644 --- a/sw/airborne/subsystems/gps/gps_sim_nps.h +++ b/sw/airborne/subsystems/gps/gps_sim_nps.h @@ -11,6 +11,6 @@ extern bool gps_has_fix; extern void gps_feed_value(); -extern void gps_nps_impl_init(); +extern void gps_nps_init(); #endif /* GPS_SIM_NPS_H */ From 6cc4d590f58af5a31b05ca3f0afc64befd6e2635 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 18 May 2016 15:23:59 +0200 Subject: [PATCH 04/11] [gps] call gps_periodic_check from module --- conf/modules/gps_furuno.xml | 2 +- conf/modules/gps_mediatek_diy.xml | 2 +- conf/modules/gps_nmea.xml | 2 +- conf/modules/gps_nps.xml | 2 +- conf/modules/gps_piksi.xml | 3 +-- conf/modules/gps_sim.xml | 2 +- conf/modules/gps_sim_hitl.xml | 1 - conf/modules/gps_sirf.xml | 2 +- conf/modules/gps_skytraq.xml | 2 +- conf/modules/gps_ublox.xml | 3 +-- conf/modules/gps_udp.xml | 2 +- sw/airborne/firmwares/fixedwing/main_ap.c | 4 ---- sw/airborne/firmwares/rotorcraft/main.c | 1 - sw/airborne/subsystems/gps.c | 6 +++--- sw/airborne/subsystems/gps.h | 2 +- sw/airborne/subsystems/gps/gps_piksi.h | 2 ++ sw/airborne/subsystems/gps/gps_sim_nps.h | 1 + sw/airborne/subsystems/gps/gps_udp.c | 2 ++ 18 files changed, 19 insertions(+), 22 deletions(-) diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index dc5c3d84d80..fd45e7febcf 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -14,7 +14,7 @@ - + diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index b79ef51feca..f5cf63fbea9 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -14,7 +14,7 @@ - + diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index 367c53d9779..1a4767516cf 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -14,7 +14,7 @@ - + diff --git a/conf/modules/gps_nps.xml b/conf/modules/gps_nps.xml index 5ebd63cd074..eef9e367a5d 100644 --- a/conf/modules/gps_nps.xml +++ b/conf/modules/gps_nps.xml @@ -12,7 +12,7 @@ - + diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index 3970c277940..5c6299e900a 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -13,9 +13,8 @@
- - + diff --git a/conf/modules/gps_sim.xml b/conf/modules/gps_sim.xml index ff98572b9bc..04bf7f74952 100644 --- a/conf/modules/gps_sim.xml +++ b/conf/modules/gps_sim.xml @@ -11,7 +11,7 @@ - + diff --git a/conf/modules/gps_sim_hitl.xml b/conf/modules/gps_sim_hitl.xml index e92f600904e..dae6752746e 100644 --- a/conf/modules/gps_sim_hitl.xml +++ b/conf/modules/gps_sim_hitl.xml @@ -12,7 +12,6 @@ - diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index dca29eadfce..accd5511471 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -14,7 +14,7 @@ - + diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index cb26f6bec85..18aea9ee74c 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -14,7 +14,7 @@ - + diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index 988437c20b7..70184ef1755 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -13,9 +13,8 @@
- - + diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index 3bde0c132df..32fca4c8829 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -13,7 +13,7 @@ - + diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 11836ad7e33..69cdf9baa39 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -638,10 +638,6 @@ void sensors_task(void) update_ahrs_from_sim(); #endif -#if USE_GPS - gps_periodic_check(); -#endif - //FIXME: temporary hack, remove me #ifdef InsPeriodic InsPeriodic(); diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index 607c526bfbc..cc5ff88120d 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -340,7 +340,6 @@ STATIC_INLINE void failsafe_check(void) #endif #if USE_GPS - gps_periodic_check(); if (autopilot_mode == AP_MODE_NAV && autopilot_motors_on && #if NO_GPS_LOST_WITH_RC_VALID diff --git a/sw/airborne/subsystems/gps.c b/sw/airborne/subsystems/gps.c index bc068a9aba9..05f977f3e4a 100644 --- a/sw/airborne/subsystems/gps.c +++ b/sw/airborne/subsystems/gps.c @@ -160,10 +160,10 @@ static void send_gps_sol(struct transport_tx *trans, struct link_device *dev) } #endif -void gps_periodic_check(void) +void gps_periodic_check(struct GpsState *gps_s) { - if (sys_time.nb_sec - gps.last_msg_time > GPS_TIMEOUT) { - gps.fix = GPS_FIX_NONE; + if (sys_time.nb_sec - gps_s->last_msg_time > GPS_TIMEOUT) { + gps_s->fix = GPS_FIX_NONE; } } diff --git a/sw/airborne/subsystems/gps.h b/sw/airborne/subsystems/gps.h index 56e190d7594..d7ef70d6a95 100644 --- a/sw/airborne/subsystems/gps.h +++ b/sw/airborne/subsystems/gps.h @@ -151,7 +151,7 @@ static inline bool gps_has_been_good(void) /** Periodic GPS check. * Marks GPS as lost when no GPS message was received for GPS_TIMEOUT seconds */ -extern void gps_periodic_check(void); +extern void gps_periodic_check(struct GpsState *gps_s); /** * GPS Reset diff --git a/sw/airborne/subsystems/gps/gps_piksi.h b/sw/airborne/subsystems/gps/gps_piksi.h index cbe2b0a5782..c0ba2356a16 100644 --- a/sw/airborne/subsystems/gps/gps_piksi.h +++ b/sw/airborne/subsystems/gps/gps_piksi.h @@ -36,6 +36,8 @@ #define PRIMARY_GPS GPS_PIKSI #endif +extern struct GpsState gps_piksi; + extern void gps_piksi_event(void); extern void gps_piksi_init(void); diff --git a/sw/airborne/subsystems/gps/gps_sim_nps.h b/sw/airborne/subsystems/gps/gps_sim_nps.h index c1de3eee0d8..42c6e3c0220 100644 --- a/sw/airborne/subsystems/gps/gps_sim_nps.h +++ b/sw/airborne/subsystems/gps/gps_sim_nps.h @@ -7,6 +7,7 @@ #define PRIMARY_GPS GPS_SIM #endif +extern struct GpsState gps_nps; extern bool gps_has_fix; extern void gps_feed_value(); diff --git a/sw/airborne/subsystems/gps/gps_udp.c b/sw/airborne/subsystems/gps/gps_udp.c index 0cd86d7fb08..c30c19069e4 100644 --- a/sw/airborne/subsystems/gps/gps_udp.c +++ b/sw/airborne/subsystems/gps/gps_udp.c @@ -37,6 +37,8 @@ unsigned char gps_udp_read_buffer[256]; struct FmsNetwork *gps_network = NULL; +struct GpsState gps_udp; + void gps_udp_init(void) { gps_udp.fix = GPS_FIX_NONE; From 6bf56d70799d1093889e8d1a7516e6ce88a35186 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 15 Jun 2016 21:14:24 +0200 Subject: [PATCH 05/11] [gps] autoload gps_sim and gps_nps modules from the "normal" gps modules so that you don't have to add them manually in your airframe to get the simulation running --- conf/airframes/examples/quadrotor_lisa_mx.xml | 1 - conf/modules/gps_furuno.xml | 2 ++ conf/modules/gps_mediatek_diy.xml | 2 ++ conf/modules/gps_nmea.xml | 2 ++ conf/modules/gps_piksi.xml | 2 ++ conf/modules/gps_sim_hitl.xml | 1 + conf/modules/gps_sirf.xml | 2 ++ conf/modules/gps_skytraq.xml | 2 ++ conf/modules/gps_ublox.xml | 2 ++ conf/modules/gps_udp.xml | 2 ++ 10 files changed, 17 insertions(+), 1 deletion(-) diff --git a/conf/airframes/examples/quadrotor_lisa_mx.xml b/conf/airframes/examples/quadrotor_lisa_mx.xml index f9bb6197870..30341971ab6 100644 --- a/conf/airframes/examples/quadrotor_lisa_mx.xml +++ b/conf/airframes/examples/quadrotor_lisa_mx.xml @@ -17,7 +17,6 @@ - diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index fd45e7febcf..d1d128dbf99 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -10,6 +10,8 @@ + +
diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index f5cf63fbea9..5d6c20b6e0e 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -10,6 +10,8 @@ + +
diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index 1a4767516cf..0b65a81ab14 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -10,6 +10,8 @@ + +
diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index 5c6299e900a..8634ded2569 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -10,6 +10,8 @@ + +
diff --git a/conf/modules/gps_sim_hitl.xml b/conf/modules/gps_sim_hitl.xml index dae6752746e..f5526ddafb9 100644 --- a/conf/modules/gps_sim_hitl.xml +++ b/conf/modules/gps_sim_hitl.xml @@ -8,6 +8,7 @@ +
diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index accd5511471..2902b7b3d04 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -10,6 +10,8 @@ + +
diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index 18aea9ee74c..0c139448681 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -10,6 +10,8 @@ + +
diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index 70184ef1755..52e2402434a 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -10,6 +10,8 @@ + +
diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index 32fca4c8829..6a4866b6a9d 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -9,6 +9,8 @@ + +
From 56e5bc891a0123e8929ef4057a14b420f330e35c Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 15 Jun 2016 23:18:28 +0200 Subject: [PATCH 06/11] [gps] fix invalid xml and dox --- conf/modules/gps_furuno.xml | 2 +- conf/modules/gps_mediatek_diy.xml | 2 +- conf/modules/gps_nmea.xml | 2 +- conf/modules/gps_nps.xml | 2 +- conf/modules/gps_piksi.xml | 2 +- conf/modules/gps_sim.xml | 2 +- conf/modules/gps_sirf.xml | 2 +- conf/modules/gps_skytraq.xml | 2 +- conf/modules/gps_ublox.xml | 2 +- conf/modules/gps_udp.xml | 2 +- sw/airborne/subsystems/gps.c | 17 +++++++++++++++-- sw/airborne/subsystems/gps/gps_mtk.h | 2 ++ sw/airborne/subsystems/gps/gps_nmea.h | 10 +++++----- sw/airborne/subsystems/gps/gps_piksi.h | 2 ++ sw/airborne/subsystems/gps/gps_sim.h | 3 ++- sw/airborne/subsystems/gps/gps_sim_nps.h | 2 ++ sw/airborne/subsystems/gps/gps_sirf.h | 2 ++ sw/airborne/subsystems/gps/gps_skytraq.h | 2 ++ sw/airborne/subsystems/gps/gps_ubx.h | 2 ++ sw/airborne/subsystems/gps/gps_udp.h | 2 ++ 20 files changed, 46 insertions(+), 18 deletions(-) diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index d1d128dbf99..46b75ee16a9 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index 5d6c20b6e0e..749928366d7 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index 0b65a81ab14..531c55f900a 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_nps.xml b/conf/modules/gps_nps.xml index eef9e367a5d..d41d2d26f48 100644 --- a/conf/modules/gps_nps.xml +++ b/conf/modules/gps_nps.xml @@ -12,7 +12,7 @@ - + diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index 8634ded2569..2dd37be648a 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_sim.xml b/conf/modules/gps_sim.xml index 04bf7f74952..edc25b558ec 100644 --- a/conf/modules/gps_sim.xml +++ b/conf/modules/gps_sim.xml @@ -11,7 +11,7 @@ - + diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index 2902b7b3d04..0cf53947c03 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index 0c139448681..118862eb149 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index 52e2402434a..8e4b76e9e6c 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index 6a4866b6a9d..bf1e564059e 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -15,7 +15,7 @@ - + diff --git a/sw/airborne/subsystems/gps.c b/sw/airborne/subsystems/gps.c index 05f977f3e4a..cb6123d0026 100644 --- a/sw/airborne/subsystems/gps.c +++ b/sw/airborne/subsystems/gps.c @@ -19,9 +19,22 @@ * Boston, MA 02111-1307, USA. */ -/** @file gps.c - * @brief Device independent GPS code +/** + * @file gps.c + * @brief Device independent GPS code. + * This provides some general GPS functions and handles the selection of the + * currently active GPS (if multiple ones are used). + * + * Each GPS implementation sends a GPS message via ABI for each new measurement, + * which can be received by any other part (either from all or only one specific GPS). + * + * To make it easy to switch to the currently best (or simply the preferred) GPS at runtime, + * the #multi_gps_mode can be set to #GPS_MODE_PRIMARY, #GPS_MODE_SECONDARY or #GPS_MODE_AUTO. + * This re-sends the GPS message of the "selected" GPS with #GPS_MULTI_ID as sender id. + * In the (default) GPS_MODE_AUTO mode, the GPS with the best fix is selected. * + * The global #gps struct is also updated from the "selected" GPS + * and used to send the normal GPS telemetry messages. */ #include "subsystems/abi.h" diff --git a/sw/airborne/subsystems/gps/gps_mtk.h b/sw/airborne/subsystems/gps/gps_mtk.h index 7846ab1e9bc..cba70e6dcc2 100644 --- a/sw/airborne/subsystems/gps/gps_mtk.h +++ b/sw/airborne/subsystems/gps/gps_mtk.h @@ -71,6 +71,8 @@ extern struct GpsMtk gps_mtk; extern void gps_mtk_event(void); extern void gps_mtk_init(void); +#define gps_mtk_periodic_check() gps_periodic_check(&gps_mtk.state) + #ifdef GPS_CONFIGURE extern void gps_configure(void); extern void gps_configure_uart(void); diff --git a/sw/airborne/subsystems/gps/gps_nmea.h b/sw/airborne/subsystems/gps/gps_nmea.h index 26f634946b5..0baeaedd76e 100644 --- a/sw/airborne/subsystems/gps/gps_nmea.h +++ b/sw/airborne/subsystems/gps/gps_nmea.h @@ -26,7 +26,6 @@ * */ - #ifndef GPS_NMEA_H #define GPS_NMEA_H @@ -41,10 +40,6 @@ #define PRIMARY_GPS GPS_NMEA #endif -extern void gps_nmea_init(void); -extern void gps_nmea_event(void); - - struct GpsNmea { bool msg_available; ///< flag set to TRUE if a new msg/sentence is available to be parsed bool is_configured; ///< flag set to TRUE if configuration is finished @@ -59,6 +54,11 @@ struct GpsNmea { extern struct GpsNmea gps_nmea; +extern void gps_nmea_init(void); +extern void gps_nmea_event(void); + +#define gps_nmea_periodic_check() gps_periodic_check(&gps_nmea.state) + /* * This part is used by the autopilot to read data from a uart diff --git a/sw/airborne/subsystems/gps/gps_piksi.h b/sw/airborne/subsystems/gps/gps_piksi.h index c0ba2356a16..6b979fd4cc4 100644 --- a/sw/airborne/subsystems/gps/gps_piksi.h +++ b/sw/airborne/subsystems/gps/gps_piksi.h @@ -41,6 +41,8 @@ extern struct GpsState gps_piksi; extern void gps_piksi_event(void); extern void gps_piksi_init(void); +#define gps_piksi_periodic_check() gps_periodic_check(&gps_piksi) + /* * Reset base station position */ diff --git a/sw/airborne/subsystems/gps/gps_sim.h b/sw/airborne/subsystems/gps/gps_sim.h index 88e955ca47d..eb4163a1ebe 100644 --- a/sw/airborne/subsystems/gps/gps_sim.h +++ b/sw/airborne/subsystems/gps/gps_sim.h @@ -9,7 +9,8 @@ #endif extern void gps_sim_publish(void); - extern void gps_sim_init(void); +#define gps_sim_periodic_check() gps_periodic_check(&gps) + #endif /* GPS_SIM_H */ diff --git a/sw/airborne/subsystems/gps/gps_sim_nps.h b/sw/airborne/subsystems/gps/gps_sim_nps.h index 42c6e3c0220..14a9841afa7 100644 --- a/sw/airborne/subsystems/gps/gps_sim_nps.h +++ b/sw/airborne/subsystems/gps/gps_sim_nps.h @@ -14,4 +14,6 @@ extern void gps_feed_value(); extern void gps_nps_init(); +#define gps_nps_periodic_check() gps_periodic_check(&gps_nps) + #endif /* GPS_SIM_NPS_H */ diff --git a/sw/airborne/subsystems/gps/gps_sirf.h b/sw/airborne/subsystems/gps/gps_sirf.h index 6ddfc71b623..b0ec0cc2cef 100644 --- a/sw/airborne/subsystems/gps/gps_sirf.h +++ b/sw/airborne/subsystems/gps/gps_sirf.h @@ -59,4 +59,6 @@ extern struct GpsSirf gps_sirf; extern void gps_sirf_init(void); extern void gps_sirf_event(void); +#define gps_sirf_periodic_check() gps_periodic_check(&gps_sirf.state) + #endif /* GPS_SIRF_H */ diff --git a/sw/airborne/subsystems/gps/gps_skytraq.h b/sw/airborne/subsystems/gps/gps_skytraq.h index 006385a3447..823d3ae7b1d 100644 --- a/sw/airborne/subsystems/gps/gps_skytraq.h +++ b/sw/airborne/subsystems/gps/gps_skytraq.h @@ -63,4 +63,6 @@ extern struct GpsSkytraq gps_skytraq; extern void gps_skytraq_init(void); extern void gps_skytraq_event(void); +#define gps_skytraq_periodic_check() gps_periodic_check(&gps_skytraq.state) + #endif /* GPS_SKYTRAQ_H */ diff --git a/sw/airborne/subsystems/gps/gps_ubx.h b/sw/airborne/subsystems/gps/gps_ubx.h index ab1cd3b21f2..5fe25b44843 100644 --- a/sw/airborne/subsystems/gps/gps_ubx.h +++ b/sw/airborne/subsystems/gps/gps_ubx.h @@ -46,6 +46,8 @@ extern void gps_ubx_init(void); extern void gps_ubx_event(void); +#define gps_ubx_periodic_check() gps_periodic_check(&gps_ubx.state) + #define GPS_UBX_NB_CHANNELS 16 #define GPS_UBX_MAX_PAYLOAD 255 diff --git a/sw/airborne/subsystems/gps/gps_udp.h b/sw/airborne/subsystems/gps/gps_udp.h index 22c9725570e..072b09ac474 100644 --- a/sw/airborne/subsystems/gps/gps_udp.h +++ b/sw/airborne/subsystems/gps/gps_udp.h @@ -13,4 +13,6 @@ extern struct GpsState gps_udp; extern void gps_udp_parse(void); extern void gps_udp_init(void); +#define gps_udp_periodic_check() gps_periodic_check(&gps_udp) + #endif /* GPS_UDP_H */ From 59ac2449a6d75bd735bdfc509790391b5a3ab3d2 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 15 Jun 2016 23:51:32 +0200 Subject: [PATCH 07/11] [gps] remove gps_Reset settings handler this should be added to each GPS implementation separately (where appropriate) --- conf/settings/OPENUAS/openuas_fixedwing_basic_extra.xml | 1 - conf/settings/OPENUAS/openuas_tuning_basic_ins.xml | 1 - conf/settings/fixedwing_basic.xml | 1 - sw/airborne/subsystems/gps.h | 7 ------- 4 files changed, 10 deletions(-) diff --git a/conf/settings/OPENUAS/openuas_fixedwing_basic_extra.xml b/conf/settings/OPENUAS/openuas_fixedwing_basic_extra.xml index efc061732ba..b0217546b08 100644 --- a/conf/settings/OPENUAS/openuas_fixedwing_basic_extra.xml +++ b/conf/settings/OPENUAS/openuas_fixedwing_basic_extra.xml @@ -21,7 +21,6 @@ - + + + + + +
+ +
+ + + + + + + + +
+ diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index 46b75ee16a9..bef8542b6be 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -10,6 +10,7 @@ +
diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index 749928366d7..22a45b82e00 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -10,6 +10,7 @@ +
diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index 531c55f900a..afa4c8efceb 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -10,6 +10,7 @@ +
diff --git a/conf/modules/gps_nps.xml b/conf/modules/gps_nps.xml index d41d2d26f48..8aa50890271 100644 --- a/conf/modules/gps_nps.xml +++ b/conf/modules/gps_nps.xml @@ -8,6 +8,7 @@ The GPS sensor configuration is done in the header file referenced by NPS_SENSORS_PARAMS. +
diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index 2dd37be648a..e244cf73906 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -10,6 +10,7 @@ +
diff --git a/conf/modules/gps_sim.xml b/conf/modules/gps_sim.xml index edc25b558ec..9e8a7b444f0 100644 --- a/conf/modules/gps_sim.xml +++ b/conf/modules/gps_sim.xml @@ -7,6 +7,7 @@ For simple fixedwing OCaml simulator. Does not model any GPS inaccuracies/noise. +
diff --git a/conf/modules/gps_sim_hitl.xml b/conf/modules/gps_sim_hitl.xml index f5526ddafb9..9cc7447d46a 100644 --- a/conf/modules/gps_sim_hitl.xml +++ b/conf/modules/gps_sim_hitl.xml @@ -8,6 +8,7 @@ +
diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index 0cf53947c03..905815798c7 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -10,6 +10,7 @@ +
diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index 118862eb149..4b982424798 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -10,6 +10,7 @@ +
diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index 8e4b76e9e6c..fce03332691 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -10,6 +10,7 @@ +
diff --git a/conf/modules/gps_ubx_ucenter.xml b/conf/modules/gps_ubx_ucenter.xml index 243aa0d7457..b457b4a33f5 100644 --- a/conf/modules/gps_ubx_ucenter.xml +++ b/conf/modules/gps_ubx_ucenter.xml @@ -18,6 +18,7 @@ Warning: you still need to tell the driver, which paparazzi port you use. description="Dynamic model used by ublox GPS filter. Default:NAV5_DYN_AIRBORNE_2G"/> + @@ -30,6 +31,9 @@ Warning: you still need to tell the driver, which paparazzi port you use. + + gps_ublox +
diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index bf1e564059e..3830793c6b4 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -9,6 +9,7 @@ +
diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 69cdf9baa39..1bd5309f2c2 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -190,9 +190,6 @@ void init_ap(void) stateInit(); /************* Sensors initialization ***************/ -#if USE_GPS - gps_init(); -#endif #if USE_IMU imu_init(); diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index cc5ff88120d..ed7a6ba9e13 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -198,10 +198,6 @@ STATIC_INLINE void main_init(void) ins_init(); -#if USE_GPS - gps_init(); -#endif - autopilot_init(); modules_init(); From 21b9d4043b90d4c32ab0cc69ad5df681cb06b380 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Thu, 16 Jun 2016 21:23:52 +0200 Subject: [PATCH 10/11] [gps] remove duplicated elements (configured by common gps module) --- conf/modules/gps_furuno.xml | 5 ----- conf/modules/gps_mediatek_diy.xml | 5 ----- conf/modules/gps_nmea.xml | 5 ----- conf/modules/gps_nps.xml | 2 -- conf/modules/gps_piksi.xml | 5 ----- conf/modules/gps_sim.xml | 2 -- conf/modules/gps_sim_hitl.xml | 5 ----- conf/modules/gps_sirf.xml | 5 ----- conf/modules/gps_skytraq.xml | 5 ----- conf/modules/gps_ublox.xml | 5 ----- conf/modules/gps_udp.xml | 5 ----- 11 files changed, 49 deletions(-) diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index bef8542b6be..4f73ac76c72 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -8,7 +8,6 @@ - @@ -22,16 +21,12 @@ - - - - diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index 22a45b82e00..52b56525ca9 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -8,7 +8,6 @@ - @@ -22,16 +21,12 @@ - - - - ifdef SECONDARY_GPS ifneq (,$(findstring $(SECONDARY_GPS), mtk mediatek)) diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index afa4c8efceb..e41f5d212a1 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -8,7 +8,6 @@ - @@ -22,16 +21,12 @@ - - - - ifdef SECONDARY_GPS ifneq (,$(findstring $(SECONDARY_GPS), nmea)) diff --git a/conf/modules/gps_nps.xml b/conf/modules/gps_nps.xml index 8aa50890271..e84c2a512aa 100644 --- a/conf/modules/gps_nps.xml +++ b/conf/modules/gps_nps.xml @@ -15,9 +15,7 @@ - - diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index e244cf73906..bf86710fd11 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -8,7 +8,6 @@ - @@ -22,19 +21,15 @@ - - - - ifdef SECONDARY_GPS ifneq (,$(findstring $(SECONDARY_GPS), piksi)) diff --git a/conf/modules/gps_sim.xml b/conf/modules/gps_sim.xml index 9e8a7b444f0..fdb443770f2 100644 --- a/conf/modules/gps_sim.xml +++ b/conf/modules/gps_sim.xml @@ -14,9 +14,7 @@ - - diff --git a/conf/modules/gps_sim_hitl.xml b/conf/modules/gps_sim_hitl.xml index 9cc7447d46a..3d8e337e8ad 100644 --- a/conf/modules/gps_sim_hitl.xml +++ b/conf/modules/gps_sim_hitl.xml @@ -6,7 +6,6 @@ Sim HITL GPS Simulate GPS for HITL (HardwareInTheLoop) from rotorcrafts horizontal/vertical reference system. - @@ -16,14 +15,10 @@ - - - - diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index 905815798c7..43a22144ec5 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -8,7 +8,6 @@ - @@ -22,16 +21,12 @@ - - - - ifdef SECONDARY_GPS ifneq (,$(findstring $(SECONDARY_GPS), sirf)) diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index 4b982424798..8c48b33f2f5 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -8,7 +8,6 @@ - @@ -22,16 +21,12 @@ - - - - ifdef SECONDARY_GPS ifneq (,$(findstring $(SECONDARY_GPS), skytraq)) diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index fce03332691..ed7e0a9c521 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -8,7 +8,6 @@ - @@ -22,16 +21,12 @@ - - - - ifdef SECONDARY_GPS ifneq (,$(findstring $(SECONDARY_GPS), ublox)) diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index 3830793c6b4..045a66e5af2 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -7,7 +7,6 @@ Read GPS messages from UDP port 7000. - @@ -18,13 +17,9 @@ - - - - ifdef SECONDARY_GPS ifneq (,$(findstring $(SECONDARY_GPS), udp)) From 5a610111380918cca43d0ebc10964324886c77ad Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Fri, 17 Jun 2016 11:00:19 +0200 Subject: [PATCH 11/11] [gps] convert gps_datalink to module --- .../rotorcraft/gps_datalink.makefile | 32 +-------------- .../rotorcraft/gps_optitrack.makefile | 3 -- conf/modules/gps_datalink.xml | 39 ++++++++++++++++++ conf/modules/gps_optitrack.xml | 20 ++++++++++ sw/airborne/subsystems/datalink/datalink.c | 39 ------------------ sw/airborne/subsystems/gps/gps_datalink.c | 40 +++++++++++++++++-- sw/airborne/subsystems/gps/gps_datalink.h | 8 ++-- 7 files changed, 99 insertions(+), 82 deletions(-) delete mode 100644 conf/firmwares/subsystems/rotorcraft/gps_optitrack.makefile create mode 100644 conf/modules/gps_datalink.xml create mode 100644 conf/modules/gps_optitrack.xml diff --git a/conf/firmwares/subsystems/rotorcraft/gps_datalink.makefile b/conf/firmwares/subsystems/rotorcraft/gps_datalink.makefile index e0255fd9781..dfa5343924e 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_datalink.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_datalink.makefile @@ -1,31 +1 @@ -# Hey Emacs, this is a -*- makefile -*- - -GPS_LED ?= none - -ifneq ($(GPS_LED),none) - ap.CFLAGS += -DGPS_LED=$(GPS_LED) -endif - -ifdef SECONDARY_GPS -ifneq (,$(findstring $(SECONDARY_GPS), datalink)) -# this is the secondary GPS -ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_datalink.h\" -ap.CFLAGS += -DSECONDARY_GPS=gps_datalink -else -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_datalink.h\" -ap.CFLAGS += -DPRIMARY_GPS=gps_datalink -endif -else -# plain old single GPS usage -ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_datalink.h\" -endif - -ap.srcs += $(SRC_SUBSYSTEMS)/gps.c -ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_datalink.c - -ap.CFLAGS += -DUSE_GPS -DGPS_DATALINK - -nps.CFLAGS += -DUSE_GPS -nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c -nps.srcs += $(SRC_SUBSYSTEMS)/gps.c +$(error Error: The gps datalink subsystem has been converted to a module, replace by ) diff --git a/conf/firmwares/subsystems/rotorcraft/gps_optitrack.makefile b/conf/firmwares/subsystems/rotorcraft/gps_optitrack.makefile deleted file mode 100644 index 39e3410af68..00000000000 --- a/conf/firmwares/subsystems/rotorcraft/gps_optitrack.makefile +++ /dev/null @@ -1,3 +0,0 @@ -include $(CFG_ROTORCRAFT)/gps_datalink.makefile -# Always zero to get heading update -ap.CFLAGS += -DAHRS_HEADING_UPDATE_GPS_MIN_SPEED=0 diff --git a/conf/modules/gps_datalink.xml b/conf/modules/gps_datalink.xml new file mode 100644 index 00000000000..651c6f62d80 --- /dev/null +++ b/conf/modules/gps_datalink.xml @@ -0,0 +1,39 @@ + + + + + + Remote GPS via datalink. + Parses the REMOTE_GPS and REMOTE_GPS_SMALL datalink messages and publishes it onboard via ABI. + + + + + +
+ +
+ + + + + + + + ifdef SECONDARY_GPS + ifneq (,$(findstring $(SECONDARY_GPS), datalink)) + # this is the secondary GPS + ap.CFLAGS += -DGPS_SECONDARY_TYPE_H=\"subsystems/gps/gps_datalink.h\" + ap.CFLAGS += -DSECONDARY_GPS=GPS_DATALINK + else + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_datalink.h\" + ap.CFLAGS += -DPRIMARY_GPS=GPS_DATALINK + endif + else + # plain old single GPS usage + ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_datalink.h\" + endif + + +
+ diff --git a/conf/modules/gps_optitrack.xml b/conf/modules/gps_optitrack.xml new file mode 100644 index 00000000000..790b784a248 --- /dev/null +++ b/conf/modules/gps_optitrack.xml @@ -0,0 +1,20 @@ + + + + + + Optitrack used as indoor GPS. + Uses the gps_datalink implementation, but additionally sets some other defines. + Optitrack can determine the heading of a vehicle, but GPS doesn't contain heading. + So as a hack optitrack sends the heading in the GPS course field. + + + + + + + + + + + diff --git a/sw/airborne/subsystems/datalink/datalink.c b/sw/airborne/subsystems/datalink/datalink.c index be639e5c460..0c982697735 100644 --- a/sw/airborne/subsystems/datalink/datalink.c +++ b/sw/airborne/subsystems/datalink/datalink.c @@ -44,9 +44,6 @@ #if USE_GPS #include "subsystems/gps.h" #endif -#if defined GPS_DATALINK -#include "subsystems/gps/gps_datalink.h" -#endif #ifdef TRAFFIC_INFO #include "subsystems/navigation/traffic_info.h" @@ -189,42 +186,6 @@ void dl_parse_msg(void) #endif // RADIO_CONTROL_TYPE_DATALINK #if USE_GPS -#ifdef GPS_DATALINK - case DL_REMOTE_GPS_SMALL : { - // Check if the GPS is for this AC - if (DL_REMOTE_GPS_SMALL_ac_id(dl_buffer) != AC_ID) { break; } - - parse_gps_datalink_small( - DL_REMOTE_GPS_SMALL_heading(dl_buffer), - DL_REMOTE_GPS_SMALL_pos_xyz(dl_buffer), - DL_REMOTE_GPS_SMALL_speed_xyz(dl_buffer), - DL_REMOTE_GPS_SMALL_tow(dl_buffer)); - } - break; - - case DL_REMOTE_GPS : { - // Check if the GPS is for this AC - if (DL_REMOTE_GPS_ac_id(dl_buffer) != AC_ID) { break; } - - // Parse the GPS - parse_gps_datalink( - DL_REMOTE_GPS_numsv(dl_buffer), - DL_REMOTE_GPS_ecef_x(dl_buffer), - DL_REMOTE_GPS_ecef_y(dl_buffer), - DL_REMOTE_GPS_ecef_z(dl_buffer), - DL_REMOTE_GPS_lat(dl_buffer), - DL_REMOTE_GPS_lon(dl_buffer), - DL_REMOTE_GPS_alt(dl_buffer), - DL_REMOTE_GPS_hmsl(dl_buffer), - DL_REMOTE_GPS_ecef_xd(dl_buffer), - DL_REMOTE_GPS_ecef_yd(dl_buffer), - DL_REMOTE_GPS_ecef_zd(dl_buffer), - DL_REMOTE_GPS_tow(dl_buffer), - DL_REMOTE_GPS_course(dl_buffer)); - } - break; -#endif // GPS_DATALINK - case DL_GPS_INJECT : { // Check if the GPS is for this AC if (DL_GPS_INJECT_ac_id(dl_buffer) != AC_ID) { break; } diff --git a/sw/airborne/subsystems/gps/gps_datalink.c b/sw/airborne/subsystems/gps/gps_datalink.c index 7241375c5b3..fd960428a09 100644 --- a/sw/airborne/subsystems/gps/gps_datalink.c +++ b/sw/airborne/subsystems/gps/gps_datalink.c @@ -31,6 +31,7 @@ #include "subsystems/gps.h" #include "subsystems/abi.h" +#include "subsystems/datalink/datalink.h" struct LtpDef_i ltp_def; @@ -55,7 +56,7 @@ void gps_datalink_init(void) } // Parse the REMOTE_GPS_SMALL datalink packet -void parse_gps_datalink_small(int16_t heading, uint32_t pos_xyz, uint32_t speed_xyz, uint32_t tow) +static void parse_gps_datalink_small(int16_t heading, uint32_t pos_xyz, uint32_t speed_xyz, uint32_t tow) { struct EnuCoor_i enu_pos, enu_speed; @@ -121,9 +122,10 @@ void parse_gps_datalink_small(int16_t heading, uint32_t pos_xyz, uint32_t speed_ } /** Parse the REMOTE_GPS datalink packet */ -void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, int32_t ecef_z, int32_t lat, int32_t lon, - int32_t alt, - int32_t hmsl, int32_t ecef_xd, int32_t ecef_yd, int32_t ecef_zd, uint32_t tow, int32_t course) +static void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, int32_t ecef_z, + int32_t lat, int32_t lon, int32_t alt, int32_t hmsl, + int32_t ecef_xd, int32_t ecef_yd, int32_t ecef_zd, + uint32_t tow, int32_t course) { gps_datalink.lla_pos.lat = lat; gps_datalink.lla_pos.lon = lon; @@ -166,3 +168,33 @@ void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, int32_t e AbiSendMsgGPS(GPS_DATALINK_ID, now_ts, &gps_datalink); } + + +void gps_datalink_parse_REMOTE_GPS(void) +{ + if (DL_REMOTE_GPS_SMALL_ac_id(dl_buffer) != AC_ID) { return; } // not for this aircraft + + parse_gps_datalink(DL_REMOTE_GPS_numsv(dl_buffer), + DL_REMOTE_GPS_ecef_x(dl_buffer), + DL_REMOTE_GPS_ecef_y(dl_buffer), + DL_REMOTE_GPS_ecef_z(dl_buffer), + DL_REMOTE_GPS_lat(dl_buffer), + DL_REMOTE_GPS_lon(dl_buffer), + DL_REMOTE_GPS_alt(dl_buffer), + DL_REMOTE_GPS_hmsl(dl_buffer), + DL_REMOTE_GPS_ecef_xd(dl_buffer), + DL_REMOTE_GPS_ecef_yd(dl_buffer), + DL_REMOTE_GPS_ecef_zd(dl_buffer), + DL_REMOTE_GPS_tow(dl_buffer), + DL_REMOTE_GPS_course(dl_buffer)); +} + +void gps_datalink_parse_REMOTE_GPS_SMALL(void) +{ + if (DL_REMOTE_GPS_SMALL_ac_id(dl_buffer) != AC_ID) { return; } // not for this aircraft + + parse_gps_datalink_small(DL_REMOTE_GPS_SMALL_heading(dl_buffer), + DL_REMOTE_GPS_SMALL_pos_xyz(dl_buffer), + DL_REMOTE_GPS_SMALL_speed_xyz(dl_buffer), + DL_REMOTE_GPS_SMALL_tow(dl_buffer)); +} diff --git a/sw/airborne/subsystems/gps/gps_datalink.h b/sw/airborne/subsystems/gps/gps_datalink.h index 1b01bbac741..bf8e6dc2516 100644 --- a/sw/airborne/subsystems/gps/gps_datalink.h +++ b/sw/airborne/subsystems/gps/gps_datalink.h @@ -42,11 +42,9 @@ extern struct GpsState gps_datalink; extern void gps_datalink_init(void); -extern void parse_gps_datalink_small(int16_t heading, uint32_t pos_xyz, uint32_t speed_xyz, uint32_t tow); +#define gps_datalink_periodic_check() gps_periodic_check(&gps_datalink) -extern void parse_gps_datalink(uint8_t numsv, int32_t ecef_x, int32_t ecef_y, int32_t ecef_z, - int32_t lat, int32_t lon, int32_t alt, int32_t hmsl, - int32_t ecef_xd, int32_t ecef_yd, int32_t ecef_zd, - uint32_t tow, int32_t course); +extern void gps_datalink_parse_REMOTE_GPS(void); +extern void gps_datalink_parse_REMOTE_GPS_SMALL(void); #endif /* GPS_DATALINK_H */