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
b750c08c
Commit
b750c08c
authored
Feb 21, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rem. dist time issues fixed
parent
d8e92671
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
MissionController.cc
src/MissionManager/MissionController.cc
+23
-11
No files found.
src/MissionManager/MissionController.cc
View file @
b750c08c
...
...
@@ -1676,7 +1676,6 @@ void MissionController::_recalcAll(void)
void
MissionController
::
_enableDisableRemainingDistTimeCalculation
(
bool
flying
)
{
qWarning
()
<<
"MissionController::_enableDisableRemainingDistTimeCalculation(): current index: "
<<
_missionManager
->
currentIndex
();
if
(
flying
)
{
_remainingDistanceTimeTimer
.
start
();
}
else
{
...
...
@@ -2188,8 +2187,6 @@ bool MissionController::distanceTimeToMissionEnd(double &remainingDistance, doub
||
missionIndex
>
_visualItems
->
count
())
{
return
false
;
}
qWarning
(
"
\n\n
"
);
qWarning
()
<<
"MissionController::distanceTimeToMissionEnd: missionIndex"
<<
missionIndex
;
// check if vehicle is flying and fetch vehicle coordinate
QGeoCoordinate
vehiclePosition
;
if
(
_managerVehicle
&&
_managerVehicle
->
flying
()
&&
useVehiclePosition
)
{
...
...
@@ -2233,10 +2230,10 @@ bool MissionController::distanceTimeToMissionEnd(double &remainingDistance, doub
}
}
// determine speed at waypoint with index
currentMissionIdx-1
// determine speed at waypoint with index
missionIndex
double
currentSpeed
=
_settingsItem
->
specifiedFlightSpeed
();
currentSpeed
=
!
qIsNaN
(
currentSpeed
)
?
currentSpeed
:
5
;
for
(
int
i
=
1
;
i
<
missionIndex
-
1
;
++
i
)
{
for
(
int
i
=
1
;
i
<
missionIndex
;
++
i
)
{
SimpleMissionItem
*
simpleItem
=
_visualItems
->
value
<
SimpleMissionItem
*>
(
i
);
if
(
simpleItem
!=
nullptr
)
{
...
...
@@ -2246,6 +2243,7 @@ bool MissionController::distanceTimeToMissionEnd(double &remainingDistance, doub
}
}
// calculate dist and time from current vehicle pos. to mission item with index missionIndex
if
(
useVehiclePosition
)
{
// find valid coordinate
for
(
int
i
=
missionIndex
;
i
<
_visualItems
->
count
();
++
i
)
{
...
...
@@ -2265,8 +2263,6 @@ bool MissionController::distanceTimeToMissionEnd(double &remainingDistance, doub
for
(
int
i
=
missionIndex
;
i
<
_visualItems
->
count
();
i
++
)
{
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
i
));
SimpleMissionItem
*
simpleItem
=
qobject_cast
<
SimpleMissionItem
*>
(
item
);
qWarning
()
<<
"MissionController::distanceTimeToMissionEnd: i:"
<<
i
;
qWarning
()
<<
"MissionController::distanceTimeToMissionEnd: coordinate:"
<<
item
->
coordinate
();
// Assume the worst
item
->
setAzimuth
(
0.0
);
...
...
@@ -2306,7 +2302,6 @@ bool MissionController::distanceTimeToMissionEnd(double &remainingDistance, doub
if
(
lastCoordinateItem
!=
_settingsItem
||
linkStartToHome
)
{
// This is a subsequent waypoint or we are forcing the first waypoint back to home
qWarning
()
<<
"MissionController::distanceTimeToMissionEnd: entered"
;
QGeoCoordinate
currentCoord
=
item
->
coordinate
();
QGeoCoordinate
prevCoord
=
lastCoordinateItem
->
exitCoordinate
();
...
...
@@ -2328,8 +2323,27 @@ bool MissionController::distanceTimeToMissionEnd(double &remainingDistance, doub
lastCoordinateItem
=
item
;
}
if
(
simpleItem
!=
nullptr
&&
(
simpleItem
->
command
()
==
MAV_CMD_NAV_LAND
||
simpleItem
->
command
()
==
MAV_CMD_NAV_LAND_LOCAL
||
simpleItem
->
command
()
==
MAV_CMD_NAV_VTOL_LAND
))
{
qWarning
()
<<
"MissionController::distanceTimeToMissionEnd: dist: "
<<
remainingDistance
;
double
alt
=
0
;
if
(
i
==
missionIndex
)
{
alt
=
_managerVehicle
->
altitudeRelative
()
->
rawValue
().
toDouble
();
}
else
{
QGeoCoordinate
currentCoord
=
simpleItem
->
coordinate
();
if
(
simpleItem
->
coordinateHasRelativeAltitude
())
{
currentCoord
.
setAltitude
(
homePositionAltitude
+
currentCoord
.
altitude
());
}
alt
=
currentCoord
.
altitude
()
-
homePositionAltitude
;
}
double
landTime
=
qAbs
(
alt
)
/
_appSettings
->
offlineEditingDescentSpeed
()
->
rawValue
().
toDouble
();
remainingTime
+=
landTime
;
}
}
if
(
linkEndToHome
&&
lastCoordinateItem
!=
_settingsItem
)
{
...
...
@@ -2350,8 +2364,6 @@ bool MissionController::distanceTimeToMissionEnd(double &remainingDistance, doub
remainingDistance
+=
distance
;
remainingTime
+=
time
+
landTime
;
}
qWarning
()
<<
"MissionController::distanceTimeToMissionEnd: end dist: "
<<
remainingDistance
;
return
true
;
}
...
...
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