diff --git a/Paths/KlingenbachSurvey.plan b/Paths/KlingenbachSurvey.plan new file mode 100644 index 0000000000000000000000000000000000000000..ea7a4bf24569089913599f00b1229ba5d29a7423 --- /dev/null +++ b/Paths/KlingenbachSurvey.plan @@ -0,0 +1,239 @@ +{ + "fileType": "Plan", + "geoFence": { + "circles": [ + ], + "polygons": [ + ], + "version": 2 + }, + "groundStation": "QGroundControl", + "mission": { + "cruiseSpeed": 15, + "firmwareType": 3, + "hoverSpeed": 2, + "items": [ + { + "autoContinue": true, + "command": 22, + "doJumpId": 1, + "frame": 3, + "params": [ + 15, + 0, + 0, + null, + 0, + 0, + 15 + ], + "type": "SimpleItem" + }, + { + "TransectStyleComplexItem": { + "CameraCalc": { + "AdjustedFootprintFrontal": 25, + "AdjustedFootprintSide": 25, + "CameraName": "Manual (no camera specs)", + "DistanceToSurface": 16, + "DistanceToSurfaceRelative": true, + "version": 1 + }, + "CameraShots": 6, + "CameraTriggerInTurnAround": true, + "FollowTerrain": false, + "HoverAndCapture": false, + "Items": [ + { + "autoContinue": true, + "command": 16, + "doJumpId": 2, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + 47.76823086287187, + 16.53058942509675, + 12 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 206, + "doJumpId": 3, + "frame": 2, + "params": [ + 25, + 0, + 1, + 0, + 0, + 0, + 0 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 206, + "doJumpId": 4, + "frame": 2, + "params": [ + 25, + 0, + 1, + 0, + 0, + 0, + 0 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 5, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + 47.767777545528425, + 16.530589422507354, + 12 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 6, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + 47.7678946477262, + 16.53092392473375, + 12 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 206, + "doJumpId": 7, + "frame": 2, + "params": [ + 25, + 0, + 1, + 0, + 0, + 0, + 0 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 16, + "doJumpId": 8, + "frame": 3, + "params": [ + 0, + 0, + 0, + null, + 47.76834255995745, + 16.530923930172992, + 12 + ], + "type": "SimpleItem" + }, + { + "autoContinue": true, + "command": 206, + "doJumpId": 9, + "frame": 2, + "params": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "SimpleItem" + } + ], + "Refly90Degrees": false, + "TurnAroundDistance": 0, + "VisualTransectPoints": [ + [ + 47.76823086287187, + 16.53058942509675 + ], + [ + 47.767777545528425, + 16.530589422507354 + ], + [ + 47.7678946477262, + 16.53092392473375 + ], + [ + 47.76834255995745, + 16.530923930172992 + ] + ], + "version": 1 + }, + "angle": 0, + "complexItemType": "survey", + "entryLocation": 0, + "flyAlternateTransects": false, + "polygon": [ + [ + 47.76813165710231, + 16.530292332060014 + ], + [ + 47.76836780779515, + 16.530999541789157 + ], + [ + 47.767985395495465, + 16.531183148525685 + ], + [ + 47.76771877171136, + 16.530421536814117 + ] + ], + "splitConcavePolygons": false, + "type": "ComplexItem", + "version": 5 + } + ], + "plannedHomePosition": [ + 47.7677909, + 16.5305408, + 0.01 + ], + "vehicleType": 2, + "version": 2 + }, + "rallyPoints": { + "points": [ + ], + "version": 2 + }, + "version": 1 +} diff --git a/src/MissionManager/SurveyComplexItem.cc b/src/MissionManager/SurveyComplexItem.cc index a1f6e867b00ca5f12d920d96f9d4e107da7304d5..0c7be8ccca1d3680a3374c9af1ba6273bc97188d 100644 --- a/src/MissionManager/SurveyComplexItem.cc +++ b/src/MissionManager/SurveyComplexItem.cc @@ -640,6 +640,7 @@ void SurveyComplexItem::_buildAndAppendMissionItems(QList& items, bool transectEntry = true; for (const CoordInfo_t& transectCoordInfo: transect) { + qWarning() << transectCoordInfo.coord.altitude(); item = new MissionItem(seqNum++, MAV_CMD_NAV_WAYPOINT, mavFrame, diff --git a/src/MissionManager/TransectStyleComplexItem.cc b/src/MissionManager/TransectStyleComplexItem.cc index 97f9ebcb78f943eb8be5d23740515e06f19acad5..c54adff6e01b758396afbee158745902f320795c 100644 --- a/src/MissionManager/TransectStyleComplexItem.cc +++ b/src/MissionManager/TransectStyleComplexItem.cc @@ -108,6 +108,10 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, bool flyVie connect(this, &TransectStyleComplexItem::followTerrainChanged, this, &TransectStyleComplexItem::_followTerrainChanged); + connect(_cameraCalc.distanceToSurface(), &Fact::rawValueChanged, this, &TransectStyleComplexItem::_updateTransectAltitude); + connect(_cameraCalc.distanceToSurface(), &Fact::rawValueChanged, this, &TransectStyleComplexItem::_clearLoadedMissionItems); + + setDirty(false); } @@ -228,6 +232,11 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString& _coordinate = _visualTransectPoints.count() ? _visualTransectPoints.first().value() : QGeoCoordinate(); _exitCoordinate = _visualTransectPoints.count() ? _visualTransectPoints.last().value() : QGeoCoordinate(); + // Load CameraCalc data + if (!_cameraCalc.load(innerObject[_jsonCameraCalcKey].toObject(), errorString)) { + return false; + } + // Load generated mission items _loadedMissionItemsParent = new QObject(this); QJsonArray missionItemsJsonArray = innerObject[_jsonItemsKey].toArray(); @@ -241,10 +250,6 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString& _loadedMissionItems.append(missionItem); } - // Load CameraCalc data - if (!_cameraCalc.load(innerObject[_jsonCameraCalcKey].toObject(), errorString)) { - return false; - } // Load TransectStyleComplexItem individual values _turnAroundDistanceFact.setRawValue (innerObject[turnAroundDistanceName].toDouble()); @@ -419,9 +424,22 @@ void TransectStyleComplexItem::_updateTransectAltitude() { double altitude = _cameraCalc.distanceToSurface()->rawValue().toDouble(); if (altitude > 0) - for (auto list : _transects) - for (auto vertex : list) + for (int h = 0; h < _transects.length(); h++){ + QList &list = _transects[h]; + for (int i = 0; i < list.length(); i++) { + CoordInfo_t &vertex = list[i]; vertex.coord.setAltitude(altitude); + } + } +} + +void TransectStyleComplexItem::_clearLoadedMissionItems() +{ + if (_loadedMissionItemsParent){ + _loadedMissionItems.clear(); + _loadedMissionItemsParent->deleteLater(); + _loadedMissionItemsParent = nullptr; + } } void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void) diff --git a/src/MissionManager/TransectStyleComplexItem.h b/src/MissionManager/TransectStyleComplexItem.h index f638693558e2535e9a904852f58c6e0928d2300e..e584575402ff4eebf798b8a56f379dc62addd140 100644 --- a/src/MissionManager/TransectStyleComplexItem.h +++ b/src/MissionManager/TransectStyleComplexItem.h @@ -135,6 +135,7 @@ protected slots: void _polyPathTerrainData (bool success, const QList& rgPathHeightInfo); void _rebuildTransects (void); void _updateTransectAltitude (void); + void _clearLoadedMissionItems (void); protected: virtual void _rebuildTransectsPhase1 (void) = 0; ///< Rebuilds the _transects array