diff --git a/src/MissionManager/Survey.SettingsGroup.json b/src/MissionManager/Survey.SettingsGroup.json index 8287aa689736c08bc80d1ffabc595fabca0f9f24..2690fdd856512aee39670eb84582b81150dbea96 100644 --- a/src/MissionManager/Survey.SettingsGroup.json +++ b/src/MissionManager/Survey.SettingsGroup.json @@ -1,24 +1,4 @@ [ -{ - "name": "ManualGrid", - "shortDescription": "Specify all parameters for grid generation.", - "type": "bool", - "defaultValue": 1 -}, -{ - "name": "GridAltitude", - "shortDescription": "Altitude for all waypoints within the grid.", - "type": "double", - "units": "m", - "decimalPlaces": 1, - "defaultValue": 50 -}, -{ - "name": "GridAltitudeRelative", - "shortDescription": "Altitude for all waypoints within the grid is relative to home.", - "type": "bool", - "defaultValue": 1 -}, { "name": "GridAngle", "shortDescription": "Angle for parallel lines of grid.", @@ -30,140 +10,9 @@ "defaultValue": 0 }, { - "name": "GridSpacing", - "shortDescription": "Amount of spacing in between parallel grid lines.", - "type": "double", - "decimalPlaces": 2, - "min": 0.1, - "units": "m", - "defaultValue": 30 -}, -{ - "name": "TurnaroundDist", - "shortDescription": "Amount of additional distance to add outside the grid area for vehicle turnaround.", - "type": "double", - "decimalPlaces": 2, - "min": 0, - "units": "m", - "defaultValue": 30 -}, -{ - "name": "GroundResolution", - "shortDescription": "Resolution of image in relationship to ground distance.", - "type": "double", - "decimalPlaces": 2, - "min": 0, - "units": "cm/px", - "defaultValue": 3 -}, -{ - "name": "FrontalOverlap", - "shortDescription": "Amount of overlap between images in the forward facing direction.", - "type": "double", - "decimalPlaces": 0, - "min": 0, - "max": 85, - "units": "%", - "defaultValue": 70 -}, -{ - "name": "SideOverlap", - "shortDescription": "Amount of overlap between images in the side facing direction.", - "type": "double", - "decimalPlaces": 0, - "min": 0, - "max": 85, - "units": "%", - "defaultValue": 70 -}, -{ - "name": "CameraSensorWidth", - "shortDescription": "Amount of overlap between images in the side facing direction.", - "type": "double", - "decimalPlaces": 2, - "min": 1, - "units": "mm", - "defaultValue": 6.17 -}, -{ - "name": "CameraSensorHeight", - "shortDescription": "Amount of overlap between images in the side facing direction.", - "type": "double", - "decimalPlaces": 2, - "min": 1, - "units": "mm", - "defaultValue": 4.55 -}, -{ - "name": "CameraResolutionWidth", - "shortDescription": "Camera resolution width.", - "type": "uint32", - "min": 1, - "units": "px", - "defaultValue": 4000 -}, -{ - "name": "CameraResolutionHeight", - "shortDescription": "Camera resolution height.", - "type": "uint32", - "min": 1, - "units": "px", - "defaultValue": 3000 -}, -{ - "name": "CameraFocalLength", - "shortDescription": "Focal length of camera lens.", - "type": "double", - "decimalPlaces": 1, - "min": 1, - "units": "mm", - "defaultValue": 4.5 -}, -{ - "name": "CameraTriggerDistance", - "shortDescription": "Distance between each triggering of the camera. 0 specifies not camera trigger.", - "type": "double", - "decimalPlaces": 2, - "min": 0, - "units": "m", - "defaultValue": 25 -}, -{ - "name": "CameraTriggerInTurnaround", - "shortDescription": "Camera continues taking images in turnarounds.", - "type": "bool", - "defaultValue": true -}, -{ - "name": "HoverAndCapture", - "shortDescription": "Hover at each image point and take image", - "type": "bool", - "defaultValue": false -}, -{ - "name": "CameraOrientationLandscape", - "shortDescription": "Camera on vehicle is in landscape orientation.", - "type": "bool", - "defaultValue": 1 -}, -{ - "name": "FixedValueIsAltitude", - "shortDescription": "The altitude is kep constant while ground resolution changes.", + "name": "FlyAlternateTransects", + "shortDescription": "Fly every other transect in each pass.", "type": "bool", "defaultValue": false -}, -{ - "name": "Camera", - "shortDescription": "Camera selected for Survey.", - "type": "string", - "defaultValue": "" -}, -{ - "name": "GridEntryLocation", - "shortDescription": "Location for entry point into survey area", - "type": "uint32", - "enumStrings": "Position 1,Position 2,Position 3,Position 4", - "enumValues": "0,1,2,3", - "defaultValue": 0 } ] diff --git a/src/MissionManager/SurveyComplexItem.cc b/src/MissionManager/SurveyComplexItem.cc index 4df64aa29588fc96799daa1588426a5552d75775..896a0f35e2fdff15a08da6375ddd6c63f2de42be 100644 --- a/src/MissionManager/SurveyComplexItem.cc +++ b/src/MissionManager/SurveyComplexItem.cc @@ -27,6 +27,7 @@ const char* SurveyComplexItem::jsonV3ComplexItemTypeValue = "survey"; const char* SurveyComplexItem::settingsGroup = "Survey"; const char* SurveyComplexItem::gridAngleName = "GridAngle"; const char* SurveyComplexItem::gridEntryLocationName = "GridEntryLocation"; +const char* SurveyComplexItem::flyAlternateTransectsName = "FlyAlternateTransects"; const char* SurveyComplexItem::_jsonGridAngleKey = "angle"; const char* SurveyComplexItem::_jsonEntryPointKey = "entryLocation"; @@ -56,12 +57,13 @@ const char* SurveyComplexItem::_jsonV3ManualGridKey = "manualG const char* SurveyComplexItem::_jsonV3CameraOrientationLandscapeKey = "orientationLandscape"; const char* SurveyComplexItem::_jsonV3FixedValueIsAltitudeKey = "fixedValueIsAltitude"; const char* SurveyComplexItem::_jsonV3Refly90DegreesKey = "refly90Degrees"; - +const char* SurveyComplexItem::_jsonFlyAlternateTransectsKey = "flyAlternateTransects"; SurveyComplexItem::SurveyComplexItem(Vehicle* vehicle, bool flyView, QObject* parent) : TransectStyleComplexItem (vehicle, flyView, settingsGroup, parent) , _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/Survey.SettingsGroup.json"), this)) , _gridAngleFact (settingsGroup, _metaDataMap[gridAngleName]) + , _flyAlternateTransectsFact(settingsGroup, _metaDataMap[flyAlternateTransectsName]) , _entryPoint (EntryLocationTopLeft) { _editorQml = "qrc:/qml/SurveyItemEditor.qml"; @@ -79,9 +81,11 @@ SurveyComplexItem::SurveyComplexItem(Vehicle* vehicle, bool flyView, QObject* pa } connect(&_gridAngleFact, &Fact::valueChanged, this, &SurveyComplexItem::_setDirty); + connect(&_flyAlternateTransectsFact,&Fact::valueChanged, this, &SurveyComplexItem::_setDirty); connect(this, &SurveyComplexItem::refly90DegreesChanged, this, &SurveyComplexItem::_setDirty); connect(&_gridAngleFact, &Fact::valueChanged, this, &SurveyComplexItem::_rebuildTransects); + connect(&_flyAlternateTransectsFact,&Fact::valueChanged, this, &SurveyComplexItem::_rebuildTransects); connect(this, &SurveyComplexItem::refly90DegreesChanged, this, &SurveyComplexItem::_rebuildTransects); // FIXME: Shouldn't these be in TransectStyleComplexItem? They are also in CorridorScanComplexItem constructur @@ -99,6 +103,7 @@ void SurveyComplexItem::save(QJsonArray& planItems) saveObject[VisualMissionItem::jsonTypeKey] = VisualMissionItem::jsonTypeComplexItemValue; saveObject[ComplexMissionItem::jsonComplexItemTypeKey] = jsonComplexItemTypeValue; saveObject[_jsonGridAngleKey] = _gridAngleFact.rawValue().toDouble(); + saveObject[_jsonFlyAlternateTransectsKey] = _flyAlternateTransectsFact.rawValue().toBool(); saveObject[_jsonEntryPointKey] = _entryPoint; // Polygon shape @@ -152,8 +157,9 @@ bool SurveyComplexItem::_loadV4(const QJsonObject& complexObject, int sequenceNu QList keyInfoList = { { VisualMissionItem::jsonTypeKey, QJsonValue::String, true }, { ComplexMissionItem::jsonComplexItemTypeKey, QJsonValue::String, true }, - { _jsonEntryPointKey, QJsonValue::Double, true }, + { _jsonEntryPointKey, QJsonValue::Double, true }, { _jsonGridAngleKey, QJsonValue::Double, true }, + { _jsonFlyAlternateTransectsKey, QJsonValue::Double, false }, }; if (!JsonHelper::validateKeys(complexObject, keyInfoList, errorString)) { return false; @@ -180,7 +186,9 @@ bool SurveyComplexItem::_loadV4(const QJsonObject& complexObject, int sequenceNu return false; } - _gridAngleFact.setRawValue(complexObject[_jsonGridAngleKey].toDouble()); + _gridAngleFact.setRawValue (complexObject[_jsonGridAngleKey].toDouble()); + _flyAlternateTransectsFact.setRawValue (complexObject[_jsonFlyAlternateTransectsKey].toBool(false)); + _entryPoint = complexObject[_jsonEntryPointKey].toInt(); _ignoreRecalc = false; @@ -1274,6 +1282,21 @@ void SurveyComplexItem::_rebuildTransectsPhase1Worker(bool refly) _optimizeTransectsForShortestDistance(_transects.last().last().coord, transects); } + if (_flyAlternateTransectsFact.rawValue().toBool()) { + QList> alternatingTransects; + for (int i=0; i0; i--) { + if (i & 1) { + alternatingTransects.append(transects[i]); + } + } + transects = alternatingTransects; + } + // Adjust to lawnmower pattern bool reverseVertices = false; for (int i=0; i _metaDataMap; SettingsFact _gridAngleFact; + SettingsFact _flyAlternateTransectsFact; int _entryPoint; static const char* _jsonGridAngleKey; static const char* _jsonEntryPointKey; + static const char* _jsonFlyAlternateTransectsKey; static const char* _jsonV3GridObjectKey; static const char* _jsonV3GridAltitudeKey; diff --git a/src/MissionManager/SurveyComplexItemTest.cc b/src/MissionManager/SurveyComplexItemTest.cc index 2f98dc55f71a05d5cb867d20110f80825b621f08..b7a534c8f1c81e8967d6dc232d6d4faa0fa89f1d 100644 --- a/src/MissionManager/SurveyComplexItemTest.cc +++ b/src/MissionManager/SurveyComplexItemTest.cc @@ -70,7 +70,7 @@ void SurveyComplexItemTest::_testDirty(void) // These facts should set dirty when changed QList rgFacts; - rgFacts << _surveyItem->gridAngle(); + rgFacts << _surveyItem->gridAngle() << _surveyItem->flyAlternateTransects(); foreach(Fact* fact, rgFacts) { qDebug() << fact->name(); QVERIFY(!_surveyItem->dirty()); diff --git a/src/PlanView/SurveyItemEditor.qml b/src/PlanView/SurveyItemEditor.qml index b99bf0fc5068de24341c527b3ea51819860b9949..d04115b6b3ee8dff2251f620b3ac6db8590bca1e 100644 --- a/src/PlanView/SurveyItemEditor.qml +++ b/src/PlanView/SurveyItemEditor.qml @@ -130,6 +130,13 @@ Rectangle { Layout.columnSpan: 2 } + FactCheckBox { + text: qsTr("Fly alternate transects") + fact: missionItem.flyAlternateTransects + visible: _vehicle.fixedWing + Layout.columnSpan: 2 + } + QGCCheckBox { id: relAlt anchors.left: parent.left