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
2d447d33
Unverified
Commit
2d447d33
authored
Jan 05, 2018
by
Don Gagne
Committed by
GitHub
Jan 05, 2018
Browse files
Merge pull request #5960 from DonLakeFlyer/FlyWaypointLines
Fix fly view waypoint line generation
parents
270c3f46
a53d8023
Changes
1
Show whitespace changes
Inline
Side-by-side
src/MissionManager/MissionController.cc
View file @
2d447d33
...
...
@@ -1011,9 +1011,9 @@ void MissionController::_recalcWaypointLines(void)
bool
firstCoordinateItem
=
true
;
VisualMissionItem
*
lastCoordinateItem
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
0
));
bool
showH
omePosition
=
_settingsItem
->
coordinate
().
isValid
();
bool
h
omePosition
Valid
=
_settingsItem
->
coordinate
().
isValid
();
qCDebug
(
MissionControllerLog
)
<<
"_recalcWaypointLines
showH
omePosition
"
<<
showH
omePosition
;
qCDebug
(
MissionControllerLog
)
<<
"_recalcWaypointLines
h
omePosition
Valid"
<<
h
omePosition
Valid
;
CoordVectHashTable
old_table
=
_linesTable
;
_linesTable
.
clear
();
...
...
@@ -1032,35 +1032,33 @@ void MissionController::_recalcWaypointLines(void)
for
(
int
i
=
1
;
i
<
_visualItems
->
count
();
i
++
)
{
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
i
));
// If we still haven't found the first coordinate item and we hit a takeoff command, link back to home
if
(
firstCoordinateItem
&&
item
->
isSimpleItem
()
&&
(
!
_controllerVehicle
->
firmwarePlugin
()
->
supportedMissionCommands
().
contains
(
MAV_CMD_NAV_TAKEOFF
)
||
qobject_cast
<
SimpleMissionItem
*>
(
item
)
->
command
()
==
MavlinkQmlSingleton
::
MAV_CMD_NAV_TAKEOFF
||
qobject_cast
<
SimpleMissionItem
*>
(
item
)
->
command
()
==
MavlinkQmlSingleton
::
MAV_CMD_NAV_VTOL_TAKEOFF
))
{
// If we still haven't found the first coordinate item and we hit a takeoff command this means the mission starts from the ground.
// Link the first item back to home to show that.
if
(
firstCoordinateItem
&&
item
->
isSimpleItem
())
{
MAV_CMD
command
=
(
MAV_CMD
)
qobject_cast
<
SimpleMissionItem
*>
(
item
)
->
command
();
if
(
command
==
MAV_CMD_NAV_TAKEOFF
||
command
==
MAV_CMD_NAV_VTOL_TAKEOFF
)
{
linkStartToHome
=
true
;
if
(
!
_editMode
)
{
_waypointPath
.
append
(
QVariant
::
fromValue
(
lastCoordinateItem
->
coordinate
()));
}
}
if
(
item
->
specifiesCoordinate
())
{
if
(
!
item
->
isStandaloneCoordinate
())
{
if
(
item
->
specifiesCoordinate
()
&&
!
item
->
isStandaloneCoordinate
())
{
firstCoordinateItem
=
false
;
if
(
lastCoordinateItem
!=
_settingsItem
||
(
showH
omePosition
&&
linkStartToHome
))
{
if
(
lastCoordinateItem
!=
_settingsItem
||
(
h
omePosition
Valid
&&
linkStartToHome
))
{
if
(
_editMode
)
{
VisualItemPair
pair
(
lastCoordinateItem
,
item
);
_addWaypointLineSegment
(
old_table
,
pair
);
}
else
{
_waypointPath
.
append
(
QVariant
::
fromValue
(
item
->
coordinate
()));
}
}
_waypointPath
.
append
(
QVariant
::
fromValue
(
item
->
coordinate
()));
lastCoordinateItem
=
item
;
}
}
if
(
linkStartToHome
&&
homePositionValid
)
{
_waypointPath
.
prepend
(
QVariant
::
fromValue
(
_settingsItem
->
coordinate
()));
}
if
(
linkEndToHome
&&
lastCoordinateItem
!=
_settingsItem
&&
showHomePosition
)
{
if
(
linkEndToHome
&&
lastCoordinateItem
!=
_settingsItem
&&
homePositionValid
)
{
if
(
_editMode
)
{
VisualItemPair
pair
(
lastCoordinateItem
,
_settingsItem
);
_addWaypointLineSegment
(
old_table
,
pair
);
...
...
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