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
5949ff7a
Commit
5949ff7a
authored
Mar 02, 2017
by
Don Gagne
Committed by
GitHub
Mar 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4628 from nanthony21/joystickindicator
Changed joystick indicators to show output rather than input
parents
1991d269
09514ef7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
157 deletions
+31
-157
RadioComponentController.cc
src/AutoPilotPlugins/Common/RadioComponentController.cc
+4
-4
RadioComponentController.h
src/AutoPilotPlugins/Common/RadioComponentController.h
+1
-1
JoystickConfig.qml
src/VehicleSetup/JoystickConfig.qml
+15
-19
JoystickConfigController.cc
src/VehicleSetup/JoystickConfigController.cc
+9
-102
JoystickConfigController.h
src/VehicleSetup/JoystickConfigController.h
+2
-31
No files found.
src/AutoPilotPlugins/Common/RadioComponentController.cc
View file @
5949ff7a
...
...
@@ -429,7 +429,7 @@ void RadioComponentController::_inputStickDetect(enum rcCalFunctions function, i
_rgChannelInfo
[
channel
].
rcMax
=
value
;
}
_signalAllAttiudeValueChanges
();
_signalAllAtti
t
udeValueChanges
();
_advanceState
();
}
...
...
@@ -582,7 +582,7 @@ void RadioComponentController::_resetInternalCalibrationValues(void)
_rgFunctionChannelMapping
[
i
]
=
_chanMax
();
}
_signalAllAttiudeValueChanges
();
_signalAllAtti
t
udeValueChanges
();
}
/// @brief Sets internal calibration values from the stored parameters
...
...
@@ -654,7 +654,7 @@ void RadioComponentController::_setInternalCalibrationValuesFromParameters(void)
}
}
_signalAllAttiudeValueChanges
();
_signalAllAtti
t
udeValueChanges
();
}
void
RadioComponentController
::
spektrumBindMode
(
int
mode
)
...
...
@@ -1023,7 +1023,7 @@ void RadioComponentController::setTransmitterMode(int mode)
}
}
void
RadioComponentController
::
_signalAllAttiudeValueChanges
(
void
)
void
RadioComponentController
::
_signalAllAtti
t
udeValueChanges
(
void
)
{
emit
rollChannelMappedChanged
(
rollChannelMapped
());
emit
pitchChannelMappedChanged
(
pitchChannelMapped
());
...
...
src/AutoPilotPlugins/Common/RadioComponentController.h
View file @
5949ff7a
...
...
@@ -230,7 +230,7 @@ private:
void
_loadSettings
(
void
);
void
_storeSettings
(
void
);
void
_signalAllAttiudeValueChanges
(
void
);
void
_signalAllAtti
t
udeValueChanges
(
void
);
int
_chanMax
(
void
)
const
;
...
...
src/VehicleSetup/JoystickConfig.qml
View file @
5949ff7a
...
...
@@ -84,8 +84,6 @@ SetupPage {
property
int
axisValue
:
0
property
int
deadbandValue
:
0
property
int
__lastAxisValue
:
0
readonly
property
int
__axisValueMaxJitter
:
100
property
color
__barColor
:
qgcPal
.
windowShade
// Bar
...
...
@@ -105,6 +103,7 @@ SetupPage {
width
:
_deadbandWidth
height
:
parent
.
height
/
2
color
:
"
#8c161a
"
visible
:
controller
.
deadbandToggle
property
real
_percentDeadband
:
((
2
*
deadbandValue
)
/
(
32768.0
*
2
))
property
real
_deadbandWidth
:
parent
.
width
*
_percentDeadband
...
...
@@ -203,11 +202,9 @@ SetupPage {
}
Connections
{
target
:
controller
onRollAxisValueChanged
:
rollLoader
.
item
.
axisValue
=
value
target
:
_activeJoystick
on
RollAxisDeadbandChanged
:
rollLoader
.
item
.
deadbandValue
=
value
on
ManualControl
:
rollLoader
.
item
.
axisValue
=
roll
*
32768.0
}
}
...
...
@@ -235,12 +232,9 @@ SetupPage {
}
Connections
{
target
:
controller
onPitchAxisValueChanged
:
pitchLoader
.
item
.
axisValue
=
value
onPitchAxisDeadbandChanged
:
pitchLoader
.
item
.
deadbandValue
=
value
target
:
_activeJoystick
onManualControl
:
pitchLoader
.
item
.
axisValue
=
pitch
*
32768.0
}
}
...
...
@@ -268,11 +262,9 @@ SetupPage {
}
Connections
{
target
:
controller
onYawAxisValueChanged
:
yawLoader
.
item
.
axisValue
=
value
target
:
_activeJoystick
on
YawAxisDeadbandChanged
:
yawLoader
.
item
.
deadbandValue
=
value
on
ManualControl
:
yawLoader
.
item
.
axisValue
=
yaw
*
32768.0
}
}
...
...
@@ -300,11 +292,9 @@ SetupPage {
}
Connections
{
target
:
controller
onThrottleAxisValueChanged
:
throttleLoader
.
item
.
axisValue
=
value
target
:
_activeJoystick
on
ThrottleAxisDeadbandChanged
:
throttleLoader
.
item
.
deadbandValue
=
value
on
ManualControl
:
throttleLoader
.
item
.
axisValue
=
(
-
2
*
throttle
+
1
)
*
32768.0
}
}
}
// Column - Attitude Control labels
...
...
@@ -746,6 +736,12 @@ SetupPage {
axisMonitorRepeater
.
itemAt
(
axis
).
loader
.
item
.
axisValue
=
value
}
}
onAxisDeadbandChanged
:
{
if
(
axisMonitorRepeater
.
itemAt
(
axis
))
{
axisMonitorRepeater
.
itemAt
(
axis
).
loader
.
item
.
deadbandValue
=
value
}
}
}
Repeater
{
...
...
src/VehicleSetup/JoystickConfigController.cc
View file @
5949ff7a
...
...
@@ -144,26 +144,6 @@ void JoystickConfigController::_axisValueChanged(int axis, int value)
// We always update raw values
_axisRawValue
[
axis
]
=
value
;
emit
axisValueChanged
(
axis
,
_axisRawValue
[
axis
]);
// Signal attitude axis values to Qml if mapped
if
(
_rgAxisInfo
[
axis
].
function
!=
Joystick
::
maxFunction
)
{
switch
(
_rgAxisInfo
[
axis
].
function
)
{
case
Joystick
:
:
rollFunction
:
emit
rollAxisValueChanged
(
_axisRawValue
[
axis
]);
break
;
case
Joystick
:
:
pitchFunction
:
emit
pitchAxisValueChanged
(
_axisRawValue
[
axis
]);
break
;
case
Joystick
:
:
yawFunction
:
emit
yawAxisValueChanged
(
_axisRawValue
[
axis
]);
break
;
case
Joystick
:
:
throttleFunction
:
emit
throttleAxisValueChanged
(
_axisRawValue
[
axis
]);
break
;
default:
break
;
}
}
//qCDebug(JoystickConfigControllerLog) << "Raw value" << axis << value;
...
...
@@ -223,7 +203,7 @@ bool JoystickConfigController::getDeadbandToggle() {
void
JoystickConfigController
::
setDeadbandToggle
(
bool
deadband
)
{
_activeJoystick
->
setDeadband
(
deadband
);
_signalAllAttiudeValueChanges
();
_signalAllAtti
t
udeValueChanges
();
emit
deadbandToggled
(
deadband
);
}
...
...
@@ -247,7 +227,7 @@ void JoystickConfigController::_axisDeadbandChanged(int axis, int value)
value
=
abs
(
value
)
<
_calValidMaxValue
?
abs
(
value
)
:
_calValidMaxValue
;
_rgAxisInfo
[
axis
].
deadband
=
value
;
emit
axisDeadbandChanged
(
axis
,
value
);
qCDebug
(
JoystickConfigControllerLog
)
<<
"Axis:"
<<
axis
<<
"Deadband:"
<<
_rgAxisInfo
[
axis
].
deadband
;
}
...
...
@@ -257,7 +237,7 @@ void JoystickConfigController::_inputCenterWaitBegin(Joystick::AxisFunction_t fu
Q_UNUSED
(
function
);
//sensing deadband
if
(
abs
(
value
)
*
1.1
f
>
_rgAxisInfo
[
axis
].
deadband
)
{
//add 10% on top of existing deadband
if
(
(
abs
(
value
)
*
1.1
f
>
_rgAxisInfo
[
axis
].
deadband
)
&&
(
_activeJoystick
->
deadband
())
)
{
//add 10% on top of existing deadband
_axisDeadbandChanged
(
axis
,
abs
(
value
)
*
1.1
f
);
}
...
...
@@ -353,7 +333,7 @@ void JoystickConfigController::_inputStickDetect(Joystick::AxisFunction_t functi
qCDebug
(
JoystickConfigControllerLog
)
<<
"_inputStickDetect saving values, function:axis:value:reversed:_axisValueSave"
<<
function
<<
axis
<<
value
<<
info
->
reversed
<<
_axisValueSave
[
axis
];
_signalAllAttiudeValueChanges
();
_signalAllAtti
t
udeValueChanges
();
_advanceState
();
}
...
...
@@ -451,6 +431,7 @@ void JoystickConfigController::_resetInternalCalibrationValues(void)
info
->
function
=
Joystick
::
maxFunction
;
info
->
reversed
=
false
;
info
->
deadband
=
0
;
emit
axisDeadbandChanged
(
i
,
info
->
deadband
);
info
->
axisMin
=
JoystickConfigController
::
_calCenterPoint
;
info
->
axisMax
=
JoystickConfigController
::
_calCenterPoint
;
info
->
axisTrim
=
JoystickConfigController
::
_calCenterPoint
;
...
...
@@ -461,7 +442,7 @@ void JoystickConfigController::_resetInternalCalibrationValues(void)
_rgFunctionAxisMapping
[
i
]
=
_axisNoAxis
;
}
_signalAllAttiudeValueChanges
();
_signalAllAtti
t
udeValueChanges
();
}
/// @brief Sets internal calibration values from the stored settings
...
...
@@ -489,6 +470,7 @@ void JoystickConfigController::_setInternalCalibrationValuesFromSettings(void)
info
->
axisMax
=
calibration
.
max
;
info
->
reversed
=
calibration
.
reversed
;
info
->
deadband
=
calibration
.
deadband
;
emit
axisDeadbandChanged
(
axis
,
info
->
deadband
);
qCDebug
(
JoystickConfigControllerLog
)
<<
"Read settings name:axis:min:max:trim:reversed"
<<
joystick
->
name
()
<<
axis
<<
info
->
axisMin
<<
info
->
axisMax
<<
info
->
axisTrim
<<
info
->
reversed
;
}
...
...
@@ -505,7 +487,7 @@ void JoystickConfigController::_setInternalCalibrationValuesFromSettings(void)
_transmitterMode
=
joystick
->
getTXMode
();
_signalAllAttiudeValueChanges
();
_signalAllAtti
t
udeValueChanges
();
}
/// @brief Validates the current settings against the calibration rules resetting values as necessary.
...
...
@@ -683,77 +665,7 @@ int JoystickConfigController::axisCount(void)
return
_axisCount
;
}
int
JoystickConfigController
::
rollAxisValue
(
void
)
{
if
(
_rgFunctionAxisMapping
[
Joystick
::
rollFunction
]
!=
_axisNoAxis
)
{
return
_axisRawValue
[
Joystick
::
rollFunction
];
}
else
{
return
1500
;
}
}
int
JoystickConfigController
::
pitchAxisValue
(
void
)
{
if
(
_rgFunctionAxisMapping
[
Joystick
::
pitchFunction
]
!=
_axisNoAxis
)
{
return
_axisRawValue
[
Joystick
::
pitchFunction
];
}
else
{
return
1500
;
}
}
int
JoystickConfigController
::
yawAxisValue
(
void
)
{
if
(
_rgFunctionAxisMapping
[
Joystick
::
yawFunction
]
!=
_axisNoAxis
)
{
return
_axisRawValue
[
Joystick
::
yawFunction
];
}
else
{
return
1500
;
}
}
int
JoystickConfigController
::
throttleAxisValue
(
void
)
{
if
(
_rgFunctionAxisMapping
[
Joystick
::
throttleFunction
]
!=
_axisNoAxis
)
{
return
_axisRawValue
[
Joystick
::
throttleFunction
];
}
else
{
return
1500
;
}
}
int
JoystickConfigController
::
rollAxisDeadband
(
void
)
{
if
((
_rgFunctionAxisMapping
[
Joystick
::
rollFunction
]
!=
_axisNoAxis
)
&&
(
_activeJoystick
->
deadband
()))
{
return
_rgAxisInfo
[
_rgFunctionAxisMapping
[
Joystick
::
rollFunction
]].
deadband
;
}
else
{
return
0
;
}
}
int
JoystickConfigController
::
pitchAxisDeadband
(
void
)
{
if
((
_rgFunctionAxisMapping
[
Joystick
::
pitchFunction
]
!=
_axisNoAxis
)
&&
(
_activeJoystick
->
deadband
()))
{
return
_rgAxisInfo
[
_rgFunctionAxisMapping
[
Joystick
::
pitchFunction
]].
deadband
;
}
else
{
return
0
;
}
}
int
JoystickConfigController
::
yawAxisDeadband
(
void
)
{
if
((
_rgFunctionAxisMapping
[
Joystick
::
yawFunction
]
!=
_axisNoAxis
)
&&
(
_activeJoystick
->
deadband
()))
{
return
_rgAxisInfo
[
_rgFunctionAxisMapping
[
Joystick
::
yawFunction
]].
deadband
;
}
else
{
return
0
;
}
}
int
JoystickConfigController
::
throttleAxisDeadband
(
void
)
{
if
((
_rgFunctionAxisMapping
[
Joystick
::
throttleFunction
]
!=
_axisNoAxis
)
&&
(
_activeJoystick
->
deadband
()))
{
return
_rgAxisInfo
[
_rgFunctionAxisMapping
[
Joystick
::
throttleFunction
]].
deadband
;
}
else
{
return
0
;
}
}
bool
JoystickConfigController
::
rollAxisMapped
(
void
)
{
...
...
@@ -825,7 +737,7 @@ void JoystickConfigController::setTransmitterMode(int mode)
}
}
void
JoystickConfigController
::
_signalAllAttiudeValueChanges
(
void
)
void
JoystickConfigController
::
_signalAllAtti
t
udeValueChanges
(
void
)
{
emit
rollAxisMappedChanged
(
rollAxisMapped
());
emit
pitchAxisMappedChanged
(
pitchAxisMapped
());
...
...
@@ -837,11 +749,6 @@ void JoystickConfigController::_signalAllAttiudeValueChanges(void)
emit
yawAxisReversedChanged
(
yawAxisReversed
());
emit
throttleAxisReversedChanged
(
throttleAxisReversed
());
emit
rollAxisDeadbandChanged
(
rollAxisDeadband
());
emit
pitchAxisDeadbandChanged
(
pitchAxisDeadband
());
emit
yawAxisDeadbandChanged
(
yawAxisDeadband
());
emit
throttleAxisDeadbandChanged
(
throttleAxisDeadband
());
emit
transmitterModeChanged
(
_transmitterMode
);
}
...
...
src/VehicleSetup/JoystickConfigController.h
View file @
5949ff7a
...
...
@@ -52,16 +52,6 @@ public:
Q_PROPERTY
(
bool
yawAxisMapped
READ
yawAxisMapped
NOTIFY
yawAxisMappedChanged
)
Q_PROPERTY
(
bool
throttleAxisMapped
READ
throttleAxisMapped
NOTIFY
throttleAxisMappedChanged
)
Q_PROPERTY
(
int
rollAxisValue
READ
rollAxisValue
NOTIFY
rollAxisValueChanged
)
Q_PROPERTY
(
int
pitchAxisValue
READ
pitchAxisValue
NOTIFY
pitchAxisValueChanged
)
Q_PROPERTY
(
int
yawAxisValue
READ
yawAxisValue
NOTIFY
yawAxisValueChanged
)
Q_PROPERTY
(
int
throttleAxisValue
READ
throttleAxisValue
NOTIFY
throttleAxisValueChanged
)
Q_PROPERTY
(
int
rollAxisDeadband
READ
rollAxisDeadband
NOTIFY
rollAxisDeadbandChanged
)
Q_PROPERTY
(
int
pitchAxisDeadband
READ
pitchAxisDeadband
NOTIFY
pitchAxisDeadbandChanged
)
Q_PROPERTY
(
int
yawAxisDeadband
READ
yawAxisDeadband
NOTIFY
yawAxisDeadbandChanged
)
Q_PROPERTY
(
int
throttleAxisDeadband
READ
throttleAxisDeadband
NOTIFY
throttleAxisDeadbandChanged
)
Q_PROPERTY
(
int
rollAxisReversed
READ
rollAxisReversed
NOTIFY
rollAxisReversedChanged
)
Q_PROPERTY
(
int
pitchAxisReversed
READ
pitchAxisReversed
NOTIFY
pitchAxisReversedChanged
)
Q_PROPERTY
(
int
yawAxisReversed
READ
yawAxisReversed
NOTIFY
yawAxisReversedChanged
)
...
...
@@ -78,16 +68,6 @@ public:
Q_INVOKABLE
void
nextButtonClicked
(
void
);
Q_INVOKABLE
void
start
(
void
);
int
rollAxisValue
(
void
);
int
pitchAxisValue
(
void
);
int
yawAxisValue
(
void
);
int
throttleAxisValue
(
void
);
int
rollAxisDeadband
(
void
);
int
pitchAxisDeadband
(
void
);
int
yawAxisDeadband
(
void
);
int
throttleAxisDeadband
(
void
);
bool
rollAxisMapped
(
void
);
bool
pitchAxisMapped
(
void
);
bool
yawAxisMapped
(
void
);
...
...
@@ -110,21 +90,12 @@ public:
signals:
void
axisValueChanged
(
int
axis
,
int
value
);
void
axisDeadbandChanged
(
int
axis
,
int
value
);
void
rollAxisMappedChanged
(
bool
mapped
);
void
pitchAxisMappedChanged
(
bool
mapped
);
void
yawAxisMappedChanged
(
bool
mapped
);
void
throttleAxisMappedChanged
(
bool
mapped
);
void
rollAxisValueChanged
(
int
value
);
void
pitchAxisValueChanged
(
int
value
);
void
yawAxisValueChanged
(
int
value
);
void
throttleAxisValueChanged
(
int
value
);
void
rollAxisDeadbandChanged
(
int
value
);
void
pitchAxisDeadbandChanged
(
int
value
);
void
yawAxisDeadbandChanged
(
int
value
);
void
throttleAxisDeadbandChanged
(
int
value
);
void
rollAxisReversedChanged
(
bool
reversed
);
void
pitchAxisReversedChanged
(
bool
reversed
);
...
...
@@ -217,7 +188,7 @@ private:
void
_setHelpImage
(
const
char
*
imageFile
);
void
_signalAllAttiudeValueChanges
(
void
);
void
_signalAllAtti
t
udeValueChanges
(
void
);
// Member variables
...
...
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