Browse Source

gps: Add GPS driver for SBG systems devices

sbg
Brice Saussay 4 years ago
parent
commit
8c40d2c92f
  1. 2
      src/drivers/gps/CMakeLists.txt
  2. 2
      src/drivers/gps/devices
  3. 21
      src/drivers/gps/gps.cpp

2
src/drivers/gps/CMakeLists.txt

@ -46,9 +46,11 @@ px4_add_module( @@ -46,9 +46,11 @@ px4_add_module(
devices/src/ashtech.cpp
devices/src/ubx.cpp
devices/src/rtcm.cpp
devices/src/sbg_gps.cpp
devices/src/emlid_reach.cpp
MODULE_CONFIG
module.yaml
DEPENDS
sbgECom
git_gps_devices
)

2
src/drivers/gps/devices

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 4d51e5378ec74e8948981cfb9e47ed84191e2fd2
Subproject commit 2273f52dfaf229c264c354d4162534cdaed43041

21
src/drivers/gps/gps.cpp

@ -65,6 +65,7 @@ @@ -65,6 +65,7 @@
#include "devices/src/emlid_reach.h"
#include "devices/src/mtk.h"
#include "devices/src/ubx.h"
#include "devices/src/sbg_gps.h"
#ifdef __PX4_LINUX
#include <linux/spi/spidev.h>
@ -78,7 +79,8 @@ typedef enum { @@ -78,7 +79,8 @@ typedef enum {
GPS_DRIVER_MODE_UBX,
GPS_DRIVER_MODE_MTK,
GPS_DRIVER_MODE_ASHTECH,
GPS_DRIVER_MODE_EMLIDREACH
GPS_DRIVER_MODE_EMLIDREACH,
GPS_DRIVER_MODE_SBG
} gps_driver_mode_t;
/* struct for dynamic allocation of satellite info data */
@ -711,6 +713,10 @@ GPS::run() @@ -711,6 +713,10 @@ GPS::run()
_helper = new GPSDriverEmlidReach(&GPS::callback, this, &_report_gps_pos, _p_report_sat_info);
break;
case GPS_DRIVER_MODE_SBG:
_helper = new px4::sbg::GPSDriver(&GPS::callback, this, &_report_gps_pos, heading_offset);
break;
default:
break;
}
@ -810,6 +816,10 @@ GPS::run() @@ -810,6 +816,10 @@ GPS::run()
break;
case GPS_DRIVER_MODE_EMLIDREACH:
_mode = GPS_DRIVER_MODE_SBG;
break;
case GPS_DRIVER_MODE_SBG:
_mode = GPS_DRIVER_MODE_UBX;
px4_usleep(500000); // tried all possible drivers. Wait a bit before next round
break;
@ -872,6 +882,10 @@ GPS::print_status() @@ -872,6 +882,10 @@ GPS::print_status()
PX4_INFO("protocol: EMLIDREACH");
break;
case GPS_DRIVER_MODE_SBG:
PX4_INFO("protocol: SBG");
break;
default:
break;
}
@ -1039,7 +1053,7 @@ $ gps reset warm @@ -1039,7 +1053,7 @@ $ gps reset warm
PRINT_MODULE_USAGE_PARAM_FLAG('s', "Enable publication of satellite info", true);
PRINT_MODULE_USAGE_PARAM_STRING('i', "uart", "spi|uart", "GPS interface", true);
PRINT_MODULE_USAGE_PARAM_STRING('p', nullptr, "ubx|mtk|ash|eml", "GPS Protocol (default=auto select)", true);
PRINT_MODULE_USAGE_PARAM_STRING('p', nullptr, "ubx|mtk|ash|eml|sbg", "GPS Protocol (default=auto select)", true);
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset GPS device");
@ -1175,6 +1189,9 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance) @@ -1175,6 +1189,9 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance)
} else if (!strcmp(myoptarg, "eml")) {
mode = GPS_DRIVER_MODE_EMLIDREACH;
} else if (!strcmp(myoptarg, "sbg")) {
mode = GPS_DRIVER_MODE_SBG;
} else {
PX4_ERR("unknown interface: %s", myoptarg);
error_flag = true;

Loading…
Cancel
Save