Skip to content

Commit

Permalink
Merge pull request #15 from rpashchapur/utm-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
rpashchapur authored Jun 24, 2024
2 parents 2439911 + addab2f commit 346b338
Show file tree
Hide file tree
Showing 60 changed files with 908 additions and 708 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ set(QGC_RESOURCES
${CMAKE_SOURCE_DIR}/src/FirmwarePlugin/PX4/PX4Resources.qrc
)

if(CONFIG_UTM_ADAPTER)
if(QGC_UTM_ADAPTER)
add_definitions(-DQGC_UTM_ADAPTER)
list(APPEND QGC_RESOURCES ${CMAKE_SOURCE_DIR}/src/UTMSP/utmsp.qrc)
else()
list(APPEND QGC_RESOURCES ${CMAKE_SOURCE_DIR}/src/UTMSP/dummy/utmsp_dummy.qrc)
Expand Down
6 changes: 4 additions & 2 deletions QGCExternalLibs.pri
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ contains (DEFINES, DISABLE_ZEROCONF) {
}

# UTM Adapter Enabled
contains (DEFINES, CONFIG_UTM_ADAPTER){
contains (DEFINES, QGC_CONFIG_UTM_ADAPTER){
message("Updating git submodule for libevents...")
system(cd $$PWD/libs/libevents/libevents/libs/cpp/parse/nlohmann_json && git submodule update --init --recursive )

INCLUDEPATH += $$PWD/libs/libevents/libevents/libs/cpp/parse/nlohmann_json/include
LIBS += -lboost_system -lboost_thread -lssl -lcrypto
}

HEADERS += \
Expand Down
2 changes: 1 addition & 1 deletion qgroundcontrol.pro
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ LinuxBuild {
}

# UTM Adapter Enabled
contains (DEFINES, CONFIG_UTM_ADAPTER) {
contains (DEFINES, QGC_UTM_ADAPTER) {
message("UTM enabled")

#-- To test with UTM Adapter Enabled Flag
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ qt_add_library(QGC STATIC
QGCToolbox.h
)

if(QGC_UTM_ADAPTER)
add_definitions(-DQGC_UTM_ADAPTER)
endif()

add_subdirectory(ADSB)
add_subdirectory(AirLink)
add_subdirectory(AnalyzeView)
Expand Down
5 changes: 5 additions & 0 deletions src/FlightDisplay/GuidedActionConfirm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import QGroundControl
import QGroundControl.ScreenTools
import QGroundControl.Controls
import QGroundControl.Palette
import QGroundControl.UTMSP

Rectangle {
id: _root
Expand Down Expand Up @@ -133,6 +134,10 @@ Rectangle {
mapIndicator.actionConfirmed()
mapIndicator = undefined
}

UTMSPStateStorage.indicatorOnMissionStatus = true
UTMSPStateStorage.currentNotificationIndex = 7
UTMSPStateStorage.currentStateIndex = 3
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/MissionManager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
find_package(Qt6 REQUIRED COMPONENTS Core Gui Positioning Qml Xml)
if(QGC_UTM_ADAPTER)
add_definitions(-DQGC_UTM_ADAPTER)
endif()

qt_add_library(MissionManager STATIC
BlankPlanCreator.cc
Expand Down
8 changes: 1 addition & 7 deletions src/MissionManager/GeoFenceController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ bool GeoFenceController::isEmpty(void) const

}

#ifdef CONFIG_UTM_ADAPTER
#ifdef QGC_UTM_ADAPTER
void GeoFenceController::loadFlightPlanData()
{
QJsonArray jsonPolygonArray;
Expand Down Expand Up @@ -635,10 +635,4 @@ void GeoFenceController::loadFlightPlanData()

emit polygonBoundarySent(geoCoordinates);
}
bool GeoFenceController::loadUploadFlag()
{
emit uploadFlagSent(true);

return true;
}
#endif
5 changes: 2 additions & 3 deletions src/MissionManager/GeoFenceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ class GeoFenceController : public PlanElementController
/// Clears the interactive bit from all fence items
Q_INVOKABLE void clearAllInteractive(void);

#ifdef CONFIG_UTM_ADAPTER
#ifdef QGC_UTM_ADAPTER
Q_INVOKABLE void loadFlightPlanData(void);
Q_INVOKABLE bool loadUploadFlag(void);
#endif

double paramCircularFence (void);
Expand Down Expand Up @@ -98,7 +97,7 @@ class GeoFenceController : public PlanElementController
void loadComplete (void);
void paramCircularFenceChanged (void);

#ifdef CONFIG_UTM_ADAPTER
#ifdef QGC_UTM_ADAPTER
void uploadFlagSent (bool flag);
void polygonBoundarySent (QList<QGeoCoordinate> coords);
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/PlanView/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ find_package(Qt6 REQUIRED COMPONENTS Core Qml)

qt_add_library(PlanView STATIC)

if(QGC_UTM_ADAPTER)
add_definitions(-DQGC_UTM_ADAPTER)
endif()

file(GLOB QML_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.qml)
qt_add_qml_module(PlanView
URI QGroundControl.PlanView
Expand Down
2 changes: 1 addition & 1 deletion src/PlanView/MissionItemMapVisual.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Item {
if (component.status === Component.Error) {
console.log("Error loading Qml: ", object.mapVisualQML, component.errorString())
}
_visualItem = component.createObject(map, { "map": _root.map, vehicle: _root.vehicle, 'opacity': Qt.binding(function() { return _root.opacity }), 'interactive': Qt.binding(function() { return _root.interactive }) })
_visualItem = component.createObject(map, { "map": _root.map, vehicle: _root.vehicle, 'opacity': 0, 'interactive': Qt.binding(function() { return _root.interactive }) })
_visualItem.clicked.connect(_root.clicked)
}
}
Expand Down
16 changes: 2 additions & 14 deletions src/PlanView/PlanToolBarIndicators.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,7 @@ Item {
readonly property real _margins: ScreenTools.defaultFontPixelWidth

// Properties of UTM adapter
property var _utmspController: _planMasterController.geoFenceController
property bool _utmspEnabled: QGroundControl.utmspSupported
property bool responseFlag
// Dummy object when utm adapter flag is not enabled
QtObject {
id: dummyTarget
signal uploadFlagSent(bool flag)
}
Connections {
target: _utmspEnabled ? _utmspController: dummyTarget
onUploadFlagSent: function(flag) {
responseFlag = flag
}
}

function getMissionTime() {
if (!_missionTime) {
Expand Down Expand Up @@ -227,13 +214,14 @@ Item {
QGCButton {
id: uploadButton
text: _controllerDirty ? qsTr("Upload Required") : qsTr("Upload")
enabled: _utmspEnabled ? !_controllerSyncInProgress && responseFlag : !_controllerSyncInProgress
enabled: _utmspEnabled ? !_controllerSyncInProgress && UTMSPStateStorage.enableMissionUploadButton : !_controllerSyncInProgress
visible: !_controllerOffline && !_controllerSyncInProgress
primary: _controllerDirty
onClicked: {
if (_utmspEnabled) {
QGroundControl.utmspManager.utmspVehicle.triggerActivationStatusBar(true);
UTMSPStateStorage.removeFlightPlanState = true
UTMSPStateStorage.indicatorDisplayStatus = true
}
_planMasterController.upload();
}
Expand Down
159 changes: 13 additions & 146 deletions src/PlanView/PlanView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Item {
readonly property int _layerUTMSP: 4 // Additional Tab button when UTMSP is enabled
readonly property string _armedVehicleUploadPrompt: qsTr("Vehicle is currently armed. Do you want to upload the mission to the vehicle?")

signal activationParamsSent(string startTime, bool activate, string flightID)

function mapCenter() {
var coordinate = editorMap.center
Expand Down Expand Up @@ -826,26 +825,6 @@ Item {
}
}

Connections {
target: utmspEditor
function onResponseSent(response, responseFlag) {
if(responseFlag===true){
successPopup.opacity = 1
successPopup.visible = true
success_notify.text = "Flight Plan for Vehicle:" + _vehicleID +" is successfully Registered..."
var disappearTimer1 = Qt.createQmlObject("import QtQuick 2.0; Timer { interval: 3000; onTriggered: {successPopup.visible = false; successPopup.opacity = 0;} }", parent, "disappearTimer");
disappearTimer1.start()
}
else{
failPopup.opacity = 1
failPopup.visible = true
fail_notify.text = "Error in Flightblender Response..." //TODO->Will pass the response message
var disappearTimer4 = Qt.createQmlObject("import QtQuick 2.0; Timer { interval: 3000; onTriggered: {failPopup.visible = false; failPopup.opacity = 0;} }", parent, "disappearTimer");
disappearTimer4.start()
}
}
}

QGCLabel {
// Elevation provider notice on top of terrain plot
readonly property string _licenseString: QGroundControl.elevationProviderNotice
Expand Down Expand Up @@ -919,7 +898,19 @@ Item {
mainWindow.showMessageDialog(qsTr("Clear"),
qsTr("Are you sure you want to remove all mission items and clear the mission from the vehicle?"),
Dialog.Yes | Dialog.Cancel,
function() { _planMasterController.removeAllFromVehicle(); _missionController.setCurrentPlanViewSeqNum(0, true); if(_utmspEnabled){_resetRegisterFlightPlan = true; QGroundControl.utmspManager.utmspVehicle.triggerActivationStatusBar(false);}})
function() { _planMasterController.removeAllFromVehicle();
_missionController.setCurrentPlanViewSeqNum(0, true);
if(_utmspEnabled)
{_resetRegisterFlightPlan = true;
QGroundControl.utmspManager.utmspVehicle.triggerActivationStatusBar(false);
UTMSPStateStorage.startTimeStamp = "";
UTMSPStateStorage.showActivationTab = false;
UTMSPStateStorage.flightID = "";
UTMSPStateStorage.enableMissionUploadButton = false;
UTMSPStateStorage.indicatorPendingStatus = true;
UTMSPStateStorage.indicatorApprovedStatus = false;
UTMSPStateStorage.indicatorActivatedStatus = false;
UTMSPStateStorage.currentStateIndex = 0}})
}

//- ToolStrip DropPanel Components
Expand Down Expand Up @@ -1172,130 +1163,6 @@ Item {
}
}

Rectangle {
id: successPopup
x: Math.round((mainWindow.width - width) * 0.5)
y: ScreenTools.defaultFontPixelHeight
width: mainWindow.width * 0.55
height: ScreenTools.defaultFontPixelHeight * 2.944
color: _utmspEnabled? qgcPal.successNotifyUTMSP: qgcPal.buttonText
radius: ScreenTools.defaultFontPixelHeight * 0.5
border.color: qgcPal.alertBorder
border.width: 1
opacity: 0
visible: false
Text{
id: success_notify
width: successPopup.width - (ScreenTools.defaultFontPixelHeight * 2)
x: ScreenTools.defaultFontPixelWidth * 2
y: ScreenTools.defaultFontPixelHeight * 0.667
textFormat: TextEdit.RichText
font.pointSize: ScreenTools.defaultFontPointSize
font.family: ScreenTools.demiboldFontFamily
wrapMode: TextEdit.WordWrap
color: qgcPal.alertText
}
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: -(height / 2)
color: _utmspEnabled? qgcPal.successNotifyUTMSP: qgcPal.buttonText
radius: ScreenTools.defaultFontPixelHeight * 0.25
border.color: qgcPal.alertBorder
border.width: 1
width: statusLabel.contentWidth + _margins
height: statusLabel.contentHeight + _margins

property real _margins: ScreenTools.defaultFontPixelHeight * 0.25

QGCLabel {
id: statusLabel
anchors.centerIn: parent
text: qsTr("Status")
font.pointSize: ScreenTools.smallFontPointSize
color: qgcPal.alertText
}
}
Behavior on opacity {
NumberAnimation { duration: 1000 }
}
function hidesuccessPopup() {
successPopup.visible = false;
successPopup.opacity = 0;
}
Behavior on visible {
SequentialAnimation {
NumberAnimation { from: 2.5; to: 3.5; duration: 500 }
PauseAnimation { duration: 2000 }
NumberAnimation { from: 3.5; to: 2.5; duration: 500 }
}
}
}
// Failure Notification Popup
Rectangle {
id: failPopup
x: Math.round((mainWindow.width - width) * 0.5)
y: ScreenTools.defaultFontPixelHeight
width: mainWindow.width * 0.55
height: ScreenTools.defaultFontPixelHeight * 2.944
color: qgcPal.alertBackground
radius: ScreenTools.defaultFontPixelHeight * 0.5
opacity: 0
visible: false
Text{
id:fail_notify
width: successPopup.width - (ScreenTools.defaultFontPixelHeight * 2)
x: ScreenTools.defaultFontPixelWidth * 2
y: ScreenTools.defaultFontPixelHeight * 0.667
textFormat: TextEdit.RichText
font.pointSize: ScreenTools.defaultFontPointSize
font.family: ScreenTools.demiboldFontFamily
wrapMode: TextEdit.WordWrap
color: qgcPal.alertText
}
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: -(height / 2)
color: qgcPal.alertBackground
radius: ScreenTools.defaultFontPixelHeight * 0.25
border.color: qgcPal.alertBorder
border.width: 1
width: warningLabel.contentWidth + _margins
height: warningLabel.contentHeight + _margins

property real _margins: ScreenTools.defaultFontPixelHeight * 0.25

QGCLabel {
id: warningLabel
anchors.centerIn: parent
text: qsTr("Status Error")
font.pointSize: ScreenTools.smallFontPointSize
color: qgcPal.alertText
}
}
Behavior on opacity {
NumberAnimation { duration: 1000 }
}
function hidefailPopup() {
failPopup.visible = false;
failPopup.opacity = 0;
}
Behavior on visible {
SequentialAnimation {
NumberAnimation { from: 2.5; to: 3.5; duration: 500 }
PauseAnimation { duration: 2000 }
NumberAnimation { from: 3.5; to: 2.5; duration: 500 }
}
}
}
Connections{
target: utmspEditor
function onTimeStampSent(timestamp, activateflag, id){
activationParamsSent(timestamp,activateflag, id)
}
}

Connections {
target: utmspEditor
function onVehicleIDSent(id) {
Expand Down
6 changes: 3 additions & 3 deletions src/QGCToolbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include CUSTOMHEADER
#endif

#ifdef CONFIG_UTM_ADAPTER
#ifdef QGC_UTM_ADAPTER
#include "UTMSPManager.h"
#endif

Expand Down Expand Up @@ -69,7 +69,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
#ifndef QGC_AIRLINK_DISABLED
_airlinkManager = new AirLinkManager (app, this);
#endif
#ifdef CONFIG_UTM_ADAPTER
#ifdef QGC_UTM_ADAPTER
_utmspManager = new UTMSPManager (app, this);
#endif
}
Expand Down Expand Up @@ -100,7 +100,7 @@ void QGCToolbox::setChildToolboxes(void)
#ifndef QGC_AIRLINK_DISABLED
_airlinkManager->setToolbox(this);
#endif
#ifdef CONFIG_UTM_ADAPTER
#ifdef QGC_UTM_ADAPTER
_utmspManager->setToolbox(this);
#endif
}
Expand Down
Loading

0 comments on commit 346b338

Please sign in to comment.