Commit fb7663d3 authored by Lorenz Meier's avatar Lorenz Meier

Merge branch 'master' of github.com:mavlink/qgroundcontrol

parents 47d59fa9 a45f6f96
...@@ -47,6 +47,8 @@ user_config.pri ...@@ -47,6 +47,8 @@ user_config.pri
*.cproject *.cproject
*.sln *.sln
*.suo *.suo
*.uhf.txt
*.opensdf
thirdParty/qserialport-build-desktop/ thirdParty/qserialport-build-desktop/
thirdParty/qserialport/bin/ thirdParty/qserialport/bin/
......
#ifndef I3D_MOUSE_PARAMS_H
#define I3D_MOUSE_PARAMS_H
/*
Parameters for the 3D mouse based on the SDK from 3Dconnexion
*/
class I3dMouseSensor
{
public:
enum ESpeed {
kLowSpeed = 0,
kMidSpeed,
kHighSpeed
};
virtual bool IsPanZoom() const = 0;
virtual bool IsRotate() const = 0;
virtual ESpeed GetSpeed() const = 0;
virtual void SetPanZoom(bool isPanZoom) = 0;
virtual void SetRotate(bool isRotate) = 0;
virtual void SetSpeed(ESpeed speed) = 0;
protected:
virtual ~I3dMouseSensor() {}
};
class I3dMouseNavigation
{
public:
enum EPivot {
kManualPivot = 0,
kAutoPivot,
kAutoPivotOverride
};
enum ENavigation {
kObjectMode = 0,
kCameraMode,
kFlyMode,
kWalkMode,
kHelicopterMode
};
enum EPivotVisibility {
kHidePivot = 0,
kShowPivot,
kShowMovingPivot
};
virtual ENavigation GetNavigationMode() const = 0;
virtual EPivot GetPivotMode() const = 0;
virtual EPivotVisibility GetPivotVisibility() const = 0;
virtual bool IsLockHorizon() const = 0;
virtual void SetLockHorizon(bool bOn) = 0;
virtual void SetNavigationMode(ENavigation navigation) = 0;
virtual void SetPivotMode(EPivot pivot) = 0;
virtual void SetPivotVisibility(EPivotVisibility visibility) = 0;
protected:
virtual ~I3dMouseNavigation(){}
};
class I3dMouseParam : public I3dMouseSensor, public I3dMouseNavigation
{
public:
virtual ~I3dMouseParam() {}
};
#endif
This diff is collapsed.
#ifndef T3DMOUSE_INPUT_H
#define T3DMOUSE_INPUT_H
#include "MouseParameters.h"
#include <QWidget>
#include <vector>
#include <map>
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 //target at least windows XP
#endif
#include <windows.h>
/*
A class for connecting to and receiving data from a 3D Connexion 3D mouse
This helper class manages the connection to a 3D mouse, collecting WM_INPUT
messages from Windows and converting the data into 3D motion data.
This class is based on the SDK from 3D Connexion but is modified to work with Qt.
It is Windows only since it uses the WM_INPUT messages from windows directly
rather than Qt events.
Note that it needs to be compiled with _WIN32_WINNT defined as 0x0501 (windows XP)
or later because the raw input API was added in Windows XP. This also means that
Qt needs to be compiled with this enabled otherwise the QEventDispatcherWin32 blocks
in processEvents because the raw input messages do not cause the thread to be woken if
Qt is compiled for Win 2000 targets.
*/
class Mouse3DInput : public QObject
{
Q_OBJECT
public:
Mouse3DInput(QWidget* widget);
~Mouse3DInput();
static bool Is3dmouseAttached();
I3dMouseParam& MouseParams();
const I3dMouseParam& MouseParams() const;
virtual void Move3d(HANDLE device, std::vector<float>& motionData);
virtual void On3dmouseKeyDown(HANDLE device, int virtualKeyCode);
virtual void On3dmouseKeyUp(HANDLE device, int virtualKeyCode);
signals:
void Move3d(std::vector<float>& motionData);
void On3dmouseKeyDown(int virtualKeyCode);
void On3dmouseKeyUp(int virtualKeyCode);
private:
bool InitializeRawInput(HWND hwndTarget);
static bool RawInputEventFilter(void* msg, long* result);
void OnRawInput(UINT nInputCode, HRAWINPUT hRawInput);
UINT GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
bool TranslateRawInputData(UINT nInputCode, PRAWINPUT pRawInput);
void On3dmouseInput();
class TInputData
{
public:
TInputData() : fAxes(6) {}
bool IsZero() {
return (0.==fAxes[0] && 0.==fAxes[1] && 0.==fAxes[2] &&
0.==fAxes[3] && 0.==fAxes[4] && 0.==fAxes[5]);
}
int fTimeToLive; // For telling if the device was unplugged while sending data
bool fIsDirty;
std::vector<float> fAxes;
};
HWND fWindow;
// Data cache to handle multiple rawinput devices
std::map< HANDLE, TInputData> fDevice2Data;
std::map< HANDLE, unsigned long> fDevice2Keystate;
// 3dmouse parameters
MouseParameters f3dMouseParams; // Rotate, Pan Zoom etc.
// use to calculate distance traveled since last event
DWORD fLast3dmouseInputTime;
};
#endif
#include "MouseParameters.h"
MouseParameters::MouseParameters(): fNavigation(kObjectMode)
, fPivot(kAutoPivot)
, fPivotVisibility(kShowPivot)
, fIsLockHorizon(true)
, fIsPanZoom(true)
, fIsRotate(true)
, fSpeed(kLowSpeed)
{
}
MouseParameters::~MouseParameters()
{
}
bool MouseParameters::IsPanZoom() const
{
return fIsPanZoom;
}
bool MouseParameters::IsRotate() const
{
return fIsRotate;
}
MouseParameters::ESpeed MouseParameters::GetSpeed() const
{
return fSpeed;
}
void MouseParameters::SetPanZoom(bool isPanZoom)
{
fIsPanZoom=isPanZoom;
}
void MouseParameters::SetRotate(bool isRotate)
{
fIsRotate=isRotate;
}
void MouseParameters::SetSpeed(ESpeed speed)
{
fSpeed=speed;
}
MouseParameters::ENavigation MouseParameters::GetNavigationMode() const
{
return fNavigation;
}
MouseParameters::EPivot MouseParameters::GetPivotMode() const
{
return fPivot;
}
MouseParameters::EPivotVisibility MouseParameters::GetPivotVisibility() const
{
return fPivotVisibility;
}
bool MouseParameters::IsLockHorizon() const
{
return fIsLockHorizon;
}
void MouseParameters::SetLockHorizon(bool bOn)
{
fIsLockHorizon=bOn;
}
void MouseParameters::SetNavigationMode(ENavigation navigation)
{
fNavigation=navigation;
}
void MouseParameters::SetPivotMode(EPivot pivot)
{
if (fPivot!=kManualPivot || pivot!=kAutoPivotOverride)
fPivot = pivot;
}
void MouseParameters::SetPivotVisibility(EPivotVisibility visibility)
{
fPivotVisibility = visibility;
}
#ifndef T3D_MOUSE_PARAMS_H
#define T3D_MOUSE_PARAMS_H
#include "I3dMouseParams.h"
class MouseParameters : public I3dMouseParam
{
public:
MouseParameters();
~MouseParameters();
// I3dmouseSensor interface
bool IsPanZoom() const;
bool IsRotate() const;
ESpeed GetSpeed() const;
void SetPanZoom(bool isPanZoom);
void SetRotate(bool isRotate);
void SetSpeed(ESpeed speed);
// I3dmouseNavigation interface
ENavigation GetNavigationMode() const;
EPivot GetPivotMode() const;
EPivotVisibility GetPivotVisibility() const;
bool IsLockHorizon() const;
void SetLockHorizon(bool bOn);
void SetNavigationMode(ENavigation navigation);
void SetPivotMode(EPivot pivot);
void SetPivotVisibility(EPivotVisibility visibility);
private:
MouseParameters (const MouseParameters&);
const MouseParameters& operator =(const MouseParameters&);
ENavigation fNavigation;
EPivot fPivot;
EPivotVisibility fPivotVisibility;
bool fIsLockHorizon;
bool fIsPanZoom;
bool fIsRotate;
ESpeed fSpeed;
};
#endif
...@@ -624,3 +624,36 @@ win32-msvc2008|win32-msvc2010|linux { ...@@ -624,3 +624,36 @@ win32-msvc2008|win32-msvc2010|linux {
LIBS += -Llibs/thirdParty/libxbee/lib \ LIBS += -Llibs/thirdParty/libxbee/lib \
-llibxbee -llibxbee
} }
###################################################################
#### --- 3DConnexion 3d Mice support (e.g. spacenavigator) --- ####
###################################################################
# xdrvlib only supported by linux (theoretical all X11) systems
# You have to install the official 3DxWare driver for linux to use 3D 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 3DxWare driver for Windows to use the 3D mouse support on Windows systems!
win32-msvc2008|win32-msvc2010 {
message("Including support for 3DxWare for Windows system.")
SOURCES += libs/thirdParty/3DMouse/win/MouseParameters.cpp \
libs/thirdParty/3DMouse/win/Mouse3DInput.cpp \
src/input/Mouse6dofInput.cpp
HEADERS += libs/thirdParty/3DMouse/win/I3dMouseParams.h \
libs/thirdParty/3DMouse/win/MouseParameters.h \
libs/thirdParty/3DMouse/win/Mouse3DInput.h \
src/input/Mouse6dofInput.h
INCLUDEPATH += libs/thirdParty/3DMouse/win
DEFINES += MOUSE_ENABLED_WIN
}
This diff is collapsed.
/**
* @file
* @brief Definition of 3dConnexion 3dMouse interface for QGroundControl
*
* @author Matthias Krebs <makrebs@student.ethz.ch>
*
*/
#ifndef MOUSE6DOFINPUT_H
#define MOUSE6DOFINPUT_H
#include <QThread>
#ifdef MOUSE_ENABLED_WIN
#include "Mouse3DInput.h"
#endif //MOUSE_ENABLED_WIN
#include "UASInterface.h"
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);
#endif //MOUSE_ENABLED_LINUX
~Mouse6dofInput();
void run();
const double mouse3DMax;
protected:
void init();
UASInterface* uas;
bool done;
bool mouseActive;
bool translationActive;
bool rotationActive;
double xValue;
double yValue;
double zValue;
double aValue;
double bValue;
double cValue;
signals:
/**
* @brief Input of the 3d mouse has changed
*
* @param x Input x direction, range [-1, 1]
* @param y Input y direction, range [-1, 1]
* @param z Input z direction, range [-1, 1]
* @param a Input x rotation, range [-1, 1]
* @param b Input y rotation, range [-1, 1]
* @param c Input z rotation, range [-1, 1]
*/
void mouse6dofChanged(double x, double y, double z, double a, double b, double c);
/**
* @brief Activity of translational 3DMouse inputs changed
* @param translationEnable, true: translational inputs active; false: translational inputs ingored
*/
void mouseTranslationActiveChanged(bool translationEnable);
/**
* @brief Activity of rotational 3DMouse inputs changed
* @param rotationEnable, true: rotational inputs active; false: rotational inputs ingored
*/
void mouseRotationActiveChanged(bool rotationEnable);
public slots:
void setActiveUAS(UASInterface* uas);
#ifdef MOUSE_ENABLED_WIN
/** @brief Get a motion input from 3DMouse */
void motion3DMouse(std::vector<float> &motionData);
/** @brief Get a button input from 3DMouse */
void button3DMouseDown(int button);
#endif //MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
/** @brief Get an XEvent to check it for an 3DMouse event (motion or button) */
void handleX11Event(XEvent* event);
#endif //MOUSE_ENABLED_LINUX
};
#endif // MOUSE6DOFINPUT_H
...@@ -32,6 +32,8 @@ ArduPilotMegaMAV::ArduPilotMegaMAV(MAVLinkProtocol* mavlink, int id) : ...@@ -32,6 +32,8 @@ ArduPilotMegaMAV::ArduPilotMegaMAV(MAVLinkProtocol* mavlink, int id) :
UAS(mavlink, id)//, UAS(mavlink, id)//,
// place other initializers here // place other initializers here
{ {
// Ask for all streams at 4 Hz
enableAllDataTransmission(4);
} }
/** /**
......
...@@ -2454,7 +2454,25 @@ void UAS::setManualControlCommands(double roll, double pitch, double yaw, double ...@@ -2454,7 +2454,25 @@ void UAS::setManualControlCommands(double roll, double pitch, double yaw, double
} }
else else
{ {
qDebug() << "JOYSTICK/MANUAL CONTROL: IGNORING COMMANDS: Set mode to MANUAL to send joystick commands first"; //qDebug() << "JOYSTICK/MANUAL CONTROL: IGNORING COMMANDS: Set mode to MANUAL to send joystick commands first";
}
}
void UAS::setManual6DOFControlCommands(double x, double y, double z, double roll, double pitch, double yaw)
{
// If system has manual inputs enabled and is armed
if(((mode & MAV_MODE_FLAG_DECODE_POSITION_MANUAL) && (mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY)) || (mode & MAV_MODE_FLAG_HIL_ENABLED))
{
mavlink_message_t message;
mavlink_msg_setpoint_6dof_pack(mavlink->getSystemId(), mavlink->getComponentId(), &message, this->uasId, (float)x, (float)y, (float)z, (float)roll, (float)pitch, (float)yaw);
sendMessage(message);
qDebug() << __FILE__ << __LINE__ << ": SENT 6DOF CONTROL MESSAGE: x" << x << " y: " << y << " z: " << z << " roll: " << roll << " pitch: " << pitch << " yaw: " << yaw;
//emit attitudeThrustSetPointChanged(this, roll, pitch, yaw, thrust, QGC::groundTimeMilliseconds());
}
else
{
qDebug() << "3DMOUSE/MANUAL CONTROL: IGNORING COMMANDS: Set mode to MANUAL to send 3DMouse commands first";
} }
} }
......
...@@ -573,6 +573,9 @@ public slots: ...@@ -573,6 +573,9 @@ public slots:
/** @brief Receive a button pressed event from an input device, e.g. joystick */ /** @brief Receive a button pressed event from an input device, e.g. joystick */
void receiveButton(int buttonIndex); void receiveButton(int buttonIndex);
/** @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);
/** @brief Add a link associated with this robot */ /** @brief Add a link associated with this robot */
void addLink(LinkInterface* link); void addLink(LinkInterface* link);
/** @brief Remove a link associated with this robot */ /** @brief Remove a link associated with this robot */
......
...@@ -475,6 +475,7 @@ signals: ...@@ -475,6 +475,7 @@ signals:
void imageDataReceived(int imgid, const unsigned char* imageData, int length, int startIndex); void imageDataReceived(int imgid, const unsigned char* imageData, int length, int startIndex);
/** @brief Emit the new system type */ /** @brief Emit the new system type */
void systemTypeSet(UASInterface* uas, unsigned int type); void systemTypeSet(UASInterface* uas, unsigned int type);
/** @brief Attitude control enabled/disabled */ /** @brief Attitude control enabled/disabled */
void attitudeControlEnabled(bool enabled); void attitudeControlEnabled(bool enabled);
/** @brief Position 2D control enabled/disabled */ /** @brief Position 2D control enabled/disabled */
...@@ -483,6 +484,30 @@ signals: ...@@ -483,6 +484,30 @@ signals:
void positionZControlEnabled(bool enabled); void positionZControlEnabled(bool enabled);
/** @brief Heading control enabled/disabled */ /** @brief Heading control enabled/disabled */
void positionYawControlEnabled(bool enabled); void positionYawControlEnabled(bool enabled);
/** @brief Optical flow status changed */
void opticalFlowStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Vision based localization status changed */
void visionLocalizationStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Infrared / Ultrasound status changed */
void distanceSensorStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Gyroscope status changed */
void gyroStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Accelerometer status changed */
void accelStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Magnetometer status changed */
void magSensorStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Barometer status changed */
void baroStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Differential pressure / airspeed status changed */
void airspeedStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Actuator status changed */
void actuatorStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Laser scanner status changed */
void laserStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Vicon / Leica Geotracker status changed */
void groundTruthSensorStatusChanged(bool supported, bool enabled, bool ok);
/** @brief Value of a remote control channel (raw) */ /** @brief Value of a remote control channel (raw) */
void remoteControlChannelRawChanged(int channelId, float raw); void remoteControlChannelRawChanged(int channelId, float raw);
/** @brief Value of a remote control channel (scaled)*/ /** @brief Value of a remote control channel (scaled)*/
......
...@@ -123,7 +123,34 @@ HSIDisplay::HSIDisplay(QWidget *parent) : ...@@ -123,7 +123,34 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
userSetPointSet(false), userSetPointSet(false),
userXYSetPointSet(false), userXYSetPointSet(false),
userZSetPointSet(false), userZSetPointSet(false),
userYawSetPointSet(false) userYawSetPointSet(false),
gyroKnown(false),
gyroON(false),
gyroOK(false),
accelKnown(false),
accelON(false),
accelOK(false),
magKnown(false),
magON(false),
magOK(false),
pressureKnown(false),
pressureON(false),
pressureOK(false),
diffPressureKnown(false),
diffPressureON(false),
diffPressureOK(false),
flowKnown(false),
flowON(false),
flowOK(false),
laserKnown(false),
laserON(false),
laserOK(false),
viconKnown(false),
viconON(false),
viconOK(false),
actuatorsKnown(false),
actuatorsON(false),
actuatorsOK(false)
{ {
refreshTimer->setInterval(updateInterval); refreshTimer->setInterval(updateInterval);
...@@ -845,6 +872,16 @@ void HSIDisplay::setActiveUAS(UASInterface* uas) ...@@ -845,6 +872,16 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
disconnect(this->uas, SIGNAL(gpsLocalizationChanged(UASInterface*,int)), this, SLOT(updateGpsLocalization(UASInterface*,int))); disconnect(this->uas, SIGNAL(gpsLocalizationChanged(UASInterface*,int)), this, SLOT(updateGpsLocalization(UASInterface*,int)));
disconnect(this->uas, SIGNAL(irUltraSoundLocalizationChanged(UASInterface*,int)), this, SLOT(updateInfraredUltrasoundLocalization(UASInterface*,int))); disconnect(this->uas, SIGNAL(irUltraSoundLocalizationChanged(UASInterface*,int)), this, SLOT(updateInfraredUltrasoundLocalization(UASInterface*,int)));
disconnect(this->uas, SIGNAL(objectDetected(uint,int,int,QString,int,float,float)), this, SLOT(updateObjectPosition(uint,int,int,QString,int,float,float))); disconnect(this->uas, SIGNAL(objectDetected(uint,int,int,QString,int,float,float)), this, SLOT(updateObjectPosition(uint,int,int,QString,int,float,float)));
disconnect(this->uas, SIGNAL(gyroStatusChanged(bool,bool,bool)), this, SLOT(updateGyroStatus(bool,bool,bool)));
disconnect(this->uas, SIGNAL(accelStatusChanged(bool,bool,bool)), this, SLOT(updateAccelStatus(bool,bool,bool)));
disconnect(this->uas, SIGNAL(magSensorStatusChanged(bool,bool,bool)), this, SLOT(updateMagSensorStatus(bool,bool,bool)));
disconnect(this->uas, SIGNAL(baroStatusChanged(bool,bool,bool)), this, SLOT(updateBaroStatus(bool,bool,bool)));
disconnect(this->uas, SIGNAL(airspeedStatusChanged(bool,bool,bool)), this, SLOT(updateAirspeedStatus(bool,bool,bool)));
disconnect(this->uas, SIGNAL(opticalFlowStatusChanged(bool,bool,bool)), this, SLOT(updateOpticalFlowStatus(bool,bool,bool)));
disconnect(this->uas, SIGNAL(laserStatusChanged(bool,bool,bool)), this, SLOT(updateLaserStatus(bool,bool,bool)));
disconnect(this->uas, SIGNAL(groundTruthSensorStatusChanged(bool,bool,bool)), this, SLOT(updateGroundTruthSensorStatus(bool,bool,bool)));
disconnect(this->uas, SIGNAL(actuatorStatusChanged(bool,bool,bool)), this, SLOT(updateActuatorStatus(bool,bool,bool)));
} }
connect(uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool))); connect(uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool)));
...@@ -867,6 +904,16 @@ void HSIDisplay::setActiveUAS(UASInterface* uas) ...@@ -867,6 +904,16 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
connect(uas, SIGNAL(irUltraSoundLocalizationChanged(UASInterface*,int)), this, SLOT(updateInfraredUltrasoundLocalization(UASInterface*,int))); connect(uas, SIGNAL(irUltraSoundLocalizationChanged(UASInterface*,int)), this, SLOT(updateInfraredUltrasoundLocalization(UASInterface*,int)));
connect(uas, SIGNAL(objectDetected(uint,int,int,QString,int,float,float)), this, SLOT(updateObjectPosition(uint,int,int,QString,int,float,float))); connect(uas, SIGNAL(objectDetected(uint,int,int,QString,int,float,float)), this, SLOT(updateObjectPosition(uint,int,int,QString,int,float,float)));
connect(uas, SIGNAL(gyroStatusChanged(bool,bool,bool)), this, SLOT(updateGyroStatus(bool,bool,bool)));
connect(uas, SIGNAL(accelStatusChanged(bool,bool,bool)), this, SLOT(updateAccelStatus(bool,bool,bool)));
connect(uas, SIGNAL(magSensorStatusChanged(bool,bool,bool)), this, SLOT(updateMagSensorStatus(bool,bool,bool)));
connect(uas, SIGNAL(baroStatusChanged(bool,bool,bool)), this, SLOT(updateBaroStatus(bool,bool,bool)));
connect(uas, SIGNAL(airspeedStatusChanged(bool,bool,bool)), this, SLOT(updateAirspeedStatus(bool,bool,bool)));
connect(uas, SIGNAL(opticalFlowStatusChanged(bool,bool,bool)), this, SLOT(updateOpticalFlowStatus(bool,bool,bool)));
connect(uas, SIGNAL(laserStatusChanged(bool,bool,bool)), this, SLOT(updateLaserStatus(bool,bool,bool)));
connect(uas, SIGNAL(groundTruthSensorStatusChanged(bool,bool,bool)), this, SLOT(updateGroundTruthSensorStatus(bool,bool,bool)));
connect(uas, SIGNAL(actuatorStatusChanged(bool,bool,bool)), this, SLOT(updateActuatorStatus(bool,bool,bool)));
this->uas = uas; this->uas = uas;
resetMAVState(); resetMAVState();
......
...@@ -66,6 +66,83 @@ public slots: ...@@ -66,6 +66,83 @@ public slots:
void updateAttitudeControllerEnabled(bool enabled); void updateAttitudeControllerEnabled(bool enabled);
void updatePositionXYControllerEnabled(bool enabled); void updatePositionXYControllerEnabled(bool enabled);
void updatePositionZControllerEnabled(bool enabled); void updatePositionZControllerEnabled(bool enabled);
/** @brief Optical flow status changed */
void updateOpticalFlowStatus(bool supported, bool enabled, bool ok) {
if (supported && enabled && ok) {
visionFix = true;
} else {
visionFix = false;
}
}
/** @brief Vision based localization status changed */
void updateVisionLocalizationStatus(bool supported, bool enabled, bool ok) {
if (enabled && ok) {
visionFix = true;
} else {
visionFix = false;
}
visionFixKnown = supported;
}
/** @brief Infrared / Ultrasound status changed */
void updateDistanceSensorStatus(bool supported, bool enabled, bool ok) {
if (enabled && ok) {
iruFix = true;
} else {
iruFix = false;
}
iruFixKnown = supported;
}
/** @brief Gyroscope status changed */
void updateGyroStatus(bool supported, bool enabled, bool ok) {
gyroKnown = supported;
gyroON = enabled;
gyroOK = ok;
}
/** @brief Accelerometer status changed */
void updateAccelStatus(bool supported, bool enabled, bool ok) {
accelKnown = supported;
accelON = enabled;
accelOK = ok;
}
/** @brief Magnetometer status changed */
void updateMagSensorStatus(bool supported, bool enabled, bool ok) {
magKnown = supported;
magON = enabled;
magOK = ok;
}
/** @brief Barometer status changed */
void updateBaroStatus(bool supported, bool enabled, bool ok) {
pressureKnown = supported;
pressureON = enabled;
pressureOK = ok;
}
/** @brief Differential pressure / airspeed status changed */
void updateAirspeedStatus(bool supported, bool enabled, bool ok) {
diffPressureKnown = supported;
diffPressureON = enabled;
diffPressureOK = ok;
}
/** @brief Actuator status changed */
void updateActuatorStatus(bool supported, bool enabled, bool ok) {
actuatorsKnown = supported;
actuatorsON = enabled;
actuatorsOK = ok;
}
/** @brief Laser scanner status changed */
void updateLaserStatus(bool supported, bool enabled, bool ok) {
laserKnown = supported;
laserON = enabled;
laserOK = ok;
}
/** @brief Vicon / Leica Geotracker status changed */
void updateGroundTruthSensorStatus(bool supported, bool enabled, bool ok) {
viconKnown = supported;
viconON = enabled;
viconOK = ok;
}
void updateObjectPosition(unsigned int time, int id, int type, const QString& name, int quality, float bearing, float distance); void updateObjectPosition(unsigned int time, int id, int type, const QString& name, int quality, float bearing, float distance);
/** @brief Heading control enabled/disabled */ /** @brief Heading control enabled/disabled */
void updatePositionYawControllerEnabled(bool enabled); void updatePositionYawControllerEnabled(bool enabled);
......
...@@ -182,6 +182,20 @@ MainWindow::MainWindow(QWidget *parent): ...@@ -182,6 +182,20 @@ MainWindow::MainWindow(QWidget *parent):
joystickWidget = 0; joystickWidget = 0;
joystick = new JoystickInput(); joystick = new JoystickInput();
#ifdef MOUSE_ENABLED_WIN
emit initStatusChanged("Initializing 3D mouse interface.");
mouseInput = new Mouse3DInput(this);
mouse = new Mouse6dofInput(mouseInput);
#endif //MOUSE_ENABLED_WIN
#if MOUSE_ENABLED_LINUX
emit initStatusChanged("Initializing 3D mouse interface.");
mouse = new Mouse6dofInput(this);
connect(this, SIGNAL(x11EventOccured(XEvent*)), mouse, SLOT(handleX11Event(XEvent*)));
#endif //MOUSE_ENABLED_LINUX
// Connect link // Connect link
if (autoReconnect) if (autoReconnect)
{ {
...@@ -1719,3 +1733,12 @@ QList<QAction*> MainWindow::listLinkMenuActions(void) ...@@ -1719,3 +1733,12 @@ QList<QAction*> MainWindow::listLinkMenuActions(void)
{ {
return ui.menuNetwork->actions(); return ui.menuNetwork->actions();
} }
#ifdef MOUSE_ENABLED_LINUX
bool MainWindow::x11Event(XEvent *event)
{
emit x11EventOccured(event);
//qDebug("XEvent occured...");
return false;
}
#endif // MOUSE_ENABLED_LINUX
...@@ -54,6 +54,9 @@ This file is part of the QGROUNDCONTROL project ...@@ -54,6 +54,9 @@ This file is part of the QGROUNDCONTROL project
#include "HUD.h" #include "HUD.h"
#include "JoystickWidget.h" #include "JoystickWidget.h"
#include "input/JoystickInput.h" #include "input/JoystickInput.h"
#if (defined MOUSE_ENABLED_WIN) | (defined MOUSE_ENABLED_LINUX)
#include "Mouse6dofInput.h"
#endif // MOUSE_ENABLED_WIN
#include "DebugConsole.h" #include "DebugConsole.h"
#include "ParameterInterface.h" #include "ParameterInterface.h"
#include "XMLCommProtocolWidget.h" #include "XMLCommProtocolWidget.h"
...@@ -232,6 +235,10 @@ public slots: ...@@ -232,6 +235,10 @@ public slots:
signals: signals:
void initStatusChanged(const QString& message); void initStatusChanged(const QString& message);
#ifdef MOUSE_ENABLED_LINUX
/** @brief Forward X11Event to catch 3DMouse inputs */
void x11EventOccured(XEvent *event);
#endif //MOUSE_ENABLED_LINUX
public: public:
QGCMAVLinkLogPlayer* getLogPlayer() QGCMAVLinkLogPlayer* getLogPlayer()
...@@ -371,6 +378,18 @@ protected: ...@@ -371,6 +378,18 @@ protected:
JoystickInput* joystick; JoystickInput* joystick;
#ifdef MOUSE_ENABLED_WIN
/** @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 **/ /** User interface actions **/
QAction* connectUASAct; QAction* connectUASAct;
QAction* disconnectUASAct; QAction* disconnectUASAct;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment