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
ce0bd4d2
Commit
ce0bd4d2
authored
Jan 05, 2012
by
oberion
Committed by
LM
Jan 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solved Windows threading problem with joystick and signal slot bug in WaypointList.cc
parent
f4504903
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
JoystickInput.cc
src/input/JoystickInput.cc
+26
-5
JoystickInput.h
src/input/JoystickInput.h
+3
-0
WaypointList.cc
src/ui/WaypointList.cc
+5
-3
No files found.
src/input/JoystickInput.cc
View file @
ce0bd4d2
...
...
@@ -37,6 +37,7 @@ This file is part of the PIXHAWK project
#include "UAS.h"
#include "UASManager.h"
#include "QGC.h"
#include <QMutexLocker>
/**
* The coordinate frame of the joystick axis is the aeronautical frame like shown on this image:
...
...
@@ -49,10 +50,10 @@ JoystickInput::JoystickInput() :
uas
(
NULL
),
uasButtonList
(
QList
<
int
>
()),
done
(
false
),
thrustAxis
(
3
),
xAxis
(
1
),
yAxis
(
0
),
yawAxis
(
2
),
thrustAxis
(
2
),
xAxis
(
0
),
yAxis
(
1
),
yawAxis
(
3
),
joystickName
(
tr
(
"Unitinialized"
))
{
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
...
...
@@ -66,6 +67,17 @@ JoystickInput::JoystickInput() :
//start();
}
JoystickInput
::~
JoystickInput
()
{
{
QMutexLocker
locker
(
&
this
->
m_doneMutex
);
done
=
true
;
}
this
->
wait
();
this
->
deleteLater
();
}
void
JoystickInput
::
setActiveUAS
(
UASInterface
*
uas
)
{
// Only connect / disconnect is the UAS is of a controllable UAS class
...
...
@@ -134,7 +146,16 @@ void JoystickInput::run()
init
();
while
(
!
done
)
{
forever
{
{
QMutexLocker
locker
(
&
this
->
m_doneMutex
);
if
(
done
)
{
done
=
false
;
break
;
}
}
while
(
SDL_PollEvent
(
&
event
))
{
SDL_JoystickUpdate
();
...
...
src/input/JoystickInput.h
View file @
ce0bd4d2
...
...
@@ -35,6 +35,7 @@ This file is part of the PIXHAWK project
#include <QThread>
#include <QList>
#include <qmutex.h>
#include <SDL/SDL.h>
#include "UASInterface.h"
...
...
@@ -48,6 +49,7 @@ class JoystickInput : public QThread
public:
JoystickInput
();
~
JoystickInput
();
void
run
();
const
QString
&
getName
();
...
...
@@ -63,6 +65,7 @@ protected:
UASInterface
*
uas
;
QList
<
int
>
uasButtonList
;
bool
done
;
QMutex
m_doneMutex
;
// Axis 3 is thrust (CALIBRATION!)
int
thrustAxis
;
...
...
src/ui/WaypointList.cc
View file @
ce0bd4d2
...
...
@@ -154,9 +154,11 @@ void WaypointList::setUAS(UASInterface* uas)
if
(
this
->
uas
==
NULL
&&
uas
!=
NULL
)
{
this
->
uas
=
uas
;
connect
(
uas
,
SIGNAL
(
localPositionChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updatePosition
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
connect
(
uas
,
SIGNAL
(
attitudeChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitude
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
if
(
uas
!=
NULL
)
{
connect
(
uas
,
SIGNAL
(
localPositionChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updatePosition
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
connect
(
uas
,
SIGNAL
(
attitudeChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitude
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
}
connect
(
WPM
,
SIGNAL
(
updateStatusString
(
const
QString
&
)),
this
,
SLOT
(
updateStatusLabel
(
const
QString
&
)));
connect
(
WPM
,
SIGNAL
(
waypointEditableListChanged
(
void
)),
this
,
SLOT
(
waypointEditableListChanged
(
void
)));
...
...
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