From 3239118eca9d4fd875d2597be7542a24c7fa207d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Fri, 13 Jul 2018 16:28:44 +0200 Subject: [PATCH 1/3] GPS: update submodule & account for changed interface --- qgroundcontrol.pro | 4 ++++ src/GPS/Drivers | 2 +- src/GPS/GPSProvider.cc | 1 + src/GPS/vehicle_gps_position.h | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index c09b079..769e029 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -642,6 +642,8 @@ HEADERS += \ src/AnalyzeView/GeoTagController.h \ src/AnalyzeView/MavlinkConsoleController.h \ src/GPS/Drivers/src/gps_helper.h \ + src/GPS/Drivers/src/rtcm.h \ + src/GPS/Drivers/src/ashtech.h \ src/GPS/Drivers/src/ubx.h \ src/GPS/GPSManager.h \ src/GPS/GPSPositionMessage.h \ @@ -823,6 +825,8 @@ SOURCES += \ src/AnalyzeView/GeoTagController.cc \ src/AnalyzeView/MavlinkConsoleController.cc \ src/GPS/Drivers/src/gps_helper.cpp \ + src/GPS/Drivers/src/rtcm.cpp \ + src/GPS/Drivers/src/ashtech.cpp \ src/GPS/Drivers/src/ubx.cpp \ src/GPS/GPSManager.cc \ src/GPS/GPSProvider.cc \ diff --git a/src/GPS/Drivers b/src/GPS/Drivers index 41223e8..ecc26a4 160000 --- a/src/GPS/Drivers +++ b/src/GPS/Drivers @@ -1 +1 @@ -Subproject commit 41223e860e0f3b7fed5075be8ac17ecb7e07e428 +Subproject commit ecc26a43033fc1b9a3dc6dae053d28438aa2f6a1 diff --git a/src/GPS/GPSProvider.cc b/src/GPS/GPSProvider.cc index 8e77aa0..d993908 100644 --- a/src/GPS/GPSProvider.cc +++ b/src/GPS/GPSProvider.cc @@ -63,6 +63,7 @@ void GPSProvider::run() } gpsDriver = new GPSDriverUBX(GPSDriverUBX::Interface::UART, &callbackEntry, this, &_reportGpsPos, _pReportSatInfo); + baudrate = 0; // auto-configure gpsDriver->setSurveyInSpecs(_surveyInAccMeters * 10000, _surveryInDurationSecs); if (gpsDriver->configure(baudrate, GPSDriverUBX::OutputMode::RTCM) == 0) { diff --git a/src/GPS/vehicle_gps_position.h b/src/GPS/vehicle_gps_position.h index e8fa23d..1a3f8d3 100644 --- a/src/GPS/vehicle_gps_position.h +++ b/src/GPS/vehicle_gps_position.h @@ -63,6 +63,7 @@ struct vehicle_gps_position_s { float vel_d_m_s; float cog_rad; int32_t timestamp_time_relative; + float heading; uint8_t fix_type; bool vel_ned_valid; uint8_t satellites_used; From b5ab11f7616688842a234bf7fa11775a2fab59bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Fri, 13 Jul 2018 16:30:10 +0200 Subject: [PATCH 2/3] RTK GPS: add Trimble MB-Two support --- src/GPS/GPSManager.cc | 13 +++++++++++-- src/GPS/GPSManager.h | 2 +- src/GPS/GPSProvider.cc | 15 +++++++++++---- src/GPS/GPSProvider.h | 10 +++++++++- src/comm/LinkManager.cc | 2 +- src/comm/USBBoardInfo.json | 3 ++- src/ui/preferences/GeneralSettings.qml | 2 +- src/ui/toolbar/GPSRTKIndicator.qml | 2 ++ 8 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/GPS/GPSManager.cc b/src/GPS/GPSManager.cc index bd55d10..47e917a 100644 --- a/src/GPS/GPSManager.cc +++ b/src/GPS/GPSManager.cc @@ -26,13 +26,22 @@ GPSManager::~GPSManager() disconnectGPS(); } -void GPSManager::connectGPS(const QString& device) +void GPSManager::connectGPS(const QString& device, const QString& gps_type) { RTKSettings* rtkSettings = qgcApp()->toolbox()->settingsManager()->rtkSettings(); + GPSProvider::GPSType type; + if (gps_type.contains("trimble", Qt::CaseInsensitive)) { + type = GPSProvider::GPSType::trimble; + qCDebug(RTKGPSLog) << "Connecting Trimble device"; + } else { + type = GPSProvider::GPSType::u_blox; + qCDebug(RTKGPSLog) << "Connecting U-blox device"; + } + disconnectGPS(); _requestGpsStop = false; - _gpsProvider = new GPSProvider(device, true, rtkSettings->surveyInAccuracyLimit()->rawValue().toDouble(), rtkSettings->surveyInMinObservationDuration()->rawValue().toInt(), _requestGpsStop); + _gpsProvider = new GPSProvider(device, type, true, rtkSettings->surveyInAccuracyLimit()->rawValue().toDouble(), rtkSettings->surveyInMinObservationDuration()->rawValue().toInt(), _requestGpsStop); _gpsProvider->start(); //create RTCM device diff --git a/src/GPS/GPSManager.h b/src/GPS/GPSManager.h index e116f38..35ad573 100644 --- a/src/GPS/GPSManager.h +++ b/src/GPS/GPSManager.h @@ -28,7 +28,7 @@ public: GPSManager(QGCApplication* app, QGCToolbox* toolbox); ~GPSManager(); - void connectGPS (const QString& device); + void connectGPS (const QString& device, const QString& gps_type); void disconnectGPS (void); bool connected (void) const { return _gpsProvider && _gpsProvider->isRunning(); } diff --git a/src/GPS/GPSProvider.cc b/src/GPS/GPSProvider.cc index d993908..8a4d8d7 100644 --- a/src/GPS/GPSProvider.cc +++ b/src/GPS/GPSProvider.cc @@ -16,6 +16,7 @@ #include #include "Drivers/src/ubx.h" +#include "Drivers/src/ashtech.h" #include "Drivers/src/gps_helper.h" #include "definitions.h" @@ -53,7 +54,7 @@ void GPSProvider::run() _serial->setFlowControl(QSerialPort::NoFlowControl); unsigned int baudrate; - GPSDriverUBX* gpsDriver = nullptr; + GPSHelper* gpsDriver = nullptr; while (!_requestStop) { @@ -62,8 +63,13 @@ void GPSProvider::run() gpsDriver = nullptr; } - gpsDriver = new GPSDriverUBX(GPSDriverUBX::Interface::UART, &callbackEntry, this, &_reportGpsPos, _pReportSatInfo); - baudrate = 0; // auto-configure + if (_type == GPSType::trimble) { + gpsDriver = new GPSDriverAshtech(&callbackEntry, this, &_reportGpsPos, _pReportSatInfo); + baudrate = 115200; + } else { + gpsDriver = new GPSDriverUBX(GPSDriverUBX::Interface::UART, &callbackEntry, this, &_reportGpsPos, _pReportSatInfo); + baudrate = 0; // auto-configure + } gpsDriver->setSurveyInSpecs(_surveyInAccMeters * 10000, _surveryInDurationSecs); if (gpsDriver->configure(baudrate, GPSDriverUBX::OutputMode::RTCM) == 0) { @@ -102,8 +108,9 @@ void GPSProvider::run() qCDebug(RTKGPSLog) << "Exiting GPS thread"; } -GPSProvider::GPSProvider(const QString& device, bool enableSatInfo, double surveyInAccMeters, int surveryInDurationSecs, const std::atomic_bool& requestStop) +GPSProvider::GPSProvider(const QString& device, GPSType type, bool enableSatInfo, double surveyInAccMeters, int surveryInDurationSecs, const std::atomic_bool& requestStop) : _device(device) + , _type(type) , _requestStop(requestStop) , _surveyInAccMeters(surveyInAccMeters) , _surveryInDurationSecs(surveryInDurationSecs) diff --git a/src/GPS/GPSProvider.h b/src/GPS/GPSProvider.h index c2b5c7e..006dd49 100644 --- a/src/GPS/GPSProvider.h +++ b/src/GPS/GPSProvider.h @@ -29,7 +29,14 @@ class GPSProvider : public QThread { Q_OBJECT public: - GPSProvider(const QString& device, bool enableSatInfo, double surveyInAccMeters, int surveryInDurationSecs, const std::atomic_bool& requestStop); + + enum class GPSType { + u_blox, + trimble + }; + + GPSProvider(const QString& device, GPSType type, bool enableSatInfo, double surveyInAccMeters, int surveryInDurationSecs, + const std::atomic_bool& requestStop); ~GPSProvider(); /** @@ -57,6 +64,7 @@ private: int callback(GPSCallbackType type, void *data1, int data2); QString _device; + GPSType _type; const std::atomic_bool& _requestStop; double _surveyInAccMeters; int _surveryInDurationSecs; diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index ada53b2..0030c27 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -586,7 +586,7 @@ void LinkManager::_updateAutoConnectLinks(void) if (_autoConnectSettings->autoConnectRTKGPS()->rawValue().toBool() && !_toolbox->gpsManager()->connected()) { qCDebug(LinkManagerLog) << "RTK GPS auto-connected" << portInfo.portName().trimmed(); _autoConnectRTKPort = portInfo.systemLocation(); - _toolbox->gpsManager()->connectGPS(portInfo.systemLocation()); + _toolbox->gpsManager()->connectGPS(portInfo.systemLocation(), boardName); } break; #endif diff --git a/src/comm/USBBoardInfo.json b/src/comm/USBBoardInfo.json index dd24ff6..f68a71f 100644 --- a/src/comm/USBBoardInfo.json +++ b/src/comm/USBBoardInfo.json @@ -27,7 +27,8 @@ { "vendorID": 1027, "productID": 24577, "boardClass": "SiK Radio", "name": "SiK Radio", "comment": "3DR Radio on FTDI" }, { "vendorID": 4292, "productID": 60000, "boardClass": "SiK Radio", "name": "SiK Radio", "comment": "SILabs Radio" }, - { "vendorID": 5446, "productID": 424, "boardClass": "RTK GPS", "name": "RTK GPS", "comment": "Ublox RTK GPS" }, + { "vendorID": 5446, "productID": 424, "boardClass": "RTK GPS", "name": "U-blox RTK GPS", "comment": "U-blox RTK GPS" }, + { "vendorID": 1317, "productID": 42151, "boardClass": "RTK GPS", "name": "Trimble RTK GPS", "comment": "Trimble RTK GPS" }, { "vendorID": 8352, "productID": 16732, "boardClass": "OpenPilot", "name": "OpenPilot OPLink" }, { "vendorID": 8352, "productID": 16733, "boardClass": "OpenPilot", "name": "OpenPilot CC3D" }, diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 2a3c6b6..a82c319 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -402,7 +402,7 @@ QGCView { anchors.horizontalCenter: parent.horizontalCenter columns: 2 - QGCLabel { text: qsTr("Survey in accuracy") } + QGCLabel { text: qsTr("Survey in accuracy (U-blox only)") } FactTextField { Layout.preferredWidth: _valueFieldWidth fact: QGroundControl.settingsManager.rtkSettings.surveyInAccuracyLimit diff --git a/src/ui/toolbar/GPSRTKIndicator.qml b/src/ui/toolbar/GPSRTKIndicator.qml index 7dfe170..767278b 100644 --- a/src/ui/toolbar/GPSRTKIndicator.qml +++ b/src/ui/toolbar/GPSRTKIndicator.qml @@ -69,9 +69,11 @@ Item { QGCLabel { // during survey-in show the current accuracy, after that show the final accuracy text: QGroundControl.gpsRtk.valid.value ? qsTr("Accuracy:") : qsTr("Current Accuracy:") + visible: QGroundControl.gpsRtk.currentAccuracy.value > 0 } QGCLabel { text: QGroundControl.gpsRtk.currentAccuracy.valueString + " " + QGroundControl.appSettingsDistanceUnitsString + visible: QGroundControl.gpsRtk.currentAccuracy.value > 0 } QGCLabel { text: qsTr("Satellites:") } QGCLabel { text: QGroundControl.gpsRtk.numSatellites.value } From 59ed0f5253db6f461dfc19bb22ac10018d9a891a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Fri, 13 Jul 2018 17:28:21 +0200 Subject: [PATCH 3/3] GPS: update GPS drivers submodule to fix CI --- src/GPS/Drivers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GPS/Drivers b/src/GPS/Drivers index ecc26a4..d7854b7 160000 --- a/src/GPS/Drivers +++ b/src/GPS/Drivers @@ -1 +1 @@ -Subproject commit ecc26a43033fc1b9a3dc6dae053d28438aa2f6a1 +Subproject commit d7854b7bcf1610bb42d89f4bae553744cbe4408c