Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
2aa727a1
Commit
2aa727a1
authored
Feb 15, 2019
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
867ea2df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
7 deletions
+43
-7
StructureScan.SettingsGroup.json
src/MissionManager/StructureScan.SettingsGroup.json
+6
-0
StructureScanComplexItem.cc
src/MissionManager/StructureScanComplexItem.cc
+18
-6
StructureScanComplexItem.h
src/MissionManager/StructureScanComplexItem.h
+4
-0
StructureScanEditor.qml
src/PlanView/StructureScanEditor.qml
+15
-1
No files found.
src/MissionManager/StructureScan.SettingsGroup.json
View file @
2aa727a1
...
...
@@ -32,5 +32,11 @@
"units"
:
"m"
,
"min"
:
1
,
"defaultValue"
:
100
},
{
"name"
:
"StartFromTop"
,
"shortDescription"
:
"Start scan from top of structure."
,
"type"
:
"bool"
,
"defaultValue"
:
true
}
]
src/MissionManager/StructureScanComplexItem.cc
View file @
2aa727a1
...
...
@@ -26,6 +26,7 @@ const char* StructureScanComplexItem::altitudeName = "Altitude";
const
char
*
StructureScanComplexItem
::
structureHeightName
=
"StructureHeight"
;
const
char
*
StructureScanComplexItem
::
layersName
=
"Layers"
;
const
char
*
StructureScanComplexItem
::
gimbalPitchName
=
"GimbalPitch"
;
const
char
*
StructureScanComplexItem
::
startFromTopName
=
"StartFromTop"
;
const
char
*
StructureScanComplexItem
::
jsonComplexItemTypeValue
=
"StructureScan"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraCalcKey
=
"CameraCalc"
;
...
...
@@ -46,6 +47,7 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie
,
_structureHeightFact
(
settingsGroup
,
_metaDataMap
[
structureHeightName
])
,
_layersFact
(
settingsGroup
,
_metaDataMap
[
layersName
])
,
_gimbalPitchFact
(
settingsGroup
,
_metaDataMap
[
gimbalPitchName
])
,
_startFromTopFact
(
settingsGroup
,
_metaDataMap
[
startFromTopName
])
{
_editorQml
=
"qrc:/qml/StructureScanEditor.qml"
;
...
...
@@ -54,6 +56,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
(
&
_startFromTopFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
&
_layersFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_recalcLayerInfo
);
connect
(
&
_structureHeightFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_recalcLayerInfo
);
...
...
@@ -156,6 +159,7 @@ void StructureScanComplexItem::save(QJsonArray& missionItems)
saveObject
[
_jsonAltitudeRelativeKey
]
=
_altitudeRelative
;
saveObject
[
layersName
]
=
_layersFact
.
rawValue
().
toDouble
();
saveObject
[
gimbalPitchName
]
=
_gimbalPitchFact
.
rawValue
().
toDouble
();
saveObject
[
startFromTopName
]
=
_startFromTopFact
.
rawValue
().
toBool
();
QJsonObject
cameraCalcObject
;
_cameraCalc
.
save
(
cameraCalcObject
);
...
...
@@ -187,6 +191,7 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
{
_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
{
startFromTopName
,
QJsonValue
::
Bool
,
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
))
{
...
...
@@ -218,6 +223,7 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
_altitudeFact
.
setRawValue
(
complexObject
[
altitudeName
].
toDouble
());
_layersFact
.
setRawValue
(
complexObject
[
layersName
].
toDouble
());
_structureHeightFact
.
setRawValue
(
complexObject
[
structureHeightName
].
toDouble
());
_startFromTopFact
.
setRawValue
(
complexObject
[
startFromTopName
].
toBool
(
false
));
// Set the false if doesn't exist, which matches previous functionality prior to setting
_altitudeRelative
=
complexObject
[
_jsonAltitudeRelativeKey
].
toBool
(
true
);
...
...
@@ -289,8 +295,9 @@ bool StructureScanComplexItem::specifiesCoordinate(void) const
void
StructureScanComplexItem
::
appendMissionItems
(
QList
<
MissionItem
*>&
items
,
QObject
*
missionItemParent
)
{
int
seqNum
=
_sequenceNumber
;
double
baseAltitude
=
_altitudeFact
.
rawValue
().
toDouble
();
int
seqNum
=
_sequenceNumber
;
bool
startFromTop
=
_startFromTopFact
.
rawValue
().
toBool
();
double
startAltitude
=
_altitudeFact
.
rawValue
().
toDouble
()
+
(
startFromTop
?
_structureHeightFact
.
rawValue
().
toDouble
()
:
0
);
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET
,
...
...
@@ -305,10 +312,15 @@ void StructureScanComplexItem::appendMissionItems(QList<MissionItem*>& items, QO
items
.
append
(
item
);
for
(
int
layer
=
0
;
layer
<
_layersFact
.
rawValue
().
toInt
();
layer
++
)
{
bool
addTriggerStart
=
true
;
// baseAltitude is the bottom of the first layer. Hence we need to move up half the distance of the camera footprint to center the camera
// within the layer.
double
layerAltitude
=
baseAltitude
+
(
_cameraCalc
.
adjustedFootprintFrontal
()
->
rawValue
().
toDouble
()
/
2.0
)
+
(
layer
*
_cameraCalc
.
adjustedFootprintFrontal
()
->
rawValue
().
toDouble
());
bool
addTriggerStart
=
true
;
double
layerIncrement
=
(
_cameraCalc
.
adjustedFootprintFrontal
()
->
rawValue
().
toDouble
()
/
2.0
)
+
(
layer
*
_cameraCalc
.
adjustedFootprintFrontal
()
->
rawValue
().
toDouble
());
double
layerAltitude
;
if
(
startFromTop
)
{
layerAltitude
=
startAltitude
-
layerIncrement
;
}
else
{
layerAltitude
=
startAltitude
+
layerIncrement
;
}
for
(
int
i
=
0
;
i
<
_flightPolygon
.
count
();
i
++
)
{
QGeoCoordinate
vertexCoord
=
_flightPolygon
.
vertexCoordinate
(
i
);
...
...
src/MissionManager/StructureScanComplexItem.h
View file @
2aa727a1
...
...
@@ -35,6 +35,7 @@ public:
Q_PROPERTY
(
Fact
*
structureHeight
READ
structureHeight
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
(
int
cameraShots
READ
cameraShots
NOTIFY
cameraShotsChanged
)
Q_PROPERTY
(
double
timeBetweenShots
READ
timeBetweenShots
NOTIFY
timeBetweenShotsChanged
)
...
...
@@ -46,6 +47,7 @@ public:
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
;
}
int
cameraShots
(
void
)
const
;
...
...
@@ -102,6 +104,7 @@ public:
static
const
char
*
structureHeightName
;
static
const
char
*
layersName
;
static
const
char
*
gimbalPitchName
;
static
const
char
*
startFromTopName
;
signals:
void
cameraShotsChanged
(
int
cameraShots
);
...
...
@@ -147,6 +150,7 @@ private:
SettingsFact
_structureHeightFact
;
SettingsFact
_layersFact
;
SettingsFact
_gimbalPitchFact
;
SettingsFact
_startFromTopFact
;
static
const
char
*
_jsonCameraCalcKey
;
static
const
char
*
_jsonAltitudeRelativeKey
;
...
...
src/PlanView/StructureScanEditor.qml
View file @
2aa727a1
...
...
@@ -100,6 +100,14 @@ Rectangle {
rowSpacing
:
_margin
columns
:
2
FactComboBox
{
fact
:
missionItem
.
startFromTop
indexModel
:
true
model
:
[
qsTr
(
"
Start Scan From Bottom
"
),
qsTr
(
"
Start Scan From Top
"
)
]
Layout.columnSpan
:
2
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Structure height
"
)
visible
:
!
missionItem
.
cameraCalc
.
isManualCamera
...
...
@@ -165,13 +173,19 @@ Rectangle {
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
statsHeader
.
checked
QGCLabel
{
text
:
qsTr
(
"
Layers
"
)
}
QGCLabel
{
text
:
missionItem
.
layers
.
valueString
}
QGCLabel
{
text
:
qsTr
(
"
Layer height
"
)
}
QGCLabel
{
text
:
missionItem
.
cameraCalc
.
adjustedFootprintFrontal
.
valueString
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
}
QGCLabel
{
text
:
qsTr
(
"
Photo count
"
)
}
QGCLabel
{
text
:
missionItem
.
cameraShots
}
QGCLabel
{
text
:
qsTr
(
"
Photo interval
"
)
}
QGCLabel
{
text
:
missionItem
.
timeBetweenShots
.
toFixed
(
1
)
+
"
"
+
qsTr
(
"
secs
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Trigger
D
istance
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Trigger
d
istance
"
)
}
QGCLabel
{
text
:
missionItem
.
cameraCalc
.
adjustedFootprintSide
.
valueString
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
}
}
}
// Column
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment