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
089860de
Commit
089860de
authored
Jul 17, 2019
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update UI
Add gimbal to external control signal
parent
3f474fcc
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1067 additions
and
1136 deletions
+1067
-1136
qgcresources.qrc
qgcresources.qrc
+0
-45
qgroundcontrol.qrc
qgroundcontrol.qrc
+5
-0
Joystick.cc
src/Joystick/Joystick.cc
+1
-13
AxisMonitor.qml
src/QmlControls/AxisMonitor.qml
+90
-0
qmldir
src/QmlControls/QGroundControl/Controls/qmldir
+1
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+9
-2
Vehicle.h
src/Vehicle/Vehicle.h
+1
-1
JoystickConfig.qml
src/VehicleSetup/JoystickConfig.qml
+29
-988
JoystickConfigAdvanced.qml
src/VehicleSetup/JoystickConfigAdvanced.qml
+186
-0
JoystickConfigButtons.qml
src/VehicleSetup/JoystickConfigButtons.qml
+146
-0
JoystickConfigCalibration.qml
src/VehicleSetup/JoystickConfigCalibration.qml
+241
-0
JoystickConfigController.cc
src/VehicleSetup/JoystickConfigController.cc
+28
-42
JoystickConfigController.h
src/VehicleSetup/JoystickConfigController.h
+8
-28
JoystickConfigGeneral.qml
src/VehicleSetup/JoystickConfigGeneral.qml
+298
-0
UAS.cc
src/uas/UAS.cc
+23
-16
UAS.h
src/uas/UAS.h
+1
-1
No files found.
qgcresources.qrc
View file @
089860de
...
...
@@ -56,7 +56,6 @@
<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>
...
...
@@ -99,48 +98,4 @@
<qresource prefix="/opengl">
<file>resources/opengl/buglist.json</file>
</qresource>
<qresource prefix="/qml/calibration/joystick/mode1">
<file alias="joystickCenter.png">resources/calibration/joystick/mode1/joystickCenter.png</file>
<file alias="joystickPitchDown.png">resources/calibration/joystick/mode1/joystickPitchDown.png</file>
<file alias="joystickPitchUp.png">resources/calibration/joystick/mode1/joystickPitchUp.png</file>
<file alias="joystickRollLeft.png">resources/calibration/joystick/mode1/joystickRollLeft.png</file>
<file alias="joystickRollRight.png">resources/calibration/joystick/mode1/joystickRollRight.png</file>
<file alias="joystickThrottleDown.png">resources/calibration/joystick/mode1/joystickThrottleDown.png</file>
<file alias="joystickThrottleUp.png">resources/calibration/joystick/mode1/joystickThrottleUp.png</file>
<file alias="joystickYawLeft.png">resources/calibration/joystick/mode1/joystickYawLeft.png</file>
<file alias="joystickYawRight.png">resources/calibration/joystick/mode1/joystickYawRight.png</file>
</qresource>
<qresource prefix="/qml/calibration/joystick/mode2">
<file alias="joystickCenter.png">resources/calibration/joystick/mode2/joystickCenter.png</file>
<file alias="joystickPitchDown.png">resources/calibration/joystick/mode2/joystickPitchDown.png</file>
<file alias="joystickPitchUp.png">resources/calibration/joystick/mode2/joystickPitchUp.png</file>
<file alias="joystickRollLeft.png">resources/calibration/joystick/mode2/joystickRollLeft.png</file>
<file alias="joystickRollRight.png">resources/calibration/joystick/mode2/joystickRollRight.png</file>
<file alias="joystickThrottleDown.png">resources/calibration/joystick/mode2/joystickThrottleDown.png</file>
<file alias="joystickThrottleUp.png">resources/calibration/joystick/mode2/joystickThrottleUp.png</file>
<file alias="joystickYawLeft.png">resources/calibration/joystick/mode2/joystickYawLeft.png</file>
<file alias="joystickYawRight.png">resources/calibration/joystick/mode2/joystickYawRight.png</file>
</qresource>
<qresource prefix="/qml/calibration/joystick/mode3">
<file alias="joystickCenter.png">resources/calibration/joystick/mode3/joystickCenter.png</file>
<file alias="joystickPitchDown.png">resources/calibration/joystick/mode3/joystickPitchDown.png</file>
<file alias="joystickPitchUp.png">resources/calibration/joystick/mode3/joystickPitchUp.png</file>
<file alias="joystickRollLeft.png">resources/calibration/joystick/mode3/joystickRollLeft.png</file>
<file alias="joystickRollRight.png">resources/calibration/joystick/mode3/joystickRollRight.png</file>
<file alias="joystickThrottleDown.png">resources/calibration/joystick/mode3/joystickThrottleDown.png</file>
<file alias="joystickThrottleUp.png">resources/calibration/joystick/mode3/joystickThrottleUp.png</file>
<file alias="joystickYawLeft.png">resources/calibration/joystick/mode3/joystickYawLeft.png</file>
<file alias="joystickYawRight.png">resources/calibration/joystick/mode3/joystickYawRight.png</file>
</qresource>
<qresource prefix="/qml/calibration/joystick/mode4">
<file alias="joystickCenter.png">resources/calibration/joystick/mode4/joystickCenter.png</file>
<file alias="joystickPitchDown.png">resources/calibration/joystick/mode4/joystickPitchDown.png</file>
<file alias="joystickPitchUp.png">resources/calibration/joystick/mode4/joystickPitchUp.png</file>
<file alias="joystickRollLeft.png">resources/calibration/joystick/mode4/joystickRollLeft.png</file>
<file alias="joystickRollRight.png">resources/calibration/joystick/mode4/joystickRollRight.png</file>
<file alias="joystickThrottleDown.png">resources/calibration/joystick/mode4/joystickThrottleDown.png</file>
<file alias="joystickThrottleUp.png">resources/calibration/joystick/mode4/joystickThrottleUp.png</file>
<file alias="joystickYawLeft.png">resources/calibration/joystick/mode4/joystickYawLeft.png</file>
<file alias="joystickYawRight.png">resources/calibration/joystick/mode4/joystickYawRight.png</file>
</qresource>
</RCC>
qgroundcontrol.qrc
View file @
089860de
...
...
@@ -38,6 +38,10 @@
<file alias="HealthPageWidget.qml">src/FlightMap/Widgets/HealthPageWidget.qml</file>
<file alias="HelpSettings.qml">src/ui/preferences/HelpSettings.qml</file>
<file alias="JoystickConfig.qml">src/VehicleSetup/JoystickConfig.qml</file>
<file alias="JoystickConfigButtons.qml">src/VehicleSetup/JoystickConfigButtons.qml</file>
<file alias="JoystickConfigAdvanced.qml">src/VehicleSetup/JoystickConfigAdvanced.qml</file>
<file alias="JoystickConfigGeneral.qml">src/VehicleSetup/JoystickConfigGeneral.qml</file>
<file alias="JoystickConfigCalibration.qml">src/VehicleSetup/JoystickConfigCalibration.qml</file>
<file alias="LinkSettings.qml">src/ui/preferences/LinkSettings.qml</file>
<file alias="LogDownloadPage.qml">src/AnalyzeView/LogDownloadPage.qml</file>
<file alias="LogReplaySettings.qml">src/ui/preferences/LogReplaySettings.qml</file>
...
...
@@ -60,6 +64,7 @@
<file alias="QGCViewDialogContainer.qml">src/QmlControls/QGCViewDialogContainer.qml</file>
<file alias="QGroundControl/Controls/AnalyzePage.qml">src/AnalyzeView/AnalyzePage.qml</file>
<file alias="QGroundControl/Controls/AppMessages.qml">src/QmlControls/AppMessages.qml</file>
<file alias="QGroundControl/Controls/AxisMonitor.qml">src/QmlControls/AxisMonitor.qml</file>
<file alias="QGroundControl/Controls/CameraCalc.qml">src/PlanView/CameraCalc.qml</file>
<file alias="QGroundControl/Controls/CameraSection.qml">src/PlanView/CameraSection.qml</file>
<file alias="QGroundControl/Controls/ClickableColor.qml">src/QmlControls/ClickableColor.qml</file>
...
...
src/Joystick/Joystick.cc
View file @
089860de
...
...
@@ -684,11 +684,9 @@ QString Joystick::getButtonAction(int button)
QVariantList
Joystick
::
buttonActions
(
void
)
{
QVariantList
list
;
for
(
int
button
=
0
;
button
<
_totalButtonCount
;
button
++
)
{
list
+=
QVariant
::
fromValue
(
_rgButtonActions
[
button
]);
}
return
list
;
}
...
...
@@ -703,13 +701,10 @@ void Joystick::setThrottleMode(int mode)
qCWarning
(
JoystickLog
)
<<
"Invalid throttle mode"
<<
mode
;
return
;
}
_throttleMode
=
(
ThrottleMode_t
)
mode
;
_throttleMode
=
static_cast
<
ThrottleMode_t
>
(
mode
);
if
(
_throttleMode
==
ThrottleModeDownZero
)
{
setAccumulator
(
false
);
}
_saveSettings
();
emit
throttleModeChanged
(
_throttleMode
);
}
...
...
@@ -725,7 +720,6 @@ void Joystick::setNegativeThrust(bool allowNegative)
return
;
}
_negativeThrust
=
allowNegative
;
_saveSettings
();
emit
negativeThrustChanged
(
_negativeThrust
);
}
...
...
@@ -738,7 +732,6 @@ float Joystick::exponential(void)
void
Joystick
::
setExponential
(
float
expo
)
{
_exponential
=
expo
;
_saveSettings
();
emit
exponentialChanged
(
_exponential
);
}
...
...
@@ -751,7 +744,6 @@ bool Joystick::accumulator(void)
void
Joystick
::
setAccumulator
(
bool
accu
)
{
_accumulator
=
accu
;
_saveSettings
();
emit
accumulatorChanged
(
_accumulator
);
}
...
...
@@ -764,7 +756,6 @@ bool Joystick::deadband(void)
void
Joystick
::
setDeadband
(
bool
deadband
)
{
_deadband
=
deadband
;
_saveSettings
();
}
...
...
@@ -776,7 +767,6 @@ bool Joystick::circleCorrection(void)
void
Joystick
::
setCircleCorrection
(
bool
circleCorrection
)
{
_circleCorrection
=
circleCorrection
;
_saveSettings
();
emit
circleCorrectionChanged
(
_circleCorrection
);
}
...
...
@@ -799,7 +789,6 @@ void Joystick::setFrequency(float val)
void
Joystick
::
setCalibrationMode
(
bool
calibrating
)
{
_calibrationMode
=
calibrating
;
if
(
calibrating
&&
!
isRunning
())
{
_pollingStartedForCalibration
=
true
;
startPolling
(
_multiVehicleManager
->
activeVehicle
());
...
...
@@ -815,7 +804,6 @@ void Joystick::_buttonAction(const QString& action)
if
(
!
_activeVehicle
||
!
_activeVehicle
->
joystickEnabled
())
{
return
;
}
if
(
action
==
_buttonActionArm
)
{
_activeVehicle
->
setArmed
(
true
);
}
else
if
(
action
==
_buttonActionDisarm
)
{
...
...
src/QmlControls/AxisMonitor.qml
0 → 100644
View file @
089860de
import
QtQuick
2.11
import
QtQuick
.
Controls
2.4
import
QGroundControl
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
property
int
axisValue
:
0
property
int
deadbandValue
:
0
property
bool
narrowIndicator
:
false
property
color
deadbandColor
:
"
#8c161a
"
property
bool
mapped
:
false
property
bool
reversed
:
false
property
color
__barColor
:
qgcPal
.
windowShade
// Bar
Rectangle
{
id
:
bar
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
parent
.
width
height
:
parent
.
height
/
2
color
:
__barColor
}
// Deadband
Rectangle
{
id
:
deadbandBar
anchors.verticalCenter
:
parent
.
verticalCenter
x
:
_deadbandPosition
width
:
_deadbandWidth
height
:
parent
.
height
/
2
color
:
deadbandColor
visible
:
controller
.
deadbandToggle
property
real
_percentDeadband
:
((
2
*
deadbandValue
)
/
(
32768.0
*
2
))
property
real
_deadbandWidth
:
parent
.
width
*
_percentDeadband
property
real
_deadbandPosition
:
(
parent
.
width
-
_deadbandWidth
)
/
2
}
// Center point
Rectangle
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
width
:
ScreenTools
.
defaultFontPixelWidth
/
2
height
:
parent
.
height
color
:
qgcPal
.
window
}
// Indicator
Rectangle
{
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
parent
.
narrowIndicator
?
height
/
6
:
height
height
:
parent
.
height
*
0.75
x
:
(
reversed
?
(
parent
.
width
-
_indicatorPosition
)
:
_indicatorPosition
)
-
(
width
/
2
)
radius
:
width
/
2
color
:
qgcPal
.
text
visible
:
mapped
property
real
_percentAxisValue
:
((
axisValue
+
32768.0
)
/
(
32768.0
*
2
))
property
real
_indicatorPosition
:
parent
.
width
*
_percentAxisValue
}
QGCLabel
{
anchors.fill
:
parent
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
text
:
qsTr
(
"
Not Mapped
"
)
visible
:
!
mapped
}
ColorAnimation
{
id
:
barAnimation
target
:
bar
property
:
"
color
"
from
:
"
yellow
"
to
:
__barColor
duration
:
1500
}
// Axis value debugger
/*
QGCLabel {
anchors.fill: parent
text: axisValue
}
*/
}
src/QmlControls/QGroundControl/Controls/qmldir
View file @
089860de
...
...
@@ -2,6 +2,7 @@ Module QGroundControl.Controls
AnalyzePage 1.0 AnalyzePage.qml
AppMessages 1.0 AppMessages.qml
AxisMonitor 1.0 AxisMonitor.qml
CameraCalc 1.0 CameraCalc.qml
APMSubMotorDisplay 1.0 APMSubMotorDisplay.qml
CameraSection 1.0 CameraSection.qml
...
...
src/Vehicle/Vehicle.cc
View file @
089860de
...
...
@@ -2741,11 +2741,18 @@ void Vehicle::_remoteControlRSSIChanged(uint8_t rssi)
}
}
void
Vehicle
::
virtualTabletJoystickValue
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
)
void
Vehicle
::
virtualTabletJoystickValue
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
,
double
gimbalPitch
,
double
gimbalYaw
)
{
// The following if statement prevents the virtualTabletJoystick from sending values if the standard joystick is enabled
if
(
!
_joystickEnabled
&&
!
_highLatencyLink
)
{
_uas
->
setExternalControlSetpoint
(
roll
,
pitch
,
yaw
,
thrust
,
0
,
JoystickModeRC
);
_uas
->
setExternalControlSetpoint
(
static_cast
<
float
>
(
roll
),
static_cast
<
float
>
(
pitch
),
static_cast
<
float
>
(
yaw
),
static_cast
<
float
>
(
thrust
),
static_cast
<
float
>
(
gimbalPitch
),
static_cast
<
float
>
(
gimbalYaw
),
0
,
JoystickModeRC
);
}
}
...
...
src/Vehicle/Vehicle.h
View file @
089860de
...
...
@@ -697,7 +697,7 @@ public:
// Called when the message drop-down is invoked to clear current count
Q_INVOKABLE
void
resetMessages
();
Q_INVOKABLE
void
virtualTabletJoystickValue
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
);
Q_INVOKABLE
void
virtualTabletJoystickValue
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
,
double
gimbalPitch
=
0
,
double
gimbalYaw
=
0
);
Q_INVOKABLE
void
disconnectInactiveVehicle
(
void
);
/// Command vehicle to return to launch
...
...
src/VehicleSetup/JoystickConfig.qml
View file @
089860de
This diff is collapsed.
Click to expand it.
src/VehicleSetup/JoystickConfigAdvanced.qml
0 → 100644
View file @
089860de
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.11
import
QtQuick
.
Controls
2.4
import
QtQuick
.
Dialogs
1.3
import
QtQuick
.
Layouts
1.11
import
QGroundControl
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
Item
{
width
:
grid
.
width
+
(
ScreenTools
.
defaultFontPixelWidth
*
2
)
height
:
grid
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
//---------------------------------------------------------------------
GridLayout
{
id
:
grid
columns
:
2
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
anchors.centerIn
:
parent
//-------------------------------------------------------------
//-------------------------------------------------------------
QGCRadioButton
{
text
:
qsTr
(
"
Full down stick is zero throttle
"
)
checked
:
_activeJoystick
?
_activeJoystick
.
throttleMode
===
1
:
false
onClicked
:
_activeJoystick
.
throttleMode
=
1
Layout.columnSpan
:
2
}
QGCRadioButton
{
text
:
qsTr
(
"
Center stick is zero throttle
"
)
checked
:
_activeJoystick
?
_activeJoystick
.
throttleMode
===
0
:
false
onClicked
:
_activeJoystick
.
throttleMode
=
0
Layout.columnSpan
:
2
}
//-------------------------------------------------------------
QGCLabel
{
text
:
qsTr
(
"
Spring loaded throttle smoothing
"
)
visible
:
_activeJoystick
?
_activeJoystick
.
throttleMode
===
0
:
false
Layout.alignment
:
Qt
.
AlignVCenter
Layout.minimumWidth
:
ScreenTools
.
defaultFontPixelWidth
*
36
}
QGCCheckBox
{
checked
:
_activeJoystick
?
_activeJoystick
.
accumulator
:
false
visible
:
_activeJoystick
?
_activeJoystick
.
throttleMode
===
0
:
false
onClicked
:
_activeJoystick
.
accumulator
=
checked
}
//-------------------------------------------------------------
QGCLabel
{
text
:
qsTr
(
"
Allow negative Thrust
"
)
visible
:
activeVehicle
.
supportsNegativeThrust
Layout.alignment
:
Qt
.
AlignVCenter
}
QGCCheckBox
{
visible
:
activeVehicle
.
supportsNegativeThrust
enabled
:
_activeJoystick
.
negativeThrust
=
activeVehicle
.
supportsNegativeThrust
checked
:
_activeJoystick
?
_activeJoystick
.
negativeThrust
:
false
onClicked
:
_activeJoystick
.
negativeThrust
=
checked
}
//---------------------------------------------------------------------
QGCLabel
{
text
:
qsTr
(
"
Exponential:
"
)
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCSlider
{
id
:
expoSlider
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
minimumValue
:
0
maximumValue
:
0.75
Component.onCompleted
:
value
=
-
_activeJoystick
.
exponential
onValueChanged
:
_activeJoystick
.
exponential
=
-
value
}
QGCLabel
{
id
:
expoSliderIndicator
text
:
expoSlider
.
value
.
toFixed
(
2
)
}
}
//-----------------------------------------------------------------
//-- Enable Advanced Mode
QGCLabel
{
text
:
qsTr
(
"
Enable further advanced settings (careful!)
"
)
Layout.alignment
:
Qt
.
AlignVCenter
Layout.minimumWidth
:
ScreenTools
.
defaultFontPixelWidth
*
36
}
QGCCheckBox
{
id
:
advancedSettings
checked
:
activeVehicle
.
joystickMode
!==
0
onClicked
:
{
if
(
!
checked
)
{
activeVehicle
.
joystickMode
=
0
}
}
}
//-----------------------------------------------------------------
//-- Mode
QGCLabel
{
Layout.alignment
:
Qt
.
AlignVCenter
text
:
qsTr
(
"
Joystick mode:
"
)
visible
:
advancedSettings
.
checked
}
QGCComboBox
{
enabled
:
advancedSettings
.
checked
currentIndex
:
activeVehicle
.
joystickMode
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
model
:
activeVehicle
.
joystickModes
onActivated
:
activeVehicle
.
joystickMode
=
index
Layout.alignment
:
Qt
.
AlignVCenter
visible
:
advancedSettings
.
checked
}
//-----------------------------------------------------------------
//-- Message Frequency
QGCLabel
{
text
:
qsTr
(
"
Message frequency (Hz):
"
)
Layout.alignment
:
Qt
.
AlignVCenter
visible
:
advancedSettings
.
checked
}
QGCTextField
{
text
:
_activeJoystick
.
frequency
enabled
:
advancedSettings
.
checked
validator
:
DoubleValidator
{
bottom
:
0.25
;
top
:
100.0
;
}
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
Layout.alignment
:
Qt
.
AlignVCenter
onEditingFinished
:
{
_activeJoystick
.
frequency
=
parseFloat
(
text
)
}
visible
:
advancedSettings
.
checked
}
//-----------------------------------------------------------------
//-- Enable circle correction
QGCLabel
{
text
:
qsTr
(
"
Enable circle correction
"
)
Layout.alignment
:
Qt
.
AlignVCenter
visible
:
advancedSettings
.
checked
}
QGCCheckBox
{
checked
:
activeVehicle
.
joystickMode
!==
0
enabled
:
advancedSettings
.
checked
Component.onCompleted
:
{
checked
=
_activeJoystick
.
circleCorrection
}
onClicked
:
{
_activeJoystick
.
circleCorrection
=
checked
}
visible
:
advancedSettings
.
checked
}
//-----------------------------------------------------------------
//-- Deadband
QGCLabel
{
text
:
qsTr
(
"
Deadbands
"
)
Layout.alignment
:
Qt
.
AlignVCenter
visible
:
advancedSettings
.
checked
}
QGCCheckBox
{
enabled
:
advancedSettings
.
checked
checked
:
controller
.
deadbandToggle
onClicked
:
controller
.
deadbandToggle
=
checked
Layout.alignment
:
Qt
.
AlignVCenter
visible
:
advancedSettings
.
checked
}
QGCLabel
{
Layout.fillWidth
:
true
Layout.columnSpan
:
2
font.pointSize
:
ScreenTools
.
smallFontPointSize
wrapMode
:
Text
.
WordWrap
visible
:
advancedSettings
.
checked
text
:
qsTr
(
"
Deadband can be set during the first
"
)
+
qsTr
(
"
step of calibration by gently wiggling each axis.
"
)
+
qsTr
(
"
Deadband can also be adjusted by clicking and
"
)
+
qsTr
(
"
dragging vertically on the corresponding axis monitor.
"
)
}
}
}
src/VehicleSetup/JoystickConfigButtons.qml
0 → 100644
View file @
089860de
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.11
import
QtQuick
.
Controls
2.4
import
QtQuick
.
Dialogs
1.3
import
QtQuick
.
Layouts
1.11
import
QGroundControl
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
Item
{
width
:
availableWidth
height
:
(
activeVehicle
.
supportsJSButton
?
buttonCol
.
height
:
buttonFlow
.
height
)
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
Connections
{
target
:
_activeJoystick
onRawButtonPressedChanged
:
{
if
(
buttonActionRepeater
.
itemAt
(
index
))
{
buttonActionRepeater
.
itemAt
(
index
).
pressed
=
pressed
}
if
(
jsButtonActionRepeater
.
itemAt
(
index
))
{
jsButtonActionRepeater
.
itemAt
(
index
).
pressed
=
pressed
}
}
}
Flow
{
id
:
buttonFlow
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
!
activeVehicle
.
supportsJSButton
anchors.centerIn
:
parent
Repeater
{
id
:
buttonActionRepeater
model
:
_activeJoystick
?
Math
.
min
(
_activeJoystick
.
totalButtonCount
,
_maxButtons
)
:
[]
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
property
bool
pressed
QGCCheckBox
{
anchors.verticalCenter
:
parent
.
verticalCenter
checked
:
_activeJoystick
?
_activeJoystick
.
buttonActions
[
modelData
]
!==
""
:
false
onClicked
:
_activeJoystick
.
setButtonAction
(
modelData
,
checked
?
buttonActionCombo
.
textAt
(
buttonActionCombo
.
currentIndex
)
:
""
)
}
Rectangle
{
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
height
:
width
border.width
:
1
border.color
:
qgcPal
.
text
color
:
pressed
?
qgcPal
.
buttonHighlight
:
qgcPal
.
button
QGCLabel
{
anchors.fill
:
parent
color
:
pressed
?
qgcPal
.
buttonHighlightText
:
qgcPal
.
buttonText
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
text
:
modelData
}
}
QGCComboBox
{
id
:
buttonActionCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
model
:
_activeJoystick
?
_activeJoystick
.
actions
:
0
onActivated
:
_activeJoystick
.
setButtonAction
(
modelData
,
textAt
(
index
))
Component.onCompleted
:
currentIndex
=
find
(
_activeJoystick
.
buttonActions
[
modelData
])
}
}
}
}
Column
{
id
:
buttonCol
width
:
parent
.
width
visible
:
activeVehicle
.
supportsJSButton
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
3
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
horizontalAlignment
:
Text
.
AlignHCenter
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
text
:
qsTr
(
"
#
"
)
}
QGCLabel
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
text
:
qsTr
(
"
Function:
"
)
}
QGCLabel
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
text
:
qsTr
(
"
Shift Function:
"
)
}
}
Repeater
{
id
:
jsButtonActionRepeater
model
:
_activeJoystick
?
Math
.
min
(
_activeJoystick
.
totalButtonCount
,
_maxButtons
)
:
0
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
activeVehicle
.
supportsJSButton
property
bool
pressed
Rectangle
{
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
height
:
width
border.width
:
1
border.color
:
qgcPal
.
text
color
:
pressed
?
qgcPal
.
buttonHighlight
:
qgcPal
.
button
QGCLabel
{
anchors.fill
:
parent
color
:
pressed
?
qgcPal
.
buttonHighlightText
:
qgcPal
.
buttonText
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
text
:
modelData
}
}
FactComboBox
{
id
:
mainJSButtonActionCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
fact
:
controller
.
parameterExists
(
-
1
,
"
BTN
"
+
index
+
"
_FUNCTION
"
)
?
controller
.
getParameterFact
(
-
1
,
"
BTN
"
+
index
+
"
_FUNCTION
"
)
:
null
;
indexModel
:
false
}
FactComboBox
{
id
:
shiftJSButtonActionCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
fact
:
controller
.
parameterExists
(
-
1
,
"
BTN
"
+
index
+
"
_SFUNCTION
"
)
?
controller
.
getParameterFact
(
-
1
,
"
BTN
"
+
index
+
"
_SFUNCTION
"
)
:
null
;
indexModel
:
false
}
}
}
}
}
src/VehicleSetup/JoystickConfigCalibration.qml
0 → 100644
View file @
089860de
This diff is collapsed.
Click to expand it.
src/VehicleSetup/JoystickConfigController.cc
View file @
089860de
...
...
@@ -28,21 +28,6 @@ const int JoystickConfigController::_calMinDelta = 1000; ///< Amo
const
int
JoystickConfigController
::
_stickDetectSettleMSecs
=
500
;
const
char
*
JoystickConfigController
::
_imageFilePrefix
=
"calibration/joystick/"
;
const
char
*
JoystickConfigController
::
_imageFileMode1Dir
=
"mode1/"
;
const
char
*
JoystickConfigController
::
_imageFileMode2Dir
=
"mode2/"
;
const
char
*
JoystickConfigController
::
_imageFileMode3Dir
=
"mode3/"
;
const
char
*
JoystickConfigController
::
_imageFileMode4Dir
=
"mode4/"
;
const
char
*
JoystickConfigController
::
_imageCenter
=
"joystickCenter.png"
;
const
char
*
JoystickConfigController
::
_imageThrottleUp
=
"joystickThrottleUp.png"
;
const
char
*
JoystickConfigController
::
_imageThrottleDown
=
"joystickThrottleDown.png"
;
const
char
*
JoystickConfigController
::
_imageYawLeft
=
"joystickYawLeft.png"
;
const
char
*
JoystickConfigController
::
_imageYawRight
=
"joystickYawRight.png"
;
const
char
*
JoystickConfigController
::
_imageRollLeft
=
"joystickRollLeft.png"
;
const
char
*
JoystickConfigController
::
_imageRollRight
=
"joystickRollRight.png"
;
const
char
*
JoystickConfigController
::
_imagePitchUp
=
"joystickPitchUp.png"
;
const
char
*
JoystickConfigController
::
_imagePitchDown
=
"joystickPitchDown.png"
;
static
const
JoystickConfigController
::
stateStickPositions
stSticksCentered
{
0.25
,
0.5
,
0.75
,
0.5
};
...
...
@@ -137,7 +122,7 @@ JoystickConfigController::~JoystickConfigController()
/// @brief Returns the state machine entry for the specified state.
const
JoystickConfigController
::
stateMachineEntry
*
JoystickConfigController
::
_getStateMachineEntry
(
int
step
)
{
static
const
char
*
msgBegin
=
"Allow all sticks to center as shown in diagram.
\n
\n
Click Next to continue"
;
static
const
char
*
msgBegin
=
"Allow all sticks to center as shown in diagram.
\n
Click Next to continue"
;
static
const
char
*
msgThrottleUp
=
"Move the Throttle stick all the way up and hold it there..."
;
static
const
char
*
msgThrottleDown
=
"Move the Throttle stick all the way down and hold it there..."
;
static
const
char
*
msgYawLeft
=
"Move the Yaw stick all the way to the left and hold it there..."
;
...
...
@@ -151,7 +136,7 @@ const JoystickConfigController::stateMachineEntry* JoystickConfigController::_ge
static
const
char
*
msgGimbalPitchUp
=
"Move the Gimbal Pitch control all the way up and hold it there..."
;
static
const
char
*
msgGimbalYawLeft
=
"Move the Gimbal Yaw control all the way to the left and hold it there..."
;
static
const
char
*
msgGimbalYawRight
=
"Move the Gimbal Yaw control all the way to the right and hold it there..."
;
static
const
char
*
msgComplete
=
"All settings have been captured.
Click Next to enable the joystick."
;
static
const
char
*
msgComplete
=
"All settings have been captured.
\n
Click Next to enable the joystick."
;
static
const
stateMachineEntry
rgStateMachine
[]
=
{
//Function
...
...
@@ -189,6 +174,24 @@ void JoystickConfigController::_advanceState()
_setupCurrentState
();
}
bool
JoystickConfigController
::
nextEnabled
()
{
if
(
_currentStep
>=
0
)
{
const
stateMachineEntry
*
state
=
_getStateMachineEntry
(
_currentStep
);
return
state
->
nextFn
!=
nullptr
;
}
return
false
;
}
bool
JoystickConfigController
::
skipEnabled
()
{
if
(
_currentStep
>=
0
)
{
const
stateMachineEntry
*
state
=
_getStateMachineEntry
(
_currentStep
);
return
state
->
skipFn
!=
nullptr
;
}
return
false
;
}
/// @brief Sets up the state machine according to the current step from _currentStep.
void
JoystickConfigController
::
_setupCurrentState
()
{
...
...
@@ -197,14 +200,14 @@ void JoystickConfigController::_setupCurrentState()
_stickDetectAxis
=
_axisNoAxis
;
_stickDetectSettleStarted
=
false
;
_calSaveCurrentValues
();
_nextButton
->
setEnabled
(
state
->
nextFn
!=
nullptr
);
_skipButton
->
setEnabled
(
state
->
skipFn
!=
nullptr
);
_currentStickPositions
.
clear
();
_currentStickPositions
<<
state
->
stickPositions
.
leftX
<<
state
->
stickPositions
.
leftY
<<
state
->
stickPositions
.
rightX
<<
state
->
stickPositions
.
rightY
;
_currentGimbalPositions
.
clear
();
_currentGimbalPositions
<<
state
->
gimbalPositions
.
leftX
<<
state
->
gimbalPositions
.
leftY
<<
state
->
gimbalPositions
.
rightX
<<
state
->
gimbalPositions
.
rightY
;
emit
stickPositionsChanged
();
emit
gimbalPositionsChanged
();
emit
nextEnabledChanged
();
emit
skipEnabledChanged
();
}
void
JoystickConfigController
::
_axisValueChanged
(
int
axis
,
int
value
)
...
...
@@ -300,7 +303,6 @@ void JoystickConfigController::_inputCenterWaitBegin(Joystick::AxisFunction_t fu
if
((
abs
(
value
)
*
1.1
f
>
_rgAxisInfo
[
axis
].
deadband
)
&&
(
_activeJoystick
->
deadband
()))
{
//add 10% on top of existing deadband
_axisDeadbandChanged
(
axis
,
static_cast
<
int
>
(
abs
(
value
)
*
1.1
f
));
}
_nextButton
->
setEnabled
(
true
);
// FIXME: Doesn't wait for center
}
...
...
@@ -588,8 +590,6 @@ void JoystickConfigController::_startCalibration()
{
_activeJoystick
->
setCalibrationMode
(
true
);
_resetInternalCalibrationValues
();
_nextButton
->
setProperty
(
"text"
,
"Next"
);