Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
9e1d9e95
Commit
9e1d9e95
authored
Jul 17, 2014
by
Thomas Gubler
Browse files
make joystick changed signal work again
parent
1bb5779d
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/input/JoystickInput.cc
View file @
9e1d9e95
...
...
@@ -323,7 +323,7 @@ void JoystickInput::setActiveUAS(UASInterface* uas)
tmp
=
dynamic_cast
<
UAS
*>
(
this
->
uas
);
if
(
tmp
)
{
disconnect
(
this
,
SIGNAL
(
joystickChanged
(
float
,
float
,
float
,
float
,
qint8
,
qint8
,
quint16
,
JOYSTICK_MODE
)),
tmp
,
SLOT
(
setExternalControlSetpoint
(
float
,
float
,
float
,
float
,
qint8
,
qint8
,
quint16
,
JOYSTICK_MODE
)));
disconnect
(
this
,
SIGNAL
(
joystickChanged
(
float
,
float
,
float
,
float
,
qint8
,
qint8
,
quint16
,
quint8
)),
tmp
,
SLOT
(
setExternalControlSetpoint
(
float
,
float
,
float
,
float
,
qint8
,
qint8
,
quint16
,
quint8
)));
disconnect
(
this
,
SIGNAL
(
actionTriggered
(
int
)),
tmp
,
SLOT
(
triggerAction
(
int
)));
}
uasCanReverse
=
false
;
...
...
@@ -339,7 +339,8 @@ void JoystickInput::setActiveUAS(UASInterface* uas)
if
(
this
->
uas
&&
(
tmp
=
dynamic_cast
<
UAS
*>
(
this
->
uas
)))
{
connect
(
this
,
SIGNAL
(
joystickChanged
(
float
,
float
,
float
,
float
,
qint8
,
qint8
,
quint16
,
JOYSTICK_MODE
)),
tmp
,
SLOT
(
setExternalControlSetpoint
(
float
,
float
,
float
,
float
,
qint8
,
qint8
,
quint16
,
JOYSTICK_MODE
)));
connect
(
this
,
SIGNAL
(
joystickChanged
(
float
,
float
,
float
,
float
,
qint8
,
qint8
,
quint16
,
quint8
)),
tmp
,
SLOT
(
setExternalControlSetpoint
(
float
,
float
,
float
,
float
,
qint8
,
qint8
,
quint16
,
quint8
)));
qDebug
()
<<
"connected joystick"
;
connect
(
this
,
SIGNAL
(
actionTriggered
(
int
)),
tmp
,
SLOT
(
triggerAction
(
int
)));
uasCanReverse
=
tmp
->
systemCanReverse
();
...
...
src/input/JoystickInput.h
View file @
9e1d9e95
...
...
@@ -96,8 +96,8 @@ public:
enum
JOYSTICK_MODE
{
JOYSTICK_MODE_ATTITUDE
=
0
,
JOYSTICK_MODE_POSITION
=
1
,
JOYSTICK_MODE_FORCE
=
2
,
JOYSTICK_MODE_POSITION
=
1
,
JOYSTICK_MODE_FORCE
=
2
};
/**
...
...
@@ -253,7 +253,7 @@ signals:
* @param yHat hat vector in left-right direction, -1 left, 0 center, +1 right
* @param mode (setpoint type) see JOYSTICK_MODE enum
*/
void
joystickChanged
(
float
roll
,
float
pitch
,
float
yaw
,
float
throttle
,
qint8
xHat
,
qint8
yHat
,
quint16
buttons
,
JOYSTICK_MODE
mode
);
void
joystickChanged
(
float
roll
,
float
pitch
,
float
yaw
,
float
throttle
,
qint8
xHat
,
qint8
yHat
,
quint16
buttons
,
quint8
mode
);
/**
* @brief Emit a new value for an axis
...
...
@@ -366,7 +366,7 @@ public slots:
* @brief Specify which setpoints should be sent to the UAS when moving the joystick
* @param newMode the mode (setpoint type) see the JOYSTICK_MODE enum
*/
void
setMode
(
int
newMode
)
void
setMode
(
qu
int
8
newMode
)
{
mode
=
(
JOYSTICK_MODE
)
newMode
;
}
...
...
src/uas/UAS.cc
View file @
9e1d9e95
...
...
@@ -2933,7 +2933,7 @@ void UAS::toggleAutonomy()
* Set the manual control commands.
* This can only be done if the system has manual inputs enabled and is armed.
*/
void
UAS
::
setExternalControlSetpoint
(
float
roll
,
float
pitch
,
float
yaw
,
float
thrust
,
qint8
xHat
,
qint8
yHat
,
quint16
buttons
,
JoystickInput
::
JOYSTICK_MODE
joystickMode
)
void
UAS
::
setExternalControlSetpoint
(
float
roll
,
float
pitch
,
float
yaw
,
float
thrust
,
qint8
xHat
,
qint8
yHat
,
quint16
buttons
,
quint8
joystickMode
)
{
Q_UNUSED
(
xHat
);
Q_UNUSED
(
yHat
);
...
...
@@ -2978,6 +2978,7 @@ void UAS::setExternalControlSetpoint(float roll, float pitch, float yaw, float t
manualButtons
=
buttons
;
mavlink_message_t
message
;
qDebug
()
<<
"js mode"
<<
joystickMode
;
if
(
joystickMode
==
JoystickInput
::
JOYSTICK_MODE_ATTITUDE
)
{
...
...
src/uas/UAS.h
View file @
9e1d9e95
...
...
@@ -839,7 +839,7 @@ public slots:
void
toggleAutonomy
();
/** @brief Set the values for the manual control of the vehicle */
void
setExternalControlSetpoint
(
float
roll
,
float
pitch
,
float
yaw
,
float
thrust
,
qint8
xHat
,
qint8
yHat
,
quint16
buttons
,
JoystickInput
::
JOYSTICK_MODE
joystickMode
);
void
setExternalControlSetpoint
(
float
roll
,
float
pitch
,
float
yaw
,
float
thrust
,
qint8
xHat
,
qint8
yHat
,
quint16
buttons
,
quint8
);
/** @brief Set the values for the 6dof manual control of the vehicle */
void
setManual6DOFControlCommands
(
double
x
,
double
y
,
double
z
,
double
roll
,
double
pitch
,
double
yaw
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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