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
1d898067
Commit
1d898067
authored
Nov 18, 2012
by
Matthias Krebs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding 3DMouse Support for LINUX (not completed)
parent
e7036cd3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
4 deletions
+133
-4
qgroundcontrol.pro
qgroundcontrol.pro
+20
-0
Mouse6dofInput.cpp
src/input/Mouse6dofInput.cpp
+79
-0
Mouse6dofInput.h
src/input/Mouse6dofInput.h
+9
-1
MainWindow.cc
src/ui/MainWindow.cc
+14
-0
MainWindow.h
src/ui/MainWindow.h
+11
-3
No files found.
qgroundcontrol.pro
View file @
1d898067
...
...
@@ -625,6 +625,26 @@ win32-msvc2008|win32-msvc2010|linux {
-
llibxbee
}
###################################################################
####
---
3
DConnexion
3
d
Mice
support
(
e
.
g
.
spacenavigator
)
---
####
###################################################################
#
xdrvlib
only
supported
by
linux
(
theoretical
all
X11
)
systems
#
You
have
to
install
the
official
3
DxWare
driver
for
linux
to
use
3
D
mouse
support
on
linux
systems
!
linux
-
g
++
|
linux
-
g
++-
64
{
exists
(
/
usr
/
local
/
lib
/
libxdrvlib
.
so
){
message
(
"Including support for Magellan 3DxWare for linux system."
)
SOURCES
+=
src
/
input
/
Mouse6dofInput
.
cpp
HEADERS
+=
src
/
input
/
Mouse6dofInput
.
h
LIBS
+=
-
L
/
usr
/
local
/
lib
/
-
lxdrvlib
INCLUDEPATH
*=
/
usr
/
local
/
include
DEFINES
+=
MOUSE_ENABLED_LINUX
\
ParameterCheck
#
Hack
:
Has
to
be
defined
for
magellan
usage
}
}
#
Support
for
Windows
systems
#
You
have
to
install
the
official
3
DxWare
driver
for
Windows
to
use
the
3
D
mouse
support
on
Windows
systems
!
win32
-
msvc2008
|
win32
-
msvc2010
{
message
(
"Including support for 3DxWare for Windows system."
)
SOURCES
+=
libs
/
thirdParty
/
3
DMouse
/
win
/
MouseParameters
.
cpp
\
...
...
src/input/Mouse6dofInput.cpp
View file @
1d898067
...
...
@@ -9,7 +9,18 @@
#include "Mouse6dofInput.h"
#include "UAS.h"
#include "UASManager.h"
#include "QMessageBox"
#ifdef MOUSE_ENABLED_LINUX
#include <QX11Info>
#include <X11/Xlib.h>
#undef Success // Eigen library doesn't work if Success is defined
extern
"C"
{
#include "xdrvlib.h"
}
#endif // MOUSE_ENABLED_LINUX
#ifdef MOUSE_ENABLED_WIN
Mouse6dofInput
::
Mouse6dofInput
(
Mouse3DInput
*
mouseInput
)
:
mouse3DMax
(
0.075
),
// TODO: check maximum value fot plugged device
uas
(
NULL
),
...
...
@@ -30,6 +41,74 @@ Mouse6dofInput::Mouse6dofInput(Mouse3DInput* mouseInput) :
//connect(mouseInput, SIGNAL(On3dmouseKeyUp(int)), this, SLOT);
}
#endif //MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
Mouse6dofInput
::
Mouse6dofInput
(
QWidget
*
parent
)
:
mouse3DMax
(
0.075
),
// TODO: check maximum value fot plugged device
uas
(
NULL
),
done
(
false
),
mouseActive
(
false
),
xValue
(
0.0
),
yValue
(
0.0
),
zValue
(
0.0
),
aValue
(
0.0
),
bValue
(
0.0
),
cValue
(
0.0
)
{
}
#endif //MOUSE_ENABLED_LINUX
#ifdef MOUSE_ENABLED_LINUX
void
Mouse6dofInput
::
init3dMouse
(
QWidget
*
parent
)
{
if
(
!
mouseActive
)
{
// // man visudo --> then you can omit giving password (success not guarantied..)
// qDebug() << "Starting 3DxWare Daemon for 3dConnexion 3dMouse";
// QString processProgramm = "gksudo";
// QStringList processArguments;
// processArguments << "/etc/3DxWare/daemon/3dxsrv -d usb";
// process3dxDaemon = new QProcess();
// process3dxDaemon->start(processProgramm, processArguments);
// // process3dxDaemon->waitForFinished();
// // {
// // qDebug() << "... continuing without 3DxWare. May not be initialized properly!";
// // qDebug() << "Try in terminal as user root:" << processArguments.last();
// // }
Display
*
display
=
QX11Info
::
display
();
if
(
!
display
)
{
qDebug
()
<<
"Cannot open display!"
<<
endl
;
}
if
(
!
MagellanInit
(
display
,
winId
()
)
)
{
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Information
);
msgBox
.
setText
(
tr
(
"No 3DxWare driver is running."
));
msgBox
.
setInformativeText
(
tr
(
"Enter in Terminal 'sudo /etc/3DxWare/daemon/3dxsrv -d usb'"
));
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
msgBox
.
exec
();
qDebug
()
<<
"No 3DxWare driver is running!"
;
return
;
}
else
{
qDebug
()
<<
"Initialized 3dMouse"
;
mouseActive
=
true
;
}
}
else
{
qDebug
()
<<
"3dMouse already initialized.."
;
}
}
#endif //MOUSE_ENABLED_LINUX
Mouse6dofInput
::~
Mouse6dofInput
()
{
...
...
src/input/Mouse6dofInput.h
View file @
1d898067
...
...
@@ -10,7 +10,9 @@
#define MOUSE6DOFINPUT_H
#include <QThread>
#ifdef MOUSE_ENABLED_WIN
#include "Mouse3DInput.h"
#endif //MOUSE_ENABLED_WIN
#include "UASInterface.h"
...
...
@@ -19,7 +21,14 @@ class Mouse6dofInput : public QThread
Q_OBJECT
public:
#ifdef MOUSE_ENABLED_WIN
Mouse6dofInput
(
Mouse3DInput
*
mouseInput
);
#endif //MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
Mouse6dofInput
(
QWidget
*
parent
);
void
init3dMouse
(
QWidget
*
parent
);
#endif //MOUSE_ENABLED_LINUX
~
Mouse6dofInput
();
void
run
();
...
...
@@ -28,7 +37,6 @@ public:
protected:
void
init
();
Mouse3DInput
*
mouse3D
;
UASInterface
*
uas
;
bool
done
;
bool
mouseActive
;
...
...
src/ui/MainWindow.cc
View file @
1d898067
...
...
@@ -189,6 +189,12 @@ MainWindow::MainWindow(QWidget *parent):
mouse
=
new
Mouse6dofInput
(
mouseInput
);
#endif //MOUSE_ENABLED_WIN
#if MOUSE_ENABLED_LINUX
emit
initStatusChanged
(
"Initializing 3D mouse interface."
);
mouse
=
new
Mouse6dofInput
(
this
);
#endif //MOUSE_ENABLED_LINUX
// Connect link
if
(
autoReconnect
)
{
...
...
@@ -1726,3 +1732,11 @@ QList<QAction*> MainWindow::listLinkMenuActions(void)
{
return
ui
.
menuNetwork
->
actions
();
}
#ifdef MOUSE_ENABLED_LINUX
bool
MainWindow
::
x11Event
(
XEvent
*
event
)
{
emit
x11EventOccured
(
event
);
qDebug
(
"XEvent occured..."
);
}
#endif // MOUSE_ENABLED_LINUX
src/ui/MainWindow.h
View file @
1d898067
...
...
@@ -54,8 +54,8 @@ This file is part of the QGROUNDCONTROL project
#include "HUD.h"
#include "JoystickWidget.h"
#include "input/JoystickInput.h"
#if
def MOUSE_ENABLED_WIN
#include "
input/
Mouse6dofInput.h"
#if
(defined MOUSE_ENABLED_WIN) | (defined MOUSE_ENABLED_LINUX)
#include "Mouse6dofInput.h"
#endif // MOUSE_ENABLED_WIN
#include "DebugConsole.h"
#include "ParameterInterface.h"
...
...
@@ -235,6 +235,8 @@ public slots:
signals:
void
initStatusChanged
(
const
QString
&
message
);
/** @brief Forward X11Event to catch 3DMouse inputs */
void
x11EventOccured
(
XEvent
*
event
);
public:
QGCMAVLinkLogPlayer
*
getLogPlayer
()
...
...
@@ -375,11 +377,17 @@ protected:
JoystickInput
*
joystick
;
#ifdef MOUSE_ENABLED_WIN
/**
3d Mouse support (WIN only) *
*/
/**
@brief 3d Mouse support (WIN only)
*/
Mouse3DInput
*
mouseInput
;
///< 3dConnexion 3dMouse SDK
Mouse6dofInput
*
mouse
;
///< Implementation for 3dMouse input
#endif // MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
/** @brief Reimplementation of X11Event to handle 3dMouse Events (magellan) */
bool
x11Event
(
XEvent
*
event
);
Mouse6dofInput
*
mouse
;
///< Implementation for 3dMouse input
#endif // MOUSE_ENABLED_LINUX
/** User interface actions **/
QAction
*
connectUASAct
;
QAction
*
disconnectUASAct
;
...
...
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