diff --git a/CodingStyle.h b/CodingStyle.h index 2fe6dbb25..22300e5e2 100644 --- a/CodingStyle.h +++ b/CodingStyle.h @@ -21,7 +21,6 @@ #include #include "Fact.h" -#include "UASInterface.h" // Note how the Qt headers, System, headers and the QGroundControl headers above are kept in separate groups diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 6d18a8f7a..b668cba79 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -731,8 +731,6 @@ HEADERS += \ src/comm/TCPLink.h \ src/comm/UDPLink.h \ src/comm/UdpIODevice.h \ - src/uas/UAS.h \ - src/uas/UASInterface.h \ src/uas/UASMessageHandler.h \ src/AnalyzeView/GeoTagController.h \ src/AnalyzeView/ExifParser.h \ @@ -989,7 +987,6 @@ SOURCES += \ src/comm/UDPLink.cc \ src/comm/UdpIODevice.cc \ src/main.cc \ - src/uas/UAS.cc \ src/uas/UASMessageHandler.cc \ src/AnalyzeView/GeoTagController.cc \ src/AnalyzeView/ExifParser.cc \ diff --git a/src/AnalyzeView/LogDownloadController.cc b/src/AnalyzeView/LogDownloadController.cc index 6b74e40e6..db4b87a55 100644 --- a/src/AnalyzeView/LogDownloadController.cc +++ b/src/AnalyzeView/LogDownloadController.cc @@ -10,7 +10,6 @@ #include "LogDownloadController.h" #include "MultiVehicleManager.h" -#include "UAS.h" #include "QGCApplication.h" #include "QGCToolbox.h" #include "QGCMapEngine.h" @@ -103,8 +102,7 @@ QGCLogEntry::sizeStr() const //---------------------------------------------------------------------------------------- LogDownloadController::LogDownloadController(void) - : _uas(nullptr) - , _downloadData(nullptr) + : _downloadData(nullptr) , _vehicle(nullptr) , _requestingLogEntries(false) , _downloadingLogs(false) @@ -132,26 +130,24 @@ LogDownloadController::_processDownload() void LogDownloadController::_setActiveVehicle(Vehicle* vehicle) { - if(_uas) { + if(_vehicle) { _logEntriesModel.clearAndDeleteContents(); - disconnect(_uas, &UASInterface::logEntry, this, &LogDownloadController::_logEntry); - disconnect(_uas, &UASInterface::logData, this, &LogDownloadController::_logData); - _uas = nullptr; + disconnect(_vehicle, &Vehicle::logEntry, this, &LogDownloadController::_logEntry); + disconnect(_vehicle, &Vehicle::logData, this, &LogDownloadController::_logData); } _vehicle = vehicle; if(_vehicle) { - _uas = vehicle->uas(); - connect(_uas, &UASInterface::logEntry, this, &LogDownloadController::_logEntry); - connect(_uas, &UASInterface::logData, this, &LogDownloadController::_logData); + connect(_vehicle, &Vehicle::logEntry, this, &LogDownloadController::_logEntry); + connect(_vehicle, &Vehicle::logData, this, &LogDownloadController::_logData); } } //---------------------------------------------------------------------------------------- void -LogDownloadController::_logEntry(UASInterface* uas, uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t /*last_log_num*/) +LogDownloadController::_logEntry(uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t /*last_log_num*/) { //-- Do we care? - if(!_uas || uas != _uas || !_requestingLogEntries) { + if(!_requestingLogEntries) { return; } //-- If this is the first, pre-fill it @@ -312,9 +308,9 @@ void LogDownloadController::_updateDataRate(void) //---------------------------------------------------------------------------------------- void -LogDownloadController::_logData(UASInterface* uas, uint32_t ofs, uint16_t id, uint8_t count, const uint8_t* data) +LogDownloadController::_logData(uint32_t ofs, uint16_t id, uint8_t count, const uint8_t* data) { - if(!_uas || uas != _uas || !_downloadData) { + if(!_downloadData) { return; } //-- APM "Fix" @@ -499,7 +495,7 @@ LogDownloadController::refresh(void) void LogDownloadController::_requestLogList(uint32_t start, uint32_t end) { - if(_vehicle && _uas) { + if(_vehicle) { qCDebug(LogDownloadLog) << "Request log entry list (" << start << "through" << end << ")"; _setListing(true); WeakLinkInterfacePtr weakLink = _vehicle->vehicleLinkManager()->primaryLink(); @@ -675,7 +671,7 @@ LogDownloadController::_setListing(bool active) void LogDownloadController::eraseAll(void) { - if(_vehicle && _uas) { + if(_vehicle) { WeakLinkInterfacePtr weakLink = _vehicle->vehicleLinkManager()->primaryLink(); if (!weakLink.expired()) { SharedLinkInterfacePtr sharedLink = weakLink.lock(); @@ -697,9 +693,7 @@ LogDownloadController::eraseAll(void) void LogDownloadController::cancel(void) { - if(_uas){ - _receivedAllEntries(); - } + _receivedAllEntries(); if(_downloadData) { _downloadData->entry->setStatus(tr("Canceled")); if (_downloadData->file.exists()) { diff --git a/src/AnalyzeView/LogDownloadController.h b/src/AnalyzeView/LogDownloadController.h index dfcf161ba..f96e7b831 100644 --- a/src/AnalyzeView/LogDownloadController.h +++ b/src/AnalyzeView/LogDownloadController.h @@ -19,12 +19,10 @@ #include -#include "UASInterface.h" #include "AutoPilotPlugin.h" #include "QmlObjectListModel.h" class MultiVehicleManager; -class UASInterface; class Vehicle; struct LogDownloadData; @@ -107,8 +105,8 @@ signals: private slots: void _setActiveVehicle (Vehicle* vehicle); - void _logEntry (UASInterface *uas, uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t last_log_num); - void _logData (UASInterface *uas, uint32_t ofs, uint16_t id, uint8_t count, const uint8_t *data); + void _logEntry (uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t last_log_num); + void _logData (uint32_t ofs, uint16_t id, uint8_t count, const uint8_t *data); void _processDownload (); private: @@ -129,7 +127,6 @@ private: QGCLogEntry* _getNextSelected(); - UASInterface* _uas; LogDownloadData* _downloadData; QTimer _timer; QmlObjectListModel _logEntriesModel; diff --git a/src/AnalyzeView/MavlinkConsoleController.cc b/src/AnalyzeView/MavlinkConsoleController.cc index 061e9e0de..6a70e1b44 100644 --- a/src/AnalyzeView/MavlinkConsoleController.cc +++ b/src/AnalyzeView/MavlinkConsoleController.cc @@ -9,7 +9,6 @@ #include "MavlinkConsoleController.h" #include "QGCApplication.h" -#include "UAS.h" #include diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponentController.h b/src/AutoPilotPlugins/APM/APMAirframeComponentController.h index 102a75778..aa734924b 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponentController.h +++ b/src/AutoPilotPlugins/APM/APMAirframeComponentController.h @@ -14,7 +14,6 @@ #include #include -#include "UASInterface.h" #include "AutoPilotPlugin.h" #include "FactPanelController.h" diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc index 82d0bcf9c..f8414bbd6 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc @@ -9,7 +9,6 @@ #include "APMAutoPilotPlugin.h" -#include "UAS.h" #include "APMParameterMetaData.h" #include "APMFirmwarePlugin.h" #include "ArduCopterFirmwarePlugin.h" diff --git a/src/AutoPilotPlugins/APM/APMFlightModesComponentController.h b/src/AutoPilotPlugins/APM/APMFlightModesComponentController.h index 3546613a2..c214fcc45 100644 --- a/src/AutoPilotPlugins/APM/APMFlightModesComponentController.h +++ b/src/AutoPilotPlugins/APM/APMFlightModesComponentController.h @@ -16,7 +16,6 @@ #include #include -#include "UASInterface.h" #include "AutoPilotPlugin.h" #include "FactPanelController.h" #include "Vehicle.h" diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc index 944843a2c..908f13a25 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentController.cc @@ -10,7 +10,6 @@ #include "APMSensorsComponentController.h" #include "QGCMAVLink.h" -#include "UAS.h" #include "QGCApplication.h" #include "APMAutoPilotPlugin.h" #include "ParameterManager.h" diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentController.h b/src/AutoPilotPlugins/APM/APMSensorsComponentController.h index bca5fc487..460519414 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentController.h +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentController.h @@ -11,7 +11,6 @@ #include -#include "UASInterface.h" #include "FactPanelController.h" #include "QGCLoggingCategory.h" #include "APMSensorsComponent.h" diff --git a/src/AutoPilotPlugins/Common/ESP8266ComponentController.cc b/src/AutoPilotPlugins/Common/ESP8266ComponentController.cc index 1a725b5d6..fbb218bf1 100644 --- a/src/AutoPilotPlugins/Common/ESP8266ComponentController.cc +++ b/src/AutoPilotPlugins/Common/ESP8266ComponentController.cc @@ -14,7 +14,6 @@ #include "ESP8266ComponentController.h" #include "QGCApplication.h" -#include "UAS.h" #include "ParameterManager.h" #include diff --git a/src/AutoPilotPlugins/Common/ESP8266ComponentController.h b/src/AutoPilotPlugins/Common/ESP8266ComponentController.h index 7f41ca791..1aac747ef 100644 --- a/src/AutoPilotPlugins/Common/ESP8266ComponentController.h +++ b/src/AutoPilotPlugins/Common/ESP8266ComponentController.h @@ -19,7 +19,6 @@ #include #include "FactPanelController.h" -#include "UASInterface.h" #include "QGCLoggingCategory.h" #include "AutoPilotPlugin.h" diff --git a/src/AutoPilotPlugins/Common/RadioComponentController.cc b/src/AutoPilotPlugins/Common/RadioComponentController.cc index 67628a527..33ece21ee 100644 --- a/src/AutoPilotPlugins/Common/RadioComponentController.cc +++ b/src/AutoPilotPlugins/Common/RadioComponentController.cc @@ -650,7 +650,7 @@ void RadioComponentController::_setInternalCalibrationValuesFromParameters(void) void RadioComponentController::spektrumBindMode(int mode) { - _uas->pairRX(0, mode); + _vehicle->pairRX(0, mode); } /// @brief Validates the current settings against the calibration rules resetting values as necessary. @@ -702,7 +702,7 @@ void RadioComponentController::_validateCalibration(void) /// @brief Saves the rc calibration values to the board parameters. void RadioComponentController::_writeCalibration(void) { - if (!_uas) return; + if (!_vehicle) return; if (!_px4Vehicle() && (_vehicle->vehicleType() == MAV_TYPE_HELICOPTER || _vehicle->multiRotor()) && _rgChannelInfo[_rgFunctionChannelMapping[rcCalFunctionThrottle]].reversed) { // A reversed throttle could lead to dangerous power up issues if the firmware doesn't handle it absolutely correctly in all places. @@ -811,7 +811,7 @@ void RadioComponentController::_stopCalibration(void) { _currentStep = -1; - if (_uas) { + if (_vehicle) { // Only PX4 is known to support this command in all versions. For other firmware which may or may not // support this we don't show errors on failure. _vehicle->stopCalibration(_px4Vehicle() ? true : false /* showError */); diff --git a/src/AutoPilotPlugins/Common/RadioComponentController.h b/src/AutoPilotPlugins/Common/RadioComponentController.h index 4e49c803b..41647f6e2 100644 --- a/src/AutoPilotPlugins/Common/RadioComponentController.h +++ b/src/AutoPilotPlugins/Common/RadioComponentController.h @@ -19,7 +19,6 @@ #include #include "FactPanelController.h" -#include "UASInterface.h" #include "QGCLoggingCategory.h" #include "AutoPilotPlugin.h" diff --git a/src/AutoPilotPlugins/Common/SyslinkComponentController.cc b/src/AutoPilotPlugins/Common/SyslinkComponentController.cc index 731b64739..10a62500a 100644 --- a/src/AutoPilotPlugins/Common/SyslinkComponentController.cc +++ b/src/AutoPilotPlugins/Common/SyslinkComponentController.cc @@ -9,7 +9,6 @@ #include "SyslinkComponentController.h" #include "QGCApplication.h" -#include "UAS.h" #include "ParameterManager.h" #include diff --git a/src/AutoPilotPlugins/Common/SyslinkComponentController.h b/src/AutoPilotPlugins/Common/SyslinkComponentController.h index c8c909638..183788503 100644 --- a/src/AutoPilotPlugins/Common/SyslinkComponentController.h +++ b/src/AutoPilotPlugins/Common/SyslinkComponentController.h @@ -11,7 +11,6 @@ #define SyslinkComponentController_H #include "FactPanelController.h" -#include "UASInterface.h" #include "QGCLoggingCategory.h" #include "AutoPilotPlugin.h" diff --git a/src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h b/src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h index 5d24484c1..e24bfa07d 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h +++ b/src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h @@ -19,7 +19,6 @@ #include #include -#include "UASInterface.h" #include "AutoPilotPlugin.h" /// MVC Controller for AirframeComponent.qml. diff --git a/src/AutoPilotPlugins/PX4/AirframeComponentController.h b/src/AutoPilotPlugins/PX4/AirframeComponentController.h index 55f3c99ea..72163e2bd 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponentController.h +++ b/src/AutoPilotPlugins/PX4/AirframeComponentController.h @@ -18,7 +18,6 @@ #include #include -#include "UASInterface.h" #include "AutoPilotPlugin.h" #include "FactPanelController.h" diff --git a/src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc b/src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc index 3b1d186db..e1d6c0e04 100644 --- a/src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc +++ b/src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc @@ -25,10 +25,9 @@ QGC_LOGGING_CATEGORY(PX4AirframeLoaderLog, "PX4AirframeLoaderLog") bool PX4AirframeLoader::_airframeMetaDataLoaded = false; -PX4AirframeLoader::PX4AirframeLoader(AutoPilotPlugin* autopilot, UASInterface* uas, QObject* parent) +PX4AirframeLoader::PX4AirframeLoader(AutoPilotPlugin* autopilot, QObject* parent) { Q_UNUSED(autopilot); - Q_UNUSED(uas); Q_UNUSED(parent); } diff --git a/src/AutoPilotPlugins/PX4/PX4AirframeLoader.h b/src/AutoPilotPlugins/PX4/PX4AirframeLoader.h index 3114bd86e..0ffa8d90a 100644 --- a/src/AutoPilotPlugins/PX4/PX4AirframeLoader.h +++ b/src/AutoPilotPlugins/PX4/PX4AirframeLoader.h @@ -18,7 +18,6 @@ #include "ParameterManager.h" #include "FactSystem.h" -#include "UASInterface.h" #include "AutoPilotPlugin.h" /// @file PX4AirframeLoader.h @@ -34,7 +33,7 @@ class PX4AirframeLoader : QObject public: /// @param uas Uas which this set of facts is associated with - PX4AirframeLoader(AutoPilotPlugin* autpilot,UASInterface* uas, QObject* parent = nullptr); + PX4AirframeLoader(AutoPilotPlugin* autpilot, QObject* parent = nullptr); static void loadAirframeMetaData(void); diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index fd822b9d2..f928cbd8e 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -11,7 +11,6 @@ #include "PX4AutoPilotPlugin.h" #include "PX4AirframeLoader.h" #include "AirframeComponentController.h" -#include "UAS.h" #include "FirmwarePlugin/PX4/PX4ParameterMetaData.h" // FIXME: Hack #include "FirmwarePlugin/PX4/PX4FirmwarePlugin.h" // FIXME: Hack #include "QGCApplication.h" @@ -48,7 +47,7 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(Vehicle* vehicle, QObject* parent) return; } - _airframeFacts = new PX4AirframeLoader(this, _vehicle->uas(), this); + _airframeFacts = new PX4AirframeLoader(this, this); Q_CHECK_PTR(_airframeFacts); PX4AirframeLoader::loadAirframeMetaData(); diff --git a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.h b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.h index d77c9d779..2ca955737 100644 --- a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.h +++ b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.h @@ -16,7 +16,6 @@ #include #include -#include "UASInterface.h" #include "AutoPilotPlugin.h" #include "FactPanelController.h" #include "Vehicle.h" diff --git a/src/AutoPilotPlugins/PX4/PowerComponentController.cc b/src/AutoPilotPlugins/PX4/PowerComponentController.cc index 8258bcc15..fb3275da5 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponentController.cc +++ b/src/AutoPilotPlugins/PX4/PowerComponentController.cc @@ -9,7 +9,6 @@ #include "PowerComponentController.h" #include "QGCMAVLink.h" -#include "UAS.h" #include #include diff --git a/src/AutoPilotPlugins/PX4/PowerComponentController.h b/src/AutoPilotPlugins/PX4/PowerComponentController.h index 4c6b91876..9b81e0489 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponentController.h +++ b/src/AutoPilotPlugins/PX4/PowerComponentController.h @@ -17,7 +17,6 @@ #include #include -#include "UASInterface.h" #include "FactPanelController.h" /// Power Component MVC Controller for PowerComponent.qml. diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc index 2828e9ac5..785201951 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc +++ b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc @@ -9,7 +9,6 @@ #include "SensorsComponentController.h" #include "QGCMAVLink.h" -#include "UAS.h" #include "QGCApplication.h" #include "ParameterManager.h" diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentController.h b/src/AutoPilotPlugins/PX4/SensorsComponentController.h index f2fc9f2ad..222ede3af 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentController.h +++ b/src/AutoPilotPlugins/PX4/SensorsComponentController.h @@ -17,7 +17,6 @@ #include #include -#include "UASInterface.h" #include "FactPanelController.h" #include "QGCLoggingCategory.h" diff --git a/src/FactSystem/FactControls/FactPanelController.cc b/src/FactSystem/FactControls/FactPanelController.cc index e7243a40d..87e9d6b09 100644 --- a/src/FactSystem/FactControls/FactPanelController.cc +++ b/src/FactSystem/FactControls/FactPanelController.cc @@ -9,7 +9,6 @@ #include "FactPanelController.h" #include "MultiVehicleManager.h" -#include "UAS.h" #include "QGCApplication.h" #include "ParameterManager.h" @@ -24,7 +23,6 @@ FactPanelController::FactPanelController() { _vehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle(); if (_vehicle) { - _uas = _vehicle->uas(); _autopilot = _vehicle->autopilotPlugin(); } else { _vehicle = qgcApp()->toolbox()->multiVehicleManager()->offlineEditingVehicle(); diff --git a/src/FactSystem/FactControls/FactPanelController.h b/src/FactSystem/FactControls/FactPanelController.h index 85c8fb05d..a868e0d89 100644 --- a/src/FactSystem/FactControls/FactPanelController.h +++ b/src/FactSystem/FactControls/FactPanelController.h @@ -16,7 +16,6 @@ #include #include -#include "UASInterface.h" #include "AutoPilotPlugin.h" #include "QGCLoggingCategory.h" @@ -50,7 +49,6 @@ protected: void _reportMissingParameter(int componentId, const QString& name); Vehicle* _vehicle = nullptr; - UASInterface* _uas = nullptr; AutoPilotPlugin* _autopilot = nullptr; private slots: diff --git a/src/FactSystem/FactSystemTestBase.h b/src/FactSystem/FactSystemTestBase.h index 38863ea7f..0f24b2481 100644 --- a/src/FactSystem/FactSystemTestBase.h +++ b/src/FactSystem/FactSystemTestBase.h @@ -15,7 +15,6 @@ #define FactSystemTestBase_H #include "UnitTest.h" -#include "UASInterface.h" #include "AutoPilotPlugin.h" // Base class for FactSystemTest[PX4|Generic] unit tests diff --git a/src/FactSystem/FactSystemTestGeneric.h b/src/FactSystem/FactSystemTestGeneric.h index 7589de717..61b6bfacb 100644 --- a/src/FactSystem/FactSystemTestGeneric.h +++ b/src/FactSystem/FactSystemTestGeneric.h @@ -15,7 +15,6 @@ #define FactSystemTestGeneric_H #include "FactSystemTestBase.h" -#include "UASInterface.h" #include "AutoPilotPlugin.h" // Unit Test for Fact System on PX4 autopilot diff --git a/src/FactSystem/FactSystemTestPX4.h b/src/FactSystem/FactSystemTestPX4.h index 98e4e3e7d..e73d180ee 100644 --- a/src/FactSystem/FactSystemTestPX4.h +++ b/src/FactSystem/FactSystemTestPX4.h @@ -15,7 +15,6 @@ #define FactSystemTestPX4_H #include "FactSystemTestBase.h" -#include "UASInterface.h" #include "AutoPilotPlugin.h" // Unit Test for Fact System on PX4 autopilot diff --git a/src/FactSystem/ParameterManager.cc b/src/FactSystem/ParameterManager.cc index cc92af16d..3f4c044b2 100644 --- a/src/FactSystem/ParameterManager.cc +++ b/src/FactSystem/ParameterManager.cc @@ -13,7 +13,6 @@ #include "QGCApplication.h" #include "UASMessageHandler.h" #include "FirmwarePlugin.h" -#include "UAS.h" #include "JsonHelper.h" #include "ComponentInformationManager.h" #include "CompInfoParam.h" diff --git a/src/Joystick/Joystick.cc b/src/Joystick/Joystick.cc index 51dbd7e30..364d5a6ef 100644 --- a/src/Joystick/Joystick.cc +++ b/src/Joystick/Joystick.cc @@ -11,7 +11,6 @@ #include "Joystick.h" #include "QGC.h" #include "AutoPilotPlugin.h" -#include "UAS.h" #include "QGCApplication.h" #include "VideoManager.h" #include "QGCCameraManager.h" diff --git a/src/QmlControls/ParameterEditorController.h b/src/QmlControls/ParameterEditorController.h index e27ad8e6e..d629bc10d 100644 --- a/src/QmlControls/ParameterEditorController.h +++ b/src/QmlControls/ParameterEditorController.h @@ -13,7 +13,6 @@ #include #include "AutoPilotPlugin.h" -#include "UASInterface.h" #include "FactPanelController.h" #include "QmlObjectListModel.h" #include "ParameterManager.h" diff --git a/src/QmlControls/RCChannelMonitorController.h b/src/QmlControls/RCChannelMonitorController.h index 17281e0d7..0d2d1aff0 100644 --- a/src/QmlControls/RCChannelMonitorController.h +++ b/src/QmlControls/RCChannelMonitorController.h @@ -14,7 +14,6 @@ #include #include "FactPanelController.h" -#include "UASInterface.h" #include "QGCLoggingCategory.h" #include "AutoPilotPlugin.h" diff --git a/src/Vehicle/FTPManager.h b/src/Vehicle/FTPManager.h index 10e9095ab..6fbf1c061 100644 --- a/src/Vehicle/FTPManager.h +++ b/src/Vehicle/FTPManager.h @@ -14,7 +14,6 @@ #include #include -#include "UASInterface.h" #include "QGCLoggingCategory.h" #include "QGCMAVLink.h" diff --git a/src/Vehicle/MultiVehicleManager.cc b/src/Vehicle/MultiVehicleManager.cc index 1334d115a..fd596fdbe 100644 --- a/src/Vehicle/MultiVehicleManager.cc +++ b/src/Vehicle/MultiVehicleManager.cc @@ -10,7 +10,6 @@ #include "MultiVehicleManager.h" #include "AutoPilotPlugin.h" #include "MAVLinkProtocol.h" -#include "UAS.h" #include "QGCApplication.h" #include "FollowMe.h" #include "ParameterManager.h" @@ -205,8 +204,6 @@ void MultiVehicleManager::_deleteVehiclePhase1(Vehicle* vehicle) qWarning() << "Vehicle not found in map!"; } - vehicle->uas()->shutdownVehicle(); - // First we must signal that a vehicle is no longer available. _activeVehicleAvailable = false; _parameterReadyVehicleAvailable = false; diff --git a/src/Vehicle/MultiVehicleManager.h b/src/Vehicle/MultiVehicleManager.h index 30022888f..2527723a5 100644 --- a/src/Vehicle/MultiVehicleManager.h +++ b/src/Vehicle/MultiVehicleManager.h @@ -50,8 +50,6 @@ public: Q_INVOKABLE Vehicle* getVehicleById(int vehicleId); - UAS* activeUas(void) { return _activeVehicle ? _activeVehicle->uas() : nullptr; } - // Property accessors bool activeVehicleAvailable(void) const{ return _activeVehicleAvailable; } diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 52f6b8d0b..b66d99823 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -19,7 +19,6 @@ #include "FirmwarePluginManager.h" #include "LinkManager.h" #include "FirmwarePlugin.h" -#include "UAS.h" #include "JoystickManager.h" #include "MissionManager.h" #include "MissionController.h" @@ -201,9 +200,6 @@ Vehicle::Vehicle(LinkInterface* link, connect(_toolbox->multiVehicleManager(), &MultiVehicleManager::parameterReadyVehicleAvailableChanged, this, &Vehicle::_vehicleParamLoaded); - _uas = new UAS(_mavlink, this, _firmwarePluginManager); - _uas->setParent(this); - connect(this, &Vehicle::remoteControlRSSIChanged, this, &Vehicle::_remoteControlRSSIChanged); _commonInit(); @@ -242,8 +238,6 @@ Vehicle::Vehicle(LinkInterface* link, _chunkedStatusTextTimer.setInterval(1000); connect(&_chunkedStatusTextTimer, &QTimer::timeout, this, &Vehicle::_chunkedStatusTextTimeout); - _mav = uas(); - // Listen for system messages connect(_toolbox->uasMessageHandler(), &UASMessageHandler::textMessageCountChanged, this, &Vehicle::_handleTextMessage); connect(_toolbox->uasMessageHandler(), &UASMessageHandler::textMessageReceived, this, &Vehicle::_handletextMessageReceived); @@ -520,9 +514,6 @@ Vehicle::~Vehicle() delete _autopilotPlugin; _autopilotPlugin = nullptr; - delete _mav; - _mav = nullptr; - #ifdef CONFIG_UTM_ADAPTER delete _utmspVehicle; #endif @@ -822,13 +813,25 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes _handleRangefinder(message); break; #endif + case MAVLINK_MSG_ID_LOG_ENTRY: + { + mavlink_log_entry_t log; + mavlink_msg_log_entry_decode(&message, &log); + emit logEntry(log.time_utc, log.size, log.id, log.num_logs, log.last_log_num); + break; + } + case MAVLINK_MSG_ID_LOG_DATA: + { + mavlink_log_data_t log; + mavlink_msg_log_data_decode(&message, &log); + emit logData(log.ofs, log.id, log.count, log.data); + break; + } } // This must be emitted after the vehicle processes the message. This way the vehicle state is up to date when anyone else // does processing. emit mavlinkMessageReceived(message); - - _uas->receiveMessage(message); } #if !defined(NO_ARDUPILOT_DIALECT) @@ -4582,4 +4585,13 @@ void Vehicle::setEstimatorOrigin(const QGeoCoordinate& centerCoord) static_cast(qQNaN()) ); sendMessageOnLinkThreadSafe(sharedLink.get(), msg); -} \ No newline at end of file +} + +void Vehicle::pairRX(int rxType, int rxSubType) +{ + sendMavCommand(_defaultComponentId, + MAV_CMD_START_RX_PAIR, + true, + rxType, + rxSubType); +} diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index 7d353a21b..e824693c4 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -60,7 +60,6 @@ class Actuators; class EventHandler; class UAS; -class UASInterface; class FirmwarePlugin; class FirmwarePluginManager; class AutoPilotPlugin; @@ -538,9 +537,6 @@ public: /// guarantee that it makes it to the vehicle. void sendMessageMultiple(mavlink_message_t message); - /// Provides access to uas from vehicle. Temporary workaround until UAS is fully phased out. - UAS* uas() { return _uas; } - /// Provides access to uas from vehicle. Temporary workaround until AutoPilotPlugin is fully phased out. AutoPilotPlugin* autopilotPlugin() { return _autopilotPlugin; } @@ -578,6 +574,8 @@ public: void setGripperAction(GRIPPER_ACTIONS gripperAction); Q_INVOKABLE void sendGripperAction(GRIPPER_OPTIONS gripperOption); + void pairRX(int rxType, int rxSubType); + bool fixedWing() const; bool multiRotor() const; bool vtol() const; @@ -630,7 +628,6 @@ public: QString formattedMessages (); float latitude () { return static_cast(_coordinate.latitude()); } float longitude () { return static_cast(_coordinate.longitude()); } - bool mavPresent () { return _mav != nullptr; } int rcRSSI () const{ return _rcRSSI; } bool px4Firmware () const { return _firmwareType == MAV_AUTOPILOT_PX4; } bool apmFirmware () const { return _firmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA; } @@ -1061,6 +1058,9 @@ signals: void sensorsParametersResetAck (bool success); + void logEntry (uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t last_log_num); + void logData (uint32_t ofs, uint16_t id, uint8_t count, const uint8_t* data); + private slots: void _mavlinkMessageReceived (LinkInterface* link, mavlink_message_t message); void _sendMessageMultipleNext (); @@ -1183,7 +1183,6 @@ private: QGeoCoordinate _homePosition; QGeoCoordinate _armedPosition; - UASInterface* _mav = nullptr; int _currentMessageCount = 0; int _messageCount = 0; int _currentErrorCount = 0; diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 229dcc4ba..ff6ae7a5d 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -21,9 +21,6 @@ #include #include "MAVLinkProtocol.h" -#include "UASInterface.h" -#include "UASInterface.h" -#include "UAS.h" #include "LinkManager.h" #include "QGCMAVLink.h" #include "QGC.h" diff --git a/src/qgcunittest/FileManagerTest.cc b/src/qgcunittest/FileManagerTest.cc index 9fc3425d3..2f8fb5fde 100644 --- a/src/qgcunittest/FileManagerTest.cc +++ b/src/qgcunittest/FileManagerTest.cc @@ -13,7 +13,6 @@ #include "FileManagerTest.h" #include "MultiVehicleManager.h" -#include "UAS.h" #include "QGCApplication.h" FileManagerTest::FileManagerTest(void) @@ -34,9 +33,6 @@ void FileManagerTest::init(void) _fileServer = _mockLink->getFileServer(); QVERIFY(_fileServer != NULL); - _fileManager = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()->uas()->getFileManager(); - QVERIFY(_fileManager != NULL); - Q_ASSERT(_multiSpy == NULL); // Reset any internal state back to normal diff --git a/src/qgcunittest/MavlinkLogTest.cc b/src/qgcunittest/MavlinkLogTest.cc index f4c1f434f..587d7bac1 100644 --- a/src/qgcunittest/MavlinkLogTest.cc +++ b/src/qgcunittest/MavlinkLogTest.cc @@ -17,7 +17,6 @@ #include "MockLink.h" #include "QGCTemporaryFile.h" #include "QGCApplication.h" -#include "UAS.h" #include "MultiVehicleManager.h" const char* MavlinkLogTest::_tempLogFileTemplate = "FlightDataXXXXXX"; ///< Template for temporary log file diff --git a/src/uas/CMakeLists.txt b/src/uas/CMakeLists.txt index f6c217167..ee50a4dd5 100644 --- a/src/uas/CMakeLists.txt +++ b/src/uas/CMakeLists.txt @@ -1,8 +1,5 @@ add_library(uas - UAS.cc - UAS.h - UASInterface.h UASMessageHandler.cc UASMessageHandler.h ) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc deleted file mode 100644 index 1d7300dec..000000000 --- a/src/uas/UAS.cc +++ /dev/null @@ -1,398 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2020 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -// NO NEW CODE HERE -// UASInterface, UAS.h/cc are deprecated. All new functionality should go into Vehicle.h/cc -// - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include "UAS.h" -#include "LinkInterface.h" -#include "QGC.h" -#include "MAVLinkProtocol.h" -#include "QGCMAVLink.h" -#include "LinkManager.h" -#ifndef NO_SERIAL_LINK -#include "SerialLink.h" -#endif -#include "FirmwarePluginManager.h" -#include "QGCLoggingCategory.h" -#include "Vehicle.h" -#include "Joystick.h" -#include "QGCApplication.h" - -QGC_LOGGING_CATEGORY(UASLog, "UASLog") - -// THIS CLASS IS DEPRECATED. ALL NEW FUNCTIONALITY SHOULD GO INTO Vehicle class -UAS::UAS(MAVLinkProtocol* protocol, Vehicle* vehicle, FirmwarePluginManager * firmwarePluginManager) : UASInterface(), - lipoFull(4.2f), - lipoEmpty(3.5f), - uasId(vehicle->id()), - unknownPackets(), - mavlink(protocol), - receiveDropRate(0), - sendDropRate(0), - - status(-1), - - startTime(QGC::groundTimeMilliseconds()), - onboardTimeOffset(0), - - controlRollManual(true), - controlPitchManual(true), - controlYawManual(true), - controlThrustManual(true), - - attitudeKnown(false), - attitudeStamped(false), - lastAttitude(0), - - blockHomePositionChanges(false), - - // Note variances calculated from flight case from this log: http://dash.oznet.ch/view/MRjW8NUNYQSuSZkbn8dEjY - // TODO: calibrate stand-still pixhawk variances - xacc_var(0.6457f), - yacc_var(0.7048f), - zacc_var(0.97885f), - rollspeed_var(0.8126f), - pitchspeed_var(0.6145f), - yawspeed_var(0.5852f), - xmag_var(0.2393f), - ymag_var(0.2283f), - zmag_var(0.1665f), - abs_pressure_var(0.5802f), - diff_pressure_var(0.5802f), - pressure_alt_var(0.5802f), - temperature_var(0.7145f), - /* - xacc_var(0.0f), - yacc_var(0.0f), - zacc_var(0.0f), - rollspeed_var(0.0f), - pitchspeed_var(0.0f), - yawspeed_var(0.0f), - xmag_var(0.0f), - ymag_var(0.0f), - zmag_var(0.0f), - abs_pressure_var(0.0f), - diff_pressure_var(0.0f), - pressure_alt_var(0.0f), - temperature_var(0.0f), - */ - - // The protected members. - connectionLost(false), - lastVoltageWarning(0), - lastNonNullTime(0), - onboardTimeOffsetInvalidCount(0), - _vehicle(vehicle), - _firmwarePluginManager(firmwarePluginManager) -{ - -} - -/** -* @ return the id of the uas -*/ -int UAS::getUASID() const -{ - return uasId; -} - -// Ignore warnings from mavlink headers for both GCC/Clang and MSVC -#ifdef __GNUC__ - -#if __GNUC__ > 8 -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Waddress-of-packed-member" -#elif defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Waddress-of-packed-member" -#else -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wall" -#endif - -#else -#pragma warning(push, 0) -#endif - -void UAS::receiveMessage(mavlink_message_t message) -{ - // Only accept messages from this system (condition 1) - // and only then if a) attitudeStamped is disabled OR b) attitudeStamped is enabled - // and we already got one attitude packet - if (message.sysid == uasId && (!attitudeStamped || lastAttitude != 0 || message.msgid == MAVLINK_MSG_ID_ATTITUDE)) - { - switch (message.msgid) - { - - case MAVLINK_MSG_ID_LOG_ENTRY: - { - mavlink_log_entry_t log; - mavlink_msg_log_entry_decode(&message, &log); - emit logEntry(this, log.time_utc, log.size, log.id, log.num_logs, log.last_log_num); - } - break; - - case MAVLINK_MSG_ID_LOG_DATA: - { - mavlink_log_data_t log; - mavlink_msg_log_data_decode(&message, &log); - emit logData(this, log.ofs, log.id, log.count, log.data); - } - break; - - default: - break; - } - } -} - -// Pop warnings ignoring for mavlink headers for both GCC/Clang and MSVC -#ifdef __GNUC__ - #if defined(__clang__) - #pragma clang diagnostic pop - #else - #pragma GCC diagnostic pop - #endif -#else -#pragma warning(pop, 0) -#endif - -/** -* Check if time is smaller than 40 years, assuming no system without Unix -* timestamp runs longer than 40 years continuously without reboot. In worst case -* this will add/subtract the communication delay between GCS and MAV, it will -* never alter the timestamp in a safety critical way. -*/ -quint64 UAS::getUnixReferenceTime(quint64 time) -{ - // Same as getUnixTime, but does not react to attitudeStamped mode - if (time == 0) - { - // qDebug() << "XNEW time:" < has to be - // a Unix epoch timestamp. Do nothing. - return time/1000; - } -} - -/** -* @warning If attitudeStamped is enabled, this function will not actually return -* the precise time stamp of this measurement augmented to UNIX time, but will -* MOVE the timestamp IN TIME to match the last measured attitude. There is no -* reason why one would want this, except for system setups where the onboard -* clock is not present or broken and datasets should be collected that are still -* roughly synchronized. PLEASE NOTE THAT ENABLING ATTITUDE STAMPED RUINS THE -* SCIENTIFIC NATURE OF THE CORRECT LOGGING FUNCTIONS OF QGROUNDCONTROL! -*/ -quint64 UAS::getUnixTimeFromMs(quint64 time) -{ - return getUnixTime(time*1000); -} - -/** -* @warning If attitudeStamped is enabled, this function will not actually return -* the precise time stam of this measurement augmented to UNIX time, but will -* MOVE the timestamp IN TIME to match the last measured attitude. There is no -* reason why one would want this, except for system setups where the onboard -* clock is not present or broken and datasets should be collected that are -* still roughly synchronized. PLEASE NOTE THAT ENABLING ATTITUDE STAMPED -* RUINS THE SCIENTIFIC NATURE OF THE CORRECT LOGGING FUNCTIONS OF QGROUNDCONTROL! -*/ -quint64 UAS::getUnixTime(quint64 time) -{ - quint64 ret = 0; - if (attitudeStamped) - { - ret = lastAttitude; - } - - if (time == 0) - { - ret = QGC::groundTimeMilliseconds(); - } - // Check if time is smaller than 40 years, - // assuming no system without Unix timestamp - // runs longer than 40 years continuously without - // reboot. In worst case this will add/subtract the - // communication delay between GCS and MAV, - // it will never alter the timestamp in a safety - // critical way. - // - // Calculation: - // 40 years - // 365 days - // 24 hours - // 60 minutes - // 60 seconds - // 1000 milliseconds - // 1000 microseconds -#ifndef _MSC_VER - else if (time < 1261440000000000LLU) -#else - else if (time < 1261440000000000) -#endif - { - // qDebug() << "GEN time:" << time/1000 + onboardTimeOffset; - if (onboardTimeOffset == 0 || time < (lastNonNullTime - 100)) - { - lastNonNullTime = time; - onboardTimeOffset = QGC::groundTimeMilliseconds() - time/1000; - } - if (time > lastNonNullTime) lastNonNullTime = time; - - ret = time/1000 + onboardTimeOffset; - } - else - { - // Time is not zero and larger than 40 years -> has to be - // a Unix epoch timestamp. Do nothing. - ret = time/1000; - } - - return ret; -} - -/** -* Get the status of the code and a description of the status. -* Status can be unitialized, booting up, calibrating sensors, active -* standby, cirtical, emergency, shutdown or unknown. -*/ -void UAS::getStatusForCode(int statusCode, QString& uasState, QString& stateDescription) -{ - switch (statusCode) - { - case MAV_STATE_UNINIT: - uasState = tr("UNINIT"); - stateDescription = tr("Unitialized, booting up."); - break; - case MAV_STATE_BOOT: - uasState = tr("BOOT"); - stateDescription = tr("Booting system, please wait."); - break; - case MAV_STATE_CALIBRATING: - uasState = tr("CALIBRATING"); - stateDescription = tr("Calibrating sensors, please wait."); - break; - case MAV_STATE_ACTIVE: - uasState = tr("ACTIVE"); - stateDescription = tr("Active, normal operation."); - break; - case MAV_STATE_STANDBY: - uasState = tr("STANDBY"); - stateDescription = tr("Standby mode, ready for launch."); - break; - case MAV_STATE_CRITICAL: - uasState = tr("CRITICAL"); - stateDescription = tr("FAILURE: Continuing operation."); - break; - case MAV_STATE_EMERGENCY: - uasState = tr("EMERGENCY"); - stateDescription = tr("EMERGENCY: Land Immediately!"); - break; - //case MAV_STATE_HILSIM: - //uasState = tr("HIL SIM"); - //stateDescription = tr("HIL Simulation, Sensors read from SIM"); - //break; - - case MAV_STATE_POWEROFF: - uasState = tr("SHUTDOWN"); - stateDescription = tr("Powering off system."); - break; - - default: - uasState = tr("UNKNOWN"); - stateDescription = tr("Unknown system state"); - break; - } -} - -/* MANAGEMENT */ - -/** - * - * @return The uptime in milliseconds - * - */ -quint64 UAS::getUptime() const -{ - if(startTime == 0) - { - return 0; - } - else - { - return QGC::groundTimeMilliseconds() - startTime; - } -} - -/** -* Order the robot to start receiver pairing -*/ -void UAS::pairRX(int rxType, int rxSubType) -{ - if (_vehicle) { - _vehicle->sendMavCommand(_vehicle->defaultComponentId(), // target component - MAV_CMD_START_RX_PAIR, // command id - true, // showError - rxType, - rxSubType); - } -} - -void UAS::shutdownVehicle(void) -{ - _vehicle = nullptr; -} diff --git a/src/uas/UAS.h b/src/uas/UAS.h deleted file mode 100644 index 679b39a4e..000000000 --- a/src/uas/UAS.h +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2020 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -// NO NEW CODE HERE -// UASInterface, UAS.h/cc are deprecated. All new functionality should go into Vehicle.h/cc -// - -#pragma once - -#include "UASInterface.h" -#include -#include -#include "QGCMAVLink.h" -#include "Vehicle.h" -#include "FirmwarePluginManager.h" - -Q_DECLARE_LOGGING_CATEGORY(UASLog) - -class Vehicle; - -/** - * @brief A generic MAVLINK-connected MAV/UAV - * - * This class represents one vehicle. It can be used like the real vehicle, e.g. a call to halt() - * will automatically send the appropriate messages to the vehicle. The vehicle state will also be - * automatically updated by the comm architecture, so when writing code to e.g. control the vehicle - * no knowledge of the communication infrastructure is needed. - */ -class UAS : public UASInterface -{ - Q_OBJECT -public: - UAS(MAVLinkProtocol* protocol, Vehicle* vehicle, FirmwarePluginManager * firmwarePluginManager); - - float lipoFull; ///< 100% charged voltage - float lipoEmpty; ///< Discharged voltage - - /* MANAGEMENT */ - - /** @brief Get the unique system id */ - int getUASID() const; - - /** @brief The time interval the robot is switched on */ - quint64 getUptime() const; - - /// Vehicle is about to go away - void shutdownVehicle(void); - - // Setters for HIL noise variance - void setXaccVar(float var){ - xacc_var = var; - } - - void setYaccVar(float var){ - yacc_var = var; - } - - void setZaccVar(float var){ - zacc_var = var; - } - - void setRollSpeedVar(float var){ - rollspeed_var = var; - } - - void setPitchSpeedVar(float var){ - pitchspeed_var = var; - } - - void setYawSpeedVar(float var){ - pitchspeed_var = var; - } - - void setXmagVar(float var){ - xmag_var = var; - } - - void setYmagVar(float var){ - ymag_var = var; - } - - void setZmagVar(float var){ - zmag_var = var; - } - - void setAbsPressureVar(float var){ - abs_pressure_var = var; - } - - void setDiffPressureVar(float var){ - diff_pressure_var = var; - } - - void setPressureAltVar(float var){ - pressure_alt_var = var; - } - - void setTemperatureVar(float var){ - temperature_var = var; - } - -protected: - /// LINK ID AND STATUS - int uasId; ///< Unique system ID - - QList unknownPackets; ///< Packet IDs which are unknown and have been received - MAVLinkProtocol* mavlink; ///< Reference to the MAVLink instance - float receiveDropRate; ///< Percentage of packets that were dropped on the MAV's receiving link (from GCS and other MAVs) - float sendDropRate; ///< Percentage of packets that were not received from the MAV by the GCS - - /// BASIC UAS TYPE, NAME AND STATE - int status; ///< The current status of the MAV - - /// TIMEKEEPING - quint64 startTime; ///< The time the UAS was switched on - quint64 onboardTimeOffset; - - /// MANUAL CONTROL - bool controlRollManual; ///< status flag, true if roll is controlled manually - bool controlPitchManual; ///< status flag, true if pitch is controlled manually - bool controlYawManual; ///< status flag, true if yaw is controlled manually - bool controlThrustManual; ///< status flag, true if thrust is controlled manually - - /// POSITION - bool isGlobalPositionKnown; ///< If the global position has been received for this MAV - - /// ATTITUDE - bool attitudeKnown; ///< True if attitude was received, false else - bool attitudeStamped; ///< Should arriving data be timestamped with the last attitude? This helps with broken system time clocks on the MAV - quint64 lastAttitude; ///< Timestamp of last attitude measurement - - bool blockHomePositionChanges; ///< Block changes to the home position - - /// SIMULATION NOISE - float xacc_var; ///< variance of x acclerometer noise for HIL sim (mg) - float yacc_var; ///< variance of y acclerometer noise for HIL sim (mg) - float zacc_var; ///< variance of z acclerometer noise for HIL sim (mg) - float rollspeed_var; ///< variance of x gyroscope noise for HIL sim (rad/s) - float pitchspeed_var; ///< variance of y gyroscope noise for HIL sim (rad/s) - float yawspeed_var; ///< variance of z gyroscope noise for HIL sim (rad/s) - float xmag_var; ///< variance of x magnatometer noise for HIL sim (???) - float ymag_var; ///< variance of y magnatometer noise for HIL sim (???) - float zmag_var; ///< variance of z magnatometer noise for HIL sim (???) - float abs_pressure_var; ///< variance of absolute pressure noise for HIL sim (hPa) - float diff_pressure_var; ///< variance of differential pressure noise for HIL sim (hPa) - float pressure_alt_var; ///< variance of altitude pressure noise for HIL sim (hPa) - float temperature_var; ///< variance of temperature noise for HIL sim (C) - -public: - /** @brief Get the human-readable status message for this code */ - void getStatusForCode(int statusCode, QString& uasState, QString& stateDescription); - -public slots: - /** @brief Order the robot to pair its receiver **/ - void pairRX(int rxType, int rxSubType); - - /** @brief Receive a message from one of the communication links. */ - virtual void receiveMessage(mavlink_message_t message); - -signals: - void rollChanged(double val,QString name); - void pitchChanged(double val,QString name); - void yawChanged(double val,QString name); - -protected: - /** @brief Get the UNIX timestamp in milliseconds, enter microseconds */ - quint64 getUnixTime(quint64 time=0); - /** @brief Get the UNIX timestamp in milliseconds, enter milliseconds */ - quint64 getUnixTimeFromMs(quint64 time); - /** @brief Get the UNIX timestamp in milliseconds, ignore attitudeStamped mode */ - quint64 getUnixReferenceTime(quint64 time); - - bool connectionLost; ///< Flag indicates a timed out connection - quint64 connectionLossTime; ///< Time the connection was interrupted - quint64 lastVoltageWarning; ///< Time at which the last voltage warning occurred - quint64 lastNonNullTime; ///< The last timestamp from the MAV that was not null - unsigned int onboardTimeOffsetInvalidCount; ///< Count when the offboard time offset estimation seemed wrong - -private: - Vehicle* _vehicle; - FirmwarePluginManager* _firmwarePluginManager; -}; - - diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h deleted file mode 100644 index 0bfbc4564..000000000 --- a/src/uas/UASInterface.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2020 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -// NO NEW CODE HERE -// UASInterface, UAS.h/cc are deprecated. All new functionality should go into Vehicle.h/cc -// - -#pragma once - -#include -#include -#include -#include -#include - -#include "LinkInterface.h" - -/** - * @brief Interface for all robots. - * - * This interface is abstract and thus cannot be instantiated. It serves only as type definition. - * It represents an unmanned aerial vehicle, e.g. a micro air vehicle. - **/ -class UASInterface : public QObject -{ - Q_OBJECT -public: - virtual ~UASInterface() {} - - /* MANAGEMENT */ - - virtual int getUASID() const = 0; ///< Get the ID of the connected UAS - /** @brief The time interval the robot is switched on **/ - virtual quint64 getUptime() const = 0; - -public slots: - /** @brief Order the robot to pair its receiver **/ - virtual void pairRX(int rxType, int rxSubType) = 0; - -signals: - /** @brief The robot is connected **/ - void connected(); - /** @brief The robot is disconnected **/ - void disconnected(); - - /** - * @brief The battery status has been updated - * - * @param uas sending system - * @param voltage battery voltage - * @param percent remaining capacity in percent - * @param seconds estimated remaining flight time in seconds - */ - void batteryChanged(UASInterface* uas, double voltage, double current, double percent, int seconds); - void statusChanged(UASInterface* uas, QString status); - - void imageStarted(int imgid, int width, int height, int depth, int channels); - void imageDataReceived(int imgid, const unsigned char* imageData, int length, int startIndex); - - /** @brief Optical flow status changed */ - void opticalFlowStatusChanged(bool supported, bool enabled, bool ok); - /** @brief Vision based localization status changed */ - void visionLocalizationStatusChanged(bool supported, bool enabled, bool ok); - /** @brief Infrared / Ultrasound status changed */ - void distanceSensorStatusChanged(bool supported, bool enabled, bool ok); - /** @brief Gyroscope status changed */ - void gyroStatusChanged(bool supported, bool enabled, bool ok); - /** @brief Accelerometer status changed */ - void accelStatusChanged(bool supported, bool enabled, bool ok); - /** @brief Magnetometer status changed */ - void magSensorStatusChanged(bool supported, bool enabled, bool ok); - /** @brief Barometer status changed */ - void baroStatusChanged(bool supported, bool enabled, bool ok); - /** @brief Differential pressure / airspeed status changed */ - void airspeedStatusChanged(bool supported, bool enabled, bool ok); - - // ERROR AND STATUS SIGNALS - /** @brief Name of system changed */ - void nameChanged(QString newName); - /** @brief Core specifications have changed */ - void systemSpecsChanged(int uasId); - - // Log Download Signals - void logEntry (UASInterface* uas, uint32_t time_utc, uint32_t size, uint16_t id, uint16_t num_logs, uint16_t last_log_num); - void logData (UASInterface* uas, uint32_t ofs, uint16_t id, uint8_t count, const uint8_t* data); - -}; - -Q_DECLARE_INTERFACE(UASInterface, "org.qgroundcontrol/1.0") - diff --git a/src/uas/UASMessageHandler.h b/src/uas/UASMessageHandler.h index 6cb329d4b..036802241 100644 --- a/src/uas/UASMessageHandler.h +++ b/src/uas/UASMessageHandler.h @@ -16,7 +16,6 @@ #include "QGCToolbox.h" class Vehicle; -class UASInterface; class UASMessageHandler; class QGCApplication;