Commit 604d4051 authored by DonLakeFlyer's avatar DonLakeFlyer

Add ability to set Gimbal Pitch on manual scan

parent 07d998cf
......@@ -9,16 +9,6 @@
"decimalPlaces": 0,
"defaultValue": 0
},
{
"name": "GimbalYaw",
"shortDescription": "Gimbal yaw rotation.",
"type": "double",
"units": "deg",
"min": -180.0,
"max": 180.0,
"decimalPlaces": 0,
"defaultValue": 90
},
{
"name": "Altitude",
"shortDescription": "Altitude for the bottom layer of the structure scan.",
......@@ -41,32 +31,5 @@
"units": "m",
"min": 1,
"defaultValue": 100
},
{
"name": "Layer distance",
"shortDescription": "Distance between each layer.",
"type": "double",
"decimalPlaces": 2,
"min": 0,
"units": "m",
"defaultValue": 25
},
{
"name": "Scan distance",
"shortDescription": "Scan distance away from structure.",
"type": "double",
"decimalPlaces": 2,
"min": 0,
"units": "m",
"defaultValue": 25
},
{
"name": "Trigger distance",
"shortDescription": "Distance between each triggering of the camera. 0 specifies not camera trigger.",
"type": "double",
"decimalPlaces": 2,
"min": 0,
"units": "m",
"defaultValue": 25
}
]
......@@ -25,6 +25,7 @@ const char* StructureScanComplexItem::settingsGroup = "StructureSc
const char* StructureScanComplexItem::altitudeName = "Altitude";
const char* StructureScanComplexItem::structureHeightName = "StructureHeight";
const char* StructureScanComplexItem::layersName = "Layers";
const char* StructureScanComplexItem::gimbalPitchName = "GimbalPitch";
const char* StructureScanComplexItem::jsonComplexItemTypeValue = "StructureScan";
const char* StructureScanComplexItem::_jsonCameraCalcKey = "CameraCalc";
......@@ -44,6 +45,7 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie
, _altitudeFact (settingsGroup, _metaDataMap[altitudeName])
, _structureHeightFact (settingsGroup, _metaDataMap[structureHeightName])
, _layersFact (settingsGroup, _metaDataMap[layersName])
, _gimbalPitchFact (settingsGroup, _metaDataMap[gimbalPitchName])
{
_editorQml = "qrc:/qml/StructureScanEditor.qml";
......@@ -51,6 +53,7 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie
connect(&_altitudeFact, &Fact::valueChanged, this, &StructureScanComplexItem::_setDirty);
connect(&_layersFact, &Fact::valueChanged, this, &StructureScanComplexItem::_setDirty);
connect(&_gimbalPitchFact, &Fact::valueChanged, this, &StructureScanComplexItem::_setDirty);
connect(&_layersFact, &Fact::valueChanged, this, &StructureScanComplexItem::_recalcLayerInfo);
connect(&_structureHeightFact, &Fact::valueChanged, this, &StructureScanComplexItem::_recalcLayerInfo);
......@@ -76,6 +79,8 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie
connect(_cameraCalc.adjustedFootprintSide(), &Fact::valueChanged, this, &StructureScanComplexItem::_recalcCameraShots);
connect(&_layersFact, &Fact::valueChanged, this, &StructureScanComplexItem::_recalcCameraShots);
connect(&_cameraCalc, &CameraCalc::isManualCameraChanged, this, &StructureScanComplexItem::_updateGimbalPitch);
_recalcLayerInfo();
if (!kmlFile.isEmpty()) {
......@@ -147,9 +152,10 @@ void StructureScanComplexItem::save(QJsonArray& missionItems)
saveObject[ComplexMissionItem::jsonComplexItemTypeKey] = jsonComplexItemTypeValue;
saveObject[altitudeName] = _altitudeFact.rawValue().toDouble();
saveObject[structureHeightName] = _structureHeightFact.rawValue().toDouble();
saveObject[_jsonAltitudeRelativeKey] = _altitudeRelative;
saveObject[structureHeightName] = _structureHeightFact.rawValue().toDouble();
saveObject[_jsonAltitudeRelativeKey] = _altitudeRelative;
saveObject[layersName] = _layersFact.rawValue().toDouble();
saveObject[gimbalPitchName] = _gimbalPitchFact.rawValue().toDouble();
QJsonObject cameraCalcObject;
_cameraCalc.save(cameraCalcObject);
......@@ -180,6 +186,7 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
{ structureHeightName, QJsonValue::Double, true },
{ _jsonAltitudeRelativeKey, QJsonValue::Bool, true },
{ layersName, QJsonValue::Double, true },
{ gimbalPitchName, QJsonValue::Double, false }, // This value was added after initial implementation so may be missing from older files
{ _jsonCameraCalcKey, QJsonValue::Object, true },
};
if (!JsonHelper::validateKeys(complexObject, keyInfoList, errorString)) {
......@@ -212,6 +219,12 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
_layersFact.setRawValue (complexObject[layersName].toDouble());
_altitudeRelative = complexObject[_jsonAltitudeRelativeKey].toBool(true);
double gimbalPitchValue = 0;
if (complexObject.contains(gimbalPitchName)) {
gimbalPitchValue = complexObject[gimbalPitchName].toDouble();
}
_gimbalPitchFact.setRawValue(gimbalPitchValue);
if (!_structurePolygon.loadFromJson(complexObject, true /* required */, errorString)) {
_structurePolygon.clear();
return false;
......@@ -256,11 +269,12 @@ void StructureScanComplexItem::appendMissionItems(QList<MissionItem*>& items, QO
MissionItem* item = new MissionItem(seqNum++,
MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET,
MAV_FRAME_MISSION,
0, 0, 0, 0, // param 1-4 not used
0, 0, // Pitch and Roll stay in standard orientation
90, // 90 degreee yaw offset to point to structure
true, // autoContinue
false, // isCurrentItem
0, 0, 0, 0, // param 1-4 not used
_gimbalPitchFact.rawValue().toDouble(),
0, // Roll stays in standard orientation
90, // 90 degreee yaw offset to point to structure
true, // autoContinue
false, // isCurrentItem
missionItemParent);
items.append(item);
......@@ -464,3 +478,10 @@ void StructureScanComplexItem::_recalcLayerInfo(void)
_layersFact.setSendValueChangedSignals(true);
}
}
void StructureScanComplexItem::_updateGimbalPitch(void)
{
if (!_cameraCalc.isManualCamera()) {
_gimbalPitchFact.setRawValue(0);
}
}
......@@ -34,6 +34,7 @@ public:
Q_PROPERTY(Fact* altitude READ altitude CONSTANT)
Q_PROPERTY(Fact* structureHeight READ structureHeight CONSTANT)
Q_PROPERTY(Fact* layers READ layers CONSTANT)
Q_PROPERTY(Fact* gimbalPitch READ gimbalPitch CONSTANT)
Q_PROPERTY(bool altitudeRelative READ altitudeRelative WRITE setAltitudeRelative NOTIFY altitudeRelativeChanged)
Q_PROPERTY(int cameraShots READ cameraShots NOTIFY cameraShotsChanged)
Q_PROPERTY(double timeBetweenShots READ timeBetweenShots NOTIFY timeBetweenShotsChanged)
......@@ -44,6 +45,7 @@ public:
Fact* altitude (void) { return &_altitudeFact; }
Fact* structureHeight (void) { return &_structureHeightFact; }
Fact* layers (void) { return &_layersFact; }
Fact* gimbalPitch (void) { return &_gimbalPitchFact; }
bool altitudeRelative (void) const { return _altitudeRelative; }
int cameraShots (void) const;
......@@ -98,6 +100,7 @@ public:
static const char* altitudeName;
static const char* structureHeightName;
static const char* layersName;
static const char* gimbalPitchName;
signals:
void cameraShotsChanged (int cameraShots);
......@@ -114,6 +117,7 @@ private slots:
void _recalcCameraShots (void);
void _recalcLayerInfo (void);
void _updateLastSequenceNumber (void);
void _updateGimbalPitch (void);
private:
void _setExitCoordinate(const QGeoCoordinate& coordinate);
......@@ -141,6 +145,7 @@ private:
SettingsFact _altitudeFact;
SettingsFact _structureHeightFact;
SettingsFact _layersFact;
SettingsFact _gimbalPitchFact;
static const char* _jsonCameraCalcKey;
static const char* _jsonAltitudeRelativeKey;
......
......@@ -126,6 +126,16 @@ Rectangle {
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Gimbal pitch")
visible: missionItem.cameraCalc.isManualCamera
}
FactTextField {
fact: missionItem.gimbalPitch
Layout.fillWidth: true
visible: missionItem.cameraCalc.isManualCamera
}
QGCCheckBox {
text: qsTr("Relative altitude")
checked: missionItem.altitudeRelative
......
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