Browse Source

Merge pull request #8689 from DonLakeFlyer/TransectFixes

Plan - Terrain Follow: Fix tolerance adjustment step
QGC4.4
Don Gagne 5 years ago committed by GitHub
parent
commit
b1e5c0122d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/FactSystem/FactControls/AltitudeFactTextField.qml
  2. 2
      src/MissionManager/CameraCalc.cc
  3. 7
      src/MissionManager/CameraCalc.h
  4. 2
      src/MissionManager/MissionSettingsItem.cc
  5. 2
      src/MissionManager/TransectStyle.SettingsGroup.json
  6. 53
      src/MissionManager/TransectStyleComplexItem.cc
  7. 5
      src/PlanView/CameraCalcCamera.qml
  8. 6
      src/PlanView/CameraCalcGrid.qml
  9. 7
      src/PlanView/CorridorScanEditor.qml
  10. 5
      src/PlanView/StructureScanEditor.qml
  11. 17
      src/PlanView/SurveyItemEditor.qml

3
src/FactSystem/FactControls/AltitudeFactTextField.qml

@ -22,6 +22,7 @@ FactTextField {
showHelp: true showHelp: true
property int altitudeMode: QGroundControl.AltitudeModeNone property int altitudeMode: QGroundControl.AltitudeModeNone
property bool showAboveTerrainWarning: true
readonly property string _altModeNoneExtraUnits: "" readonly property string _altModeNoneExtraUnits: ""
readonly property string _altModeRelativeExtraUnits: qsTr("(Rel)") readonly property string _altModeRelativeExtraUnits: qsTr("(Rel)")
@ -44,7 +45,7 @@ FactTextField {
_altitudeModeExtraUnits = _altModeAbsoluteExtraUnits _altitudeModeExtraUnits = _altModeAbsoluteExtraUnits
} else if (altitudeMode === QGroundControl.AltitudeModeAboveTerrain) { } else if (altitudeMode === QGroundControl.AltitudeModeAboveTerrain) {
_altitudeModeExtraUnits = _altModeAboveTerrainExtraUnits _altitudeModeExtraUnits = _altModeAboveTerrainExtraUnits
if (!_aboveTerrainWarning.rawValue) { if (!_aboveTerrainWarning.rawValue && showAboveTerrainWarning) {
mainWindow.showComponentDialog(aboveTerrainWarning, qsTr("Warning"), mainWindow.showDialogDefaultWidth, StandardButton.Ok) mainWindow.showComponentDialog(aboveTerrainWarning, qsTr("Warning"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
} }
} else if (missionItem.altitudeMode === QGroundControl.AltitudeModeTerrainFrame) { } else if (missionItem.altitudeMode === QGroundControl.AltitudeModeTerrainFrame) {

2
src/MissionManager/CameraCalc.cc

@ -29,7 +29,7 @@ const char* CameraCalc::_jsonCameraSpecTypeKey = "CameraSpecType";
CameraCalc::CameraCalc(PlanMasterController* masterController, const QString& settingsGroup, QObject* parent) CameraCalc::CameraCalc(PlanMasterController* masterController, const QString& settingsGroup, QObject* parent)
: CameraSpec (settingsGroup, parent) : CameraSpec (settingsGroup, parent)
, _dirty (masterController) , _dirty (false)
, _disableRecalc (false) , _disableRecalc (false)
, _distanceToSurfaceRelative (true) , _distanceToSurfaceRelative (true)
, _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/CameraCalc.FactMetaData.json"), this)) , _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/CameraCalc.FactMetaData.json"), this))

7
src/MissionManager/CameraCalc.h

@ -33,6 +33,13 @@ public:
Q_PROPERTY(Fact* sideOverlap READ sideOverlap CONSTANT) Q_PROPERTY(Fact* sideOverlap READ sideOverlap CONSTANT)
Q_PROPERTY(Fact* adjustedFootprintSide READ adjustedFootprintSide CONSTANT) ///< Side footprint adjusted down for overlap Q_PROPERTY(Fact* adjustedFootprintSide READ adjustedFootprintSide CONSTANT) ///< Side footprint adjusted down for overlap
Q_PROPERTY(Fact* adjustedFootprintFrontal READ adjustedFootprintFrontal CONSTANT) ///< Frontal footprint adjusted down for overlap Q_PROPERTY(Fact* adjustedFootprintFrontal READ adjustedFootprintFrontal CONSTANT) ///< Frontal footprint adjusted down for overlap
// When we are creating a manual grid we still use CameraCalc to store the manual grid information. It's a bastardization of what
// CameraCalc is meant for but it greatly simplifies code and persistance of manual grids.
// grid altitude - distanceToSurface
// grid altitude mode - distanceToSurfaceRelative
// trigger distance - adjustedFootprintFrontal
// transect spacing - adjustedFootprintSide
Q_PROPERTY(bool distanceToSurfaceRelative READ distanceToSurfaceRelative WRITE setDistanceToSurfaceRelative NOTIFY distanceToSurfaceRelativeChanged) Q_PROPERTY(bool distanceToSurfaceRelative READ distanceToSurfaceRelative WRITE setDistanceToSurfaceRelative NOTIFY distanceToSurfaceRelativeChanged)
// The following values are calculated from the camera properties // The following values are calculated from the camera properties

2
src/MissionManager/MissionSettingsItem.cc

@ -190,8 +190,10 @@ void MissionSettingsItem::_setCoordinateWorker(const QGeoCoordinate& coordinate)
_plannedHomePositionCoordinate = coordinate; _plannedHomePositionCoordinate = coordinate;
emit coordinateChanged(coordinate); emit coordinateChanged(coordinate);
emit exitCoordinateChanged(coordinate); emit exitCoordinateChanged(coordinate);
if (_plannedHomePositionFromVehicle) {
_plannedHomePositionAltitudeFact.setRawValue(coordinate.altitude()); _plannedHomePositionAltitudeFact.setRawValue(coordinate.altitude());
} }
}
} }
void MissionSettingsItem::setHomePositionFromVehicle(Vehicle* vehicle) void MissionSettingsItem::setHomePositionFromVehicle(Vehicle* vehicle)

