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
0b96ca82
Commit
0b96ca82
authored
Feb 19, 2020
by
DoinLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
1200542b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
18 deletions
+43
-18
MissionController.cc
src/MissionManager/MissionController.cc
+30
-16
PlanView.qml
src/PlanView/PlanView.qml
+13
-2
No files found.
src/MissionManager/MissionController.cc
View file @
0b96ca82
...
@@ -2278,9 +2278,10 @@ bool MissionController::_isROICancelItem(SimpleMissionItem* simpleItem)
...
@@ -2278,9 +2278,10 @@ bool MissionController::_isROICancelItem(SimpleMissionItem* simpleItem)
void
MissionController
::
setCurrentPlanViewSeqNum
(
int
sequenceNumber
,
bool
force
)
void
MissionController
::
setCurrentPlanViewSeqNum
(
int
sequenceNumber
,
bool
force
)
{
{
if
(
_visualItems
&&
(
force
||
sequenceNumber
!=
_currentPlanViewSeqNum
))
{
if
(
_visualItems
&&
(
force
||
sequenceNumber
!=
_currentPlanViewSeqNum
))
{
bool
foundLand
=
false
;
bool
foundLand
=
false
;
int
takeoffIndex
=
-
1
;
int
takeoffSeqNum
=
-
1
;
int
landIndex
=
-
1
;
int
landSeqNum
=
-
1
;
int
lastFlyThroughSeqNum
=
-
1
;
_splitSegment
=
nullptr
;
_splitSegment
=
nullptr
;
_currentPlanViewItem
=
nullptr
;
_currentPlanViewItem
=
nullptr
;
...
@@ -2294,10 +2295,11 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
...
@@ -2294,10 +2295,11 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
_previousCoordinate
=
QGeoCoordinate
();
_previousCoordinate
=
QGeoCoordinate
();
for
(
int
viIndex
=
0
;
viIndex
<
_visualItems
->
count
();
viIndex
++
)
{
for
(
int
viIndex
=
0
;
viIndex
<
_visualItems
->
count
();
viIndex
++
)
{
VisualMissionItem
*
pVI
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
viIndex
));
VisualMissionItem
*
pVI
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
viIndex
));
SimpleMissionItem
*
simpleItem
=
qobject_cast
<
SimpleMissionItem
*>
(
pVI
);
SimpleMissionItem
*
simpleItem
=
qobject_cast
<
SimpleMissionItem
*>
(
pVI
);
int
currentSeqNumber
=
pVI
->
sequenceNumber
();
if
(
sequenceNumber
!=
0
&&
pVI
->
sequenceNumber
()
<=
sequenceNumber
)
{
if
(
sequenceNumber
!=
0
&&
currentSeqNumber
<=
sequenceNumber
)
{
if
(
pVI
->
specifiesCoordinate
()
&&
!
pVI
->
isStandaloneCoordinate
())
{
if
(
pVI
->
specifiesCoordinate
()
&&
!
pVI
->
isStandaloneCoordinate
())
{
// Coordinate based flight commands prior to where the takeoff would be inserted
// Coordinate based flight commands prior to where the takeoff would be inserted
_isInsertTakeoffValid
=
false
;
_isInsertTakeoffValid
=
false
;
...
@@ -2305,7 +2307,7 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
...
@@ -2305,7 +2307,7 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
}
}
if
(
qobject_cast
<
TakeoffMissionItem
*>
(
pVI
))
{
if
(
qobject_cast
<
TakeoffMissionItem
*>
(
pVI
))
{
takeoff
Index
=
viIndex
;
takeoff
SeqNum
=
currentSeqNumber
;
_isInsertTakeoffValid
=
false
;
_isInsertTakeoffValid
=
false
;
}
}
...
@@ -2317,7 +2319,7 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
...
@@ -2317,7 +2319,7 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
case
MAV_CMD_DO_LAND_START
:
case
MAV_CMD_DO_LAND_START
:
case
MAV_CMD_NAV_RETURN_TO_LAUNCH
:
case
MAV_CMD_NAV_RETURN_TO_LAUNCH
:
foundLand
=
true
;
foundLand
=
true
;
land
Index
=
viIndex
;
land
SeqNum
=
currentSeqNumber
;
break
;
break
;
default:
default:
break
;
break
;
...
@@ -2326,19 +2328,19 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
...
@@ -2326,19 +2328,19 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
FixedWingLandingComplexItem
*
fwLanding
=
qobject_cast
<
FixedWingLandingComplexItem
*>
(
pVI
);
FixedWingLandingComplexItem
*
fwLanding
=
qobject_cast
<
FixedWingLandingComplexItem
*>
(
pVI
);
if
(
fwLanding
)
{
if
(
fwLanding
)
{
foundLand
=
true
;
foundLand
=
true
;
land
Index
=
viIndex
;
land
SeqNum
=
currentSeqNumber
;
}
}
}
}
}
}
if
(
simpleItem
)
{
if
(
simpleItem
)
{
// Remember previous coordinate
// Remember previous coordinate
if
(
pVI
->
sequenceNumber
()
<
sequenceNumber
&&
simpleItem
->
specifiesCoordinate
()
&&
!
simpleItem
->
isStandaloneCoordinate
())
{
if
(
currentSeqNumber
<
sequenceNumber
&&
simpleItem
->
specifiesCoordinate
()
&&
!
simpleItem
->
isStandaloneCoordinate
())
{
_previousCoordinate
=
simpleItem
->
coordinate
();
_previousCoordinate
=
simpleItem
->
coordinate
();
}
}
// ROI state handling
// ROI state handling
if
(
pVI
->
sequenceNumber
()
<=
sequenceNumber
)
{
if
(
currentSeqNumber
<=
sequenceNumber
)
{
if
(
_isROIActive
)
{
if
(
_isROIActive
)
{
if
(
_isROICancelItem
(
simpleItem
))
{
if
(
_isROICancelItem
(
simpleItem
))
{
_isROIActive
=
false
;
_isROIActive
=
false
;
...
@@ -2349,12 +2351,17 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
...
@@ -2349,12 +2351,17 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
}
}
}
}
}
}
if
(
pVI
->
sequenceNumber
()
==
sequenceNumber
&&
_isROIBeginItem
(
simpleItem
))
{
if
(
currentSeqNumber
==
sequenceNumber
&&
_isROIBeginItem
(
simpleItem
))
{
_isROIBeginCurrentItem
=
true
;
_isROIBeginCurrentItem
=
true
;
}
}
if
(
simpleItem
->
specifiesCoordinate
()
&&
!
simpleItem
->
isStandaloneCoordinate
())
{
lastFlyThroughSeqNum
=
currentSeqNumber
;
}
}
}
if
(
pVI
->
sequenceNumber
()
==
sequenceNumber
)
{
if
(
currentSeqNumber
==
sequenceNumber
)
{
pVI
->
setIsCurrentItem
(
true
);
pVI
->
setIsCurrentItem
(
true
);
pVI
->
setHasCurrentChildItem
(
false
);
pVI
->
setHasCurrentChildItem
(
false
);
...
@@ -2383,9 +2390,9 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
...
@@ -2383,9 +2390,9 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
}
}
}
}
if
(
takeoff
Index
!=
-
1
)
{
if
(
takeoff
SeqNum
!=
-
1
)
{
// Takeoff item was found which means mission starts from ground
// Takeoff item was found which means mission starts from ground
if
(
sequenceNumber
<
takeoff
Index
)
{
if
(
sequenceNumber
<
takeoff
SeqNum
)
{
// Land is only valid after the takeoff item.
// Land is only valid after the takeoff item.
_isInsertLandValid
=
false
;
_isInsertLandValid
=
false
;
// Fly through commands are not allowed prior to the takeoff command
// Fly through commands are not allowed prior to the takeoff command
...
@@ -2393,10 +2400,17 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
...
@@ -2393,10 +2400,17 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
}
}
}
}
if
(
lastFlyThroughSeqNum
!=
-
1
)
{
// Land item must be after any fly through coordinates
if
(
sequenceNumber
<
lastFlyThroughSeqNum
)
{
_isInsertLandValid
=
false
;
}
}
if
(
foundLand
)
{
if
(
foundLand
)
{
// Can't have more than one land sequence
// Can't have more than one land sequence
_isInsertLandValid
=
false
;
_isInsertLandValid
=
false
;
if
(
sequenceNumber
>=
land
Index
)
{
if
(
sequenceNumber
>=
land
SeqNum
)
{
// Can't have fly through commands after a land item
// Can't have fly through commands after a land item
_flyThroughCommandsAllowed
=
false
;
_flyThroughCommandsAllowed
=
false
;
}
}
...
...
src/PlanView/PlanView.qml
View file @
0b96ca82
...
@@ -291,6 +291,17 @@ Item {
...
@@ -291,6 +291,17 @@ Item {
_missionController
.
insertComplexMissionItem
(
complexItemName
,
mapCenter
(),
nextIndex
,
true
/* makeCurrentItem */
)
_missionController
.
insertComplexMissionItem
(
complexItemName
,
mapCenter
(),
nextIndex
,
true
/* makeCurrentItem */
)
}
}
function
insertTakeItemAfterCurrent
()
{
var
nextIndex
=
_missionController
.
currentPlanViewVIIndex
+
1
_missionController
.
insertTakeoffItem
(
mapCenter
(),
nextIndex
,
true
/* makeCurrentItem */
)
}
function
insertLandItemAfterCurrent
()
{
var
nextIndex
=
_missionController
.
currentPlanViewVIIndex
+
1
_missionController
.
insertLandItem
(
mapCenter
(),
nextIndex
,
true
/* makeCurrentItem */
)
}
function
selectNextNotReady
()
{
function
selectNextNotReady
()
{
var
foundCurrent
=
false
var
foundCurrent
=
false
for
(
var
i
=
0
;
i
<
_missionController
.
visualItems
.
count
;
i
++
)
{
for
(
var
i
=
0
;
i
<
_missionController
.
visualItems
.
count
;
i
++
)
{
...
@@ -643,7 +654,7 @@ Item {
...
@@ -643,7 +654,7 @@ Item {
break*/
break*/
case
takeoffButtonIndex
:
case
takeoffButtonIndex
:
allAddClickBoolsOff
()
allAddClickBoolsOff
()
_missionController
.
insertTakeoffItem
(
mapCenter
(),
_missionController
.
currentMissionIndex
,
true
/* makeCurrentItem */
)
insertTakeItemAfterCurrent
(
)
break
break
case
waypointButtonIndex
:
case
waypointButtonIndex
:
if
(
_addWaypointOnClick
)
{
if
(
_addWaypointOnClick
)
{
...
@@ -675,7 +686,7 @@ Item {
...
@@ -675,7 +686,7 @@ Item {
break
break
case
landButtonIndex
:
case
landButtonIndex
:
allAddClickBoolsOff
()
allAddClickBoolsOff
()
_missionController
.
insertLandItem
(
mapCenter
(),
_missionController
.
currentMissionIndex
,
true
/* makeCurrentItem */
)
insertLandItemAfterCurrent
(
)
break
break
}
}
}
}
...
...
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