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
e9d5cff5
Commit
e9d5cff5
authored
Jul 14, 2016
by
Kelly Steich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
computing camera shots and covered area
parent
89c87d8c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
3 deletions
+78
-3
MissionItemStatus.qml
src/MissionEditor/MissionItemStatus.qml
+8
-3
ComplexMissionItem.cc
src/MissionManager/ComplexMissionItem.cc
+53
-0
ComplexMissionItem.h
src/MissionManager/ComplexMissionItem.h
+17
-0
No files found.
src/MissionEditor/MissionItemStatus.qml
View file @
e9d5cff5
...
...
@@ -34,25 +34,30 @@ Rectangle {
property
real
_collapsedWidth
:
valueGrid
.
width
+
(
margins
*
2
)
property
bool
_expanded
:
true
property
real
_distance
:
_statusValid
?
_currentMissionItem
.
distance
:
0
property
real
_altDifference
:
_statusValid
?
_currentMissionItem
.
altDifference
:
0
property
real
_gradient
:
_statusValid
||
_currentMissionItem
.
distance
==
0
?
Math
.
atan
(
_currentMissionItem
.
altDifference
/
_currentMissionItem
.
distance
)
:
0
property
real
_gradientPercent
:
isNaN
(
_gradient
)
?
0
:
_gradient
*
100
property
real
_azimuth
:
_statusValid
?
_currentMissionItem
.
azimuth
:
-
1
property
int
_numberShots
:
_currentSurvey
?
_currentMissionItem
.
cameraShots
:
0
property
real
_coveredArea
:
_currentSurvey
?
_currentMissionItem
.
coveredArea
:
0
property
bool
_statusValid
:
currentMissionItem
!=
undefined
property
bool
_vehicleValid
:
_activeVehicle
!=
undefined
property
bool
_missionValid
:
missionItems
!=
undefined
property
bool
_currentSurvey
:
_statusValid
?
currentMissionItem
.
commandName
==
"
Survey
"
:
false
property
bool
_isVTOL
:
_vehicleValid
?
_activeVehicle
.
vtol
:
false
property
string
_distanceText
:
_statusValid
?
QGroundControl
.
metersToAppSettingsDistanceUnits
(
_distance
).
toFixed
(
2
)
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
:
"
"
property
string
_altText
:
_statusValid
?
QGroundControl
.
metersToAppSettingsDistanceUnits
(
_altDifference
).
toFixed
(
2
)
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
:
"
"
property
string
_gradientText
:
_statusValid
?
_gradientPercent
.
toFixed
(
0
)
+
"
%
"
:
"
"
property
string
_azimuthText
:
_statusValid
?
Math
.
round
(
_azimuth
)
:
"
"
property
string
_numberShotsText
:
_currentSurvey
?
"
783
"
:
"
"
property
string
_coveredAreaText
:
_currentSurvey
?
"
87ha / 217acr
"
:
"
"
property
string
_numberShotsText
:
_currentSurvey
?
_numberShots
.
toFixed
(
0
)
:
"
"
property
string
_coveredAreaText
:
_currentSurvey
?
QGroundControl
.
squareMetersToAppSettingsAreaUnits
(
_coveredArea
).
toFixed
(
2
)
+
"
"
+
QGroundControl
.
appSettingsAreaUnitsString
:
"
"
property
string
_totalDistanceText
:
_missionValid
?
"
30.91
"
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
:
"
"
property
string
_totalTimeText
:
_missionValid
?
"
34min 23s
"
:
"
"
property
string
_maxTelemDistText
:
_missionValid
?
"
5.23
"
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
:
"
"
property
bool
_isVTOL
:
_vehicleValid
?
_activeVehicle
.
vtol
:
false
property
string
_hoverDistanceText
:
_missionValid
?
"
0.47
"
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
:
"
"
property
string
_cruiseDistanceText
:
_missionValid
?
"
30.44
"
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
:
"
"
property
string
_hoverTimeText
:
_missionValid
?
"
4min 02s
"
:
"
"
...
...
src/MissionManager/ComplexMissionItem.cc
View file @
e9d5cff5
...
...
@@ -36,6 +36,8 @@ ComplexMissionItem::ComplexMissionItem(Vehicle* vehicle, QObject* parent)
,
_dirty
(
false
)
,
_cameraTrigger
(
false
)
,
_gridAltitudeRelative
(
true
)
,
_cameraShots
(
0
)
,
_coveredArea
(
0.0
)
,
_gridAltitudeFact
(
0
,
"Altitude:"
,
FactMetaData
::
valueTypeDouble
)
,
_gridAngleFact
(
0
,
"Grid angle:"
,
FactMetaData
::
valueTypeDouble
)
,
_gridSpacingFact
(
0
,
"Grid spacing:"
,
FactMetaData
::
valueTypeDouble
)
...
...
@@ -47,10 +49,44 @@ ComplexMissionItem::ComplexMissionItem(Vehicle* vehicle, QObject* parent)
connect
(
&
_gridSpacingFact
,
&
Fact
::
valueChanged
,
this
,
&
ComplexMissionItem
::
_generateGrid
);
connect
(
&
_gridAngleFact
,
&
Fact
::
valueChanged
,
this
,
&
ComplexMissionItem
::
_generateGrid
);
connect
(
&
_cameraTriggerDistanceFact
,
&
Fact
::
valueChanged
,
this
,
&
ComplexMissionItem
::
_generateGrid
);
connect
(
this
,
&
ComplexMissionItem
::
cameraTriggerChanged
,
this
,
&
ComplexMissionItem
::
_cameraTriggerChanged
);
}
const
ComplexMissionItem
&
ComplexMissionItem
::
operator
=
(
const
ComplexMissionItem
&
other
)
{
_vehicle
=
other
.
_vehicle
;
setIsCurrentItem
(
other
.
_isCurrentItem
);
setDirty
(
other
.
_dirty
);
setAltDifference
(
other
.
_altDifference
);
setAltPercent
(
other
.
_altPercent
);
setAzimuth
(
other
.
_azimuth
);
setDistance
(
other
.
_distance
);
setCameraShots
(
other
.
_cameraShots
);
setCoveredArea
(
other
.
_coveredArea
);
return
*
this
;
}
void
ComplexMissionItem
::
setCameraShots
(
int
cameraShots
)
{
if
(
_cameraShots
!=
cameraShots
)
{
_cameraShots
=
cameraShots
;
emit
cameraShotsChanged
(
_cameraShots
);
}
}
void
ComplexMissionItem
::
setCoveredArea
(
double
coveredArea
)
{
if
(
!
qFuzzyCompare
(
_coveredArea
,
coveredArea
))
{
_coveredArea
=
coveredArea
;
emit
coveredAreaChanged
(
_coveredArea
);
}
}
void
ComplexMissionItem
::
clearPolygon
(
void
)
{
// Bug workaround, see below
...
...
@@ -280,17 +316,34 @@ void ComplexMissionItem::_generateGrid(void)
qCDebug
(
ComplexMissionItemLog
)
<<
_polygonPath
[
i
].
value
<
QGeoCoordinate
>
()
<<
polygonPoints
.
last
().
x
()
<<
polygonPoints
.
last
().
y
();
}
double
coveredArea
=
0.0
;
for
(
int
i
=
0
;
i
<
polygonPoints
.
count
();
i
++
)
{
if
(
i
!=
0
)
{
coveredArea
+=
polygonPoints
[
i
-
1
].
x
()
*
polygonPoints
[
i
].
y
()
-
polygonPoints
[
i
].
x
()
*
polygonPoints
[
i
-
1
].
y
();
}
else
{
coveredArea
+=
polygonPoints
.
last
().
x
()
*
polygonPoints
[
i
].
y
()
-
polygonPoints
[
i
].
x
()
*
polygonPoints
.
last
().
y
();
}
}
setCoveredArea
(
0.5
*
fabs
(
coveredArea
));
// Generate grid
_gridGenerator
(
polygonPoints
,
gridPoints
);
double
surveyDistance
=
0.0
;
// Convert to Geo and set altitude
for
(
int
i
=
0
;
i
<
gridPoints
.
count
();
i
++
)
{
QPointF
&
point
=
gridPoints
[
i
];
if
(
i
!=
0
)
{
surveyDistance
+=
sqrt
(
pow
((
gridPoints
[
i
]
-
gridPoints
[
i
-
1
]).
x
(),
2.0
)
+
pow
((
gridPoints
[
i
]
-
gridPoints
[
i
-
1
]).
y
(),
2.0
));
}
QGeoCoordinate
geoCoord
;
convertNedToGeo
(
-
point
.
y
(),
point
.
x
(),
0
,
tangentOrigin
,
&
geoCoord
);
_gridPoints
+=
QVariant
::
fromValue
(
geoCoord
);
}
setCameraShots
((
int
)
floor
(
surveyDistance
/
_cameraTriggerDistanceFact
.
rawValue
().
toDouble
()));
emit
gridPointsChanged
();
emit
lastSequenceNumberChanged
(
lastSequenceNumber
());
...
...
src/MissionManager/ComplexMissionItem.h
View file @
e9d5cff5
...
...
@@ -25,6 +25,8 @@ class ComplexMissionItem : public VisualMissionItem
public:
ComplexMissionItem
(
Vehicle
*
vehicle
,
QObject
*
parent
=
NULL
);
const
ComplexMissionItem
&
operator
=
(
const
ComplexMissionItem
&
other
);
Q_PROPERTY
(
Fact
*
gridAltitude
READ
gridAltitude
CONSTANT
)
Q_PROPERTY
(
bool
gridAltitudeRelative
MEMBER
_gridAltitudeRelative
NOTIFY
gridAltitudeRelativeChanged
)
Q_PROPERTY
(
Fact
*
gridAngle
READ
gridAngle
CONSTANT
)
...
...
@@ -35,6 +37,9 @@ public:
Q_PROPERTY
(
int
lastSequenceNumber
READ
lastSequenceNumber
NOTIFY
lastSequenceNumberChanged
)
Q_PROPERTY
(
QVariantList
gridPoints
READ
gridPoints
NOTIFY
gridPointsChanged
)
Q_PROPERTY
(
int
cameraShots
READ
cameraShots
NOTIFY
cameraShotsChanged
)
Q_PROPERTY
(
double
coveredArea
READ
coveredArea
NOTIFY
coveredAreaChanged
)
Q_INVOKABLE
void
clearPolygon
(
void
);
Q_INVOKABLE
void
addPolygonCoordinate
(
const
QGeoCoordinate
coordinate
);
Q_INVOKABLE
void
adjustPolygonCoordinate
(
int
vertexIndex
,
const
QGeoCoordinate
coordinate
);
...
...
@@ -47,6 +52,12 @@ public:
Fact
*
gridSpacing
(
void
)
{
return
&
_gridSpacingFact
;
}
Fact
*
cameraTriggerDistance
(
void
)
{
return
&
_cameraTriggerDistanceFact
;
}
int
cameraShots
(
void
)
const
{
return
_cameraShots
;
}
double
coveredArea
(
void
)
const
{
return
_coveredArea
;
}
void
setCameraShots
(
int
cameraShots
);
void
setCoveredArea
(
double
coveredArea
);
/// @return The last sequence number used by this item. Takes into account child items of the complex item
int
lastSequenceNumber
(
void
)
const
;
...
...
@@ -91,6 +102,9 @@ signals:
void
cameraTriggerChanged
(
bool
cameraTrigger
);
void
gridAltitudeRelativeChanged
(
bool
gridAltitudeRelative
);
void
cameraShotsChanged
(
int
cameraShots
);
void
coveredAreaChanged
(
double
coveredArea
);
private
slots
:
void
_cameraTriggerChanged
(
void
);
...
...
@@ -115,6 +129,9 @@ private:
bool
_cameraTrigger
;
bool
_gridAltitudeRelative
;
int
_cameraShots
;
double
_coveredArea
;
Fact
_gridAltitudeFact
;
Fact
_gridAngleFact
;
Fact
_gridSpacingFact
;
...
...
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