2
src/MissionManager/TransectStyle.SettingsGroup.json

@ -37,7 +37,7 @@
}, },
{ {
"name": "TerrainAdjustTolerance", "name": "TerrainAdjustTolerance",
"shortDescription": "If adjacent terrain waypoints are within this tolerence they will be removed.", "shortDescription": "Additional waypoints within the transect will be added if the terrain altitude difference grows larger than this tolerance.",
"type": "double", "type": "double",
"decimalPlaces": 2, "decimalPlaces": 2,
"min": 0, "min": 0,

53
src/MissionManager/TransectStyleComplexItem.cc

@ -538,6 +538,18 @@ void TransectStyleComplexItem::_adjustTransectsForTerrain(void)
} }
emit lastSequenceNumberChanged(lastSequenceNumber()); emit lastSequenceNumberChanged(lastSequenceNumber());
// Update entry/exit coordinates
if (_transects.count()) {
if (_transects.first().count()) {
_coordinate.setAltitude(_transects.first().first().coord.altitude());
emit coordinateChanged(coordinate());
}
if (_transects.last().count()) {
_exitCoordinate.setAltitude(_transects.last().last().coord.altitude());
emit exitCoordinateChanged(exitCoordinate());
}
}
} }
} }
@ -653,32 +665,25 @@ void TransectStyleComplexItem::_adjustForTolerance(QList<CoordInfo_t>& transect)
{ {
QList<CoordInfo_t> adjustedPoints; QList<CoordInfo_t> adjustedPoints;
if (transect.count()) {
double tolerance = _terrainAdjustToleranceFact.rawValue().toDouble(); double tolerance = _terrainAdjustToleranceFact.rawValue().toDouble();
CoordInfo_t& lastCoordInfo = transect.first();
int coordIndex = 0; adjustedPoints.append(lastCoordInfo);
while (coordIndex < transect.count()) {
const CoordInfo_t& fromCoordInfo = transect[coordIndex];
adjustedPoints.append(fromCoordInfo); int coordIndex = 1;
while (coordIndex < transect.count()) {
// Walk forward until we fall out of tolerence or find a fixed point // Walk forward until we fall out of tolerence. When we fall out of tolerance add that point.
while (++coordIndex < transect.count()) { // We always add non-interstitial points no matter what.
const CoordInfo_t& toCoordInfo = transect[coordIndex]; const CoordInfo_t& nextCoordInfo = transect[coordIndex];
if (toCoordInfo.coordType != CoordTypeInteriorTerrainAdded || qAbs(fromCoordInfo.coord.altitude() - toCoordInfo.coord.altitude()) > tolerance) { if (nextCoordInfo.coordType != CoordTypeInteriorTerrainAdded || qAbs(lastCoordInfo.coord.altitude() - nextCoordInfo.coord.altitude()) > tolerance) {
adjustedPoints.append(toCoordInfo); adjustedPoints.append(nextCoordInfo);
coordIndex++; lastCoordInfo = nextCoordInfo;
break;
} }
coordIndex++;
} }
} }
#if 0
qDebug() << "_adjustForTolerance";
for (const TransectStyleComplexItem::CoordInfo_t& coordInfo: adjustedPoints) {
qDebug() << coordInfo.coordType;
}
#endif
transect = adjustedPoints; transect = adjustedPoints;
} }
@ -686,7 +691,7 @@ void TransectStyleComplexItem::_addInterstitialTerrainPoints(QList<CoordInfo_t>&
{ {
QList<CoordInfo_t> adjustedTransect; QList<CoordInfo_t> adjustedTransect;
double requestedAltitude = _cameraCalc.distanceToSurface()->rawValue().toDouble(); double distanceToSurface = _cameraCalc.distanceToSurface()->rawValue().toDouble();
for (int i=0; i<transect.count() - 1; i++) { for (int i=0; i<transect.count() - 1; i++) {
CoordInfo_t fromCoordInfo = transect[i]; CoordInfo_t fromCoordInfo = transect[i];
@ -697,8 +702,8 @@ void TransectStyleComplexItem::_addInterstitialTerrainPoints(QList<CoordInfo_t>&
const TerrainPathQuery::PathHeightInfo_t& pathHeightInfo = transectPathHeightInfo[i]; const TerrainPathQuery::PathHeightInfo_t& pathHeightInfo = transectPathHeightInfo[i];
fromCoordInfo.coord.setAltitude(pathHeightInfo.heights.first() + requestedAltitude); fromCoordInfo.coord.setAltitude(pathHeightInfo.heights.first() + distanceToSurface);
toCoordInfo.coord.setAltitude(pathHeightInfo.heights.last() + requestedAltitude); toCoordInfo.coord.setAltitude(pathHeightInfo.heights.last() + distanceToSurface);
if (i == 0) { if (i == 0) {
adjustedTransect.append(fromCoordInfo); adjustedTransect.append(fromCoordInfo);
@ -712,7 +717,7 @@ void TransectStyleComplexItem::_addInterstitialTerrainPoints(QList<CoordInfo_t>&
CoordInfo_t interstitialCoordInfo; CoordInfo_t interstitialCoordInfo;
interstitialCoordInfo.coordType = CoordTypeInteriorTerrainAdded; interstitialCoordInfo.coordType = CoordTypeInteriorTerrainAdded;
interstitialCoordInfo.coord = fromCoordInfo.coord.atDistanceAndAzimuth(distance * percentTowardsTo, azimuth); interstitialCoordInfo.coord = fromCoordInfo.coord.atDistanceAndAzimuth(distance * percentTowardsTo, azimuth);
interstitialCoordInfo.coord.setAltitude(interstitialTerrainHeight + requestedAltitude); interstitialCoordInfo.coord.setAltitude(interstitialTerrainHeight + distanceToSurface);
adjustedTransect.append(interstitialCoordInfo); adjustedTransect.append(interstitialCoordInfo);
} }
@ -722,7 +727,7 @@ void TransectStyleComplexItem::_addInterstitialTerrainPoints(QList<CoordInfo_t>&
CoordInfo_t lastCoordInfo = transect.last(); CoordInfo_t lastCoordInfo = transect.last();
const TerrainPathQuery::PathHeightInfo_t& pathHeightInfo = transectPathHeightInfo.last(); const TerrainPathQuery::PathHeightInfo_t& pathHeightInfo = transectPathHeightInfo.last();
lastCoordInfo.coord.setAltitude(pathHeightInfo.heights.last() + requestedAltitude); lastCoordInfo.coord.setAltitude(pathHeightInfo.heights.last() + distanceToSurface);
adjustedTransect.append(lastCoordInfo); adjustedTransect.append(lastCoordInfo);
#if 0 #if 0

5
src/PlanView/CameraCalcCamera.qml

@ -15,11 +15,6 @@ Column {
spacing: _margin spacing: _margin
property var cameraCalc property var cameraCalc
property bool vehicleFlightIsFrontal: true
property string distanceToSurfaceLabel
property int distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
property string frontalDistanceLabel
property string sideDistanceLabel
property real _margin: ScreenTools.defaultFontPixelWidth / 2 property real _margin: ScreenTools.defaultFontPixelWidth / 2
property string _cameraName: cameraCalc.cameraName.value property string _cameraName: cameraCalc.cameraName.value

6
src/PlanView/CameraCalcGrid.qml

@ -87,6 +87,7 @@ Column {
QGCRadioButton { QGCRadioButton {
id: fixedDistanceRadio id: fixedDistanceRadio
leftPadding: 0
text: distanceToSurfaceLabel text: distanceToSurfaceLabel
checked: !!cameraCalc.valueSetIsDistance.value checked: !!cameraCalc.valueSetIsDistance.value
onClicked: cameraCalc.valueSetIsDistance.value = 1 onClicked: cameraCalc.valueSetIsDistance.value = 1
@ -95,13 +96,15 @@ Column {
AltitudeFactTextField { AltitudeFactTextField {
fact: cameraCalc.distanceToSurface fact: cameraCalc.distanceToSurface
altitudeMode: distanceToSurfaceAltitudeMode altitudeMode: distanceToSurfaceAltitudeMode
showAboveTerrainWarning: false
enabled: fixedDistanceRadio.checked enabled: fixedDistanceRadio.checked
Layout.fillWidth: true Layout.fillWidth: true
} }
QGCRadioButton { QGCRadioButton {
id: fixedImageDensityRadio id: fixedImageDensityRadio
text: qsTr("Ground Res") leftPadding: 0
text: qsTr("Grnd Res")
checked: !cameraCalc.valueSetIsDistance.value checked: !cameraCalc.valueSetIsDistance.value
onClicked: cameraCalc.valueSetIsDistance.value = 0 onClicked: cameraCalc.valueSetIsDistance.value = 0
} }
@ -127,6 +130,7 @@ Column {
AltitudeFactTextField { AltitudeFactTextField {
fact: cameraCalc.distanceToSurface fact: cameraCalc.distanceToSurface
altitudeMode: distanceToSurfaceAltitudeMode altitudeMode: distanceToSurfaceAltitudeMode
showAboveTerrainWarning: false
Layout.fillWidth: true Layout.fillWidth: true
} }

7
src/PlanView/CorridorScanEditor.qml

@ -253,13 +253,6 @@ Rectangle {
CameraCalcCamera { CameraCalcCamera {
cameraCalc: missionItem.cameraCalc cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: true
distanceToSurfaceLabel: qsTr("Altitude")
distanceToSurfaceAltitudeMode: missionItem.followTerrain ?
QGroundControl.AltitudeModeAboveTerrain :
missionItem.cameraCalc.distanceToSurfaceRelative
frontalDistanceLabel: qsTr("Trigger Dist")
sideDistanceLabel: qsTr("Spacing")
} }
} }
} }

5
src/PlanView/StructureScanEditor.qml

@ -248,11 +248,6 @@ Rectangle {
CameraCalcCamera { CameraCalcCamera {
cameraCalc: missionItem.cameraCalc cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: false
distanceToSurfaceLabel: qsTr("Scan Distance")
distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
frontalDistanceLabel: qsTr("Layer Height")
sideDistanceLabel: qsTr("Trigger Distance")
} }
} }
} }

17
src/PlanView/SurveyItemEditor.qml

@ -280,16 +280,6 @@ Rectangle {
spacing: _margin spacing: _margin
visible: transectsHeader.checked visible: transectsHeader.checked
/*
Temporarily removed due to bug https://github.com/mavlink/qgroundcontrol/issues/7005
FactCheckBox {
text: qsTr("Split concave polygons")
fact: _splitConcave
visible: _splitConcave.visible
property Fact _splitConcave: missionItem.splitConcavePolygons
}
*/
QGCOptionsComboBox { QGCOptionsComboBox {
Layout.fillWidth: true Layout.fillWidth: true
@ -406,13 +396,6 @@ Rectangle {
CameraCalcCamera { CameraCalcCamera {
cameraCalc: missionItem.cameraCalc cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: true
distanceToSurfaceLabel: qsTr("Altitude")
distanceToSurfaceAltitudeMode: missionItem.followTerrain ?
QGroundControl.AltitudeModeAboveTerrain :
missionItem.cameraCalc.distanceToSurfaceRelative
frontalDistanceLabel: qsTr("Trigger Dist")
sideDistanceLabel: qsTr("Spacing")
} }
} // Camera Column } // Camera Column

Loading…
Cancel
Save