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
f9fed02a
Commit
f9fed02a
authored
Dec 10, 2019
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
c133b717
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
129 additions
and
182 deletions
+129
-182
CorridorScanPlanCreator.cc
src/MissionManager/CorridorScanPlanCreator.cc
+1
-1
MissionController.cc
src/MissionManager/MissionController.cc
+64
-47
MissionController.h
src/MissionManager/MissionController.h
+19
-9
StructureScanPlanCreator.cc
src/MissionManager/StructureScanPlanCreator.cc
+1
-1
SurveyPlanCreator.cc
src/MissionManager/SurveyPlanCreator.cc
+1
-1
MissionItemEditor.qml
src/PlanView/MissionItemEditor.qml
+0
-2
MissionItemStatus.qml
src/PlanView/MissionItemStatus.qml
+1
-1
PlanView.qml
src/PlanView/PlanView.qml
+42
-120
No files found.
src/MissionManager/CorridorScanPlanCreator.cc
View file @
f9fed02a
...
...
@@ -24,5 +24,5 @@ void CorridorScanPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
VisualMissionItem
*
takeoffItem
=
_missionController
->
insertTakeoffItem
(
mapCenterCoord
,
-
1
);
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternCorridorScanName
,
mapCenterCoord
,
-
1
);
_missionController
->
insertLandItem
(
mapCenterCoord
,
-
1
);
_missionController
->
setCurrentPlanView
Index
(
takeoffItem
->
sequenceNumber
(),
true
);
_missionController
->
setCurrentPlanView
SeqNum
(
takeoffItem
->
sequenceNumber
(),
true
);
}
src/MissionManager/MissionController.cc
View file @
f9fed02a
...
...
@@ -68,7 +68,8 @@ MissionController::MissionController(PlanMasterController* masterController, QOb
,
_inRecalcSequence
(
false
)
,
_appSettings
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
())
,
_progressPct
(
0
)
,
_currentPlanViewIndex
(
-
1
)
,
_currentPlanViewSeqNum
(
-
1
)
,
_currentPlanViewVIIndex
(
-
1
)
,
_currentPlanViewItem
(
nullptr
)
,
_splitSegment
(
nullptr
)
{
...
...
@@ -380,7 +381,7 @@ VisualMissionItem* MissionController::_insertSimpleMissionItemWorker(QGeoCoordin
_recalcAllWithCoordinate
(
coordinate
);
if
(
makeCurrentItem
)
{
setCurrentPlanView
Index
(
newItem
->
sequenceNumber
(),
true
);
setCurrentPlanView
SeqNum
(
newItem
->
sequenceNumber
(),
true
);
}
return
newItem
;
...
...
@@ -418,7 +419,7 @@ VisualMissionItem* MissionController::insertTakeoffItem(QGeoCoordinate /*coordin
_recalcAll
();
if
(
makeCurrentItem
)
{
setCurrentPlanView
Index
(
newItem
->
sequenceNumber
(),
true
);
setCurrentPlanView
SeqNum
(
newItem
->
sequenceNumber
(),
true
);
}
return
newItem
;
...
...
@@ -437,10 +438,24 @@ VisualMissionItem* MissionController::insertLandItem(QGeoCoordinate coordinate,
VisualMissionItem
*
MissionController
::
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
)
{
MAV_CMD
command
=
_controllerVehicle
->
firmwarePlugin
()
->
supportedMissionCommands
().
contains
(
MAV_CMD_DO_SET_ROI_LOCATION
)
?
MAV_CMD_DO_SET_ROI_LOCATION
:
MAV_CMD_DO_SET_ROI
;
return
_insertSimpleMissionItemWorker
(
coordinate
,
command
,
visualItemIndex
,
makeCurrentItem
);
SimpleMissionItem
*
simpleItem
=
qobject_cast
<
SimpleMissionItem
*>
(
_insertSimpleMissionItemWorker
(
coordinate
,
MAV_CMD_DO_SET_ROI_LOCATION
,
visualItemIndex
,
makeCurrentItem
));
if
(
!
_controllerVehicle
->
firmwarePlugin
()
->
supportedMissionCommands
().
contains
(
MAV_CMD_DO_SET_ROI_LOCATION
))
{
simpleItem
->
setCommand
(
MAV_CMD_DO_SET_ROI
)
;
simpleItem
->
missionItem
().
setParam1
(
MAV_ROI_LOCATION
);
}
return
simpleItem
;
}
VisualMissionItem
*
MissionController
::
insertCancelROIMissionItem
(
int
visualItemIndex
,
bool
makeCurrentItem
)
{
SimpleMissionItem
*
simpleItem
=
qobject_cast
<
SimpleMissionItem
*>
(
_insertSimpleMissionItemWorker
(
QGeoCoordinate
(),
MAV_CMD_DO_SET_ROI_NONE
,
visualItemIndex
,
makeCurrentItem
));
if
(
!
_controllerVehicle
->
firmwarePlugin
()
->
supportedMissionCommands
().
contains
(
MAV_CMD_DO_SET_ROI_NONE
))
{
simpleItem
->
setCommand
(
MAV_CMD_DO_SET_ROI
)
;
simpleItem
->
missionItem
().
setParam1
(
MAV_ROI_NONE
);
}
return
simpleItem
;
}
VisualMissionItem
*
MissionController
::
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
)
...
...
@@ -536,7 +551,7 @@ void MissionController::_insertComplexMissionItemWorker(const QGeoCoordinate& ma
_recalcAllWithCoordinate
(
mapCenterCoordinate
);
if
(
makeCurrentItem
)
{
setCurrentPlanView
Index
(
complexItem
->
sequenceNumber
(),
true
);
setCurrentPlanView
SeqNum
(
complexItem
->
sequenceNumber
(),
true
);
}
}
...
...
@@ -1736,7 +1751,7 @@ void MissionController::_initAllVisualItems(void)
emit
plannedHomePositionChanged
(
plannedHomePosition
());
if
(
!
_flyView
)
{
setCurrentPlanView
Index
(
0
,
true
);
setCurrentPlanView
SeqNum
(
0
,
true
);
}
setDirty
(
false
);
...
...
@@ -2149,32 +2164,25 @@ void MissionController::_managerRemoveAllComplete(bool error)
}
}
int
MissionController
::
currentPlanViewIndex
(
void
)
const
{
return
_currentPlanViewIndex
;
}
VisualMissionItem
*
MissionController
::
currentPlanViewItem
(
void
)
const
{
return
_currentPlanViewItem
;
}
void
MissionController
::
setCurrentPlanViewIndex
(
int
sequenceNumber
,
bool
force
)
void
MissionController
::
setCurrentPlanViewSeqNum
(
int
sequenceNumber
,
bool
force
)
{
if
(
_visualItems
&&
(
force
||
sequenceNumber
!=
_currentPlanView
Index
))
{
bool
foundLand
=
false
;
int
takeoffIndex
=
-
1
;
int
landIndex
=
-
1
;
if
(
_visualItems
&&
(
force
||
sequenceNumber
!=
_currentPlanView
SeqNum
))
{
bool
foundLand
=
false
;
int
takeoffIndex
=
-
1
;
int
landIndex
=
-
1
;
_splitSegment
=
nullptr
;
_currentPlanViewItem
=
nullptr
;
_currentPlanViewIndex
=
-
1
;
_currentPlanViewSeqNum
=
-
1
;
_currentPlanViewVIIndex
=
-
1
;
_isInsertTakeoffValid
=
true
;
_isInsertLandValid
=
true
;
_isROIActive
=
false
;
_flyThroughCommandsAllowed
=
true
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
VisualMissionItem
*
pVI
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
i
));
for
(
int
viIndex
=
0
;
viIndex
<
_visualItems
->
count
();
viIndex
++
)
{
VisualMissionItem
*
pVI
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
viIndex
));
SimpleMissionItem
*
simpleItem
=
qobject_cast
<
SimpleMissionItem
*>
(
pVI
);
if
(
sequenceNumber
!=
0
&&
pVI
->
sequenceNumber
()
<=
sequenceNumber
)
{
if
(
pVI
->
specifiesCoordinate
()
&&
!
pVI
->
isStandaloneCoordinate
())
{
...
...
@@ -2184,12 +2192,11 @@ void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force)
}
if
(
qobject_cast
<
TakeoffMissionItem
*>
(
pVI
))
{
takeoffIndex
=
i
;
takeoffIndex
=
viIndex
;
_isInsertTakeoffValid
=
false
;
}
if
(
!
foundLand
)
{
SimpleMissionItem
*
simpleItem
=
qobject_cast
<
SimpleMissionItem
*>
(
pVI
);
if
(
simpleItem
)
{
switch
(
simpleItem
->
mavCommand
())
{
case
MAV_CMD_NAV_LAND
:
...
...
@@ -2197,7 +2204,7 @@ void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force)
case
MAV_CMD_DO_LAND_START
:
case
MAV_CMD_NAV_RETURN_TO_LAUNCH
:
foundLand
=
true
;
landIndex
=
i
;
landIndex
=
viIndex
;
break
;
default:
break
;
...
...
@@ -2206,7 +2213,27 @@ void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force)
FixedWingLandingComplexItem
*
fwLanding
=
qobject_cast
<
FixedWingLandingComplexItem
*>
(
pVI
);
if
(
fwLanding
)
{
foundLand
=
true
;
landIndex
=
i
;
landIndex
=
viIndex
;
}
}
}
// ROI state handling
if
(
simpleItem
)
{
if
(
pVI
->
sequenceNumber
()
<=
sequenceNumber
)
{
if
(
_isROIActive
)
{
if
(
simpleItem
->
mavCommand
()
==
MAV_CMD_DO_SET_ROI_NONE
||
(
simpleItem
->
mavCommand
()
==
MAV_CMD_DO_SET_ROI
&&
simpleItem
->
missionItem
().
param1
()
==
MAV_ROI_NONE
))
{
_isROIActive
=
false
;
}
}
else
{
if
(
simpleItem
->
mavCommand
()
==
MAV_CMD_DO_SET_ROI_LOCATION
||
simpleItem
->
mavCommand
()
==
MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET
||
(
simpleItem
->
mavCommand
()
==
MAV_CMD_DO_SET_ROI
&&
simpleItem
->
missionItem
().
param1
()
==
MAV_ROI_LOCATION
))
{
_isROIActive
=
true
;
}
}
}
}
...
...
@@ -2214,11 +2241,12 @@ void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force)
if
(
pVI
->
sequenceNumber
()
==
sequenceNumber
)
{
pVI
->
setIsCurrentItem
(
true
);
_currentPlanViewItem
=
pVI
;
_currentPlanViewIndex
=
sequenceNumber
;
_currentPlanViewSeqNum
=
sequenceNumber
;
_currentPlanViewVIIndex
=
viIndex
;
if
(
pVI
->
specifiesCoordinate
()
&&
!
pVI
->
isStandaloneCoordinate
())
{
// Determine split segment used to display line split editing ui.
for
(
int
j
=
i
-
1
;
j
>
0
;
j
--
)
{
for
(
int
j
=
viIndex
-
1
;
j
>
0
;
j
--
)
{
VisualMissionItem
*
pPrev
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
j
));
if
(
pPrev
->
specifiesCoordinate
()
&&
!
pPrev
->
isStandaloneCoordinate
())
{
VisualItemPair
splitPair
(
pPrev
,
pVI
);
...
...
@@ -2252,11 +2280,13 @@ void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force)
}
}
emit
currentPlanViewIndexChanged
();
emit
currentPlanViewSeqNumChanged
();
emit
currentPlanViewVIIndexChanged
();
emit
currentPlanViewItemChanged
();
emit
splitSegmentChanged
();
emit
isInsertTakeoffValidChanged
();
emit
isInsertLandValidChanged
();
emit
isROIActiveChanged
();
emit
flyThroughCommandsAllowedChanged
();
}
}
...
...
@@ -2349,16 +2379,3 @@ bool MissionController::isEmpty(void) const
{
return
_visualItems
->
count
()
<=
1
;
}
int
MissionController
::
visualItemIndexFromSequenceNumber
(
int
sequenceNumber
)
const
{
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
const
VisualMissionItem
*
vi
=
_visualItems
->
value
<
VisualMissionItem
*>
(
i
);
if
(
vi
->
sequenceNumber
()
==
sequenceNumber
)
{
return
i
;
}
}
qWarning
()
<<
"MissionController::getVisualItemIndex visual item not found"
;
return
0
;
}
src/MissionManager/MissionController.h
View file @
f9fed02a
...
...
@@ -77,7 +77,8 @@ public:
Q_PROPERTY
(
int
missionItemCount
READ
missionItemCount
NOTIFY
missionItemCountChanged
)
///< True mission item command count (only valid in Fly View)
Q_PROPERTY
(
int
currentMissionIndex
READ
currentMissionIndex
NOTIFY
currentMissionIndexChanged
)
Q_PROPERTY
(
int
resumeMissionIndex
READ
resumeMissionIndex
NOTIFY
resumeMissionIndexChanged
)
///< Returns the item index two which a mission should be resumed. -1 indicates resume mission not available.
Q_PROPERTY
(
int
currentPlanViewIndex
READ
currentPlanViewIndex
NOTIFY
currentPlanViewIndexChanged
)
Q_PROPERTY
(
int
currentPlanViewSeqNum
READ
currentPlanViewSeqNum
NOTIFY
currentPlanViewSeqNumChanged
)
Q_PROPERTY
(
int
currentPlanViewVIIndex
READ
currentPlanViewVIIndex
NOTIFY
currentPlanViewVIIndexChanged
)
Q_PROPERTY
(
VisualMissionItem
*
currentPlanViewItem
READ
currentPlanViewItem
NOTIFY
currentPlanViewItemChanged
)
Q_PROPERTY
(
double
missionDistance
READ
missionDistance
NOTIFY
missionDistanceChanged
)
Q_PROPERTY
(
double
missionTime
READ
missionTime
NOTIFY
missionTimeChanged
)
...
...
@@ -94,6 +95,7 @@ public:
Q_PROPERTY
(
QString
structureScanComplexItemName
READ
structureScanComplexItemName
CONSTANT
)
Q_PROPERTY
(
bool
isInsertTakeoffValid
MEMBER
_isInsertTakeoffValid
NOTIFY
isInsertTakeoffValidChanged
)
Q_PROPERTY
(
bool
isInsertLandValid
MEMBER
_isInsertLandValid
NOTIFY
isInsertLandValidChanged
)
Q_PROPERTY
(
bool
isROIActive
MEMBER
_isROIActive
NOTIFY
isROIActiveChanged
)
Q_PROPERTY
(
bool
flyThroughCommandsAllowed
MEMBER
_flyThroughCommandsAllowed
NOTIFY
flyThroughCommandsAllowedChanged
)
Q_INVOKABLE
void
removeMissionItem
(
int
index
);
...
...
@@ -126,6 +128,12 @@ public:
/// @return Newly created item
Q_INVOKABLE
VisualMissionItem
*
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
=
false
);
/// Add a new Cancel ROI mission item to the list
/// @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
*
insertCancelROIMissionItem
(
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
...
...
@@ -150,10 +158,7 @@ public:
/// Sets a new current mission item (PlanView).
/// @param sequenceNumber - index for new item, -1 to clear current item
Q_INVOKABLE
void
setCurrentPlanViewIndex
(
int
sequenceNumber
,
bool
force
);
/// Returns the index of this item in the visual item list
Q_INVOKABLE
int
visualItemIndexFromSequenceNumber
(
int
sequenceNumber
)
const
;
Q_INVOKABLE
void
setCurrentPlanViewSeqNum
(
int
sequenceNumber
,
bool
force
);
/// Determines if the mission has all data needed to be saved or sent to the vehicle.
/// IMPORTANT NOTE: The return value is a VisualMissionItem::ReadForSaveState value. It is an int here to work around
...
...
@@ -196,7 +201,7 @@ public:
QVariantList
waypointPath
(
void
)
{
return
_waypointPath
;
}
QStringList
complexMissionItemNames
(
void
)
const
;
QGeoCoordinate
plannedHomePosition
(
void
)
const
;
VisualMissionItem
*
currentPlanViewItem
(
void
)
const
;
VisualMissionItem
*
currentPlanViewItem
(
void
)
const
{
return
_currentPlanViewItem
;
}
double
progressPct
(
void
)
const
{
return
_progressPct
;
}
QString
surveyComplexItemName
(
void
)
const
{
return
patternSurveyName
;
}
QString
corridorScanComplexItemName
(
void
)
const
{
return
patternCorridorScanName
;
}
...
...
@@ -206,7 +211,8 @@ public:
int
missionItemCount
(
void
)
const
{
return
_missionItemCount
;
}
int
currentMissionIndex
(
void
)
const
;
int
resumeMissionIndex
(
void
)
const
;
int
currentPlanViewIndex
(
void
)
const
;
int
currentPlanViewSeqNum
(
void
)
const
{
return
_currentPlanViewSeqNum
;
}
int
currentPlanViewVIIndex
(
void
)
const
{
return
_currentPlanViewVIIndex
;
}
double
missionDistance
(
void
)
const
{
return
_missionFlightStatus
.
totalDistance
;
}
double
missionTime
(
void
)
const
{
return
_missionFlightStatus
.
totalTime
;
}
...
...
@@ -249,12 +255,14 @@ signals:
void
plannedHomePositionChanged
(
QGeoCoordinate
plannedHomePosition
);
void
progressPctChanged
(
double
progressPct
);
void
currentMissionIndexChanged
(
int
currentMissionIndex
);
void
currentPlanViewIndexChanged
(
void
);
void
currentPlanViewSeqNumChanged
(
void
);
void
currentPlanViewVIIndexChanged
(
void
);
void
currentPlanViewItemChanged
(
void
);
void
missionBoundingCubeChanged
(
void
);
void
missionItemCountChanged
(
int
missionItemCount
);
void
isInsertTakeoffValidChanged
(
void
);
void
isInsertLandValidChanged
(
void
);
void
isROIActiveChanged
(
void
);
void
flyThroughCommandsAllowedChanged
(
void
);
private
slots
:
...
...
@@ -325,7 +333,8 @@ private:
MissionFlightStatus_t
_missionFlightStatus
;
AppSettings
*
_appSettings
;
double
_progressPct
;
int
_currentPlanViewIndex
;
int
_currentPlanViewSeqNum
;
int
_currentPlanViewVIIndex
;
VisualMissionItem
*
_currentPlanViewItem
;
QTimer
_updateTimer
;
QGCGeoBoundingCube
_travelBoundingCube
;
...
...
@@ -333,6 +342,7 @@ private:
CoordinateVector
*
_splitSegment
;
bool
_isInsertTakeoffValid
=
true
;
bool
_isInsertLandValid
=
true
;
bool
_isROIActive
=
false
;
bool
_flyThroughCommandsAllowed
=
true
;
static
const
char
*
_settingsGroup
;
...
...
src/MissionManager/StructureScanPlanCreator.cc
View file @
f9fed02a
...
...
@@ -24,5 +24,5 @@ void StructureScanPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
VisualMissionItem
*
takeoffItem
=
_missionController
->
insertTakeoffItem
(
mapCenterCoord
,
-
1
);
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternStructureScanName
,
mapCenterCoord
,
-
1
)
->
setWizardMode
(
true
);
_missionController
->
insertLandItem
(
mapCenterCoord
,
-
1
);
_missionController
->
setCurrentPlanView
Index
(
takeoffItem
->
sequenceNumber
(),
true
);
_missionController
->
setCurrentPlanView
SeqNum
(
takeoffItem
->
sequenceNumber
(),
true
);
}
src/MissionManager/SurveyPlanCreator.cc
View file @
f9fed02a
...
...
@@ -25,5 +25,5 @@ void SurveyPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
VisualMissionItem
*
takeoffItem
=
_missionController
->
insertTakeoffItem
(
mapCenterCoord
,
-
1
);
_missionController
->
insertComplexMissionItem
(
MissionController
::
patternSurveyName
,
mapCenterCoord
,
-
1
);
_missionController
->
insertLandItem
(
mapCenterCoord
,
-
1
);
_missionController
->
setCurrentPlanView
Index
(
takeoffItem
->
sequenceNumber
(),
true
);
_missionController
->
setCurrentPlanView
SeqNum
(
takeoffItem
->
sequenceNumber
(),
true
);
}
src/PlanView/MissionItemEditor.qml
View file @
f9fed02a
...
...
@@ -30,8 +30,6 @@ Rectangle {
signal
clicked
signal
remove
signal
insertWaypoint
signal
insertComplexItem
(
string
complexItemName
)
signal
selectNextNotReadyItem
property
var
_masterController
:
masterController
...
...
src/PlanView/MissionItemStatus.qml
View file @
f9fed02a
...
...
@@ -60,7 +60,7 @@ Rectangle {
orientation
:
ListView
.
Horizontal
spacing
:
0
clip
:
true
currentIndex
:
_missionController
.
currentPlanView
Index
currentIndex
:
_missionController
.
currentPlanView
SeqNum
onCountChanged
:
{
var
calcLength
=
(
statusListView
.
count
+
1
)
*
(
statusListView
.
count
?
statusListView
.
contentItem
.
children
[
0
].
width
:
1
)
...
...
src/PlanView/PlanView.qml
View file @
f9fed02a
This diff is collapsed.
Click to expand it.
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