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
5b94043d
Unverified
Commit
5b94043d
authored
Jan 19, 2018
by
Don Gagne
Committed by
GitHub
Jan 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6051 from DonLakeFlyer/StructureHeight
Structure Scan: Structure height support
parents
cf4bbcc9
37c29077
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
12 deletions
+64
-12
CameraCalc.h
src/MissionManager/CameraCalc.h
+6
-4
MissionSettingsItem.cc
src/MissionManager/MissionSettingsItem.cc
+1
-1
StructureScanComplexItem.cc
src/MissionManager/StructureScanComplexItem.cc
+32
-4
StructureScanComplexItem.h
src/MissionManager/StructureScanComplexItem.h
+5
-0
CameraCalc.qml
src/PlanView/CameraCalc.qml
+3
-0
StructureScanEditor.qml
src/PlanView/StructureScanEditor.qml
+17
-3
No files found.
src/MissionManager/CameraCalc.h
View file @
5b94043d
...
...
@@ -21,8 +21,9 @@ public:
CameraCalc
(
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
QString
cameraName
READ
cameraName
WRITE
setCameraName
NOTIFY
cameraNameChanged
)
Q_PROPERTY
(
QString
customCameraName
READ
customCameraName
CONSTANT
)
// Camera name for custom camera setting
Q_PROPERTY
(
QString
manualCameraName
READ
manualCameraName
CONSTANT
)
// Camera name for manual camera setting
Q_PROPERTY
(
QString
customCameraName
READ
customCameraName
CONSTANT
)
///< Camera name for custom camera setting
Q_PROPERTY
(
QString
manualCameraName
READ
manualCameraName
CONSTANT
)
///< Camera name for manual camera setting
Q_PROPERTY
(
bool
isManualCamera
READ
isManualCamera
NOTIFY
cameraNameChanged
)
///< true: using manual camera
Q_PROPERTY
(
Fact
*
valueSetIsDistance
READ
valueSetIsDistance
CONSTANT
)
///< true: distance specified, resolution calculated
Q_PROPERTY
(
Fact
*
distanceToSurface
READ
distanceToSurface
CONSTANT
)
///< Distance to surface for image foot print calculation
Q_PROPERTY
(
Fact
*
imageDensity
READ
imageDensity
CONSTANT
)
///< Image density on surface (cm/px)
...
...
@@ -48,8 +49,9 @@ public:
Fact
*
adjustedFootprintSide
(
void
)
{
return
&
_adjustedFootprintSideFact
;
}
Fact
*
adjustedFootprintFrontal
(
void
)
{
return
&
_adjustedFootprintFrontalFact
;
}
double
imageFootprintSide
(
void
)
const
{
return
_imageFootprintSide
;
}
double
imageFootprintFrontal
(
void
)
const
{
return
_imageFootprintFrontal
;
}
bool
isManualCamera
(
void
)
{
return
cameraName
()
==
manualCameraName
();
}
double
imageFootprintSide
(
void
)
const
{
return
_imageFootprintSide
;
}
double
imageFootprintFrontal
(
void
)
const
{
return
_imageFootprintFrontal
;
}
bool
dirty
(
void
)
const
{
return
_dirty
;
}
void
setDirty
(
bool
dirty
);
...
...
src/MissionManager/MissionSettingsItem.cc
View file @
5b94043d
...
...
@@ -302,6 +302,6 @@ void MissionSettingsItem::_setHomeAltFromTerrain(double terrainAltitude)
_plannedHomePositionAltitudeFact
.
setSendValueChangedSignals
(
false
);
_plannedHomePositionAltitudeFact
.
setRawValue
(
terrainAltitude
);
_plannedHomePositionAltitudeFact
.
clearDeferredValueChangeSignal
();
_plannedHomePositionAltitudeFact
.
setSendValueChangedSignals
(
fals
e
);
_plannedHomePositionAltitudeFact
.
setSendValueChangedSignals
(
tru
e
);
}
}
src/MissionManager/StructureScanComplexItem.cc
View file @
5b94043d
...
...
@@ -22,6 +22,7 @@
QGC_LOGGING_CATEGORY
(
StructureScanComplexItemLog
,
"StructureScanComplexItemLog"
)
const
char
*
StructureScanComplexItem
::
_altitudeFactName
=
"Altitude"
;
const
char
*
StructureScanComplexItem
::
_structureHeightFactName
=
"StructureHeight"
;
const
char
*
StructureScanComplexItem
::
_layersFactName
=
"Layers"
;
const
char
*
StructureScanComplexItem
::
_gimbalPitchFactName
=
"GimbalPitch"
;
const
char
*
StructureScanComplexItem
::
_gimbalYawFactName
=
"GimbalYaw"
;
...
...
@@ -71,6 +72,10 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, QObject* pa
connect
(
&
_gimbalPitchFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
&
_gimbalYawFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
&
_layersFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_recalcLayerInfo
);
connect
(
&
_structureHeightFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_recalcLayerInfo
);
connect
(
_cameraCalc
.
adjustedFootprintFrontal
(),
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_recalcLayerInfo
);
connect
(
this
,
&
StructureScanComplexItem
::
altitudeRelativeChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
this
,
&
StructureScanComplexItem
::
altitudeRelativeChanged
,
this
,
&
StructureScanComplexItem
::
coordinateHasRelativeAltitudeChanged
);
connect
(
this
,
&
StructureScanComplexItem
::
altitudeRelativeChanged
,
this
,
&
StructureScanComplexItem
::
exitCoordinateHasRelativeAltitudeChanged
);
...
...
@@ -89,6 +94,8 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, QObject* pa
connect
(
&
_flightPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
StructureScanComplexItem
::
_recalcCameraShots
);
connect
(
_cameraCalc
.
adjustedFootprintSide
(),
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_recalcCameraShots
);
connect
(
&
_layersFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_recalcCameraShots
);
_recalcLayerInfo
();
}
void
StructureScanComplexItem
::
_setScanDistance
(
double
scanDistance
)
...
...
@@ -143,13 +150,14 @@ void StructureScanComplexItem::save(QJsonArray& missionItems)
QJsonObject
saveObject
;
// Header
saveObject
[
JsonHelper
::
jsonVersionKey
]
=
1
;
saveObject
[
JsonHelper
::
jsonVersionKey
]
=
2
;
saveObject
[
VisualMissionItem
::
jsonTypeKey
]
=
VisualMissionItem
::
jsonTypeComplexItemValue
;
saveObject
[
ComplexMissionItem
::
jsonComplexItemTypeKey
]
=
jsonComplexItemTypeValue
;
saveObject
[
_gimbalPitchFactName
]
=
_gimbalPitchFact
.
rawValue
().
toDouble
();
saveObject
[
_gimbalYawFactName
]
=
_gimbalYawFact
.
rawValue
().
toDouble
();
saveObject
[
_altitudeFactName
]
=
_altitudeFact
.
rawValue
().
toDouble
();
saveObject
[
_structureHeightFactName
]
=
_structureHeightFact
.
rawValue
().
toDouble
();
saveObject
[
_jsonAltitudeRelativeKey
]
=
_altitudeRelative
;
saveObject
[
_layersFactName
]
=
_layersFact
.
rawValue
().
toDouble
();
...
...
@@ -181,7 +189,8 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
{
_gimbalPitchFactName
,
QJsonValue
::
Double
,
true
},
{
_gimbalYawFactName
,
QJsonValue
::
Double
,
true
},
{
_altitudeFactName
,
QJsonValue
::
Double
,
true
},
{
_jsonAltitudeRelativeKey
,
QJsonValue
::
Bool
,
false
},
{
_structureHeightFactName
,
QJsonValue
::
Double
,
true
},
{
_jsonAltitudeRelativeKey
,
QJsonValue
::
Bool
,
true
},
{
_layersFactName
,
QJsonValue
::
Double
,
true
},
{
_jsonCameraCalcKey
,
QJsonValue
::
Object
,
true
},
};
...
...
@@ -199,7 +208,7 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
}
int
version
=
complexObject
[
JsonHelper
::
jsonVersionKey
].
toInt
();
if
(
version
!=
1
)
{
if
(
version
!=
2
)
{
errorString
=
tr
(
"%1 complex item version %2 not supported"
).
arg
(
jsonComplexItemTypeValue
).
arg
(
version
);
return
false
;
}
...
...
@@ -273,7 +282,9 @@ void StructureScanComplexItem::appendMissionItems(QList<MissionItem*>& items, QO
for
(
int
layer
=
0
;
layer
<
_layersFact
.
rawValue
().
toInt
();
layer
++
)
{
bool
addTriggerStart
=
true
;
double
layerAltitude
=
baseAltitude
+
(
layer
*
_cameraCalc
.
adjustedFootprintFrontal
()
->
rawValue
().
toDouble
());
// 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
());
for
(
int
i
=
0
;
i
<
_flightPolygon
.
count
();
i
++
)
{
QGeoCoordinate
vertexCoord
=
_flightPolygon
.
vertexCoordinate
(
i
);
...
...
@@ -449,3 +460,20 @@ void StructureScanComplexItem::setAltitudeRelative(bool altitudeRelative)
emit
altitudeRelativeChanged
(
altitudeRelative
);
}
}
void
StructureScanComplexItem
::
_recalcLayerInfo
(
void
)
{
if
(
_cameraCalc
.
isManualCamera
())
{
// Structure height is calculated from layer count, layer height.
_structureHeightFact
.
setSendValueChangedSignals
(
false
);
_structureHeightFact
.
setRawValue
(
_layersFact
.
rawValue
().
toInt
()
*
_cameraCalc
.
adjustedFootprintFrontal
()
->
rawValue
().
toDouble
());
_structureHeightFact
.
clearDeferredValueChangeSignal
();
_structureHeightFact
.
setSendValueChangedSignals
(
true
);
}
else
{
// Layer count is calculated from structure and layer heights
_layersFact
.
setSendValueChangedSignals
(
false
);
_layersFact
.
setRawValue
(
qCeil
(
_structureHeightFact
.
rawValue
().
toDouble
()
/
_cameraCalc
.
adjustedFootprintFrontal
()
->
rawValue
().
toDouble
()));
_layersFact
.
clearDeferredValueChangeSignal
();
_layersFact
.
setSendValueChangedSignals
(
true
);
}
}
src/MissionManager/StructureScanComplexItem.h
View file @
5b94043d
...
...
@@ -31,6 +31,7 @@ public:
Q_PROPERTY
(
Fact
*
gimbalPitch
READ
gimbalPitch
CONSTANT
)
Q_PROPERTY
(
Fact
*
gimbalYaw
READ
gimbalYaw
CONSTANT
)
Q_PROPERTY
(
Fact
*
altitude
READ
altitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
structureHeight
READ
structureHeight
CONSTANT
)
Q_PROPERTY
(
Fact
*
layers
READ
layers
CONSTANT
)
Q_PROPERTY
(
bool
altitudeRelative
READ
altitudeRelative
WRITE
setAltitudeRelative
NOTIFY
altitudeRelativeChanged
)
Q_PROPERTY
(
int
cameraShots
READ
cameraShots
NOTIFY
cameraShotsChanged
)
...
...
@@ -41,6 +42,7 @@ public:
CameraCalc
*
cameraCalc
(
void
)
{
return
&
_cameraCalc
;
}
Fact
*
altitude
(
void
)
{
return
&
_altitudeFact
;
}
Fact
*
structureHeight
(
void
)
{
return
&
_structureHeightFact
;
}
Fact
*
layers
(
void
)
{
return
&
_layersFact
;
}
bool
altitudeRelative
(
void
)
const
{
return
_altitudeRelative
;
}
...
...
@@ -110,6 +112,7 @@ private slots:
void
_rebuildFlightPolygon
(
void
);
void
_recalcCameraShots
(
void
);
void
_resetGimbal
(
void
);
void
_recalcLayerInfo
(
void
);
private:
void
_setExitCoordinate
(
const
QGeoCoordinate
&
coordinate
);
...
...
@@ -135,11 +138,13 @@ private:
static
QMap
<
QString
,
FactMetaData
*>
_metaDataMap
;
Fact
_altitudeFact
;
Fact
_structureHeightFact
;
Fact
_layersFact
;
Fact
_gimbalPitchFact
;
Fact
_gimbalYawFact
;
static
const
char
*
_altitudeFactName
;
static
const
char
*
_structureHeightFactName
;
static
const
char
*
_layersFactName
;
static
const
char
*
_gimbalPitchFactName
;
static
const
char
*
_gimbalYawFactName
;
...
...
src/PlanView/CameraCalc.qml
View file @
5b94043d
...
...
@@ -248,6 +248,8 @@ Column {
}
// Calculated values
/*
Taking these out for now since they take up so much space. May come back at a later time.
GridLayout {
anchors.left: parent.left
anchors.right: parent.right
...
...
@@ -269,6 +271,7 @@ Column {
enabled: false
}
} // GridLayout
*/
}
// Column - Camera spec based ui
...
...
src/PlanView/StructureScanEditor.qml
View file @
5b94043d
...
...
@@ -87,7 +87,7 @@ Rectangle {
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
/
2
rowSpacing
:
0
columns
:
3
enabled
:
missionItem
.
cameraCalc
.
cameraName
===
missionItem
.
cameraCalc
.
manualCameraName
visible
:
missionItem
.
cameraCalc
.
isManualCamera
Item
{
width
:
1
;
height
:
1
}
QGCLabel
{
text
:
qsTr
(
"
Pitch
"
)
}
...
...
@@ -126,13 +126,27 @@ Rectangle {
rowSpacing
:
_margin
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Layers
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Structure height
"
)
visible
:
!
missionItem
.
cameraCalc
.
isManualCamera
}
FactTextField
{
fact
:
missionItem
.
structureHeight
Layout.fillWidth
:
true
visible
:
!
missionItem
.
cameraCalc
.
isManualCamera
}
QGCLabel
{
text
:
qsTr
(
"
# Layers
"
)
visible
:
missionItem
.
cameraCalc
.
isManualCamera
}
FactTextField
{
fact
:
missionItem
.
layers
Layout.fillWidth
:
true
visible
:
missionItem
.
cameraCalc
.
isManualCamera
}
QGCLabel
{
text
:
qsTr
(
"
Altitude
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Bottom layer alt
"
)
}
FactTextField
{
fact
:
missionItem
.
altitude
Layout.fillWidth
:
true
...
...
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