Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
259b5dc7
Commit
259b5dc7
authored
Feb 06, 2018
by
DonLakeFlyer
Browse files
Support for images in turnaround
parent
0619847e
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/MissionManager/CorridorScanComplexItem.cc
View file @
259b5dc7
...
...
@@ -59,7 +59,17 @@ void CorridorScanComplexItem::_polylineCountChanged(int count)
int
CorridorScanComplexItem
::
lastSequenceNumber
(
void
)
const
{
return
_sequenceNumber
+
((
_corridorPolyline
.
count
()
+
2
/* trigger start/stop */
+
(
_hasTurnaround
()
?
2
:
0
))
*
_transectCount
());
int
itemCount
=
_transectPoints
.
count
();
// Each transpect point represents a waypoint item
if
(
_cameraTriggerInTurnAroundFact
.
rawValue
().
toDouble
())
{
// Only one camera start and on camera stop
itemCount
+=
2
;
}
else
{
// Each transect will have a camera start and stop in it
itemCount
+=
_transectCount
()
*
2
;
}
return
_sequenceNumber
+
itemCount
-
1
;
}
void
CorridorScanComplexItem
::
save
(
QJsonArray
&
missionItems
)
...
...
@@ -144,11 +154,12 @@ int CorridorScanComplexItem::_transectCount(void) const
void
CorridorScanComplexItem
::
appendMissionItems
(
QList
<
MissionItem
*>&
items
,
QObject
*
missionItemParent
)
{
int
seqNum
=
_sequenceNumber
;
int
pointIndex
=
0
;
int
seqNum
=
_sequenceNumber
;
int
pointIndex
=
0
;
bool
imagesEverywhere
=
_cameraTriggerInTurnAroundFact
.
rawValue
().
toDouble
();
while
(
pointIndex
<
_transectPoints
.
count
())
{
if
(
_hasTurnaround
())
{
if
(
pointIndex
!=
0
&&
_hasTurnaround
())
{
QGeoCoordinate
vertexCoord
=
_transectPoints
[
pointIndex
++
].
value
<
QGeoCoordinate
>
();
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
MAV_CMD_NAV_WAYPOINT
,
...
...
@@ -166,7 +177,7 @@ void CorridorScanComplexItem::appendMissionItems(QList<MissionItem*>& items, QOb
items
.
append
(
item
);
}
bool
addTrigger
=
true
;
bool
addTrigger
=
imagesEverywhere
?
pointIndex
==
0
:
true
;
for
(
int
i
=
0
;
i
<
_corridorPolyline
.
count
();
i
++
)
{
QGeoCoordinate
vertexCoord
=
_transectPoints
[
pointIndex
++
].
value
<
QGeoCoordinate
>
();
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
...
...
@@ -200,19 +211,21 @@ void CorridorScanComplexItem::appendMissionItems(QList<MissionItem*>& items, QOb
}
}
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
MAV_CMD_DO_SET_CAM_TRIGG_DIST
,
MAV_FRAME_MISSION
,
0
,
// stop triggering
0
,
// shutter integration (ignore)
0
,
// trigger immediately when starting
0
,
0
,
0
,
0
,
// param 4-7 unused
true
,
// autoContinue
false
,
// isCurrentItem
missionItemParent
);
items
.
append
(
item
);
if
(
!
imagesEverywhere
)
{
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
MAV_CMD_DO_SET_CAM_TRIGG_DIST
,
MAV_FRAME_MISSION
,
0
,
// stop triggering
0
,
// shutter integration (ignore)
0
,
// trigger immediately when starting
0
,
0
,
0
,
0
,
// param 4-7 unused
true
,
// autoContinue
false
,
// isCurrentItem
missionItemParent
);
items
.
append
(
item
);
}
if
(
_hasTurnaround
())
{
if
(
_hasTurnaround
()
&&
pointIndex
<
_transectPoints
.
count
()
)
{
QGeoCoordinate
vertexCoord
=
_transectPoints
[
pointIndex
++
].
value
<
QGeoCoordinate
>
();
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
MAV_CMD_NAV_WAYPOINT
,
...
...
@@ -230,6 +243,20 @@ void CorridorScanComplexItem::appendMissionItems(QList<MissionItem*>& items, QOb
items
.
append
(
item
);
}
}
if
(
imagesEverywhere
)
{
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
MAV_CMD_DO_SET_CAM_TRIGG_DIST
,
MAV_FRAME_MISSION
,
0
,
// stop triggering
0
,
// shutter integration (ignore)
0
,
// trigger immediately when starting
0
,
0
,
0
,
0
,
// param 4-7 unused
true
,
// autoContinue
false
,
// isCurrentItem
missionItemParent
);
items
.
append
(
item
);
}
}
void
CorridorScanComplexItem
::
applyNewAltitude
(
double
newAltitude
)
...
...
@@ -388,6 +415,21 @@ void CorridorScanComplexItem::_rebuildTransects(void)
normalizedTransectPosition
+=
transectSpacing
;
}
// At this point _transectPoints has an extra turnaround segment at the beginning and end.
// These must be remove for the correcvt flight pattern.
_transectPoints
.
takeFirst
();
_transectPoints
.
takeLast
();
}
// Calculate distance flown for complex item
_complexDistance
=
0
;
for
(
int
i
=
0
;
i
<
_transectPoints
.
count
()
-
2
;
i
++
)
{
_complexDistance
+=
_transectPoints
[
i
].
value
<
QGeoCoordinate
>
().
distanceTo
(
_transectPoints
[
i
+
1
].
value
<
QGeoCoordinate
>
());
}
if
(
_cameraTriggerInTurnAroundFact
.
rawValue
().
toDouble
())
{
_cameraShots
=
qCeil
(
_complexDistance
/
_cameraCalc
.
adjustedFootprintFrontal
()
->
rawValue
().
toDouble
());
}
_coordinate
=
_transectPoints
.
count
()
?
_transectPoints
.
first
().
value
<
QGeoCoordinate
>
()
:
QGeoCoordinate
();
...
...
@@ -395,6 +437,7 @@ void CorridorScanComplexItem::_rebuildTransects(void)
emit
transectPointsChanged
();
emit
cameraShotsChanged
();
emit
complexDistanceChanged
();
emit
coordinateChanged
(
_coordinate
);
emit
exitCoordinateChanged
(
_exitCoordinate
);
}
...
...
src/MissionManager/TransectStyleComplexItem.cc
View file @
259b5dc7
...
...
@@ -35,7 +35,7 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, QString set
,
_sequenceNumber
(
0
)
,
_dirty
(
false
)
,
_ignoreRecalc
(
false
)
,
_
scan
Distance
(
0.
0
)
,
_
complex
Distance
(
0
)
,
_cameraShots
(
0
)
,
_cameraMinTriggerInterval
(
0
)
,
_cameraCalc
(
vehicle
)
...
...
@@ -61,14 +61,6 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, QString set
connect
(
_cameraCalc
.
adjustedFootprintSide
(),
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
_signalLastSequenceNumberChanged
);
connect
(
_cameraCalc
.
adjustedFootprintFrontal
(),
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
_signalLastSequenceNumberChanged
);
connect
(
&
_turnAroundDistanceFact
,
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
cameraShotsChanged
);
connect
(
&
_hoverAndCaptureFact
,
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
cameraShotsChanged
);
connect
(
&
_refly90DegreesFact
,
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
cameraShotsChanged
);
connect
(
&
_surveyAreaPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
TransectStyleComplexItem
::
cameraShotsChanged
);
connect
(
&
_cameraTriggerInTurnAroundFact
,
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
cameraShotsChanged
);
connect
(
_cameraCalc
.
adjustedFootprintSide
(),
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
cameraShotsChanged
);
connect
(
_cameraCalc
.
adjustedFootprintFrontal
(),
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
cameraShotsChanged
);
connect
(
&
_turnAroundDistanceFact
,
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
complexDistanceChanged
);
connect
(
&
_hoverAndCaptureFact
,
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
complexDistanceChanged
);
connect
(
&
_refly90DegreesFact
,
&
Fact
::
valueChanged
,
this
,
&
TransectStyleComplexItem
::
complexDistanceChanged
);
...
...
@@ -94,14 +86,6 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, QString set
connect
(
this
,
&
TransectStyleComplexItem
::
transectPointsChanged
,
this
,
&
TransectStyleComplexItem
::
greatestDistanceToChanged
);
}
void
TransectStyleComplexItem
::
_setScanDistance
(
double
scanDistance
)
{
if
(
!
qFuzzyCompare
(
_scanDistance
,
scanDistance
))
{
_scanDistance
=
scanDistance
;
emit
complexDistanceChanged
();
}
}
void
TransectStyleComplexItem
::
_setCameraShots
(
int
cameraShots
)
{
if
(
_cameraShots
!=
cameraShots
)
{
...
...
src/MissionManager/TransectStyleComplexItem.h
View file @
259b5dc7
...
...
@@ -61,7 +61,7 @@ public:
QString
mapVisualQML
(
void
)
const
override
=
0
;
bool
load
(
const
QJsonObject
&
complexObject
,
int
sequenceNumber
,
QString
&
errorString
)
override
=
0
;
double
complexDistance
(
void
)
const
final
{
return
_
scan
Distance
;
}
double
complexDistance
(
void
)
const
final
{
return
_
complex
Distance
;
}
double
greatestDistanceTo
(
const
QGeoCoordinate
&
other
)
const
final
;
// Overrides from VisualMissionItem
...
...
@@ -119,7 +119,6 @@ protected:
void
_save
(
QJsonObject
&
saveObject
);
bool
_load
(
const
QJsonObject
&
complexObject
,
QString
&
errorString
);
void
_setExitCoordinate
(
const
QGeoCoordinate
&
coordinate
);
void
_setScanDistance
(
double
scanDistance
);
void
_setCameraShots
(
int
cameraShots
);
double
_triggerDistance
(
void
)
const
;
int
_transectCount
(
void
)
const
;
...
...
@@ -135,7 +134,7 @@ protected:
QGCMapPolygon
_surveyAreaPolygon
;
bool
_ignoreRecalc
;
double
_
scan
Distance
;
double
_
complex
Distance
;
int
_cameraShots
;
double
_timeBetweenShots
;
double
_cameraMinTriggerInterval
;
...
...
src/MissionManager/TransectStyleComplexItemTest.cc
View file @
259b5dc7
...
...
@@ -110,10 +110,9 @@ void TransectStyleComplexItemTest::_testRebuildTransects(void)
// _rebuildTransects call
// coveredAreaChanged signal
// lastSequenceNumberChanged signal
// cameraShotsChanged signal
_adjustSurveAreaPolygon
();
QVERIFY
(
_transectStyleItem
->
rebuildTransectsCalled
);
QVERIFY
(
_multiSpy
->
checkSignalsByMask
(
coveredAreaChangedMask
|
lastSequenceNumberChangedMask
|
cameraShotsChangedMask
));
QVERIFY
(
_multiSpy
->
checkSignalsByMask
(
coveredAreaChangedMask
|
lastSequenceNumberChangedMask
));
_transectStyleItem
->
rebuildTransectsCalled
=
false
;
_transectStyleItem
->
setDirty
(
false
);
_multiSpy
->
clearAllSignals
();
...
...
@@ -121,7 +120,6 @@ void TransectStyleComplexItemTest::_testRebuildTransects(void)
// Changes to these facts should trigger:
// _rebuildTransects call
// lastSequenceNumberChanged signal
// cameraShotsChanged signal
QList
<
Fact
*>
rgFacts
;
rgFacts
<<
_transectStyleItem
->
turnAroundDistance
()
<<
_transectStyleItem
->
cameraTriggerInTurnAround
()
...
...
@@ -133,7 +131,7 @@ void TransectStyleComplexItemTest::_testRebuildTransects(void)
qDebug
()
<<
fact
->
name
();
changeFactValue
(
fact
);
QVERIFY
(
_transectStyleItem
->
rebuildTransectsCalled
);
QVERIFY
(
_multiSpy
->
checkSignalsByMask
(
lastSequenceNumberChangedMask
|
cameraShotsChangedMask
));
QVERIFY
(
_multiSpy
->
checkSignalsByMask
(
lastSequenceNumberChangedMask
));
_transectStyleItem
->
setDirty
(
false
);
_multiSpy
->
clearAllSignals
();
_transectStyleItem
->
rebuildTransectsCalled
=
false
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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