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
c5b75b70
Commit
c5b75b70
authored
Jul 15, 2019
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Joystick UI WIP
parent
4f293495
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
164 additions
and
112 deletions
+164
-112
qgcresources.qrc
qgcresources.qrc
+1
-0
joystick.svg
resources/calibration/joystick/joystick.svg
+47
-0
JoystickConfig.qml
src/VehicleSetup/JoystickConfig.qml
+116
-112
No files found.
qgcresources.qrc
View file @
c5b75b70
...
...
@@ -56,6 +56,7 @@
<file alias="px4.png">resources/firmware/px4.png</file>
</qresource>
<qresource prefix="/res/calibration">
<file alias="joystick.svg">resources/calibration/joystick/joystick.svg</file>
<file alias="accel_back.png">resources/calibration/accel_back.png</file>
<file alias="accel_down.png">resources/calibration/accel_down.png</file>
<file alias="accel_front.png">resources/calibration/accel_front.png</file>
...
...
resources/calibration/joystick/joystick.svg
0 → 100644
View file @
c5b75b70
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version=
"1.1"
id=
"Layer_1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
x=
"0px"
y=
"0px"
viewBox=
"0 0 288 144"
style=
"enable-background:new 0 0 288 144;"
xml:space=
"preserve"
>
<style
type=
"text/css"
>
.st0{fill:none;stroke:#000000;stroke-width:4;stroke-miterlimit:10;}
.st1{fill:none;stroke:#000000;stroke-width:3;stroke-miterlimit:10;}
.st2{fill:none;stroke:#000000;stroke-miterlimit:10;}
.st3{fill:none;stroke:#000000;stroke-width:2;stroke-miterlimit:10;}
</style>
<circle
class=
"st0"
cx=
"72"
cy=
"86.4"
r=
"36"
/>
<circle
class=
"st0"
cx=
"216"
cy=
"86.4"
r=
"36"
/>
<circle
class=
"st1"
cx=
"72"
cy=
"28.8"
r=
"10.8"
/>
<circle
class=
"st1"
cx=
"216"
cy=
"28.8"
r=
"10.8"
/>
<g>
<line
class=
"st2"
x1=
"57.343"
y1=
"28.8"
x2=
"53.059"
y2=
"28.8"
/>
<line
class=
"st2"
x1=
"86.657"
y1=
"28.8"
x2=
"90.941"
y2=
"28.8"
/>
<line
class=
"st2"
x1=
"86.158"
y1=
"25.006"
x2=
"90.295"
y2=
"23.898"
/>
<line
class=
"st2"
x1=
"84.693"
y1=
"21.471"
x2=
"88.403"
y2=
"19.33"
/>
<line
class=
"st2"
x1=
"82.364"
y1=
"18.436"
x2=
"85.393"
y2=
"15.407"
/>
<line
class=
"st2"
x1=
"79.329"
y1=
"16.107"
x2=
"81.47"
y2=
"12.397"
/>
<line
class=
"st2"
x1=
"75.794"
y1=
"14.642"
x2=
"76.902"
y2=
"10.505"
/>
<line
class=
"st2"
x1=
"72"
y1=
"14.143"
x2=
"72"
y2=
"9.859"
/>
<line
class=
"st2"
x1=
"68.206"
y1=
"14.642"
x2=
"67.098"
y2=
"10.505"
/>
<line
class=
"st2"
x1=
"64.671"
y1=
"16.107"
x2=
"62.53"
y2=
"12.397"
/>
<line
class=
"st2"
x1=
"61.636"
y1=
"18.436"
x2=
"58.607"
y2=
"15.407"
/>
<line
class=
"st2"
x1=
"59.307"
y1=
"21.471"
x2=
"55.597"
y2=
"19.33"
/>
<line
class=
"st2"
x1=
"57.842"
y1=
"25.006"
x2=
"53.705"
y2=
"23.898"
/>
</g>
<g>
<line
class=
"st2"
x1=
"201.343"
y1=
"28.8"
x2=
"197.059"
y2=
"28.8"
/>
<line
class=
"st2"
x1=
"230.657"
y1=
"28.8"
x2=
"234.941"
y2=
"28.8"
/>
<line
class=
"st2"
x1=
"230.158"
y1=
"25.006"
x2=
"234.295"
y2=
"23.898"
/>
<line
class=
"st2"
x1=
"228.693"
y1=
"21.471"
x2=
"232.403"
y2=
"19.33"
/>
<line
class=
"st2"
x1=
"226.364"
y1=
"18.436"
x2=
"229.393"
y2=
"15.407"
/>
<line
class=
"st2"
x1=
"223.329"
y1=
"16.107"
x2=
"225.47"
y2=
"12.397"
/>
<line
class=
"st2"
x1=
"219.794"
y1=
"14.642"
x2=
"220.902"
y2=
"10.505"
/>
<line
class=
"st2"
x1=
"216"
y1=
"14.143"
x2=
"216"
y2=
"9.859"
/>
<line
class=
"st2"
x1=
"212.206"
y1=
"14.642"
x2=
"211.098"
y2=
"10.505"
/>
<line
class=
"st2"
x1=
"208.671"
y1=
"16.107"
x2=
"206.53"
y2=
"12.397"
/>
<line
class=
"st2"
x1=
"205.636"
y1=
"18.436"
x2=
"202.607"
y2=
"15.407"
/>
<line
class=
"st2"
x1=
"203.307"
y1=
"21.471"
x2=
"199.597"
y2=
"19.33"
/>
<line
class=
"st2"
x1=
"201.842"
y1=
"25.006"
x2=
"197.705"
y2=
"23.898"
/>
</g>
<path
class=
"st3"
d=
"M274.39,142.253H13.61c-6.6,0-12-5.4-12-12V13.747c0-6.6,5.4-12,12-12h260.78c6.6,0,12,5.4,12,12v116.505
C286.39,136.853,280.99,142.253,274.39,142.253z"
/>
</svg>
src/VehicleSetup/JoystickConfig.qml
View file @
c5b75b70
...
...
@@ -27,7 +27,8 @@ SetupPage {
pageName
:
qsTr
(
"
Joystick
"
)
pageDescription
:
qsTr
(
"
Joystick Setup is used to configure a calibrate joysticks.
"
)
readonly
property
real
_maxButtons
:
64
readonly
property
real
_maxButtons
:
64
readonly
property
real
_attitudeLabelWidth
:
ScreenTools
.
defaultFontPixelWidth
*
12
Connections
{
target
:
joystickManager
...
...
@@ -157,7 +158,7 @@ SetupPage {
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.left
:
parent
.
left
anchors.right
:
rightColumn
.
left
spacing
:
10
spacing
:
ScreenTools
.
defaultFontPixelHeight
// Attitude Controls
Column
{
...
...
@@ -171,9 +172,9 @@ SetupPage {
height
:
defaultTextHeight
*
2
QGCLabel
{
id
:
rollLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
activeVehicle
.
sub
?
qsTr
(
"
Lateral
"
)
:
qsTr
(
"
Roll
"
)
id
:
rollLabel
width
:
_attitudeLabelWidth
text
:
activeVehicle
.
sub
?
qsTr
(
"
Lateral
"
)
:
qsTr
(
"
Roll
"
)
}
Loader
{
...
...
@@ -188,8 +189,8 @@ SetupPage {
}
Connections
{
target
:
_activeJoystick
onManualControl
:
rollLoader
.
item
.
axisValue
=
roll
*
32768.0
target
:
_activeJoystick
onManualControl
:
rollLoader
.
item
.
axisValue
=
roll
*
32768.0
}
}
...
...
@@ -198,9 +199,9 @@ SetupPage {
height
:
defaultTextHeight
*
2
QGCLabel
{
id
:
pitchLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
activeVehicle
.
sub
?
qsTr
(
"
Forward
"
)
:
qsTr
(
"
Pitch
"
)
id
:
pitchLabel
width
:
_attitudeLabelWidth
text
:
activeVehicle
.
sub
?
qsTr
(
"
Forward
"
)
:
qsTr
(
"
Pitch
"
)
}
Loader
{
...
...
@@ -210,13 +211,13 @@ SetupPage {
height
:
ScreenTools
.
defaultFontPixelHeight
width
:
100
sourceComponent
:
axisMonitorDisplayComponent
property
bool
mapped
:
controller
.
pitchAxisMapped
property
bool
reversed
:
controller
.
pitchAxisReversed
property
bool
mapped
:
controller
.
pitchAxisMapped
property
bool
reversed
:
controller
.
pitchAxisReversed
}
Connections
{
target
:
_activeJoystick
onManualControl
:
pitchLoader
.
item
.
axisValue
=
pitch
*
32768.0
target
:
_activeJoystick
onManualControl
:
pitchLoader
.
item
.
axisValue
=
pitch
*
32768.0
}
}
...
...
@@ -225,9 +226,9 @@ SetupPage {
height
:
defaultTextHeight
*
2
QGCLabel
{
id
:
yawLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
qsTr
(
"
Yaw
"
)
id
:
yawLabel
width
:
_attitudeLabelWidth
text
:
qsTr
(
"
Yaw
"
)
}
Loader
{
...
...
@@ -237,13 +238,13 @@ SetupPage {
height
:
ScreenTools
.
defaultFontPixelHeight
width
:
100
sourceComponent
:
axisMonitorDisplayComponent
property
bool
mapped
:
controller
.
yawAxisMapped
property
bool
reversed
:
controller
.
yawAxisReversed
property
bool
mapped
:
controller
.
yawAxisMapped
property
bool
reversed
:
controller
.
yawAxisReversed
}
Connections
{
target
:
_activeJoystick
onManualControl
:
yawLoader
.
item
.
axisValue
=
yaw
*
32768.0
target
:
_activeJoystick
onManualControl
:
yawLoader
.
item
.
axisValue
=
yaw
*
32768.0
}
}
...
...
@@ -252,9 +253,9 @@ SetupPage {
height
:
defaultTextHeight
*
2
QGCLabel
{
id
:
throttleLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
qsTr
(
"
Throttle
"
)
id
:
throttleLabel
width
:
_attitudeLabelWidth
text
:
qsTr
(
"
Throttle
"
)
}
Loader
{
...
...
@@ -264,13 +265,13 @@ SetupPage {
height
:
ScreenTools
.
defaultFontPixelHeight
width
:
100
sourceComponent
:
axisMonitorDisplayComponent
property
bool
mapped
:
controller
.
throttleAxisMapped
property
bool
reversed
:
controller
.
throttleAxisReversed
property
bool
mapped
:
controller
.
throttleAxisMapped
property
bool
reversed
:
controller
.
throttleAxisReversed
}
Connections
{
target
:
_activeJoystick
onManualControl
:
throttleLoader
.
item
.
axisValue
=
_activeJoystick
.
negativeThrust
?
-
throttle
*
32768.0
:
(
-
2
*
throttle
+
1
)
*
32768.0
target
:
_activeJoystick
onManualControl
:
throttleLoader
.
item
.
axisValue
=
_activeJoystick
.
negativeThrust
?
-
throttle
*
32768.0
:
(
-
2
*
throttle
+
1
)
*
32768.0
}
}
...
...
@@ -279,9 +280,9 @@ SetupPage {
height
:
defaultTextHeight
*
2
QGCLabel
{
id
:
gimbalPitchLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
qsTr
(
"
Gimbal Pitch
"
)
id
:
gimbalPitchLabel
width
:
_attitudeLabelWidth
text
:
qsTr
(
"
Gimbal Pitch
"
)
}
Loader
{
...
...
@@ -296,7 +297,7 @@ SetupPage {
}
Connections
{
target
:
_activeJoystick
target
:
_activeJoystick
onManualControl
:
gimbalPitchLoader
.
item
.
axisValue
=
gimbalPitch
*
32768.0
}
}
...
...
@@ -306,9 +307,9 @@ SetupPage {
height
:
defaultTextHeight
*
2
QGCLabel
{
id
:
gimbalYawLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
qsTr
(
"
Gimbal Yaw
"
)
id
:
gimbalYawLabel
width
:
_attitudeLabelWidth
text
:
qsTr
(
"
Gimbal Yaw
"
)
}
Loader
{
...
...
@@ -323,7 +324,7 @@ SetupPage {
}
Connections
{
target
:
_activeJoystick
target
:
_activeJoystick
onManualControl
:
gimbalYawLoader
.
item
.
axisValue
=
gimbalYaw
*
32768.0
}
}
...
...
@@ -334,26 +335,24 @@ SetupPage {
Row
{
spacing
:
10
visible
:
_activeJoystick
.
requiresCalibration
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCButton
{
id
:
skipButton
text
:
qsTr
(
"
Skip
"
)
onClicked
:
controller
.
skipButtonClicked
()
id
:
skipButton
text
:
qsTr
(
"
Skip
"
)
onClicked
:
controller
.
skipButtonClicked
()
}
QGCButton
{
id
:
cancelButton
text
:
qsTr
(
"
Cancel
"
)
onClicked
:
controller
.
cancelButtonClicked
()
id
:
cancelButton
text
:
qsTr
(
"
Cancel
"
)
onClicked
:
controller
.
cancelButtonClicked
()
}
QGCButton
{
id
:
nextButton
primary
:
true
text
:
qsTr
(
"
Calibrate
"
)
onClicked
:
controller
.
nextButtonClicked
()
onClicked
:
controller
.
nextButtonClicked
()
}
}
// Row - Buttons
}
// Status Text
QGCLabel
{
...
...
@@ -412,41 +411,34 @@ SetupPage {
}
}
Row
{
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
qsTr
(
"
Active joystick:
"
)
}
QGCLabel
{
id
:
activeJoystickLabel
anchors.baseline
:
joystickCombo
.
baseline
text
:
qsTr
(
"
Active joystick:
"
)
}
QGCComboBox
{
id
:
joystickCombo
width
:
parent
.
width
*
0.9
model
:
joystickManager
.
joystickNames
QGCComboBox
{
id
:
joystickCombo
width
:
parent
.
width
-
activeJoystickLabel
.
width
-
parent
.
spacing
model
:
joystickManager
.
joystickNames
onActivated
:
joystickManager
.
activeJoystickName
=
textAt
(
index
)
onActivated
:
joystickManager
.
activeJoystickName
=
textAt
(
index
)
Component.onCompleted
:
{
var
index
=
joystickCombo
.
find
(
joystickManager
.
activeJoystickName
)
if
(
index
===
-
1
)
{
console
.
warn
(
qsTr
(
"
Active joystick name not in combo
"
),
joystickManager
.
activeJoystickName
)
}
else
{
joystickCombo
.
currentIndex
=
index
}
}
Component.onCompleted
:
{
Connections
{
target
:
joystickManager
onAvailableJoysticksChanged
:
{
var
index
=
joystickCombo
.
find
(
joystickManager
.
activeJoystickName
)
if
(
index
===
-
1
)
{
console
.
warn
(
qsTr
(
"
Active joystick name not in combo
"
),
joystickManager
.
activeJoystickName
)
}
else
{
if
(
index
>=
0
)
{
joystickCombo
.
currentIndex
=
index
}
}
Connections
{
target
:
joystickManager
onAvailableJoysticksChanged
:
{
var
index
=
joystickCombo
.
find
(
joystickManager
.
activeJoystickName
)
if
(
index
>=
0
)
{
joystickCombo
.
currentIndex
=
index
}
}
}
}
}
...
...
@@ -494,7 +486,7 @@ SetupPage {
}
Column
{
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
3
spacing
:
ScreenTools
.
defaultFontPixelHeight
QGCLabel
{
id
:
expoSliderLabel
...
...
@@ -502,15 +494,15 @@ SetupPage {
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCSlider
{
id
:
expoSlider
minimumValue
:
0
m
aximumValue
:
0.75
Component.onCompleted
:
value
=
-
_activeJoystick
.
exponential
onValueChanged
:
_activeJoystick
.
exponential
=
-
value
id
:
expoSlider
width
:
ScreenTools
.
defaultFontPixelWidth
*
14
m
inimumValue
:
0
maximumValue
:
0.75
Component.onCompleted
:
value
=
-
_activeJoystick
.
exponential
onValueChanged
:
_activeJoystick
.
exponential
=
-
value
}
QGCLabel
{
id
:
expoSliderIndicator
text
:
expoSlider
.
value
.
toFixed
(
2
)
...
...
@@ -761,53 +753,58 @@ SetupPage {
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
width
:
Math
.
min
(
joystickPage
.
ScreenTools
.
defaultFontPixelWidth
*
35
,
availableWidth
*
0.4
)
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
spacing
:
ScreenTools
.
defaultFontPixelHeight
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCLabel
{
text
:
"
TX Mode:
"
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCRadioButton
{
text
:
"
1
"
checked
:
controller
.
transmitterMode
==
1
enabled
:
!
controller
.
calibrating
onClicked
:
controller
.
transmitterMode
=
1
text
:
"
1
"
checked
:
controller
.
transmitterMode
==
1
enabled
:
!
controller
.
calibrating
onClicked
:
controller
.
transmitterMode
=
1
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCRadioButton
{
text
:
"
2
"
checked
:
controller
.
transmitterMode
==
2
enabled
:
!
controller
.
calibrating
onClicked
:
controller
.
transmitterMode
=
2
text
:
"
2
"
checked
:
controller
.
transmitterMode
==
2
enabled
:
!
controller
.
calibrating
onClicked
:
controller
.
transmitterMode
=
2
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCRadioButton
{
text
:
"
3
"
checked
:
controller
.
transmitterMode
==
3
enabled
:
!
controller
.
calibrating
onClicked
:
controller
.
transmitterMode
=
3
text
:
"
3
"
checked
:
controller
.
transmitterMode
==
3
enabled
:
!
controller
.
calibrating
onClicked
:
controller
.
transmitterMode
=
3
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCRadioButton
{
text
:
"
4
"
checked
:
controller
.
transmitterMode
==
4
enabled
:
!
controller
.
calibrating
onClicked
:
controller
.
transmitterMode
=
4
text
:
"
4
"
checked
:
controller
.
transmitterMode
==
4
enabled
:
!
controller
.
calibrating
onClicked
:
controller
.
transmitterMode
=
4
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
Image
{
width
:
parent
.
width
QGCColoredImage
{
width
:
parent
.
width
*
0.9
height
:
width
*
0.5
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
smooth
:
true
source
:
controller
.
imageHelp
source
:
"
/res/calibration/joystick.svg
"
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
// Axis monitor
...
...
@@ -815,7 +812,10 @@ SetupPage {
width
:
parent
.
width
spacing
:
5
QGCLabel
{
text
:
qsTr
(
"
Axis Monitor
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Axis Monitor
"
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
Connections
{
target
:
controller
...
...
@@ -840,6 +840,7 @@ SetupPage {
Row
{
spacing
:
5
anchors.horizontalCenter
:
parent
.
horizontalCenter
// Need this to get to loader from Connections above
property
Item
loader
:
theLoader
...
...
@@ -860,7 +861,6 @@ SetupPage {
property
bool
mapped
:
true
readonly
property
bool
reversed
:
false
MouseArea
{
id
:
deadbandMouseArea
anchors.fill
:
parent
.
item
...
...
@@ -897,7 +897,10 @@ SetupPage {
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
QGCLabel
{
text
:
qsTr
(
"
Button Monitor
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Button Monitor
"
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
Connections
{
target
:
_activeJoystick
...
...
@@ -910,19 +913,20 @@ SetupPage {
}
Flow
{
width
:
parent
.
width
width
:
parent
.
width
*
0.9
spacing
:
-
1
anchors.horizontalCenter
:
parent
.
horizontalCenter
Repeater
{
id
:
buttonMonitorRepeater
model
:
_activeJoystick
?
_activeJoystick
.
totalButtonCount
:
0
Rectangle
{
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.
2
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.
5
height
:
width
border.width
:
1
border.color
:
qgcPal
.
text
color
:
pressed
?
qgcPal
.
buttonHighlight
:
qgcPal
.
button
color
:
pressed
?
qgcPal
.
buttonHighlight
:
qgcPal
.
windowShade
property
bool
pressed
...
...
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