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
566167ab
Commit
566167ab
authored
May 14, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cubic relative altitude slider
parent
703c7d41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
+24
-11
GuidedAltitudeSlider.qml
src/FlightDisplay/GuidedAltitudeSlider.qml
+24
-11
No files found.
src/FlightDisplay/GuidedAltitudeSlider.qml
View file @
566167ab
...
...
@@ -21,18 +21,27 @@ Rectangle {
readonly
property
real
_maxAlt
:
121.92
// 400 feet
readonly
property
real
_minAlt
:
3
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
real
_vehicleAltitude
:
_activeVehicle
?
_activeVehicle
.
altitudeRelative
.
rawValue
:
0
property
bool
_fixedWing
:
_activeVehicle
?
_activeVehicle
.
fixedWing
:
false
property
real
_sliderMaxAlt
:
_fixedWing
?
_maxAlt
:
Math
.
min
(
_vehicleAltitude
+
10
,
_maxAlt
)
property
real
_sliderMinAlt
:
_fixedWing
?
_minAlt
:
Math
.
max
(
_vehicleAltitude
-
10
,
_minAlt
)
property
var
_guidedSettings
:
QGroundControl
.
settingsManager
.
guidedSettings
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
real
_vehicleAltitude
:
_activeVehicle
?
_activeVehicle
.
altitudeRelative
.
rawValue
:
0
property
bool
_fixedWing
:
_activeVehicle
?
_activeVehicle
.
fixedWing
:
false
property
real
_sliderMaxAlt
:
_fixedWing
?
_guidedSettings
.
fixedWingMaximumAltitude
.
value
:
_guidedSettings
.
vehicleMaximumAltitude
.
value
property
real
_sliderMinAlt
:
_fixedWing
?
_guidedSettings
.
fixedWingMinimumAltitude
.
value
:
_guidedSettings
.
vehicleMinimumAltitude
.
value
function
reset
()
{
altSlider
.
value
=
Math
.
min
(
Math
.
max
(
altSlider
.
minimumValue
,
0
),
altSlider
.
maximumValue
)
altSlider
.
value
=
0
}
function
getValue
()
{
return
altSlider
.
value
return
altField
.
newAltitude
-
_vehicleAltitude
}
function
log10
(
value
)
{
if
(
value
===
0
)
{
return
0
}
else
{
return
Math
.
log
(
value
)
/
Math
.
LN10
}
}
Column
{
...
...
@@ -55,7 +64,11 @@ Rectangle {
anchors.horizontalCenter
:
parent
.
horizontalCenter
text
:
Math
.
abs
(
newAltitude
.
toFixed
(
1
))
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
property
real
newAltitude
:
QGroundControl
.
metersToAppSettingsDistanceUnits
(
_root
.
_vehicleAltitude
+
altSlider
.
value
).
toFixed
(
1
)
property
real
altGainRange
:
Math
.
max
(
_sliderMaxAlt
-
_vehicleAltitude
,
0
)
property
real
altLossRange
:
Math
.
max
(
_vehicleAltitude
-
_sliderMinAlt
,
0
)
property
real
altExp
:
Math
.
pow
(
altSlider
.
value
,
3
)
property
real
altLossGain
:
altExp
*
(
altSlider
.
value
>
0
?
altGainRange
:
altLossRange
)
property
real
newAltitude
:
_vehicleAltitude
+
altLossGain
// QGroundControl.metersToAppSettingsDistanceUnits(_root._vehicleAltitude + altSlider.value).toFixed(1)
}
}
...
...
@@ -67,9 +80,9 @@ Rectangle {
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
orientation
:
Qt
.
Vertical
minimumValue
:
_root
.
_sliderMinAlt
-
_root
.
_vehicleAltitude
maximumValue
:
_root
.
_sliderMaxAlt
-
_root
.
_vehicleAltitude
zeroCentered
:
true
minimumValue
:
-
1
maximumValue
:
1
zeroCentered
:
true
rotation
:
180
// We want slide up to be positive values
...
...
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