Unverified Commit b91e9897 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7239 from DonLakeFlyer/StructureScanFixes

Structure scan fixes (V2)
parents a40661ca 92e497da
......@@ -6,7 +6,7 @@ Note: This file only contains high level features or important fixes.
### 3.6.0 - Daily Build
* No changes yet
* Major rewrite and bug fix pass through Structure Scan. Previous version had such bad problems that it can no longer be supported. Plans with Structure Scan will need to be recreated. New QGC will not load old Structure Scan plans.
### 3.5.1 - Not yet released
* Fix tile set count but in OfflineMaps which would cause image and elevation tile set to have incorrect counts and be incorrectly marked as download incomplete.
......
......@@ -10,8 +10,16 @@
"defaultValue": 0
},
{
"name": "Altitude",
"shortDescription": "Altitude for the bottom layer of the structure scan.",
"name": "EntranceAltitude",
"shortDescription": "Vehicle will fly to/from the structure at this altitude.",
"type": "double",
"units": "m",
"decimalPlaces": 1,
"defaultValue": 50
},
{
"name": "ScanBottomAlt",
"shortDescription": "Altitude for the bottomost covered area of the scan. You can adjust this value such that the Bottom Layer Alt will fly above obstacles on the ground.",
"type": "double",
"units": "m",
"decimalPlaces": 1,
......@@ -35,7 +43,7 @@
},
{
"name": "StartFromTop",
"shortDescription": "Start scan from top of structure.",
"shortDescription": "Start scanning from top of structure.",
"type": "bool",
"defaultValue": true
}
......
......@@ -31,32 +31,34 @@ public:
StructureScanComplexItem(Vehicle* vehicle, bool flyView, const QString& kmlOrSHPFile, QObject* parent);
Q_PROPERTY(CameraCalc* cameraCalc READ cameraCalc CONSTANT)
Q_PROPERTY(Fact* altitude READ altitude CONSTANT)
Q_PROPERTY(Fact* entranceAlt READ entranceAlt CONSTANT)
Q_PROPERTY(Fact* structureHeight READ structureHeight CONSTANT)
Q_PROPERTY(Fact* scanBottomAlt READ scanBottomAlt CONSTANT)
Q_PROPERTY(Fact* layers READ layers CONSTANT)
Q_PROPERTY(Fact* gimbalPitch READ gimbalPitch CONSTANT)
Q_PROPERTY(Fact* startFromTop READ startFromTop CONSTANT)
Q_PROPERTY(bool altitudeRelative READ altitudeRelative WRITE setAltitudeRelative NOTIFY altitudeRelativeChanged)
Q_PROPERTY(double bottomFlightAlt READ bottomFlightAlt NOTIFY bottomFlightAltChanged)
Q_PROPERTY(double topFlightAlt READ topFlightAlt NOTIFY topFlightAltChanged)
Q_PROPERTY(int cameraShots READ cameraShots NOTIFY cameraShotsChanged)
Q_PROPERTY(double timeBetweenShots READ timeBetweenShots NOTIFY timeBetweenShotsChanged)
Q_PROPERTY(QGCMapPolygon* structurePolygon READ structurePolygon CONSTANT)
Q_PROPERTY(QGCMapPolygon* flightPolygon READ flightPolygon CONSTANT)
CameraCalc* cameraCalc (void) { return &_cameraCalc; }
Fact* altitude (void) { return &_altitudeFact; }
Fact* entranceAlt (void) { return &_entranceAltFact; }
Fact* scanBottomAlt (void) { return &_scanBottomAltFact; }
Fact* structureHeight (void) { return &_structureHeightFact; }
Fact* layers (void) { return &_layersFact; }
Fact* gimbalPitch (void) { return &_gimbalPitchFact; }
Fact* startFromTop (void) { return &_startFromTopFact; }
bool altitudeRelative (void) const { return _altitudeRelative; }
double bottomFlightAlt (void);
double topFlightAlt (void);
int cameraShots (void) const;
double timeBetweenShots (void);
QGCMapPolygon* structurePolygon (void) { return &_structurePolygon; }
QGCMapPolygon* flightPolygon (void) { return &_flightPolygon; }
void setAltitudeRelative (bool altitudeRelative);
Q_INVOKABLE void rotateEntryPoint(void);
// Overrides from ComplexMissionItem
......@@ -88,8 +90,8 @@ public:
void applyNewAltitude (double newAltitude) final;
double additionalTimeDelay (void) const final { return 0; }
bool coordinateHasRelativeAltitude (void) const final { return _altitudeRelative; }
bool exitCoordinateHasRelativeAltitude (void) const final { return _altitudeRelative; }
bool coordinateHasRelativeAltitude (void) const final { return true; }
bool exitCoordinateHasRelativeAltitude (void) const final { return true; }
bool exitCoordinateSameAsEntry (void) const final { return true; }
void setDirty (bool dirty) final;
......@@ -100,7 +102,7 @@ public:
static const char* jsonComplexItemTypeValue;
static const char* settingsGroup;
static const char* altitudeName;
static const char* scanBottomAltName;
static const char* structureHeightName;
static const char* layersName;
static const char* gimbalPitchName;
......@@ -109,7 +111,8 @@ public:
signals:
void cameraShotsChanged (int cameraShots);
void timeBetweenShotsChanged (void);
void altitudeRelativeChanged (bool altitudeRelative);
void bottomFlightAltChanged (void);
void topFlightAltChanged (void);
private slots:
void _setDirty(void);
......@@ -122,6 +125,7 @@ private slots:
void _recalcLayerInfo (void);
void _updateLastSequenceNumber (void);
void _updateGimbalPitch (void);
void _signalTopBottomAltChanged (void);
private:
void _setExitCoordinate(const QGeoCoordinate& coordinate);
......@@ -132,10 +136,8 @@ private:
QMap<QString, FactMetaData*> _metaDataMap;
int _sequenceNumber;
bool _dirty;
QGCMapPolygon _structurePolygon;
QGCMapPolygon _flightPolygon;
bool _altitudeRelative;
int _entryVertex; // Polygon vertext which is used as the mission entry point
bool _ignoreRecalc;
......@@ -146,14 +148,16 @@ private:
CameraCalc _cameraCalc;
SettingsFact _altitudeFact;
SettingsFact _scanBottomAltFact;
SettingsFact _structureHeightFact;
SettingsFact _layersFact;
SettingsFact _gimbalPitchFact;
SettingsFact _startFromTopFact;
SettingsFact _entranceAltFact;
static const char* _jsonCameraCalcKey;
static const char* _jsonAltitudeRelativeKey;
static const char* _entranceAltName; // This value cannot be overriden
friend class StructureScanComplexItemTest;
};
......
......@@ -11,7 +11,7 @@
#include "QGCApplication.h"
StructureScanComplexItemTest::StructureScanComplexItemTest(void)
: _offlineVehicle(NULL)
: _offlineVehicle(nullptr)
{
_polyPoints << QGeoCoordinate(47.633550640000003, -122.08982199) << QGeoCoordinate(47.634129020000003, -122.08887249) <<
QGeoCoordinate(47.633619320000001, -122.08811074) << QGeoCoordinate(47.633189139999999, -122.08900124);
......@@ -59,7 +59,7 @@ void StructureScanComplexItemTest::_testDirty(void)
// These facts should set dirty when changed
QList<Fact*> rgFacts;
rgFacts << _structureScanItem->altitude() << _structureScanItem->layers();
rgFacts << _structureScanItem->entranceAlt() << _structureScanItem->layers();
for(Fact* fact: rgFacts) {
qDebug() << fact->name();
QVERIFY(!_structureScanItem->dirty());
......@@ -74,13 +74,6 @@ void StructureScanComplexItemTest::_testDirty(void)
_multiSpy->clearAllSignals();
}
rgFacts.clear();
QVERIFY(!_structureScanItem->dirty());
_structureScanItem->setAltitudeRelative(!_structureScanItem->altitudeRelative());
QVERIFY(_multiSpy->checkSignalByMask(dirtyChangedMask));
QVERIFY(_multiSpy->pullBoolFromSignalIndex(dirtyChangedIndex));
_structureScanItem->setDirty(false);
_multiSpy->clearAllSignals();
}
void StructureScanComplexItemTest::_initItem(void)
......
......@@ -109,33 +109,27 @@ Rectangle {
}
QGCLabel {
text: qsTr("Structure height")
visible: !missionItem.cameraCalc.isManualCamera
text: qsTr("Structure Height")
}
FactTextField {
fact: missionItem.structureHeight
Layout.fillWidth: true
visible: !missionItem.cameraCalc.isManualCamera
}
QGCLabel {
text: qsTr("# Layers")
visible: missionItem.cameraCalc.isManualCamera
}
QGCLabel { text: qsTr("Scan Bottom Alt") }
FactTextField {
fact: missionItem.layers
fact: missionItem.scanBottomAlt
Layout.fillWidth: true
visible: missionItem.cameraCalc.isManualCamera
}
QGCLabel { text: qsTr("Bottom layer alt") }
QGCLabel { text: qsTr("Entrance/Exit Alt") }
FactTextField {
fact: missionItem.altitude
fact: missionItem.entranceAlt
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Gimbal pitch")
text: qsTr("Gimbal Pitch")
visible: missionItem.cameraCalc.isManualCamera
}
FactTextField {
......@@ -143,13 +137,6 @@ Rectangle {
Layout.fillWidth: true
visible: missionItem.cameraCalc.isManualCamera
}
QGCCheckBox {
text: qsTr("Relative altitude")
checked: missionItem.altitudeRelative
Layout.columnSpan: 2
onClicked: missionItem.altitudeRelative = checked
}
}
Item {
......@@ -176,16 +163,22 @@ Rectangle {
QGCLabel { text: qsTr("Layers") }
QGCLabel { text: missionItem.layers.valueString }
QGCLabel { text: qsTr("Layer height") }
QGCLabel { text: qsTr("Layer Height") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintFrontal.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Photo count") }
QGCLabel { text: qsTr("Top Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.topFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Bottom Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.bottomFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Photo Count") }
QGCLabel { text: missionItem.cameraShots }
QGCLabel { text: qsTr("Photo interval") }
QGCLabel { text: qsTr("Photo Interval") }
QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") }
QGCLabel { text: qsTr("Trigger distance") }
QGCLabel { text: qsTr("Trigger Distance") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintSide.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
}
} // Column
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment