From 404c65ce0eb2d437841bb08d26c0ae1ad74fe73c Mon Sep 17 00:00:00 2001 From: Valentin Platzgummer Date: Mon, 28 Oct 2019 17:00:26 +0100 Subject: [PATCH] WimaMenu edited, upload progress bar added, guided action for override upload added. --- Paths/#airstrip2.wima | 1305 +++++++++++++++++ Paths/airstrip.wima | 612 +++++--- src/FlightDisplay/FlightDisplayView.qml | 10 + src/FlightDisplay/FlightDisplayWimaMenu.qml | 98 +- src/FlightDisplay/GuidedActionsController.qml | 14 +- src/Wima/WimaArea.cc | 16 +- src/Wima/WimaArea.h | 5 +- src/Wima/WimaAreaData.cc | 14 + src/Wima/WimaAreaData.h | 9 +- src/Wima/WimaController.cc | 57 +- src/Wima/WimaController.h | 11 +- src/Wima/WimaPlaner.cc | 53 +- src/Wima/WimaPlaner.h | 1 - 13 files changed, 1936 insertions(+), 269 deletions(-) create mode 100644 Paths/#airstrip2.wima diff --git a/Paths/#airstrip2.wima b/Paths/#airstrip2.wima new file mode 100644 index 000000000..8aa1e6c62 --- /dev/null +++ b/Paths/#airstrip2.wima @@ -0,0 +1,1305 @@ +{ + "AreaItems": [ + { + "AreaType": "Measurement Area", + "BorderPolygonOffset": 5, + "BottomLayerAltitude": 5, + "LayerDistance": 1, + "NumberOfLayers": 1, + "ShowBorderPolygon": 0, + "maxAltitude": 30, + "polygon": [ + [ + -35.36245358940141, + 149.1646806473599 + ], + [ + -35.36245358940141, + 149.16578342801836 + ], + [ + -35.363352909990994, + 149.16578342801836 + ], + [ + -35.363352909990994, + 149.1646806473599 + ], + [ + -35.36312807984359, + 149.1646806473599 + ], + [ + -35.36296398653496, + 149.16502466400482 + ] + ] + }, + { + "AreaType": "Service Area", + "BorderPolygonOffset": 5, + "ShowBorderPolygon": 0, + "maxAltitude": 30, + "polygon": [ + [ + -35.36248285724683, + 149.1627701598158 + ], + [ + -35.3626687576296, + 149.16366279250963 + ], + [ + -35.363382177836534, + 149.16387291919182 + ], + [ + -35.363382177836534, + 149.1627701385335 + ] + ] + }, + { + "AreaType": "Corridor", + "BorderPolygonOffset": 5, + "ShowBorderPolygon": 0, + "maxAltitude": 30, + "polygon": [ + [ + -35.363320220969754, + 149.1637670850203 + ], + [ + -35.363529358437894, + 149.16378063924185 + ], + [ + -35.363574380892516, + 149.1642967591381 + ], + [ + -35.363543879984505, + 149.16482712641488 + ], + [ + -35.36329351841123, + 149.164816439099 + ], + [ + -35.36330340439825, + 149.1649660354658 + ], + [ + -35.363702517472056, + 149.16497315778963 + ], + [ + -35.363660401341, + 149.16360075931567 + ], + [ + -35.36331910239775, + 149.16358542808774 + ] + ] + } + ], + "MissionItems": { + "fileType": "Plan", + "geoFence": { + "circles": [ + ], + "polygons": [ + ], + "version": 2 + }, + "groundStation": "QGroundControl", + "mission": { + "cruiseSpeed": 15, + "firmwareType": 3, + "hoverSpeed": 5, + "items": [ + { + "autoContinue": true, + "command": 22, + "doJumpId": 1, + "frame": 3, + "params": [ + 15, + 0, + 0, + null, + -35.362978993685076, + 149.16326900199346, + 10 + ], + "type": "SimpleItem" + }, + { + "AMSLAltAboveTerrain": null, + "Altitude": 10, + "AltitudeMode": 1, + "autoContinue": true, + "command": 16, + "doJumpId": 2, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36352927725744, + 149.1637807442891, + 10 + ], + "type": "SimpleItem" + }, + { + "AMSLAltAboveTerrain": null, + "Altitude": 10, + "AltitudeMode": 1, + "autoContinue": true, + "command": 16, + "doJumpId": 3, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363574290722916, + 149.1642967611374, + 10 + ], + "type": "SimpleItem" + }, + { + "AMSLAltAboveTerrain": null, + "Altitude": 10, + "AltitudeMode": 1, + "autoContinue": true, + "command": 16, + "doJumpId": 4, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363543796473635, + 149.16482701262834, + 10 + ], + "type": "SimpleItem" + }, + { + "TransectStyleComplexItem": { + "CameraCalc": { + "AdjustedFootprintFrontal": 25, + "AdjustedFootprintSide": 25, + "CameraName": "Manual (no camera specs)", + "DistanceToSurface": 10, + "DistanceToSurfaceRelative": true, + "version": 1 + }, + "CameraShots": 0, + "CameraTriggerInTurnAround": true, + "FollowTerrain": false, + "HoverAndCapture": false, + "Items": [ + { + "autoContinue": true, + "command": 16, + "doJumpId": 5, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36245358940141, + 149.16538711253594, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 6, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36251302582901, + 149.16544370014293, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 7, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36256996559667, + 149.16550402454794, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 8, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362624252636444, + 149.16556792040595, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 9, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36267573815133, + 149.16563521258288, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 10, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36272428102312, + 149.1657057166355, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 11, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362769748199156, + 149.16577923931715, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 12, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36277219283575, + 149.16578342801836, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 13, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362986974212454, + 149.16578342801836, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 14, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36298485972606, + 149.1657791389439, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 15, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36293909346315, + 149.16569181155742, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 16, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362889662718516, + 149.16560754091284, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 17, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36283670297842, + 149.16552655799012, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 18, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36278035940181, + 149.1654490847578, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 19, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36272078642253, + 149.1653753335646, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 20, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36265814732595, + 149.16530550655747, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 21, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.3625926138015, + 149.16523979512738, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 22, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36252436547201, + 149.16517837938474, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 23, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36245358940141, + 149.16512142766587, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 24, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36245358940141, + 149.16486707783693, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 25, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36253522132639, + 149.16492437813338, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 26, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36261429575511, + 149.16498683865336, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 27, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36269059595006, + 149.16505428819696, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 28, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362763912777716, + 149.1651265418896, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 29, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36283404528174, + 149.165203401689, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 30, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36290080123381, + 149.16528465692778, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 31, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36296399766052, + 149.16537008489095, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 32, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363023461344845, + 149.16545945142641, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 33, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363079029300955, + 149.16555251158672, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 34, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363130549220955, + 149.16564901030043, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 35, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363177879892326, + 149.16574868307129, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 36, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36319307226993, + 149.16578342801836, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 37, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363352909990994, + 149.16568281045824, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 38, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363351135204404, + 149.16567866438558, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 39, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363300578639084, + 149.16556796886485, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 40, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36324536678632, + 149.16546066953018, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 41, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36318565097796, + 149.16535706048163, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 42, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363121594890885, + 149.16525742570434, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 43, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363053374098364, + 149.1651620382904, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 44, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36298117558886, + 149.16507115969, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 45, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362905197253454, + 149.1649850389951, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 46, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363048795293054, + 149.16484686501553, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 47, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36313047420841, + 149.16494239051738, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 48, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36320796408074, + 149.16504302687207, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 49, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36328105251568, + 149.16514849824236, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 50, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36334953918292, + 149.16525851553854, + 10 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 51, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363352909990994, + 149.16526425099372, + 10 + ], + "type": "SimpleItem" + } + ], + "Refly90Degrees": false, + "TurnAroundDistance": 10, + "VisualTransectPoints": [ + [ + -35.36245358940141, + 149.16538711253594 + ], + [ + -35.36251302582901, + 149.16544370014293 + ], + [ + -35.36256996559667, + 149.16550402454794 + ], + [ + -35.362624252636444, + 149.16556792040595 + ], + [ + -35.36267573815133, + 149.16563521258288 + ], + [ + -35.36272428102312, + 149.1657057166355 + ], + [ + -35.362769748199156, + 149.16577923931715 + ], + [ + -35.36277219283575, + 149.16578342801836 + ], + [ + -35.362986974212454, + 149.16578342801836 + ], + [ + -35.36298485972606, + 149.1657791389439 + ], + [ + -35.36293909346315, + 149.16569181155742 + ], + [ + -35.362889662718516, + 149.16560754091284 + ], + [ + -35.36283670297842, + 149.16552655799012 + ], + [ + -35.36278035940181, + 149.1654490847578 + ], + [ + -35.36272078642253, + 149.1653753335646 + ], + [ + -35.36265814732595, + 149.16530550655747 + ], + [ + -35.3625926138015, + 149.16523979512738 + ], + [ + -35.36252436547201, + 149.16517837938474 + ], + [ + -35.36245358940141, + 149.16512142766587 + ], + [ + -35.36245358940141, + 149.16486707783693 + ], + [ + -35.36253522132639, + 149.16492437813338 + ], + [ + -35.36261429575511, + 149.16498683865336 + ], + [ + -35.36269059595006, + 149.16505428819696 + ], + [ + -35.362763912777716, + 149.1651265418896 + ], + [ + -35.36283404528174, + 149.165203401689 + ], + [ + -35.36290080123381, + 149.16528465692778 + ], + [ + -35.36296399766052, + 149.16537008489095 + ], + [ + -35.363023461344845, + 149.16545945142641 + ], + [ + -35.363079029300955, + 149.16555251158672 + ], + [ + -35.363130549220955, + 149.16564901030043 + ], + [ + -35.363177879892326, + 149.16574868307129 + ], + [ + -35.36319307226993, + 149.16578342801836 + ], + [ + -35.363352909990994, + 149.16568281045824 + ], + [ + -35.363351135204404, + 149.16567866438558 + ], + [ + -35.363300578639084, + 149.16556796886485 + ], + [ + -35.36324536678632, + 149.16546066953018 + ], + [ + -35.36318565097796, + 149.16535706048163 + ], + [ + -35.363121594890885, + 149.16525742570434 + ], + [ + -35.363053374098364, + 149.1651620382904 + ], + [ + -35.36298117558886, + 149.16507115969 + ], + [ + -35.362905197253454, + 149.1649850389951 + ], + [ + -35.363048795293054, + 149.16484686501553 + ], + [ + -35.36313047420841, + 149.16494239051738 + ], + [ + -35.36320796408074, + 149.16504302687207 + ], + [ + -35.36328105251568, + 149.16514849824236 + ], + [ + -35.36334953918292, + 149.16525851553854 + ], + [ + -35.363352909990994, + 149.16526425099372 + ] + ], + "version": 1 + }, + "complexItemType": "circularSurvey", + "deltaAlpha": 3, + "deltaR": 20, + "isSnakePath": true, + "polygon": [ + [ + -35.36245358940141, + 149.1646806473599 + ], + [ + -35.36245358940141, + 149.16578342801836 + ], + [ + -35.363352909990994, + 149.16578342801836 + ], + [ + -35.363352909990994, + 149.1646806473599 + ], + [ + -35.36312807984359, + 149.1646806473599 + ], + [ + -35.36296398653496, + 149.16502466400482 + ] + ], + "referencePointAlt": 0, + "referencePointLat": -35.36160214540112, + "referencePointLong": 149.16680703205395, + "transectMinLength": 50, + "type": "ComplexItem", + "version": 1 + }, + { + "AMSLAltAboveTerrain": null, + "Altitude": 10, + "AltitudeMode": 1, + "autoContinue": true, + "command": 16, + "doJumpId": 59, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.363352999822524, + 149.1649670306819, + 10 + ], + "type": "SimpleItem" + }, + { + "AMSLAltAboveTerrain": null, + "Altitude": 10, + "AltitudeMode": 1, + "autoContinue": true, + "command": 16, + "doJumpId": 60, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36354379647366, + 149.16482701262782, + 10 + ], + "type": "SimpleItem" + }, + { + "AMSLAltAboveTerrain": null, + "Altitude": 10, + "AltitudeMode": 1, + "autoContinue": true, + "command": 16, + "doJumpId": 61, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36357429072291, + 149.1642967611374, + 10 + ], + "type": "SimpleItem" + }, + { + "AMSLAltAboveTerrain": null, + "Altitude": 10, + "AltitudeMode": 1, + "autoContinue": true, + "command": 16, + "doJumpId": 62, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36352927725748, + 149.16378074428962, + 10 + ], + "type": "SimpleItem" + }, + { + "AMSLAltAboveTerrain": null, + "Altitude": 0, + "AltitudeMode": 1, + "autoContinue": true, + "command": 21, + "doJumpId": 63, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362978993685076, + 149.16326900199346, + 0 + ], + "type": "SimpleItem" + } + ], + "plannedHomePosition": [ + -35.362978993685076, + 149.16326900199346, + 584 + ], + "vehicleType": 2, + "version": 2 + }, + "rallyPoints": { + "points": [ + ], + "version": 2 + }, + "version": 1 + } +} diff --git a/Paths/airstrip.wima b/Paths/airstrip.wima index 9c4a5421b..6aab1b776 100644 --- a/Paths/airstrip.wima +++ b/Paths/airstrip.wima @@ -10,8 +10,8 @@ "maxAltitude": 30, "polygon": [ [ - -35.362152163919546, - 149.16448710864455 + -35.3621610661112, + 149.16497105526304 ], [ -35.36213375235144, @@ -22,8 +22,8 @@ 149.1652730399651 ], [ - -35.36296630566926, - 149.16437441952598 + -35.36293663201281, + 149.16507668791138 ], [ -35.3624178590449, @@ -86,70 +86,6 @@ 149.1648418922889 ] ] - }, - { - "AreaType": "WimaArea", - "BorderPolygonOffset": 6, - "ShowBorderPolygon": 0, - "maxAltitude": 30, - "polygon": [ - [ - -35.36322713411004, - 149.16531992799887 - ], - [ - -35.36339046047408, - 149.1653465947412 - ], - [ - -35.36340978594098, - 149.16514336625502 - ], - [ - -35.36323927935986, - 149.1651285529241 - ], - [ - -35.36309263422199, - 149.1648418922889 - ], - [ - -35.36295710220423, - 149.16507410185955 - ], - [ - -35.36296630566926, - 149.16437441952598 - ], - [ - -35.3624178590449, - 149.16489129146896 - ], - [ - -35.362152163919546, - 149.16448710864455 - ], - [ - -35.36213375235144, - 149.16517170689133 - ], - [ - -35.36295448541686, - 149.1652730399651 - ], - [ - -35.362955480611134, - 149.16519738151985 - ], - [ - -35.3630787019141, - 149.1650480404527 - ], - [ - -35.363231051789455, - 149.1652578530414 - ] - ] } ], "MissionItems": { @@ -215,8 +151,8 @@ 0, 0, null, - -35.36295719666588, - 149.16507375074823, + -35.36293925099285, + 149.16510449740943, 10 ], "type": "SimpleItem" @@ -246,8 +182,8 @@ 0, 0, null, - -35.362134841282526, - 149.16513121711287, + -35.36237813221649, + 149.16520187962828, 15 ], "type": "SimpleItem" @@ -262,8 +198,8 @@ 0, 0, null, - -35.362245571925655, - 149.16510462605532, + -35.36248150654672, + 149.1652060855136, 15 ], "type": "SimpleItem" @@ -278,8 +214,8 @@ 0, 0, null, - -35.36235796269691, - 149.16509237366853, + -35.36258395605599, + 149.16522351845865, 15 ], "type": "SimpleItem" @@ -294,8 +230,8 @@ 0, 0, null, - -35.362470782219496, - 149.16509459419223, + -35.362612634406396, + 149.16523083280285, 15 ], "type": "SimpleItem" @@ -310,8 +246,8 @@ 0, 0, null, - -35.362582794419104, - 149.16511126329786, + -35.36281728523062, + 149.1652561003325, 15 ], "type": "SimpleItem" @@ -326,8 +262,8 @@ 0, 0, null, - -35.36269277206664, - 149.16514219835526, + -35.36280901093997, + 149.16525163598675, 15 ], "type": "SimpleItem" @@ -342,8 +278,8 @@ 0, 0, null, - -35.36279951022397, - 149.1651870604334, + -35.362707725400796, + 149.16520520239393, 15 ], "type": "SimpleItem" @@ -358,8 +294,8 @@ 0, 0, null, - -35.36290183944552, - 149.165245358014, + -35.36260303653957, + 149.16517200553648, 15 ], "type": "SimpleItem" @@ -374,8 +310,8 @@ 0, 0, null, - -35.36293977978824, - 149.16527122431197, + -35.36249609134935, + 149.16515240912608, 15 ], "type": "SimpleItem" @@ -390,8 +326,8 @@ 0, 0, null, - -35.36295764481516, - 149.165032850518, + -35.36238806154404, + 149.16514662786508, 15 ], "type": "SimpleItem" @@ -406,8 +342,8 @@ 0, 0, null, - -35.36294599674311, - 149.16502583053742, + -35.362280130720784, + 149.16515472509425, 15 ], "type": "SimpleItem" @@ -422,8 +358,8 @@ 0, 0, null, - -35.36282471227199, - 149.164963075649, + -35.36217348139226, + 149.16517661209863, 15 ], "type": "SimpleItem" @@ -438,8 +374,8 @@ 0, 0, null, - -35.36269874274617, - 149.16491621028723, + -35.362139455409434, + 149.1651298112357, 15 ], "type": "SimpleItem" @@ -454,8 +390,8 @@ 0, 0, null, - -35.362569468314135, - 149.1648857479188, + -35.36225028061817, + 149.16510381929967, 15 ], "type": "SimpleItem" @@ -470,8 +406,8 @@ 0, 0, null, - -35.362438305333626, - 149.16487202229578, + -35.362362714365624, + 149.16509217487337, 15 ], "type": "SimpleItem" @@ -486,8 +422,8 @@ 0, 0, null, - -35.36240466617704, - 149.16487122211092, + -35.36247552480412, + 149.1650950055356, 15 ], "type": "SimpleItem" @@ -502,8 +438,8 @@ 0, 0, null, - -35.36240256038893, - 149.16487120872927, + -35.36258747595889, + 149.165112280273, 15 ], "type": "SimpleItem" @@ -518,8 +454,8 @@ 0, 0, null, - -35.36227107237207, - 149.16487895633045, + -35.36269734126966, + 149.16514380981994, 15 ], "type": "SimpleItem" @@ -534,8 +470,8 @@ 0, 0, null, - -35.3621409650951, - 149.16490351508716, + -35.362803917029076, + 149.16518924873213, 15 ], "type": "SimpleItem" @@ -550,8 +486,8 @@ 0, 0, null, - -35.362147036428354, - 149.1646777644029, + -35.36290603557084, + 149.16524809917132, 15 ], "type": "SimpleItem" @@ -566,8 +502,8 @@ 0, 0, null, - -35.362264747402975, - 149.16465837377498, + -35.36293977978824, + 149.16527122431197, 15 ], "type": "SimpleItem" @@ -582,8 +518,8 @@ 0, 0, null, - -35.36264493753943, - 149.16467728613557, + -35.3629491462552, + 149.1652143197706, 15 ], "type": "SimpleItem" @@ -598,8 +534,8 @@ 0, 0, null, - -35.36279156861293, - 149.1647185638169, + -35.36294415605949, + 149.16521088561058, 15 ], "type": "SimpleItem" @@ -614,8 +550,8 @@ 0, 0, null, - -35.3629338777606, - 149.16477840994767, + -35.36283865646523, + 149.16514735290244, 15 ], "type": "SimpleItem" @@ -630,8 +566,8 @@ 0, 0, null, - -35.3629608116285, - 149.16479209735147, + -35.36272831904077, + 149.16509769074077, 15 ], "type": "SimpleItem" @@ -646,8 +582,8 @@ 0, 0, null, - -35.36296391205428, - 149.164556391219, + -35.36261435266603, + 149.1650624432346, 15 ], "type": "SimpleItem" @@ -662,8 +598,248 @@ 0, 0, null, - -35.36282993704515, - 149.1645029372569, + -35.362498005980456, + 149.16504199656302, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 31, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36238055370268, + 149.16503657474402, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 32, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36226328266444, + 149.16504623718018, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 33, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36214747771178, + 149.16507087800784, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 34, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.3621554459957, + 149.1650123416087, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 35, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36227619716103, + 149.1649890427917, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 36, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36239827291801, + 149.16498134899987, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 37, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36252033577909, + 149.164989344528, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 38, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362641048398025, + 149.16501294177547, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 39, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.3627590882221, + 149.16505188220583, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 40, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.3628731619823, + 149.16510573917958, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 41, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36294306927446, + 149.1651474850289, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 42, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362548139395244, + 149.16493785039734, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 43, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.362538113964206, + 149.1649363592096, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 44, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.3624114370437, + 149.16492637520534, + 15 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 45, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + -35.36228460299838, + 149.16493268282542, 15 ], "type": "SimpleItem" @@ -673,124 +849,184 @@ "TurnAroundDistance": 10, "VisualTransectPoints": [ [ - -35.362134841282526, - 149.16513121711287 + -35.36237813221649, + 149.16520187962828 + ], + [ + -35.36248150654672, + 149.1652060855136 + ], + [ + -35.36258395605599, + 149.16522351845865 + ], + [ + -35.362612634406396, + 149.16523083280285 + ], + [ + -35.36281728523062, + 149.1652561003325 + ], + [ + -35.36280901093997, + 149.16525163598675 + ], + [ + -35.362707725400796, + 149.16520520239393 + ], + [ + -35.36260303653957, + 149.16517200553648 + ], + [ + -35.36249609134935, + 149.16515240912608 + ], + [ + -35.36238806154404, + 149.16514662786508 + ], + [ + -35.362280130720784, + 149.16515472509425 + ], + [ + -35.36217348139226, + 149.16517661209863 ], [ - -35.362245571925655, - 149.16510462605532 + -35.362139455409434, + 149.1651298112357 ], [ - -35.36235796269691, - 149.16509237366853 + -35.36225028061817, + 149.16510381929967 ], [ - -35.362470782219496, - 149.16509459419223 + -35.362362714365624, + 149.16509217487337 ], [ - -35.362582794419104, - 149.16511126329786 + -35.36247552480412, + 149.1650950055356 ], [ - -35.36269277206664, - 149.16514219835526 + -35.36258747595889, + 149.165112280273 ], [ - -35.36279951022397, - 149.1651870604334 + -35.36269734126966, + 149.16514380981994 ], [ - -35.36290183944552, - 149.165245358014 + -35.362803917029076, + 149.16518924873213 + ], + [ + -35.36290603557084, + 149.16524809917132 ], [ -35.36293977978824, 149.16527122431197 ], [ - -35.36295764481516, - 149.165032850518 + -35.3629491462552, + 149.1652143197706 + ], + [ + -35.36294415605949, + 149.16521088561058 + ], + [ + -35.36283865646523, + 149.16514735290244 + ], + [ + -35.36272831904077, + 149.16509769074077 ], [ - -35.36294599674311, - 149.16502583053742 + -35.36261435266603, + 149.1650624432346 ], [ - -35.36282471227199, - 149.164963075649 + -35.362498005980456, + 149.16504199656302 ], [ - -35.36269874274617, - 149.16491621028723 + -35.36238055370268, + 149.16503657474402 ], [ - -35.362569468314135, - 149.1648857479188 + -35.36226328266444, + 149.16504623718018 ], [ - -35.362438305333626, - 149.16487202229578 + -35.36214747771178, + 149.16507087800784 ], [ - -35.36240466617704, - 149.16487122211092 + -35.3621554459957, + 149.1650123416087 ], [ - -35.36240256038893, - 149.16487120872927 + -35.36227619716103, + 149.1649890427917 ], [ - -35.36227107237207, - 149.16487895633045 + -35.36239827291801, + 149.16498134899987 ], [ - -35.3621409650951, - 149.16490351508716 + -35.36252033577909, + 149.164989344528 ], [ - -35.362147036428354, - 149.1646777644029 + -35.362641048398025, + 149.16501294177547 ], [ - -35.362264747402975, - 149.16465837377498 + -35.3627590882221, + 149.16505188220583 ], [ - -35.36264493753943, - 149.16467728613557 + -35.3628731619823, + 149.16510573917958 ], [ - -35.36279156861293, - 149.1647185638169 + -35.36294306927446, + 149.1651474850289 ], [ - -35.3629338777606, - 149.16477840994767 + -35.362548139395244, + 149.16493785039734 ], [ - -35.3629608116285, - 149.16479209735147 + -35.362538113964206, + 149.1649363592096 ], [ - -35.36296391205428, - 149.164556391219 + -35.3624114370437, + 149.16492637520534 ], [ - -35.36282993704515, - 149.1645029372569 + -35.36228460299838, + 149.16493268282542 ] ], "version": 1 }, "complexItemType": "circularSurvey", "deltaAlpha": 6, - "deltaR": 20, + "deltaR": 5, "isSnakePath": true, "polygon": [ [ - -35.362152163919546, - 149.16448710864455 + -35.3621610661112, + 149.16497105526304 ], [ -35.36213375235144, @@ -801,8 +1037,8 @@ 149.1652730399651 ], [ - -35.36296630566926, - 149.16437441952598 + -35.36293663201281, + 149.16507668791138 ], [ -35.3624178590449, @@ -822,15 +1058,15 @@ "AltitudeMode": 1, "autoContinue": true, "command": 16, - "doJumpId": 39, + "doJumpId": 54, "frame": 3, "params": [ 0, 0, 0, null, - -35.362957196665874, - 149.1650737507487, + -35.36293925099291, + 149.1651044974102, 10 ], "type": "SimpleItem" @@ -841,15 +1077,15 @@ "AltitudeMode": 1, "autoContinue": true, "command": 16, - "doJumpId": 40, + "doJumpId": 55, "frame": 3, "params": [ 0, 0, 0, null, - -35.36307869775492, - 149.1650482003725, + -35.36307869775491, + 149.16504820037198, 10 ], "type": "SimpleItem" @@ -860,7 +1096,7 @@ "AltitudeMode": 1, "autoContinue": true, "command": 21, - "doJumpId": 41, + "doJumpId": 56, "frame": 3, "params": [ 0, diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index ca99402fd..2735e6984 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -548,6 +548,7 @@ QGCView { wimaController: wimaController + planMasterController: masterController } //------------------------------------------------------------------------- @@ -689,12 +690,21 @@ QGCView { GuidedActionsController { id: guidedActionsController + wimaController: wimaController missionController: _missionController confirmDialog: guidedActionConfirm actionList: guidedActionList altitudeSlider: _altitudeSlider z: _flightVideoPipControl.z + 1 + property bool uploadOverrideRequired: wimaController.uploadOverrideRequired + + onUploadOverrideRequiredChanged: { + if (uploadOverrideRequired) { + confirmAction(actionOverrideUpload) + } + } + onShowStartMissionChanged: { if (showStartMission) { confirmAction(actionStartMission) diff --git a/src/FlightDisplay/FlightDisplayWimaMenu.qml b/src/FlightDisplay/FlightDisplayWimaMenu.qml index 97a25b9b9..0c0670e5c 100644 --- a/src/FlightDisplay/FlightDisplayWimaMenu.qml +++ b/src/FlightDisplay/FlightDisplayWimaMenu.qml @@ -23,6 +23,21 @@ Item { width: 300 property var wimaController // must be provided by the user + property var planMasterController // must be provided by the user + + property bool _controllerValid: planMasterController !== undefined + property real _controllerProgressPct: _controllerValid ? planMasterController.missionController.progressPct : 0 + + // Progress bar visibility + on_ControllerProgressPctChanged: { + if (_controllerProgressPct === 1) { + uploadCompleteText.visible = true + progressBar.visible = false + } else if (_controllerProgressPct > 0) { + progressBar.visible = true + uploadCompleteText.visible = false + } + } // box containing all items Rectangle { @@ -73,9 +88,12 @@ Item { } GridLayout { columns: 2 - rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.25 - visible: settingsHeader.checked + rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 + columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.left: parent.left + anchors.right: parent.right + visible: settingsHeader.checked // Settings QGCLabel { text: qsTr("Next Waypoint") } @@ -109,50 +127,90 @@ Item { } SectionHeader{ - id: commandHeader - text: qsTr("Commands") + id: missionHeader + text: qsTr("Mission") } GridLayout { - columns: 2 - rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.25 - visible: commandHeader.checked + columns: 2 + rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 + columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.left: parent.left + anchors.right: parent.right + visible: missionHeader.checked // Buttons QGCButton { id: buttonPreviousMissionPhase - text: qsTr("Reverse") - onClicked: wimaController.previousPhase(); + text: qsTr("Reverse") + onClicked: wimaController.previousPhase(); Layout.fillWidth: true } QGCButton { id: buttonNextMissionPhase - text: qsTr("Forward") - onClicked: wimaController.nextPhase(); + text: qsTr("Forward") + onClicked: wimaController.nextPhase(); Layout.fillWidth: true } QGCButton { id: buttonResetPhase - text: qsTr("Reset Phase") - onClicked: wimaController.resetPhase(); + text: qsTr("Reset Phase") + onClicked: wimaController.resetPhase(); Layout.fillWidth: true + Layout.rowSpan: 2 } + + } + + SectionHeader{ + id: vehicleHeader + text: qsTr("Vehicle") + } + GridLayout { + columns: 2 + rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 + columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.left: parent.left + anchors.right: parent.right + visible: vehicleHeader.checked + QGCButton { id: buttonUpload - text: qsTr("Upload") - onClicked: wimaController.uploadToVehicle(); + text: qsTr("Upload") + onClicked: wimaController.uploadToVehicle(); Layout.fillWidth: true } QGCButton { id: buttonRemoveFromVehicle - text: qsTr("Remove") - onClicked: wimaController.removeFromVehicle(); + text: qsTr("Remove") + onClicked: wimaController.removeFromVehicle(); Layout.fillWidth: true } + + // progess bar + Rectangle { + id: progressBar + height: 4 + width: _controllerProgressPct * parent.width + color: qgcPal.colorGreen + visible: false + } + + QGCLabel { + id: uploadCompleteText + font.pointSize: ScreenTools.largeFontPointSize + Layout.columnSpan: 2 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "Done" + visible: false + } + } SectionHeader { @@ -166,8 +224,6 @@ Item { visible: statsHeader.checked QGCLabel { - anchors.left: parent.left - anchors.right: parent.right text: qsTr("Phase Length: ") wrapMode: Text.WordWrap font.pointSize: ScreenTools.smallFontPointSize diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index c099ed669..10427a08a 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -27,6 +27,7 @@ import QGroundControl.FlightMap 1.0 Item { id: _root + property var wimaController property var missionController property var confirmDialog property var actionList @@ -50,7 +51,8 @@ Item { readonly property string landAbortTitle: qsTr("Land Abort") readonly property string setWaypointTitle: qsTr("Set Waypoint") readonly property string gotoTitle: qsTr("Goto Location") - readonly property string vtolTransitionTitle: qsTr("VTOL Transition") + readonly property string vtolTransitionTitle: qsTr("VTOL Transition") + readonly property string overrideUploadTitle: qsTr("Override Lock") readonly property string armMessage: qsTr("Arm the vehicle.") readonly property string disarmMessage: qsTr("Disarm the vehicle") @@ -70,6 +72,7 @@ Item { readonly property string mvPauseMessage: qsTr("Pause all vehicles at their current position.") readonly property string vtolTransitionFwdMessage: qsTr("Transition VTOL to fixed wing flight.") readonly property string vtolTransitionMRMessage: qsTr("Transition VTOL to multi-rotor flight.") + readonly property string overrideUploadMessage: qsTr("Vehicle is not inside service area. Override upload lock?") readonly property int actionRTL: 1 readonly property int actionLand: 2 @@ -92,6 +95,7 @@ Item { readonly property int actionMVStartMission: 19 readonly property int actionVtolTransitionToFwdFlight: 20 readonly property int actionVtolTransitionToMRFlight: 21 + readonly property int actionOverrideUpload: 22 property bool showEmergenyStop: _guidedActionsEnabled && !_hideEmergenyStop && _vehicleArmed && _vehicleFlying property bool showArm: _guidedActionsEnabled && !_vehicleArmed @@ -331,6 +335,11 @@ Item { confirmDialog.message = vtolTransitionMRMessage confirmDialog.hideTrigger = true break + case actionOverrideUpload: + confirmDialog.title = overrideUploadTitle + confirmDialog.message = overrideUploadMessage + confirmDialog.hideTrigger = true + break default: console.warn("Unknown actionCode", actionCode) return @@ -406,6 +415,9 @@ Item { case actionVtolTransitionToMRFlight: _activeVehicle.vtolInFwdFlight = false break + case actionOverrideUpload: + wimaController.forceUploadToVehicle() + break default: console.warn(qsTr("Internal error: unknown actionCode"), actionCode) break diff --git a/src/Wima/WimaArea.cc b/src/Wima/WimaArea.cc index 8f33701e2..5f8e19607 100644 --- a/src/Wima/WimaArea.cc +++ b/src/Wima/WimaArea.cc @@ -1,6 +1,5 @@ #include "WimaArea.h" - /*! * \variable WimaArea::epsilonMeter * \brief The accuracy used for distance calculations (unit: m). @@ -378,7 +377,7 @@ int WimaArea::previousVertexIndex(int index) const * Returns \c true if the calling area is self intersecting, \c false else. * \note If the calling area is self intersecting, it's not a \l {Simple Polygon}. */ -bool WimaArea::isSimplePolygon() +bool WimaArea::isSimplePolygon() const { using namespace PolygonCalculus; using namespace GeoUtilities; @@ -391,6 +390,19 @@ bool WimaArea::isSimplePolygon() } +bool WimaArea::containsCoordinate(const QGeoCoordinate &coordinate) const +{ + using namespace PlanimetryCalculus; + using namespace PolygonCalculus; + using namespace GeoUtilities; + + if (this->count() > 2) { + QPolygonF polygon = toQPolygonF(toCartesian2D(this->coordinateList(), coordinate)); + return PlanimetryCalculus::contains(polygon, QPointF(0,0)); + } else + return false; +} + /*! * \fn void WimaArea::saveToJson(QJsonObject &json) * Saves the calling area to \c QJsonObject object and stores it inside \a json. diff --git a/src/Wima/WimaArea.h b/src/Wima/WimaArea.h index dfff87588..614e9b85e 100644 --- a/src/Wima/WimaArea.h +++ b/src/Wima/WimaArea.h @@ -13,6 +13,7 @@ #include "GeoUtilities.h" #include "PolygonCalculus.h" +#include "PlanimetryCalculus.h" class WimaArea : public QGCMapPolygon //abstract base class for all WimaAreas { @@ -54,6 +55,8 @@ public: bool join (WimaArea &area, QString &errorString); int nextVertexIndex (int index) const; int previousVertexIndex (int index) const; + bool isSimplePolygon () const; + bool containsCoordinate (const QGeoCoordinate &coordinate) const; void saveToJson (QJsonObject& jsonObject); @@ -63,7 +66,7 @@ public: static QGCMapPolygon toQGCPolygon (const WimaArea& area); static bool join (const WimaArea &area1, const WimaArea &area2, WimaArea& joinedArea, QString &errorString); static bool join (const WimaArea &area1, const WimaArea &area2, WimaArea& joinedArea); - bool isSimplePolygon (); + // Friends friend void print(const WimaArea& area, QString& outputString); diff --git a/src/Wima/WimaAreaData.cc b/src/Wima/WimaAreaData.cc index 1f586f408..a2944ac7c 100644 --- a/src/Wima/WimaAreaData.cc +++ b/src/Wima/WimaAreaData.cc @@ -41,6 +41,20 @@ QList WimaAreaData::coordinateList() const return coordinateList; } +bool WimaAreaData::containsCoordinate(const QGeoCoordinate &coordinate) const +{ + using namespace PlanimetryCalculus; + using namespace PolygonCalculus; + using namespace GeoUtilities; + + if (_path.size() > 2) { + QPolygonF polygon = toQPolygonF(toCartesian2D(this->coordinateList(), coordinate)); + return PlanimetryCalculus::contains(polygon, QPointF(0,0)); + } else + return false; +} + + /*! * \fn void WimaAreaData::setMaxAltitude(double maxAltitude) * diff --git a/src/Wima/WimaAreaData.h b/src/Wima/WimaAreaData.h index 7ef8ad14c..4c4898c61 100644 --- a/src/Wima/WimaAreaData.h +++ b/src/Wima/WimaAreaData.h @@ -19,10 +19,11 @@ public: //WimaAreaData(const WimaArea &other, QObject *parent = nullptr); WimaAreaData& operator=(const WimaAreaData& otherData) = delete; // avoid slicing - double maxAltitude() const; - QVariantList path() const; - QGeoCoordinate center() const; - QList coordinateList() const; + double maxAltitude() const; + QVariantList path() const; + QGeoCoordinate center() const; + QList coordinateList() const; + bool containsCoordinate(const QGeoCoordinate &coordinate) const; virtual QString type() const = 0; diff --git a/src/Wima/WimaController.cc b/src/Wima/WimaController.cc index 961cc89af..2d705d3a7 100644 --- a/src/Wima/WimaController.cc +++ b/src/Wima/WimaController.cc @@ -26,7 +26,10 @@ WimaController::WimaController(QObject *parent) , _nextPhaseStartWaypointIndex (settingsGroup, _metaDataMap[startWaypointIndexName]) , _showAllMissionItems (settingsGroup, _metaDataMap[showAllMissionItemsName]) , _showCurrentMissionItems (settingsGroup, _metaDataMap[showCurrentMissionItemsName]) + , _startWaypointIndex (0) , _lastMissionPhaseReached (false) + , _uploadOverrideRequired (false) + { _nextPhaseStartWaypointIndex.setRawValue(int(1)); _showAllMissionItems.setRawValue(true); @@ -108,6 +111,11 @@ Fact *WimaController::showCurrentMissionItems() return &_showCurrentMissionItems; } +bool WimaController::uploadOverrideRequired() const +{ + return _uploadOverrideRequired; +} + Fact *WimaController::startWaypointIndex() { return &_nextPhaseStartWaypointIndex; @@ -145,6 +153,15 @@ void WimaController::setDataContainer(WimaDataContainer *container) } } +void WimaController::setUploadOverrideRequired(bool overrideRequired) +{ + if (_uploadOverrideRequired != overrideRequired) { + _uploadOverrideRequired = overrideRequired; + + emit uploadOverrideRequiredChanged(); + } +} + void WimaController::nextPhase() { calcNextPhase(); @@ -154,9 +171,9 @@ void WimaController::previousPhase() { if (_nextPhaseStartWaypointIndex.rawValue().toInt() > 0) { _lastMissionPhaseReached = false; - _nextPhaseStartWaypointIndex.setRawValue( 1 + std::max(_startWaypointIndex - - _maxWaypointsPerPhase.rawValue().toInt() - + _overlapWaypoints.rawValue().toInt(), 0)); + _nextPhaseStartWaypointIndex.setRawValue(std::max(_startWaypointIndex + - _maxWaypointsPerPhase.rawValue().toInt() + + _overlapWaypoints.rawValue().toInt(), 1)); } } @@ -168,6 +185,18 @@ void WimaController::resetPhase() bool WimaController::uploadToVehicle() { + if (!_serviceArea.containsCoordinate(_masterController->managerVehicle()->coordinate())) { + qgcApp()->showMessage(tr("Vehicle is not inside service area.")); + setUploadOverrideRequired(true); + return false; + } + + return forceUploadToVehicle(); +} + +bool WimaController::forceUploadToVehicle() +{ + setUploadOverrideRequired(false); if (_currentMissionItems.count() < 1) return false; @@ -187,23 +216,6 @@ bool WimaController::uploadToVehicle() _missionController->insertSimpleMissionItem(*item, visuals->count()); } -// // set land command for last mission item -// SimpleMissionItem *landItem = visuals->value(visuals->count()-1); -// if (landItem == nullptr) { -// qWarning("WimaController::uploadToVehicle(): nullptr"); -// _missionController->removeAll(); -// return; -// } - -// // check vehicle type, before setting land command -// Vehicle* controllerVehicle = _masterController->controllerVehicle(); -// MAV_CMD landCmd = controllerVehicle->vtol() ? MAV_CMD_NAV_VTOL_LAND : MAV_CMD_NAV_LAND; -// if (controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains(landCmd)) { -// landItem->setCommand(landCmd); -// } else { -// _missionController->removeAll(); -// return; -// } _masterController->sendToVehicle(); return true; @@ -584,7 +596,10 @@ void WimaController::updateNextWaypoint() void WimaController::recalcCurrentPhase() { _lastMissionPhaseReached = false; - _nextPhaseStartWaypointIndex.setRawValue(_startWaypointIndex + 1); + disconnect(&_nextPhaseStartWaypointIndex, &Fact::rawValueChanged, this, &WimaController::calcNextPhase); + _nextPhaseStartWaypointIndex.setRawValue(_startWaypointIndex + 1); + connect(&_nextPhaseStartWaypointIndex, &Fact::rawValueChanged, this, &WimaController::calcNextPhase); + calcNextPhase(); } bool WimaController::setTakeoffLandPosition() diff --git a/src/Wima/WimaController.h b/src/Wima/WimaController.h index 70ed8720e..c7ed1481a 100644 --- a/src/Wima/WimaController.h +++ b/src/Wima/WimaController.h @@ -51,6 +51,7 @@ public: Q_PROPERTY(Fact* startWaypointIndex READ startWaypointIndex CONSTANT) Q_PROPERTY(Fact* showAllMissionItems READ showAllMissionItems CONSTANT) Q_PROPERTY(Fact* showCurrentMissionItems READ showCurrentMissionItems CONSTANT) + Q_PROPERTY(bool uploadOverrideRequired READ uploadOverrideRequired WRITE setUploadOverrideRequired NOTIFY uploadOverrideRequiredChanged) @@ -72,20 +73,23 @@ public: Fact* overlapWaypoints (void); Fact* maxWaypointsPerPhase (void); Fact* startWaypointIndex (void); - Fact* showAllMissionItems (void); - Fact* showCurrentMissionItems (void); + Fact* showAllMissionItems (void); + Fact* showCurrentMissionItems(void); + bool uploadOverrideRequired (void) const; // Property setters void setMasterController (PlanMasterController* masterController); void setMissionController (MissionController* missionController); void setDataContainer (WimaDataContainer* container); + void setUploadOverrideRequired (bool overrideRequired); // Member Methodes Q_INVOKABLE void nextPhase(); Q_INVOKABLE void previousPhase(); Q_INVOKABLE void resetPhase(); Q_INVOKABLE bool uploadToVehicle(); + Q_INVOKABLE bool forceUploadToVehicle(); Q_INVOKABLE void removeFromVehicle(); Q_INVOKABLE void saveToCurrent (); @@ -131,6 +135,7 @@ signals: void currentMissionItemsChanged (void); void waypointPathChanged (void); void currentWaypointPathChanged (void); + void uploadOverrideRequiredChanged (void); private slots: bool fetchContainerData(); @@ -175,4 +180,6 @@ private: int _startWaypointIndex; // indes of the mission item stored in _missionItems defining the first element // (which is not part of the arrival path) of _currentMissionItem bool _lastMissionPhaseReached; + bool _uploadOverrideRequired; // Is set to true if uploadToVehicle() did not suceed because the vehicle is not inside the service area. + // The user can override the upload lock with a slider, this will reset this variable to false. }; diff --git a/src/Wima/WimaPlaner.cc b/src/Wima/WimaPlaner.cc index 28c394c6f..3ea41a0e0 100644 --- a/src/Wima/WimaPlaner.cc +++ b/src/Wima/WimaPlaner.cc @@ -19,12 +19,20 @@ WimaPlaner::WimaPlaner(QObject *parent) , _corridor (this) , _circularSurvey (nullptr) , _surveyRefChanging (false) + , _measurementAreaChanging (false) + , _corridorChanging (false) + , _serviceAreaChanging (false) , _syncronizedWithController (false) , _readyForSync (false) { + _lastMeasurementAreaPath = _measurementArea.path(); + _lastServiceAreaPath = _serviceArea.path(); + _lastCorridorPath = _corridor.path(); + connect(this, &WimaPlaner::currentPolygonIndexChanged, this, &WimaPlaner::recalcPolygonInteractivity); connect(&_updateTimer, &QTimer::timeout, this, &WimaPlaner::updateTimerSlot); connect(this, &WimaPlaner::joinedAreaValidChanged, this, &WimaPlaner::updateMission); + _updateTimer.setInterval(500); // 250 ms means: max update time 2*250 ms _updateTimer.start(); } @@ -199,11 +207,8 @@ bool WimaPlaner::updateMission() setReadyForSync(false); - if ( !_joinedAreaValid) { - if (_joinedAreaErrorString.size() > 0) - qgcApp()->showMessage(_joinedAreaErrorString); + if ( !_joinedAreaValid) return false; - } // extract old survey data @@ -339,6 +344,7 @@ bool WimaPlaner::loadFromFile(const QString &filename) return false; } + _lastMeasurementAreaPath = _measurementArea.path(); // prevents error messages at this point validAreaCounter++; _visualItems.append(&_measurementArea); emit visualItemsChanged(); @@ -350,6 +356,7 @@ bool WimaPlaner::loadFromFile(const QString &filename) return false; } + _lastServiceAreaPath = _serviceArea.path(); // prevents error messages at this point validAreaCounter++; _visualItems.append(&_serviceArea); emit visualItemsChanged(); @@ -361,6 +368,7 @@ bool WimaPlaner::loadFromFile(const QString &filename) return false; } + _lastCorridorPath = _corridor.path(); // prevents error messages at this point validAreaCounter++; _visualItems.append(&_corridor); emit visualItemsChanged(); @@ -373,18 +381,12 @@ bool WimaPlaner::loadFromFile(const QString &filename) errorString += QString(tr("Invalid or non existing entry for %s.\n").arg(WimaArea::areaTypeName)); return false; } - } + } + recalcJoinedArea(); _currentFile.sprintf("%s/%s.%s", fileInfo.path().toLocal8Bit().data(), fileInfo.completeBaseName().toLocal8Bit().data(), wimaFileExtension); emit currentFileChanged(); - //recalcJoinedArea(); - - // MissionItems - // extrac MissionItems part - -// bool ret = json.contains(missionItemsName); -// qWarning() << ret; QJsonObject missionObject = json[missionItemsName].toObject(); @@ -429,11 +431,6 @@ bool WimaPlaner::loadFromFile(const QString &filename) _circularSurvey = missionItems->value(i); if (_circularSurvey != nullptr) { - if ( !recalcJoinedArea()) { - qgcApp()->showMessage(_joinedAreaErrorString); - return false; - } - _lastSurveyRefPoint = _circularSurvey->refPoint(); _surveyRefChanging = false; _circularSurvey->setAutoGenerated(true); // prevents reinitialisation from gui @@ -445,16 +442,15 @@ bool WimaPlaner::loadFromFile(const QString &filename) } } - if (_circularSurvey == nullptr) - updateMission(); + //if (_circularSurvey == nullptr) + updateMission(); // remove temporary file if ( !temporaryFile.remove() ){ qWarning("WimaPlaner::loadFromFile(): not able to remove temporary file."); } - _syncronizedWithController = false; - _readyForSync = false; + setSyncronizedWithController(false); return true; @@ -465,7 +461,6 @@ bool WimaPlaner::loadFromFile(const QString &filename) } else { errorString += QString(tr("File extension not supported.\n")); qgcApp()->showMessage(errorMessage.arg(errorString)); - return false; } } @@ -600,31 +595,31 @@ bool WimaPlaner::calcArrivalAndReturnPath() bool WimaPlaner::recalcJoinedArea() { - _joinedAreaErrorString.clear(); setJoinedAreaValid(false); // check if area paths form simple polygons if ( !_serviceArea.isSimplePolygon() ) { - _joinedAreaErrorString.append(tr("Service area is self intersecting and thus not a simple polygon. Only simple polygons allowed.\n")); + qgcApp()->showMessage(tr("Service area is self intersecting and thus not a simple polygon. Only simple polygons allowed.\n")); return false; } if ( !_corridor.isSimplePolygon() && _corridor.count() > 0) { - _joinedAreaErrorString.append(tr("Corridor is self intersecting and thus not a simple polygon. Only simple polygons allowed.\n")); + qgcApp()->showMessage(tr("Corridor is self intersecting and thus not a simple polygon. Only simple polygons allowed.\n")); return false; } if ( !_measurementArea.isSimplePolygon() ) { - _joinedAreaErrorString.append(tr("Measurement area is self intersecting and thus not a simple polygon. Only simple polygons allowed.\n")); + qgcApp()->showMessage(tr("Measurement area is self intersecting and thus not a simple polygon. Only simple polygons allowed.\n")); return false; } _joinedArea.setPath(_serviceArea.path()); _joinedArea.join(_corridor); if ( !_joinedArea.join(_measurementArea) ) { - _joinedAreaErrorString.append(tr("Not able to join areas. Service area and measurement" - " must have a overlapping section, or be connected through a corridor.")); + qgcApp()->showMessage(tr("Not able to join areas. Service area and measurement" + " must have a overlapping section, or be connected through a corridor.")); return false; // this happens if all areas are pairwise disjoint } + // join service area, op area and corridor setJoinedAreaValid(true); return true; @@ -640,6 +635,8 @@ bool WimaPlaner::recalcJoinedArea() void WimaPlaner::pushToContainer() { if (_container != nullptr) { + if (!_readyForSync) + return; WimaPlanData planData = toPlanData(); _container->push(planData); setSyncronizedWithController(true); diff --git a/src/Wima/WimaPlaner.h b/src/Wima/WimaPlaner.h index de2d47215..4b04fd5b6 100644 --- a/src/Wima/WimaPlaner.h +++ b/src/Wima/WimaPlaner.h @@ -151,7 +151,6 @@ private: WimaDataContainer *_container; // container for data exchange with WimaController QmlObjectListModel _visualItems; // contains all visible areas WimaJoinedArea _joinedArea; // joined area fromed by _measurementArea, _serviceArea, _corridor - QString _joinedAreaErrorString; // contains errors which appeared in recalcJoinedArea bool _joinedAreaValid; WimaMeasurementArea _measurementArea; // measurement area WimaServiceArea _serviceArea; // area for supplying -- 2.22.0