Commit 942ecb8f authored by DonLakeFlyer's avatar DonLakeFlyer

Support for camera min trigger interval validation

parent 22b24fe9
...@@ -17,16 +17,18 @@ CameraMetaData::CameraMetaData(const QString& name, ...@@ -17,16 +17,18 @@ CameraMetaData::CameraMetaData(const QString& name,
double focalLength, double focalLength,
bool landscape, bool landscape,
bool fixedOrientation, bool fixedOrientation,
double minTriggerInterval,
QObject* parent) QObject* parent)
: QObject(parent) : QObject (parent)
, _name(name) , _name (name)
, _sensorWidth(sensorWidth) , _sensorWidth (sensorWidth)
, _sensorHeight(sensorHeight) , _sensorHeight (sensorHeight)
, _imageWidth(imageWidth) , _imageWidth (imageWidth)
, _imageHeight(imageHeight) , _imageHeight (imageHeight)
, _focalLength(focalLength) , _focalLength (focalLength)
, _landscape(landscape) , _landscape (landscape)
, _fixedOrientation(fixedOrientation) , _fixedOrientation (fixedOrientation)
, _minTriggerInterval (minTriggerInterval)
{ {
} }
...@@ -26,6 +26,7 @@ public: ...@@ -26,6 +26,7 @@ public:
double focalLength, double focalLength,
bool landscape, bool landscape,
bool fixedOrientation, bool fixedOrientation,
double minTriggerInterval,
QObject* parent = NULL); QObject* parent = NULL);
Q_PROPERTY(QString name MEMBER _name CONSTANT) ///< Camera name Q_PROPERTY(QString name MEMBER _name CONSTANT) ///< Camera name
...@@ -36,6 +37,7 @@ public: ...@@ -36,6 +37,7 @@ public:
Q_PROPERTY(double focalLength MEMBER _focalLength CONSTANT) ///< Focal length in millimeters Q_PROPERTY(double focalLength MEMBER _focalLength CONSTANT) ///< Focal length in millimeters
Q_PROPERTY(bool landscape MEMBER _landscape CONSTANT) ///< true: camera is in landscape orientation Q_PROPERTY(bool landscape MEMBER _landscape CONSTANT) ///< true: camera is in landscape orientation
Q_PROPERTY(bool fixedOrientation MEMBER _fixedOrientation CONSTANT) ///< true: camera is in fixed orientation Q_PROPERTY(bool fixedOrientation MEMBER _fixedOrientation CONSTANT) ///< true: camera is in fixed orientation
Q_PROPERTY(double minTriggerInterval MEMBER _minTriggerInterval CONSTANT) ///< Minimum time in seconds between each photo taken, 0 for not specified
private: private:
QString _name; QString _name;
...@@ -46,6 +48,7 @@ private: ...@@ -46,6 +48,7 @@ private:
double _focalLength; double _focalLength;
bool _landscape; bool _landscape;
bool _fixedOrientation; bool _fixedOrientation;
double _minTriggerInterval;
}; };
#endif #endif
...@@ -354,6 +354,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle) ...@@ -354,6 +354,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
16, 16,
true, true,
false, false,
0,
this); this);
_cameraList.append(QVariant::fromValue(metaData)); _cameraList.append(QVariant::fromValue(metaData));
...@@ -365,6 +366,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle) ...@@ -365,6 +366,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
5.2, 5.2,
true, true,
false, false,
0,
this); this);
_cameraList.append(QVariant::fromValue(metaData)); _cameraList.append(QVariant::fromValue(metaData));
...@@ -376,6 +378,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle) ...@@ -376,6 +378,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
10.2, 10.2,
true, true,
false, false,
0,
this); this);
_cameraList.append(QVariant::fromValue(metaData)); _cameraList.append(QVariant::fromValue(metaData));
...@@ -387,6 +390,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle) ...@@ -387,6 +390,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
4.5, 4.5,
true, true,
false, false,
0,
this); this);
metaData = new CameraMetaData(tr("Canon EOS-M 22mm"), metaData = new CameraMetaData(tr("Canon EOS-M 22mm"),
...@@ -397,6 +401,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle) ...@@ -397,6 +401,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
22, 22,
true, true,
false, false,
0,
this); this);
_cameraList.append(QVariant::fromValue(metaData)); _cameraList.append(QVariant::fromValue(metaData));
...@@ -408,6 +413,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle) ...@@ -408,6 +413,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
16, 16,
true, true,
false, false,
0,
this); this);
_cameraList.append(QVariant::fromValue(metaData)); _cameraList.append(QVariant::fromValue(metaData));
...@@ -419,6 +425,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle) ...@@ -419,6 +425,7 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
10.4, 10.4,
true, true,
false, false,
0,
this); this);
_cameraList.append(QVariant::fromValue(metaData)); _cameraList.append(QVariant::fromValue(metaData));
} }
......
...@@ -39,6 +39,7 @@ const char* SurveyMissionItem::_jsonCameraSensorHeightKey = "sensorHeigh ...@@ -39,6 +39,7 @@ const char* SurveyMissionItem::_jsonCameraSensorHeightKey = "sensorHeigh
const char* SurveyMissionItem::_jsonCameraResolutionWidthKey = "resolutionWidth"; const char* SurveyMissionItem::_jsonCameraResolutionWidthKey = "resolutionWidth";
const char* SurveyMissionItem::_jsonCameraResolutionHeightKey = "resolutionHeight"; const char* SurveyMissionItem::_jsonCameraResolutionHeightKey = "resolutionHeight";
const char* SurveyMissionItem::_jsonCameraFocalLengthKey = "focalLength"; const char* SurveyMissionItem::_jsonCameraFocalLengthKey = "focalLength";
const char* SurveyMissionItem::_jsonCameraMinTriggerIntervalKey = "minTriggerInterval";
const char* SurveyMissionItem::_jsonCameraObjectKey = "camera"; const char* SurveyMissionItem::_jsonCameraObjectKey = "camera";
const char* SurveyMissionItem::_jsonCameraNameKey = "name"; const char* SurveyMissionItem::_jsonCameraNameKey = "name";
const char* SurveyMissionItem::_jsonManualGridKey = "manualGrid"; const char* SurveyMissionItem::_jsonManualGridKey = "manualGrid";
...@@ -79,6 +80,7 @@ SurveyMissionItem::SurveyMissionItem(Vehicle* vehicle, QObject* parent) ...@@ -79,6 +80,7 @@ SurveyMissionItem::SurveyMissionItem(Vehicle* vehicle, QObject* parent)
, _missionCommandCount(0) , _missionCommandCount(0)
, _refly90Degrees(false) , _refly90Degrees(false)
, _additionalFlightDelaySeconds(0) , _additionalFlightDelaySeconds(0)
, _cameraMinTriggerInterval(0)
, _ignoreRecalc(false) , _ignoreRecalc(false)
, _surveyDistance(0.0) , _surveyDistance(0.0)
, _cameraShots(0) , _cameraShots(0)
...@@ -240,6 +242,7 @@ void SurveyMissionItem::save(QJsonArray& missionItems) ...@@ -240,6 +242,7 @@ void SurveyMissionItem::save(QJsonArray& missionItems)
cameraObject[_jsonCameraResolutionWidthKey] = _cameraResolutionWidthFact.rawValue().toDouble(); cameraObject[_jsonCameraResolutionWidthKey] = _cameraResolutionWidthFact.rawValue().toDouble();
cameraObject[_jsonCameraResolutionHeightKey] = _cameraResolutionHeightFact.rawValue().toDouble(); cameraObject[_jsonCameraResolutionHeightKey] = _cameraResolutionHeightFact.rawValue().toDouble();
cameraObject[_jsonCameraFocalLengthKey] = _cameraFocalLengthFact.rawValue().toDouble(); cameraObject[_jsonCameraFocalLengthKey] = _cameraFocalLengthFact.rawValue().toDouble();
cameraObject[_jsonCameraMinTriggerIntervalKey] = _cameraMinTriggerInterval;
cameraObject[_jsonGroundResolutionKey] = _groundResolutionFact.rawValue().toDouble(); cameraObject[_jsonGroundResolutionKey] = _groundResolutionFact.rawValue().toDouble();
cameraObject[_jsonFrontalOverlapKey] = _frontalOverlapFact.rawValue().toInt(); cameraObject[_jsonFrontalOverlapKey] = _frontalOverlapFact.rawValue().toInt();
cameraObject[_jsonSideOverlapKey] = _sideOverlapFact.rawValue().toInt(); cameraObject[_jsonSideOverlapKey] = _sideOverlapFact.rawValue().toInt();
...@@ -373,6 +376,7 @@ bool SurveyMissionItem::load(const QJsonObject& complexObject, int sequenceNumbe ...@@ -373,6 +376,7 @@ bool SurveyMissionItem::load(const QJsonObject& complexObject, int sequenceNumbe
{ _jsonCameraFocalLengthKey, QJsonValue::Double, true }, { _jsonCameraFocalLengthKey, QJsonValue::Double, true },
{ _jsonCameraNameKey, QJsonValue::String, true }, { _jsonCameraNameKey, QJsonValue::String, true },
{ _jsonCameraOrientationLandscapeKey, QJsonValue::Bool, true }, { _jsonCameraOrientationLandscapeKey, QJsonValue::Bool, true },
{ _jsonCameraMinTriggerIntervalKey, QJsonValue::Double, false },
}; };
if (!JsonHelper::validateKeys(cameraObject, cameraKeyInfoList, errorString)) { if (!JsonHelper::validateKeys(cameraObject, cameraKeyInfoList, errorString)) {
return false; return false;
...@@ -389,6 +393,7 @@ bool SurveyMissionItem::load(const QJsonObject& complexObject, int sequenceNumbe ...@@ -389,6 +393,7 @@ bool SurveyMissionItem::load(const QJsonObject& complexObject, int sequenceNumbe
_cameraResolutionWidthFact.setRawValue (cameraObject[_jsonCameraResolutionWidthKey].toDouble()); _cameraResolutionWidthFact.setRawValue (cameraObject[_jsonCameraResolutionWidthKey].toDouble());
_cameraResolutionHeightFact.setRawValue (cameraObject[_jsonCameraResolutionHeightKey].toDouble()); _cameraResolutionHeightFact.setRawValue (cameraObject[_jsonCameraResolutionHeightKey].toDouble());
_cameraFocalLengthFact.setRawValue (cameraObject[_jsonCameraFocalLengthKey].toDouble()); _cameraFocalLengthFact.setRawValue (cameraObject[_jsonCameraFocalLengthKey].toDouble());
_cameraMinTriggerInterval = cameraObject[_jsonCameraMinTriggerIntervalKey].toDouble(0);
} }
// Polygon shape // Polygon shape
......
...@@ -43,14 +43,15 @@ public: ...@@ -43,14 +43,15 @@ public:
Q_PROPERTY(Fact* cameraResolutionWidth READ cameraResolutionWidth CONSTANT) Q_PROPERTY(Fact* cameraResolutionWidth READ cameraResolutionWidth CONSTANT)
Q_PROPERTY(Fact* cameraResolutionHeight READ cameraResolutionHeight CONSTANT) Q_PROPERTY(Fact* cameraResolutionHeight READ cameraResolutionHeight CONSTANT)
Q_PROPERTY(Fact* cameraFocalLength READ cameraFocalLength CONSTANT) Q_PROPERTY(Fact* cameraFocalLength READ cameraFocalLength CONSTANT)
Q_PROPERTY(Fact* fixedValueIsAltitude READ fixedValueIsAltitude CONSTANT)
Q_PROPERTY(Fact* cameraOrientationLandscape READ cameraOrientationLandscape CONSTANT) Q_PROPERTY(Fact* cameraOrientationLandscape READ cameraOrientationLandscape CONSTANT)
Q_PROPERTY(Fact* fixedValueIsAltitude READ fixedValueIsAltitude CONSTANT)
Q_PROPERTY(Fact* manualGrid READ manualGrid CONSTANT) Q_PROPERTY(Fact* manualGrid READ manualGrid CONSTANT)
Q_PROPERTY(Fact* camera READ camera CONSTANT) Q_PROPERTY(Fact* camera READ camera CONSTANT)
Q_PROPERTY(bool cameraOrientationFixed MEMBER _cameraOrientationFixed NOTIFY cameraOrientationFixedChanged) Q_PROPERTY(bool cameraOrientationFixed MEMBER _cameraOrientationFixed NOTIFY cameraOrientationFixedChanged)
Q_PROPERTY(bool hoverAndCaptureAllowed READ hoverAndCaptureAllowed CONSTANT) Q_PROPERTY(bool hoverAndCaptureAllowed READ hoverAndCaptureAllowed CONSTANT)
Q_PROPERTY(bool refly90Degrees READ refly90Degrees WRITE setRefly90Degrees NOTIFY refly90DegreesChanged) Q_PROPERTY(bool refly90Degrees READ refly90Degrees WRITE setRefly90Degrees NOTIFY refly90DegreesChanged)
Q_PROPERTY(double cameraMinTriggerInterval MEMBER _cameraMinTriggerInterval NOTIFY cameraMinTriggerIntervalChanged)
Q_PROPERTY(double timeBetweenShots READ timeBetweenShots NOTIFY timeBetweenShotsChanged) Q_PROPERTY(double timeBetweenShots READ timeBetweenShots NOTIFY timeBetweenShotsChanged)
Q_PROPERTY(QVariantList gridPoints READ gridPoints NOTIFY gridPointsChanged) Q_PROPERTY(QVariantList gridPoints READ gridPoints NOTIFY gridPointsChanged)
...@@ -165,14 +166,15 @@ public: ...@@ -165,14 +166,15 @@ public:
static const char* cameraName; static const char* cameraName;
signals: signals:
void gridPointsChanged (void); void gridPointsChanged (void);
void cameraShotsChanged (int cameraShots); void cameraShotsChanged (int cameraShots);
void coveredAreaChanged (double coveredArea); void coveredAreaChanged (double coveredArea);
void cameraValueChanged (void); void cameraValueChanged (void);
void gridTypeChanged (QString gridType); void gridTypeChanged (QString gridType);
void timeBetweenShotsChanged (void); void timeBetweenShotsChanged (void);
void cameraOrientationFixedChanged (bool cameraOrientationFixed); void cameraOrientationFixedChanged (bool cameraOrientationFixed);
void refly90DegreesChanged (bool refly90Degrees); void refly90DegreesChanged (bool refly90Degrees);
void cameraMinTriggerIntervalChanged (double cameraMinTriggerInterval);
private slots: private slots:
void _setDirty(void); void _setDirty(void);
...@@ -233,6 +235,7 @@ private: ...@@ -233,6 +235,7 @@ private:
int _missionCommandCount; int _missionCommandCount;
bool _refly90Degrees; bool _refly90Degrees;
double _additionalFlightDelaySeconds; double _additionalFlightDelaySeconds;
double _cameraMinTriggerInterval;
bool _ignoreRecalc; bool _ignoreRecalc;
double _surveyDistance; double _surveyDistance;
...@@ -283,6 +286,7 @@ private: ...@@ -283,6 +286,7 @@ private:
static const char* _jsonCameraResolutionWidthKey; static const char* _jsonCameraResolutionWidthKey;
static const char* _jsonCameraResolutionHeightKey; static const char* _jsonCameraResolutionHeightKey;
static const char* _jsonCameraFocalLengthKey; static const char* _jsonCameraFocalLengthKey;
static const char* _jsonCameraMinTriggerIntervalKey;
static const char* _jsonManualGridKey; static const char* _jsonManualGridKey;
static const char* _jsonCameraObjectKey; static const char* _jsonCameraObjectKey;
static const char* _jsonCameraNameKey; static const char* _jsonCameraNameKey;
......
...@@ -57,7 +57,9 @@ Rectangle { ...@@ -57,7 +57,9 @@ Rectangle {
gridTypeCombo.currentIndex = index gridTypeCombo.currentIndex = index
if (index != 1) { if (index != 1) {
// Specific camera is selected // Specific camera is selected
missionItem.cameraOrientationFixed = _vehicleCameraList[index - _gridTypeCamera].fixedOrientation var camera = _vehicleCameraList[index - _gridTypeCamera]
missionItem.cameraOrientationFixed = camera.fixedOrientation
missionItem.cameraMinTriggerInterval = camera.minTriggerInterval
} }
} }
} }
...@@ -181,6 +183,15 @@ Rectangle { ...@@ -181,6 +183,15 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
spacing: _margin spacing: _margin
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(missionItem.cameraMinTriggerInterval.toFixed(1))
wrapMode: Text.WordWrap
color: qgcPal.warningText
visible: missionItem.manualGrid.value !== true && missionItem.cameraShots > 0 && missionItem.cameraMinTriggerInterval !== 0 && missionItem.cameraMinTriggerInterval > missionItem.timeBetweenShots
}
SectionHeader { SectionHeader {
id: cameraHeader id: cameraHeader
text: qsTr("Camera") text: qsTr("Camera")
...@@ -207,6 +218,7 @@ Rectangle { ...@@ -207,6 +218,7 @@ Rectangle {
missionItem.manualGrid.value = false missionItem.manualGrid.value = false
missionItem.camera.value = gridTypeCombo.textAt(index) missionItem.camera.value = gridTypeCombo.textAt(index)
missionItem.cameraOrientationFixed = false missionItem.cameraOrientationFixed = false
missionItem.cameraMinTriggerInterval = 0
} else { } else {
missionItem.manualGrid.value = false missionItem.manualGrid.value = false
missionItem.camera.value = gridTypeCombo.textAt(index) missionItem.camera.value = gridTypeCombo.textAt(index)
...@@ -219,6 +231,7 @@ Rectangle { ...@@ -219,6 +231,7 @@ Rectangle {
missionItem.cameraFocalLength.rawValue = _vehicleCameraList[listIndex].focalLength missionItem.cameraFocalLength.rawValue = _vehicleCameraList[listIndex].focalLength
missionItem.cameraOrientationLandscape.rawValue = _vehicleCameraList[listIndex].landscape ? 1 : 0 missionItem.cameraOrientationLandscape.rawValue = _vehicleCameraList[listIndex].landscape ? 1 : 0
missionItem.cameraOrientationFixed = _vehicleCameraList[listIndex].fixedOrientation missionItem.cameraOrientationFixed = _vehicleCameraList[listIndex].fixedOrientation
missionItem.cameraMinTriggerInterval = _vehicleCameraList[listIndex].minTriggerInterval
_noCameraValueRecalc = false _noCameraValueRecalc = false
recalcFromCameraValues() recalcFromCameraValues()
} }
......
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