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
9c9e2d14
Commit
9c9e2d14
authored
Mar 20, 2018
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be careful of climb rates of 0
parent
c168ed75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
48 deletions
+53
-48
TransectStyleComplexItem.cc
src/MissionManager/TransectStyleComplexItem.cc
+53
-48
No files found.
src/MissionManager/TransectStyleComplexItem.cc
View file @
9c9e2d14
...
...
@@ -500,7 +500,7 @@ int TransectStyleComplexItem::_maxPathHeight(const TerrainPathQuery::PathHeightI
void
TransectStyleComplexItem
::
_adjustForMaxRates
(
QList
<
CoordInfo_t
>&
transect
)
{
double
maxClimbRate
=
_terrainAdjustMaxClimbRateFact
.
rawValue
().
toDouble
();
double
maxDescentRate
=
-
_terrainAdjustMaxDescentRateFact
.
rawValue
().
toDouble
();
double
maxDescentRate
=
_terrainAdjustMaxDescentRateFact
.
rawValue
().
toDouble
();
double
flightSpeed
=
_missionFlightStatus
.
vehicleSpeed
;
if
(
qIsNaN
(
flightSpeed
)
||
(
maxClimbRate
==
0
&&
maxDescentRate
==
0
))
{
...
...
@@ -510,55 +510,60 @@ void TransectStyleComplexItem::_adjustForMaxRates(QList<CoordInfo_t>& transect)
return
;
}
// Adjust climb rates
bool
climbRateAdjusted
;
do
{
//qDebug() << "climbrate pass";
climbRateAdjusted
=
false
;
for
(
int
i
=
0
;
i
<
transect
.
count
()
-
1
;
i
++
)
{
QGeoCoordinate
&
fromCoord
=
transect
[
i
].
coord
;
QGeoCoordinate
&
toCoord
=
transect
[
i
+
1
].
coord
;
double
altDifference
=
toCoord
.
altitude
()
-
fromCoord
.
altitude
();
double
distance
=
fromCoord
.
distanceTo
(
toCoord
);
double
seconds
=
distance
/
flightSpeed
;
double
climbRate
=
altDifference
/
seconds
;
//qDebug() << QString("Index:%1 altDifference:%2 distance:%3 seconds:%4 climbRate:%5").arg(i).arg(altDifference).arg(distance).arg(seconds).arg(climbRate);
if
(
climbRate
>
0
&&
climbRate
-
maxClimbRate
>
0.1
)
{
double
maxAltitudeDelta
=
maxClimbRate
*
seconds
;
fromCoord
.
setAltitude
(
toCoord
.
altitude
()
-
maxAltitudeDelta
);
//qDebug() << "Adjusting";
climbRateAdjusted
=
true
;
if
(
maxClimbRate
>
0
)
{
// Adjust climb rates
bool
climbRateAdjusted
;
do
{
//qDebug() << "climbrate pass";
climbRateAdjusted
=
false
;
for
(
int
i
=
0
;
i
<
transect
.
count
()
-
1
;
i
++
)
{
QGeoCoordinate
&
fromCoord
=
transect
[
i
].
coord
;
QGeoCoordinate
&
toCoord
=
transect
[
i
+
1
].
coord
;
double
altDifference
=
toCoord
.
altitude
()
-
fromCoord
.
altitude
();
double
distance
=
fromCoord
.
distanceTo
(
toCoord
);
double
seconds
=
distance
/
flightSpeed
;
double
climbRate
=
altDifference
/
seconds
;
//qDebug() << QString("Index:%1 altDifference:%2 distance:%3 seconds:%4 climbRate:%5").arg(i).arg(altDifference).arg(distance).arg(seconds).arg(climbRate);
if
(
climbRate
>
0
&&
climbRate
-
maxClimbRate
>
0.1
)
{
double
maxAltitudeDelta
=
maxClimbRate
*
seconds
;
fromCoord
.
setAltitude
(
toCoord
.
altitude
()
-
maxAltitudeDelta
);
//qDebug() << "Adjusting";
climbRateAdjusted
=
true
;
}
}
}
}
while
(
climbRateAdjusted
);
// Adjust descent rates
bool
descentRateAdjusted
;
do
{
//qDebug() << "descent rate pass";
descentRateAdjusted
=
false
;
for
(
int
i
=
1
;
i
<
transect
.
count
();
i
++
)
{
QGeoCoordinate
&
fromCoord
=
transect
[
i
-
1
].
coord
;
QGeoCoordinate
&
toCoord
=
transect
[
i
].
coord
;
double
altDifference
=
toCoord
.
altitude
()
-
fromCoord
.
altitude
();
double
distance
=
fromCoord
.
distanceTo
(
toCoord
);
double
seconds
=
distance
/
flightSpeed
;
double
descentRate
=
altDifference
/
seconds
;
//qDebug() << QString("Index:%1 altDifference:%2 distance:%3 seconds:%4 descentRate:%5").arg(i).arg(altDifference).arg(distance).arg(seconds).arg(descentRate);
if
(
descentRate
<
0
&&
descentRate
-
maxDescentRate
<
-
0.1
)
{
double
maxAltitudeDelta
=
maxDescentRate
*
seconds
;
toCoord
.
setAltitude
(
fromCoord
.
altitude
()
+
maxAltitudeDelta
);
//qDebug() << "Adjusting";
descentRateAdjusted
=
true
;
}
while
(
climbRateAdjusted
);
}
if
(
maxDescentRate
>
0
)
{
// Adjust descent rates
bool
descentRateAdjusted
;
maxDescentRate
=
-
maxDescentRate
;
do
{
//qDebug() << "descent rate pass";
descentRateAdjusted
=
false
;
for
(
int
i
=
1
;
i
<
transect
.
count
();
i
++
)
{
QGeoCoordinate
&
fromCoord
=
transect
[
i
-
1
].
coord
;
QGeoCoordinate
&
toCoord
=
transect
[
i
].
coord
;
double
altDifference
=
toCoord
.
altitude
()
-
fromCoord
.
altitude
();
double
distance
=
fromCoord
.
distanceTo
(
toCoord
);
double
seconds
=
distance
/
flightSpeed
;
double
descentRate
=
altDifference
/
seconds
;
//qDebug() << QString("Index:%1 altDifference:%2 distance:%3 seconds:%4 descentRate:%5").arg(i).arg(altDifference).arg(distance).arg(seconds).arg(descentRate);
if
(
descentRate
<
0
&&
descentRate
-
maxDescentRate
<
-
0.1
)
{
double
maxAltitudeDelta
=
maxDescentRate
*
seconds
;
toCoord
.
setAltitude
(
fromCoord
.
altitude
()
+
maxAltitudeDelta
);
//qDebug() << "Adjusting";
descentRateAdjusted
=
true
;
}
}
}
}
while
(
descentRateAdjusted
);
}
while
(
descentRateAdjusted
);
}
}
void
TransectStyleComplexItem
::
_adjustForTolerance
(
QList
<
CoordInfo_t
>&
transect
)
...
...
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