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
5c09454c
Unverified
Commit
5c09454c
authored
Oct 08, 2019
by
Don Gagne
Committed by
GitHub
Oct 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7886 from DonLakeFlyer/WizardMode
Wizard Mode for Create Plan
parents
79618021
42897a63
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
493 additions
and
303 deletions
+493
-303
CorridorScanPlanCreator.cc
src/MissionManager/CorridorScanPlanCreator.cc
+8
-10
CustomPlanCreator.cc
src/MissionManager/CustomPlanCreator.cc
+9
-8
FixedWingLandingComplexItem.cc
src/MissionManager/FixedWingLandingComplexItem.cc
+12
-1
FixedWingLandingComplexItem.h
src/MissionManager/FixedWingLandingComplexItem.h
+20
-16
MissionController.cc
src/MissionManager/MissionController.cc
+38
-17
MissionController.h
src/MissionManager/MissionController.h
+20
-13
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+7
-0
SimpleMissionItem.h
src/MissionManager/SimpleMissionItem.h
+1
-2
StructureScanComplexItem.cc
src/MissionManager/StructureScanComplexItem.cc
+3
-1
StructureScanPlanCreator.cc
src/MissionManager/StructureScanPlanCreator.cc
+8
-9
SurveyPlanCreator.cc
src/MissionManager/SurveyPlanCreator.cc
+9
-9
TransectStyleComplexItem.cc
src/MissionManager/TransectStyleComplexItem.cc
+3
-3
VisualMissionItem.cc
src/MissionManager/VisualMissionItem.cc
+9
-0
VisualMissionItem.h
src/MissionManager/VisualMissionItem.h
+17
-13
CorridorScanEditor.qml
src/PlanView/CorridorScanEditor.qml
+13
-2
FWLandingPatternEditor.qml
src/PlanView/FWLandingPatternEditor.qml
+59
-22
FWLandingPatternMapVisual.qml
src/PlanView/FWLandingPatternMapVisual.qml
+16
-2
MissionItemEditor.qml
src/PlanView/MissionItemEditor.qml
+1
-0
PlanView.qml
src/PlanView/PlanView.qml
+17
-8
SimpleItemEditor.qml
src/PlanView/SimpleItemEditor.qml
+197
-163
StructureScanEditor.qml
src/PlanView/StructureScanEditor.qml
+13
-2
SurveyItemEditor.qml
src/PlanView/SurveyItemEditor.qml
+13
-2
No files found.
src/MissionManager/CorridorScanPlanCreator.cc
View file @
5c09454c
...
...
@@ -10,6 +10,7 @@
#include "CorridorScanPlanCreator.h"
#include "PlanMasterController.h"
#include "MissionSettingsItem.h"
#include "FixedWingLandingComplexItem.h"
CorridorScanPlanCreator
::
CorridorScanPlanCreator
(
PlanMasterController
*
planMasterController
,
QObject
*
parent
)
:
PlanCreator
(
planMasterController
,
MissionController
::
patternCorridorScanName
,
QStringLiteral
(
"/qmlimages/PlanCreator/CorridorScanPlanCreator.png"
),
parent
)
...
...
@@ -20,19 +21,16 @@ CorridorScanPlanCreator::CorridorScanPlanCreator(PlanMasterController* planMaste
void
CorridorScanPlanCreator
::
createPlan
(
const
QGeoCoordinate
&
mapCenterCoord
)
{
_planMasterController
->
removeAll
();
int
seqNum
=
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternCorridorScanName
,
mapCenterCoord
,
_missionController
->
visualItems
()
->
count
());
VisualMissionItem
*
takeoffItem
=
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
,
-
1
);
takeoffItem
->
setWizardMode
(
true
);
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternCorridorScanName
,
mapCenterCoord
,
-
1
)
->
setWizardMode
(
true
);
if
(
_planMasterController
->
managerVehicle
()
->
fixedWing
())
{
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternFWLandingName
,
mapCenterCoord
,
_missionController
->
visualItems
()
->
count
());
FixedWingLandingComplexItem
*
landingItem
=
qobject_cast
<
FixedWingLandingComplexItem
*>
(
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternFWLandingName
,
mapCenterCoord
,
-
1
));
landingItem
->
setWizardMode
(
true
);
landingItem
->
setLoiterDragAngleOnly
(
true
);
}
else
{
MissionSettingsItem
*
settingsItem
=
_missionController
->
visualItems
()
->
value
<
MissionSettingsItem
*>
(
0
);
settingsItem
->
setMissionEndRTL
(
true
);
}
_missionController
->
setCurrentPlanViewIndex
(
seqNum
,
false
);
_missionController
->
setCurrentPlanViewIndex
(
takeoffItem
->
sequenceNumber
(),
true
);
}
src/MissionManager/CustomPlanCreator.cc
View file @
5c09454c
...
...
@@ -10,6 +10,7 @@
#include "CustomPlanCreator.h"
#include "PlanMasterController.h"
#include "MissionSettingsItem.h"
#include "FixedWingLandingComplexItem.h"
CustomPlanCreator
::
CustomPlanCreator
(
PlanMasterController
*
planMasterController
,
QObject
*
parent
)
:
PlanCreator
(
planMasterController
,
tr
(
"Custom"
),
QStringLiteral
(
"/qmlimages/PlanCreator/CustomPlanCreator.png"
),
parent
)
...
...
@@ -20,18 +21,18 @@ CustomPlanCreator::CustomPlanCreator(PlanMasterController* planMasterController,
void
CustomPlanCreator
::
createPlan
(
const
QGeoCoordinate
&
mapCenterCoord
)
{
_planMasterController
->
removeAll
();
int
seqNum
=
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
,
_missionController
->
visualItems
()
->
count
());
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
.
atDistanceAndAzimuth
(
50
,
135
),
_missionController
->
visualItems
()
->
count
());
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
.
atDistanceAndAzimuth
(
50
,
-
135
),
_missionController
->
visualItems
()
->
count
());
VisualMissionItem
*
takeoffItem
=
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
,
-
1
);
takeoffItem
->
setWizardMode
(
true
);
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
.
atDistanceAndAzimuth
(
50
,
135
),
-
1
)
->
setWizardMode
(
true
);
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
.
atDistanceAndAzimuth
(
50
,
-
135
),
-
1
)
->
setWizardMode
(
true
);
if
(
_planMasterController
->
managerVehicle
()
->
fixedWing
())
{
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternFWLandingName
,
mapCenterCoord
,
_missionController
->
visualItems
()
->
count
());
FixedWingLandingComplexItem
*
landingItem
=
qobject_cast
<
FixedWingLandingComplexItem
*>
(
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternFWLandingName
,
mapCenterCoord
,
-
1
));
landingItem
->
setWizardMode
(
true
);
landingItem
->
setLoiterDragAngleOnly
(
true
);
}
else
{
MissionSettingsItem
*
settingsItem
=
_missionController
->
visualItems
()
->
value
<
MissionSettingsItem
*>
(
0
);
settingsItem
->
setMissionEndRTL
(
true
);
}
_missionController
->
setCurrentPlanViewIndex
(
seqNum
,
fals
e
);
_missionController
->
setCurrentPlanViewIndex
(
takeoffItem
->
sequenceNumber
(),
tru
e
);
}
src/MissionManager/FixedWingLandingComplexItem.cc
View file @
5c09454c
...
...
@@ -51,6 +51,7 @@ FixedWingLandingComplexItem::FixedWingLandingComplexItem(Vehicle* vehicle, bool
,
_dirty
(
false
)
,
_landingCoordSet
(
false
)
,
_ignoreRecalcSignals
(
false
)
,
_loiterDragAngleOnly
(
false
)
,
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/FWLandingPattern.FactMetaData.json"
),
this
))
,
_landingDistanceFact
(
settingsGroup
,
_metaDataMap
[
loiterToLandDistanceName
])
,
_loiterAltitudeFact
(
settingsGroup
,
_metaDataMap
[
loiterAltitudeName
])
...
...
@@ -101,6 +102,8 @@ FixedWingLandingComplexItem::FixedWingLandingComplexItem(Vehicle* vehicle, bool
connect
(
this
,
&
FixedWingLandingComplexItem
::
altitudesAreRelativeChanged
,
this
,
&
FixedWingLandingComplexItem
::
exitCoordinateHasRelativeAltitudeChanged
);
connect
(
this
,
&
FixedWingLandingComplexItem
::
landingCoordSetChanged
,
this
,
&
FixedWingLandingComplexItem
::
readyForSaveStateChanged
);
connect
(
this
,
&
FixedWingLandingComplexItem
::
wizardModeChanged
,
this
,
&
FixedWingLandingComplexItem
::
readyForSaveStateChanged
);
if
(
vehicle
->
apmFirmware
())
{
// ArduPilot does not support camera commands
_stopTakingVideoFact
.
setRawValue
(
false
);
...
...
@@ -712,5 +715,13 @@ void FixedWingLandingComplexItem::_signalLastSequenceNumberChanged(void)
FixedWingLandingComplexItem
::
ReadyForSaveState
FixedWingLandingComplexItem
::
readyForSaveState
(
void
)
const
{
return
_landingCoordSet
?
ReadyForSave
:
NotReadyForSaveData
;
return
_landingCoordSet
&&
!
_wizardMode
?
ReadyForSave
:
NotReadyForSaveData
;
}
void
FixedWingLandingComplexItem
::
setLoiterDragAngleOnly
(
bool
loiterDragAngleOnly
)
{
if
(
loiterDragAngleOnly
!=
_loiterDragAngleOnly
)
{
_loiterDragAngleOnly
=
loiterDragAngleOnly
;
emit
loiterDragAngleOnlyChanged
(
_loiterDragAngleOnly
);
}
}
src/MissionManager/FixedWingLandingComplexItem.h
View file @
5c09454c
...
...
@@ -26,21 +26,22 @@ class FixedWingLandingComplexItem : public ComplexMissionItem
public:
FixedWingLandingComplexItem
(
Vehicle
*
vehicle
,
bool
flyView
,
QObject
*
parent
);
Q_PROPERTY
(
Fact
*
loiterAltitude
READ
loiterAltitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
loiterRadius
READ
loiterRadius
CONSTANT
)
Q_PROPERTY
(
Fact
*
landingAltitude
READ
landingAltitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
landingHeading
READ
landingHeading
CONSTANT
)
Q_PROPERTY
(
Fact
*
valueSetIsDistance
READ
valueSetIsDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
landingDistance
READ
landingDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
glideSlope
READ
glideSlope
CONSTANT
)
Q_PROPERTY
(
bool
loiterClockwise
MEMBER
_loiterClockwise
NOTIFY
loiterClockwiseChanged
)
Q_PROPERTY
(
bool
altitudesAreRelative
MEMBER
_altitudesAreRelative
NOTIFY
altitudesAreRelativeChanged
)
Q_PROPERTY
(
Fact
*
stopTakingPhotos
READ
stopTakingPhotos
CONSTANT
)
Q_PROPERTY
(
Fact
*
stopTakingVideo
READ
stopTakingVideo
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
loiterCoordinate
READ
loiterCoordinate
WRITE
setLoiterCoordinate
NOTIFY
loiterCoordinateChanged
)
Q_PROPERTY
(
QGeoCoordinate
loiterTangentCoordinate
READ
loiterTangentCoordinate
NOTIFY
loiterTangentCoordinateChanged
)
Q_PROPERTY
(
QGeoCoordinate
landingCoordinate
READ
landingCoordinate
WRITE
setLandingCoordinate
NOTIFY
landingCoordinateChanged
)
Q_PROPERTY
(
bool
landingCoordSet
MEMBER
_landingCoordSet
NOTIFY
landingCoordSetChanged
)
Q_PROPERTY
(
Fact
*
loiterAltitude
READ
loiterAltitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
loiterRadius
READ
loiterRadius
CONSTANT
)
Q_PROPERTY
(
Fact
*
landingAltitude
READ
landingAltitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
landingHeading
READ
landingHeading
CONSTANT
)
Q_PROPERTY
(
Fact
*
valueSetIsDistance
READ
valueSetIsDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
landingDistance
READ
landingDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
glideSlope
READ
glideSlope
CONSTANT
)
Q_PROPERTY
(
bool
loiterClockwise
MEMBER
_loiterClockwise
NOTIFY
loiterClockwiseChanged
)
Q_PROPERTY
(
bool
altitudesAreRelative
MEMBER
_altitudesAreRelative
NOTIFY
altitudesAreRelativeChanged
)
Q_PROPERTY
(
Fact
*
stopTakingPhotos
READ
stopTakingPhotos
CONSTANT
)
Q_PROPERTY
(
Fact
*
stopTakingVideo
READ
stopTakingVideo
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
loiterCoordinate
READ
loiterCoordinate
WRITE
setLoiterCoordinate
NOTIFY
loiterCoordinateChanged
)
Q_PROPERTY
(
QGeoCoordinate
loiterTangentCoordinate
READ
loiterTangentCoordinate
NOTIFY
loiterTangentCoordinateChanged
)
Q_PROPERTY
(
QGeoCoordinate
landingCoordinate
READ
landingCoordinate
WRITE
setLandingCoordinate
NOTIFY
landingCoordinateChanged
)
Q_PROPERTY
(
bool
landingCoordSet
MEMBER
_landingCoordSet
NOTIFY
landingCoordSetChanged
)
Q_PROPERTY
(
bool
loiterDragAngleOnly
READ
loiterDragAngleOnly
WRITE
setLoiterDragAngleOnly
NOTIFY
loiterDragAngleOnlyChanged
)
Fact
*
loiterAltitude
(
void
)
{
return
&
_loiterAltitudeFact
;
}
Fact
*
loiterRadius
(
void
)
{
return
&
_loiterRadiusFact
;
}
...
...
@@ -54,9 +55,11 @@ public:
QGeoCoordinate
landingCoordinate
(
void
)
const
{
return
_landingCoordinate
;
}
QGeoCoordinate
loiterCoordinate
(
void
)
const
{
return
_loiterCoordinate
;
}
QGeoCoordinate
loiterTangentCoordinate
(
void
)
const
{
return
_loiterTangentCoordinate
;
}
bool
loiterDragAngleOnly
(
void
)
const
{
return
_loiterDragAngleOnly
;
}
void
setLandingCoordinate
(
const
QGeoCoordinate
&
coordinate
);
void
setLoiterCoordinate
(
const
QGeoCoordinate
&
coordinate
);
void
setLoiterDragAngleOnly
(
bool
loiterDragAngleOnly
);
/// Scans the loaded items for a landing pattern complex item
static
bool
scanForItem
(
QmlObjectListModel
*
visualItems
,
bool
flyView
,
Vehicle
*
vehicle
);
...
...
@@ -66,7 +69,6 @@ public:
static
MissionItem
*
createLandItem
(
int
seqNum
,
bool
altRel
,
double
lat
,
double
lon
,
double
alt
,
QObject
*
parent
);
// Overrides from ComplexMissionItem
double
complexDistance
(
void
)
const
final
;
int
lastSequenceNumber
(
void
)
const
final
;
bool
load
(
const
QJsonObject
&
complexObject
,
int
sequenceNumber
,
QString
&
errorString
)
final
;
...
...
@@ -123,6 +125,7 @@ signals:
void
loiterClockwiseChanged
(
bool
loiterClockwise
);
void
altitudesAreRelativeChanged
(
bool
altitudesAreRelative
);
void
valueSetIsDistanceChanged
(
bool
valueSetIsDistance
);
void
loiterDragAngleOnlyChanged
(
bool
loiterDragAngleOnly
);
private
slots
:
void
_recalcFromHeadingAndDistanceChange
(
void
);
...
...
@@ -147,6 +150,7 @@ private:
QGeoCoordinate
_landingCoordinate
;
bool
_landingCoordSet
;
bool
_ignoreRecalcSignals
;
bool
_loiterDragAngleOnly
;
QMap
<
QString
,
FactMetaData
*>
_metaDataMap
;
...
...
src/MissionManager/MissionController.cc
View file @
5c09454c
...
...
@@ -349,7 +349,7 @@ int MissionController::_nextSequenceNumber(void)
}
}
int
MissionController
::
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
)
VisualMissionItem
*
MissionController
::
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
)
{
int
sequenceNumber
=
_nextSequenceNumber
();
SimpleMissionItem
*
newItem
=
new
SimpleMissionItem
(
_controllerVehicle
,
_flyView
,
this
);
...
...
@@ -373,15 +373,23 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int vi
}
}
newItem
->
setMissionFlightStatus
(
_missionFlightStatus
);
_visualItems
->
insert
(
visualItemIndex
,
newItem
);
if
(
visualItemIndex
==
-
1
)
{
_visualItems
->
append
(
newItem
);
}
else
{
_visualItems
->
insert
(
visualItemIndex
,
newItem
);
}
// We send the click coordinate through here to be able to set the planned home position from the user click location if needed
_recalcAllWithClickCoordinate
(
coordinate
);
return
newItem
->
sequenceNumber
();
if
(
makeCurrentItem
)
{
setCurrentPlanViewIndex
(
newItem
->
sequenceNumber
(),
true
);
}
return
newItem
;
}
int
MissionController
::
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
)
VisualMissionItem
*
MissionController
::
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
)
{
int
sequenceNumber
=
_nextSequenceNumber
();
SimpleMissionItem
*
newItem
=
new
SimpleMissionItem
(
_controllerVehicle
,
_flyView
,
this
);
...
...
@@ -399,16 +407,24 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int visua
newItem
->
altitude
()
->
setRawValue
(
prevAltitude
);
newItem
->
setAltitudeMode
(
static_cast
<
QGroundControlQmlGlobal
::
AltitudeMode
>
(
prevAltitudeMode
));
}
_visualItems
->
insert
(
visualItemIndex
,
newItem
);
if
(
visualItemIndex
==
-
1
)
{
_visualItems
->
append
(
newItem
);
}
else
{
_visualItems
->
insert
(
visualItemIndex
,
newItem
);
}
_recalcAll
();
return
newItem
->
sequenceNumber
();
if
(
makeCurrentItem
)
{
setCurrentPlanViewIndex
(
newItem
->
sequenceNumber
(),
true
);
}
return
newItem
;
}
int
MissionController
::
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
visualItemIndex
)
VisualMissionItem
*
MissionController
::
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
)
{
ComplexMissionItem
*
newItem
;
ComplexMissionItem
*
newItem
=
nullptr
;
// If the ComplexMissionItem is inserted first, add a TakeOff SimpleMissionItem
if
(
_visualItems
->
count
()
==
1
&&
(
_controllerVehicle
->
fixedWing
()
||
_controllerVehicle
->
vtol
()
||
_controllerVehicle
->
multiRotor
()))
{
...
...
@@ -416,7 +432,6 @@ int MissionController::insertComplexMissionItem(QString itemName, QGeoCoordinate
visualItemIndex
++
;
}
int
sequenceNumber
=
_nextSequenceNumber
();
if
(
itemName
==
patternSurveyName
)
{
newItem
=
new
SurveyComplexItem
(
_controllerVehicle
,
_flyView
,
QString
()
/* kmlFile */
,
_visualItems
/* parent */
);
newItem
->
setCoordinate
(
mapCenterCoordinate
);
...
...
@@ -428,15 +443,17 @@ int MissionController::insertComplexMissionItem(QString itemName, QGeoCoordinate
newItem
=
new
CorridorScanComplexItem
(
_controllerVehicle
,
_flyView
,
QString
()
/* kmlFile */
,
_visualItems
/* parent */
);
}
else
{
qWarning
()
<<
"Internal error: Unknown complex item:"
<<
itemName
;
return
sequenceNumbe
r
;
return
nullpt
r
;
}
return
_insertComplexMissionItemWorker
(
newItem
,
visualItemIndex
);
_insertComplexMissionItemWorker
(
newItem
,
visualItemIndex
,
makeCurrentItem
);
return
newItem
;
}
int
MissionController
::
insertComplexMissionItemFromKMLOrSHP
(
QString
itemName
,
QString
file
,
int
visualItemIndex
)
VisualMissionItem
*
MissionController
::
insertComplexMissionItemFromKMLOrSHP
(
QString
itemName
,
QString
file
,
int
visualItemIndex
,
bool
makeCurrentItem
)
{
ComplexMissionItem
*
newItem
;
ComplexMissionItem
*
newItem
=
nullptr
;
if
(
itemName
==
patternSurveyName
)
{
newItem
=
new
SurveyComplexItem
(
_controllerVehicle
,
_flyView
,
file
,
_visualItems
);
...
...
@@ -446,13 +463,15 @@ int MissionController::insertComplexMissionItemFromKMLOrSHP(QString itemName, QS
newItem
=
new
CorridorScanComplexItem
(
_controllerVehicle
,
_flyView
,
file
,
_visualItems
);
}
else
{
qWarning
()
<<
"Internal error: Unknown complex item:"
<<
itemName
;
return
_nextSequenceNumber
()
;
return
nullptr
;
}
return
_insertComplexMissionItemWorker
(
newItem
,
visualItemIndex
);
_insertComplexMissionItemWorker
(
newItem
,
visualItemIndex
,
makeCurrentItem
);
return
newItem
;
}
int
MissionController
::
_insertComplexMissionItemWorker
(
ComplexMissionItem
*
complexItem
,
int
visualItemIndex
)
void
MissionController
::
_insertComplexMissionItemWorker
(
ComplexMissionItem
*
complexItem
,
int
visualItemIndex
,
bool
makeCurrentItem
)
{
int
sequenceNumber
=
_nextSequenceNumber
();
bool
surveyStyleItem
=
qobject_cast
<
SurveyComplexItem
*>
(
complexItem
)
||
...
...
@@ -500,7 +519,9 @@ int MissionController::_insertComplexMissionItemWorker(ComplexMissionItem* compl
}
_recalcAll
();
return
complexItem
->
sequenceNumber
();
if
(
makeCurrentItem
)
{
setCurrentPlanViewIndex
(
complexItem
->
sequenceNumber
(),
true
);
}
}
void
MissionController
::
removeMissionItem
(
int
index
)
...
...
src/MissionManager/MissionController.h
View file @
5c09454c
...
...
@@ -103,28 +103,35 @@ public:
Q_INVOKABLE
void
removeMissionItem
(
int
index
);
/// Add a new simple mission item to the list
/// @param visualItemIndex: index to insert at
/// @return Sequence number for new item
Q_INVOKABLE
int
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
);
/// @param coordinate: Coordinate for item
/// @param visualItemIndex: index to insert at, -1 for end of list
/// @param makeCurrentItem: true: Make this item the current item
/// @return Newly created item
Q_INVOKABLE
VisualMissionItem
*
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
=
false
);
/// Add a new ROI mission item to the list
/// @param visualItemIndex: index to insert at
/// @return Sequence number for new item
Q_INVOKABLE
int
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
);
/// @param coordinate: Coordinate for item
/// @param visualItemIndex: index to insert at, -1 for end of list
/// @param makeCurrentItem: true: Make this item the current item
/// @return Newly created item
Q_INVOKABLE
VisualMissionItem
*
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
=
false
);
/// Add a new complex mission item to the list
/// @param itemName: Name of complex item to create (from complexMissionItemNames)
/// @param mapCenterCoordinate: coordinate for current center of map
/// @param visualItemIndex: index to insert at
/// @return Sequence number for new item
Q_INVOKABLE
int
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
visualItemIndex
);
/// @param visualItemIndex: index to insert at, -1 for end of list
/// @param makeCurrentItem: true: Make this item the current item
/// @return Newly created item
Q_INVOKABLE
VisualMissionItem
*
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
=
false
);
/// Add a new complex mission item to the list
/// @param itemName: Name of complex item to create (from complexMissionItemNames)
/// @param file: kml or shp file to load from shape from
/// @param visualItemIndex: index to insert at, -1 for end
/// @return Sequence number for new item
Q_INVOKABLE
int
insertComplexMissionItemFromKMLOrSHP
(
QString
itemName
,
QString
file
,
int
visualItemIndex
);
/// @param coordinate: Coordinate for item
/// @param visualItemIndex: index to insert at, -1 for end of list
/// @param makeCurrentItem: true: Make this item the current item
/// @return Newly created item
Q_INVOKABLE
VisualMissionItem
*
insertComplexMissionItemFromKMLOrSHP
(
QString
itemName
,
QString
file
,
int
visualItemIndex
,
bool
makeCurrentItem
=
false
);
Q_INVOKABLE
void
resumeMission
(
int
resumeIndex
);
...
...
@@ -284,7 +291,7 @@ private:
void
_initLoadedVisualItems
(
QmlObjectListModel
*
loadedVisualItems
);
CoordinateVector
*
_addWaypointLineSegment
(
CoordVectHashTable
&
prevItemPairHashTable
,
VisualItemPair
&
pair
);
void
_addTimeDistance
(
bool
vtolInHover
,
double
hoverTime
,
double
cruiseTime
,
double
extraTime
,
double
distance
,
int
seqNum
);
int
_insertComplexMissionItemWorker
(
ComplexMissionItem
*
complexItem
,
int
visualItemIndex
);
void
_insertComplexMissionItemWorker
(
ComplexMissionItem
*
complexItem
,
int
visualItemIndex
,
bool
makeCurrentItem
);
void
_warnIfTerrainFrameUsed
(
void
);
private:
...
...
src/MissionManager/SimpleMissionItem.cc
View file @
5c09454c
...
...
@@ -200,6 +200,8 @@ void SimpleMissionItem::_connectSignals(void)
connect
(
this
,
&
SimpleMissionItem
::
cameraSectionChanged
,
this
,
&
SimpleMissionItem
::
_setDirty
);
connect
(
this
,
&
SimpleMissionItem
::
cameraSectionChanged
,
this
,
&
SimpleMissionItem
::
_updateLastSequenceNumber
);
connect
(
this
,
&
SimpleMissionItem
::
wizardModeChanged
,
this
,
&
SimpleMissionItem
::
readyForSaveStateChanged
);
// These are coordinate parameters, they must emit coordinateChanged signal
connect
(
&
_missionItem
.
_param5Fact
,
&
Fact
::
valueChanged
,
this
,
&
SimpleMissionItem
::
_sendCoordinateChanged
);
connect
(
&
_missionItem
.
_param6Fact
,
&
Fact
::
valueChanged
,
this
,
&
SimpleMissionItem
::
_sendCoordinateChanged
);
...
...
@@ -325,6 +327,7 @@ bool SimpleMissionItem::load(QTextStream &loadStream)
}
_updateOptionalSections
();
}
return
success
;
}
...
...
@@ -726,6 +729,10 @@ void SimpleMissionItem::_terrainAltChanged(void)
SimpleMissionItem
::
ReadyForSaveState
SimpleMissionItem
::
readyForSaveState
(
void
)
const
{
if
(
_wizardMode
)
{
return
NotReadyForSaveData
;
}
bool
terrainReady
=
!
specifiesAltitude
()
||
!
qIsNaN
(
_missionItem
.
_param7Fact
.
rawValue
().
toDouble
());
return
terrainReady
?
ReadyForSave
:
NotReadyForSaveTerrain
;
}
...
...
src/MissionManager/SimpleMissionItem.h
View file @
5c09454c
...
...
@@ -99,7 +99,6 @@ public:
const
MissionItem
&
missionItem
(
void
)
const
{
return
_missionItem
;
}
// Overrides from VisualMissionItem
bool
dirty
(
void
)
const
final
{
return
_dirty
;
}
bool
isSimpleItem
(
void
)
const
final
{
return
true
;
}
bool
isStandaloneCoordinate
(
void
)
const
final
;
...
...
@@ -154,7 +153,7 @@ private slots:
void
_rebuildFacts
(
void
);
void
_rebuildTextFieldFacts
(
void
);
void
_possibleAdditionalTimeDelayChanged
(
void
);
void
_setDefaultsForCommand
(
void
);
void
_setDefaultsForCommand
(
void
);
private:
void
_connectSignals
(
void
);
...
...
src/MissionManager/StructureScanComplexItem.cc
View file @
5c09454c
...
...
@@ -87,6 +87,8 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie
connect
(
&
_layersFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_recalcScanDistance
);
connect
(
&
_flightPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
StructureScanComplexItem
::
_recalcScanDistance
);
connect
(
this
,
&
StructureScanComplexItem
::
wizardModeChanged
,
this
,
&
StructureScanComplexItem
::
readyForSaveStateChanged
);
_recalcLayerInfo
();
if
(
!
kmlOrShpFile
.
isEmpty
())
{
...
...
@@ -621,5 +623,5 @@ void StructureScanComplexItem::_recalcScanDistance()
StructureScanComplexItem
::
ReadyForSaveState
StructureScanComplexItem
::
readyForSaveState
(
void
)
const
{
return
_structurePolygon
.
isValid
()
?
ReadyForSave
:
NotReadyForSaveData
;
return
_structurePolygon
.
isValid
()
&&
!
_wizardMode
?
ReadyForSave
:
NotReadyForSaveData
;
}
src/MissionManager/StructureScanPlanCreator.cc
View file @
5c09454c
...
...
@@ -10,6 +10,7 @@
#include "StructureScanPlanCreator.h"
#include "PlanMasterController.h"
#include "MissionSettingsItem.h"
#include "FixedWingLandingComplexItem.h"
StructureScanPlanCreator
::
StructureScanPlanCreator
(
PlanMasterController
*
planMasterController
,
QObject
*
parent
)
:
PlanCreator
(
planMasterController
,
MissionController
::
patternStructureScanName
,
QStringLiteral
(
"/qmlimages/PlanCreator/StructureScanPlanCreator.png"
),
parent
)
...
...
@@ -20,18 +21,16 @@ StructureScanPlanCreator::StructureScanPlanCreator(PlanMasterController* planMas
void
StructureScanPlanCreator
::
createPlan
(
const
QGeoCoordinate
&
mapCenterCoord
)
{
_planMasterController
->
removeAll
();
int
seqNum
=
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternStructureScanName
,
mapCenterCoord
,
_missionController
->
visualItems
()
->
count
());
VisualMissionItem
*
takeoffItem
=
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
,
-
1
);
takeoffItem
->
setWizardMode
(
true
);
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternStructureScanName
,
mapCenterCoord
,
-
1
)
->
setWizardMode
(
true
);
if
(
_planMasterController
->
managerVehicle
()
->
fixedWing
())
{
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternFWLandingName
,
mapCenterCoord
,
_missionController
->
visualItems
()
->
count
());
FixedWingLandingComplexItem
*
landingItem
=
qobject_cast
<
FixedWingLandingComplexItem
*>
(
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternFWLandingName
,
mapCenterCoord
,
-
1
));
landingItem
->
setWizardMode
(
true
);
landingItem
->
setLoiterDragAngleOnly
(
true
);
}
else
{
MissionSettingsItem
*
settingsItem
=
_missionController
->
visualItems
()
->
value
<
MissionSettingsItem
*>
(
0
);
settingsItem
->
setMissionEndRTL
(
true
);
}
_missionController
->
setCurrentPlanViewIndex
(
seqNum
,
fals
e
);
_missionController
->
setCurrentPlanViewIndex
(
takeoffItem
->
sequenceNumber
(),
tru
e
);
}
src/MissionManager/SurveyPlanCreator.cc
View file @
5c09454c
...
...
@@ -10,6 +10,8 @@
#include "SurveyPlanCreator.h"
#include "PlanMasterController.h"
#include "MissionSettingsItem.h"
#include "FixedWingLandingComplexItem.h"
#include "FixedWingLandingComplexItem.h"
SurveyPlanCreator
::
SurveyPlanCreator
(
PlanMasterController
*
planMasterController
,
QObject
*
parent
)
:
PlanCreator
(
planMasterController
,
MissionController
::
patternSurveyName
,
QStringLiteral
(
"/qmlimages/PlanCreator/SurveyPlanCreator.png"
),
parent
)
...
...
@@ -20,18 +22,16 @@ SurveyPlanCreator::SurveyPlanCreator(PlanMasterController* planMasterController,
void
SurveyPlanCreator
::
createPlan
(
const
QGeoCoordinate
&
mapCenterCoord
)
{
_planMasterController
->
removeAll
();
int
seqNum
=
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternSurveyName
,
mapCenterCoord
,
_missionController
->
visualItems
()
->
count
());
VisualMissionItem
*
takeoffItem
=
_missionController
->
insertSimpleMissionItem
(
mapCenterCoord
,
-
1
);
takeoffItem
->
setWizardMode
(
true
);
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternSurveyName
,
mapCenterCoord
,
-
1
)
->
setWizardMode
(
true
);
if
(
_planMasterController
->
managerVehicle
()
->
fixedWing
())
{
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternFWLandingName
,
mapCenterCoord
,
_missionController
->
visualItems
()
->
count
());
FixedWingLandingComplexItem
*
landingItem
=
qobject_cast
<
FixedWingLandingComplexItem
*>
(
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternFWLandingName
,
mapCenterCoord
,
-
1
));
landingItem
->
setWizardMode
(
true
);
landingItem
->
setLoiterDragAngleOnly
(
true
);
}
else
{
MissionSettingsItem
*
settingsItem
=
_missionController
->
visualItems
()
->
value
<
MissionSettingsItem
*>
(
0
);
settingsItem
->
setMissionEndRTL
(
true
);
}
_missionController
->
setCurrentPlanViewIndex
(
seqNum
,
fals
e
);
_missionController
->
setCurrentPlanViewIndex
(
takeoffItem
->
sequenceNumber
(),
tru
e
);
}
src/MissionManager/TransectStyleComplexItem.cc
View file @
5c09454c
...
...
@@ -106,8 +106,8 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, bool flyVie
connect
(
this
,
&
TransectStyleComplexItem
::
visualTransectPointsChanged
,
this
,
&
TransectStyleComplexItem
::
complexDistanceChanged
);
connect
(
this
,
&
TransectStyleComplexItem
::
visualTransectPointsChanged
,
this
,
&
TransectStyleComplexItem
::
greatestDistanceToChanged
);
connect
(
this
,
&
TransectStyleComplexItem
::
followTerrainChanged
,
this
,
&
TransectStyleComplexItem
::
_followTerrain
Changed
);
connect
(
this
,
&
TransectStyleComplexItem
::
followTerrainChanged
,
this
,
&
TransectStyleComplexItem
::
_followTerrainChanged
);
connect
(
this
,
&
TransectStyleComplexItem
::
wizardModeChanged
,
this
,
&
TransectStyleComplexItem
::
readyForSaveState
Changed
);
connect
(
&
_surveyAreaPolygon
,
&
QGCMapPolygon
::
isValidChanged
,
this
,
&
TransectStyleComplexItem
::
readyForSaveStateChanged
);
...
...
@@ -494,7 +494,7 @@ TransectStyleComplexItem::ReadyForSaveState TransectStyleComplexItem::readyForSa
{
bool
terrainReady
=
_followTerrain
?
_transectsPathHeightInfo
.
count
()
:
true
;
bool
polygonNotReady
=
!
_surveyAreaPolygon
.
isValid
();
return
polygonNotReady
?
return
(
polygonNotReady
||
_wizardMode
)
?
NotReadyForSaveData
:
(
terrainReady
?
ReadyForSave
:
NotReadyForSaveTerrain
);
}
...
...
src/MissionManager/VisualMissionItem.cc
View file @
5c09454c
...
...
@@ -37,6 +37,7 @@ VisualMissionItem::VisualMissionItem(Vehicle* vehicle, bool flyView, QObject* pa
,
_distance
(
0.0
)
,
_missionGimbalYaw
(
qQNaN
())
,
_missionVehicleYaw
(
qQNaN
())
,
_wizardMode
(
false
)
,
_lastLatTerrainQuery
(
0
)
,
_lastLonTerrainQuery
(
0
)
{
...
...
@@ -56,6 +57,7 @@ VisualMissionItem::VisualMissionItem(const VisualMissionItem& other, bool flyVie
,
_terrainCollision
(
false
)
,
_azimuth
(
0.0
)
,
_distance
(
0.0
)
,
_wizardMode
(
false
)
{
*
this
=
other
;
...
...
@@ -218,3 +220,10 @@ void VisualMissionItem::_setBoundingCube(QGCGeoBoundingCube bc)
}
}
void
VisualMissionItem
::
setWizardMode
(
bool
wizardMode
)
{
if
(
wizardMode
!=
_wizardMode
)
{
_wizardMode
=
wizardMode
;
emit
wizardModeChanged
(
_wizardMode
);
}
}
src/MissionManager/VisualMissionItem.h
View file @
5c09454c
...
...
@@ -74,6 +74,7 @@ public:
Q_PROPERTY
(
double
missionGimbalYaw
READ
missionGimbalYaw
NOTIFY
missionGimbalYawChanged
)
///< Current gimbal yaw state at this point in mission
Q_PROPERTY
(
double
missionVehicleYaw
READ
missionVehicleYaw
NOTIFY
missionVehicleYawChanged
)
///< Expected vehicle yaw at this point in mission
Q_PROPERTY
(
bool
flyView
READ
flyView
CONSTANT
)
Q_PROPERTY
(
bool
wizardMode
READ
wizardMode
WRITE
setWizardMode
NOTIFY
wizardModeChanged
)
Q_PROPERTY
(
ReadyForSaveState
readyForSaveState
READ
readyForSaveState
NOTIFY
readyForSaveStateChanged
)
Q_PROPERTY
(
QGCGeoBoundingCube
*
boundingCube
READ
boundingCube
NOTIFY
boundingCubeChanged
)
...
...
@@ -88,19 +89,17 @@ public:
Q_PROPERTY
(
double
distance
READ
distance
WRITE
setDistance
NOTIFY
distanceChanged
)
///< Distance to previous waypoint
// Property accesors
bool
homePosition
(
void
)
const
{
return
_homePositionSpecialCase
;
}
void
setHomePositionSpecialCase
(
bool
homePositionSpecialCase
)
{
_homePositionSpecialCase
=
homePositionSpecialCase
;
}
double
altDifference
(
void
)
const
{
return
_altDifference
;
}
double
altPercent
(
void
)
const
{
return
_altPercent
;
}
double
terrainPercent
(
void
)
const
{
return
_terrainPercent
;
}
bool
terrainCollision
(
void
)
const
{
return
_terrainCollision
;
}
double
azimuth
(
void
)
const
{
return
_azimuth
;
}
double
distance
(
void
)
const
{
return
_distance
;
}
bool
isCurrentItem
(
void
)
const
{
return
_isCurrentItem
;
}
double
terrainAltitude
(
void
)
const
{
return
_terrainAltitude
;
}
bool
flyView
(
void
)
const
{
return
_flyView
;
}
bool
homePosition
(
void
)
const
{
return
_homePositionSpecialCase
;
}
double
altDifference
(
void
)
const
{
return
_altDifference
;
}
double
altPercent
(
void
)
const
{
return
_altPercent
;
}
double
terrainPercent
(
void
)
const
{
return
_terrainPercent
;
}
bool
terrainCollision
(
void
)
const
{
return
_terrainCollision
;
}
double
azimuth
(
void
)
const
{
return
_azimuth
;
}
double
distance
(
void
)
const
{
return
_distance
;
}
bool
isCurrentItem
(
void
)
const
{
return
_isCurrentItem
;
}
double
terrainAltitude
(
void
)
const
{
return
_terrainAltitude
;
}
bool
flyView
(
void
)
const
{
return
_flyView
;
}
bool
wizardMode
(
void
)
const
{
return
_wizardMode
;
}
QmlObjectListModel
*
childItems
(
void
)
{
return
&
_childItems
;
}
...
...
@@ -111,6 +110,9 @@ public:
void
setTerrainCollision
(
bool
terrainCollision
);
void
setAzimuth
(
double
azimuth
);
void
setDistance
(
double
distance
);
void
setWizardMode
(
bool
wizardMode
);
void
setHomePositionSpecialCase
(
bool
homePositionSpecialCase
)
{
_homePositionSpecialCase
=
homePositionSpecialCase
;
}
Vehicle
*
vehicle
(
void
)
{
return
_vehicle
;
}
...
...
@@ -205,6 +207,7 @@ signals:
void
additionalTimeDelayChanged
(
void
);
void
boundingCubeChanged
(
void
);
void
readyForSaveStateChanged
(
void
);
void
wizardModeChanged
(
bool
wizardMode
);
void
coordinateHasRelativeAltitudeChanged
(
bool
coordinateHasRelativeAltitude
);
void
exitCoordinateHasRelativeAltitudeChanged
(
bool
exitCoordinateHasRelativeAltitude
);
...
...
@@ -226,6 +229,7 @@ protected:
QString
_editorQml
;
///< Qml resource for editing item
double
_missionGimbalYaw
;
double
_missionVehicleYaw
;
bool
_wizardMode
;
///< true: Item editor is showing wizard completion panel
QGCGeoBoundingCube
_boundingCube
;
///< The bounding "cube" of this element.
...
...
src/PlanView/CorridorScanEditor.qml
View file @
5c09454c
...
...
@@ -56,23 +56,34 @@ Rectangle {
anchors.right
:
parent
.
right
ColumnLayout
{
id
:
wizardModeColumn
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margin
visible
:
!
missionItem
.
corridorPolyline
.
isValid
visible
:
!
missionItem
.
corridorPolyline
.
isValid
||
missionItem
.
wizardMode
QGCLabel
{
Layout.fillWidth
:
true
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
Use the Corridor Tools to create the polyline which defines the corridor.
"
)
}
QGCButton
{
text
:
qsTr
(
"
Done With Polyline
"
)
Layout.fillWidth
:
true
enabled
:
missionItem
.
corridorPolyline
.
isValid
onClicked
:
{
missionItem
.
wizardMode
=
false
editorRoot
.
selectNextNotReadyItem
()
}
}
}
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margin
visible
:
missionItem
.
corridorPolyline
.
isValid
visible
:
!
wizardModeColumn
.
visible
QGCTabBar
{
id
:
tabBar
...
...
src/PlanView/FWLandingPatternEditor.qml
View file @
5c09454c
...
...
@@ -49,7 +49,7 @@ Rectangle {
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margin
visible
:
missionItem
.
landingCoordSet
visible
:
!
editorColumnNeedLandingPoint
.
visible
SectionHeader
{
id
:
loiterPointSection
...
...
@@ -216,33 +216,70 @@ Rectangle {
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
visible
:
!
missionItem
.
landingCoordSet
visible
:
!
missionItem
.
landingCoordSet
||
missionItem
.
wizardMode
spacing
:
ScreenTools
.
defaultFontPixelHeight
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
horizontalAlignment
:
Text
.
AlignHCenter
text
:
qsTr
(
"
Click in map to set landing point.
"
)
}
Column
{
id
:
landingCoordColumn
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
ScreenTools
.
defaultFontPixelHeight
visible
:
!
missionItem
.
landingCoordSet
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
horizontalAlignment
:
Text
.
AlignHCenter
text
:
qsTr
(
"
Click in map to set landing point.
"
)
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
horizontalAlignment
:
Text
.
AlignHCenter
text
:
qsTr
(
"
- or -
"
)
visible
:
activeVehicle
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
horizontalAlignment
:
Text
.
AlignHCenter
text
:
qsTr
(
"
- or -
"
)
visible
:
activeVehicle
}