Commit fe4c2dca authored by Hugo Vincent's avatar Hugo Vincent

Merge branch 'master' of pixhawk.ethz.ch:groundcontrol

Conflicts:
	mavground.pri
	src/AudioOutput.h
	src/Core.cc
parents 43b95458 03f3b211
...@@ -8,7 +8,6 @@ obj ...@@ -8,7 +8,6 @@ obj
bin/*.exe bin/*.exe
bin/*.txt bin/*.txt
bin/mac bin/mac
mavground
*pro.user *pro.user
qrc_*.cpp qrc_*.cpp
*.Debug *.Debug
...@@ -17,4 +16,5 @@ tmp ...@@ -17,4 +16,5 @@ tmp
debug debug
release release
opengroundcontrol.xcodeproj/** opengroundcontrol.xcodeproj/**
opengroundcontrol
qgroundcontrol
File added
DEPENDPATH += src DEPENDPATH += src
INCLUDEPATH += src INCLUDEPATH += src
MOC_DIR = tmp
OBJECTS_DIR = obj
# Input # Input
HEADERS += curve.h \ HEADERS += curve.h \
...@@ -52,5 +50,3 @@ SOURCES += curve.cpp \ ...@@ -52,5 +50,3 @@ SOURCES += curve.cpp \
openaerialmapadapter.cpp \ openaerialmapadapter.cpp \
fixedimageoverlay.cpp \ fixedimageoverlay.cpp \
emptymapadapter.cpp emptymapadapter.cpp
QT += network
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
# #
#------------------------------------------------- #-------------------------------------------------
QT += network opengl svg xml QT += network opengl svg xml phonon
TEMPLATE = app TEMPLATE = app
TARGET = opengroundcontrol TARGET = qgroundcontrol
BASEDIR = . BASEDIR = .
BUILDDIR = build BUILDDIR = build
...@@ -38,6 +38,7 @@ LANGUAGE = C++ ...@@ -38,6 +38,7 @@ LANGUAGE = C++
#CONFIG += static release console #CONFIG += static release console
CONFIG += static debug_and_release console CONFIG += static debug_and_release console
QMAKE_CFLAGS += -j8 QMAKE_CFLAGS += -j8
QMAKE_CXXFLAGS += -j8
OBJECTS_DIR = $$BUILDDIR/obj OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc MOC_DIR = $$BUILDDIR/moc
...@@ -46,7 +47,7 @@ UI_HEADERS_DIR = src/ui/generated ...@@ -46,7 +47,7 @@ UI_HEADERS_DIR = src/ui/generated
# Add external libraries # Add external libraries
INCLUDEPATH += $$BASEDIR/lib/flite/include \ INCLUDEPATH += $$BASEDIR/lib/flite/include \
$$BASEDIR/lib/flite/lang $$BASEDIR/lib/flite/lang
#$$BASEDIR/lib/qextserialport/include #$$BASEDIR/lib/qextserialport/include
# $$BASEDIR/lib/openjaus/libjaus/include \ # $$BASEDIR/lib/openjaus/libjaus/include \
...@@ -58,16 +59,17 @@ message(Qt version $$[QT_VERSION]) ...@@ -58,16 +59,17 @@ message(Qt version $$[QT_VERSION])
# MAC OS X # MAC OS X
macx { macx {
message(Building for Mac OS X)
message(Building for Mac OS X 64bit)
CONFIG += x86_64 CONFIG += x86_64
CONFIG -= x86 static CONFIG -= x86 static phonon
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
DESTDIR = $$BASEDIR/bin/mac DESTDIR = $$BASEDIR/bin/mac
INCLUDEPATH += -framework SDL \ INCLUDEPATH += -framework SDL \
$$BASEDIR/MAVLink/src $$BASEDIR/MAVLink/src
LIBS += -framework IOKit \ LIBS += -framework IOKit \
-framework SDL \ -framework SDL \
...@@ -75,7 +77,11 @@ macx { ...@@ -75,7 +77,11 @@ macx {
-framework ApplicationServices \ -framework ApplicationServices \
-lm -lm
DEFINES += _TTY_POSIX_ # Enable function-profiling with the OS X saturn tool
debug {
#QMAKE_CXXFLAGS += -finstrument-functions
#LIBS += -lSaturn
}
ICON = $$BASEDIR/images/icons/macx.icns ICON = $$BASEDIR/images/icons/macx.icns
} }
...@@ -84,8 +90,6 @@ macx { ...@@ -84,8 +90,6 @@ macx {
linux-g++ { linux-g++ {
message(Building for GNU/Linux) message(Building for GNU/Linux)
QT += phonon
debug { debug {
DESTDIR = $$BASEDIR DESTDIR = $$BASEDIR
...@@ -96,8 +100,6 @@ linux-g++ { ...@@ -96,8 +100,6 @@ linux-g++ {
} }
INCLUDEPATH += /usr/include/SDL INCLUDEPATH += /usr/include/SDL
DEFINES += _TTY_POSIX_
HARDWARE_PLATFORM = $$system(uname -a) HARDWARE_PLATFORM = $$system(uname -a)
contains( HARDWARE_PLATFORM, x86_64 ) { contains( HARDWARE_PLATFORM, x86_64 ) {
# 64-bit Linux # 64-bit Linux
...@@ -131,8 +133,6 @@ win32 { ...@@ -131,8 +133,6 @@ win32 {
-lmingw32 -lSDLmain -lSDL -mwindows -lmingw32 -lSDLmain -lSDL -mwindows
INCLUDEPATH += $$BASEDIR/lib/sdl/include/SDL INCLUDEPATH += $$BASEDIR/lib/sdl/include/SDL
DEFINES += _TTY_WIN_
debug { debug {
DESTDIR = $$BASEDIR/bin DESTDIR = $$BASEDIR/bin
...@@ -144,3 +144,4 @@ win32 { ...@@ -144,3 +144,4 @@ win32 {
} }
# Include general settings for MAVGround # Include general settings for MAVGround
include(mavground.pri) include(mavground.pri)
# Include serial port library # Include serial port library
include(src/lib/qextserialport/qextserialport.pri) include(src/lib/qextserialport/qextserialport.pri)
# Include QWT plotting library # Include QWT plotting library
include(src/lib/qwt/qwt.pri) include(src/lib/qwt/qwt.pri)
# Include FLITE audio synthesizer library # Include FLITE audio synthesizer library
#include(src/lib/flite/flite.pri) #include(src/lib/flite/flite.pri)
# Include QMapControl map library # Include QMapControl map library
include(lib/QMapControl/QMapControl.pri) include(src/lib/qmapcontrol/qmapcontrol.pri)
DEPENDPATH += . \ #include(lib/QMapControl/QMapControl.pri)
lib/QMapControl \
lib/QMapControl/src DEPENDPATH += . \
INCLUDEPATH += . \ lib/QMapControl \
lib/QMapControl \ lib/QMapControl/src
../mavlink/src \ INCLUDEPATH += . \
MAVLink/src \ lib/QMapControl \
mavlink/src ../mavlink/src \
MAVLink/src \
# Input mavlink/src
FORMS += src/ui/MainWindow.ui \
src/ui/CommSettings.ui \ # Input
src/ui/SerialSettings.ui \ FORMS += src/ui/MainWindow.ui \
src/ui/UASControl.ui \ src/ui/CommSettings.ui \
src/ui/UASList.ui \ src/ui/SerialSettings.ui \
src/ui/UASInfo.ui \ src/ui/UASControl.ui \
src/ui/LineChart.ui \ src/ui/UASList.ui \
src/ui/UASView.ui \ src/ui/UASInfo.ui \
src/ui/ParameterInterface.ui \ src/ui/LineChart.ui \
src/ui/WaypointList.ui \ src/ui/UASView.ui \
src/ui/WaypointView.ui \ src/ui/ParameterInterface.ui \
src/ui/ObjectDetectionView.ui \ src/ui/WaypointList.ui \
src/ui/JoystickWidget.ui \ src/ui/WaypointView.ui \
src/ui/DebugConsole.ui \ src/ui/ObjectDetectionView.ui \
src/ui/MapWidget.ui \ src/ui/JoystickWidget.ui \
src/ui/XMLCommProtocolWidget.ui \ src/ui/DebugConsole.ui \
src/ui/HDDisplay.ui \ src/ui/MapWidget.ui \
src/ui/MAVLinkSettingsWidget.ui \ src/ui/XMLCommProtocolWidget.ui \
src/ui/AudioOutputWidget.ui src/ui/HDDisplay.ui \
INCLUDEPATH += src \ src/ui/MAVLinkSettingsWidget.ui \
src/ui \ src/ui/AudioOutputWidget.ui
src/ui/linechart \ INCLUDEPATH += src \
src/ui/uas \ src/ui \
src/ui/map \ src/ui/linechart \
src/uas \ src/ui/uas \
src/comm \ src/ui/map \
include/ui \ src/uas \
src/input \ src/comm \
src/lib/qmapcontrol \ include/ui \
src/ui/mavlink src/input \
HEADERS += src/MG.h \ src/lib/qmapcontrol \
src/Core.h \ src/ui/mavlink
src/uas/UASInterface.h \ HEADERS += src/MG.h \
src/uas/UAS.h \ src/Core.h \
src/uas/UASManager.h \ src/uas/UASInterface.h \
src/comm/LinkManager.h \ src/uas/UAS.h \
src/comm/LinkInterface.h \ src/uas/UASManager.h \
src/comm/SerialLinkInterface.h \ src/comm/LinkManager.h \
src/comm/SerialLink.h \ src/comm/LinkInterface.h \
src/comm/SerialSimulationLink.h \ src/comm/SerialLinkInterface.h \
src/comm/ProtocolInterface.h \ src/comm/SerialLink.h \
src/comm/MAVLinkProtocol.h \ src/comm/SerialSimulationLink.h \
src/comm/AS4Protocol.h \ src/comm/ProtocolInterface.h \
src/ui/CommConfigurationWindow.h \ src/comm/MAVLinkProtocol.h \
src/ui/SerialConfigurationWindow.h \ src/comm/AS4Protocol.h \
src/ui/MainWindow.h \ src/ui/CommConfigurationWindow.h \
src/ui/uas/UASControlWidget.h \ src/ui/SerialConfigurationWindow.h \
src/ui/uas/UASListWidget.h \ src/ui/MainWindow.h \
src/ui/uas/UASInfoWidget.h \ src/ui/uas/UASControlWidget.h \
src/ui/HUD.h \ src/ui/uas/UASListWidget.h \
src/ui/linechart/LinechartWidget.h \ src/ui/uas/UASInfoWidget.h \
src/ui/linechart/LinechartContainer.h \ src/ui/HUD.h \
src/ui/linechart/LinechartPlot.h \ src/ui/linechart/LinechartWidget.h \
src/ui/linechart/Scrollbar.h \ src/ui/linechart/LinechartContainer.h \
src/ui/linechart/ScrollZoomer.h \ src/ui/linechart/LinechartPlot.h \
src/configuration.h \ src/ui/linechart/Scrollbar.h \
src/ui/uas/UASView.h \ src/ui/linechart/ScrollZoomer.h \
src/ui/CameraView.h \ src/configuration.h \
src/comm/MAVLinkSimulationLink.h \ src/ui/uas/UASView.h \
src/comm/UDPLink.h \ src/ui/CameraView.h \
src/ui/ParameterInterface.h \ src/comm/MAVLinkSimulationLink.h \
src/ui/WaypointList.h \ src/comm/UDPLink.h \
src/Waypoint.h \ src/ui/ParameterInterface.h \
src/ui/WaypointView.h \ src/ui/WaypointList.h \
src/ui/ObjectDetectionView.h \ src/Waypoint.h \
src/input/JoystickInput.h \ src/ui/WaypointView.h \
src/ui/JoystickWidget.h \ src/ui/ObjectDetectionView.h \
src/ui/PFD.h \ src/input/JoystickInput.h \
src/ui/GaugePanel.h \ src/ui/JoystickWidget.h \
src/ui/DebugConsole.h \ src/ui/PFD.h \
src/ui/MapWidget.h \ src/ui/GaugePanel.h \
src/ui/XMLCommProtocolWidget.h \ src/ui/DebugConsole.h \
src/ui/mavlink/DomItem.h \ src/ui/MapWidget.h \
src/ui/mavlink/DomModel.h \ src/ui/XMLCommProtocolWidget.h \
src/comm/MAVLinkXMLParser.h \ src/ui/mavlink/DomItem.h \
src/ui/HDDisplay.h \ src/ui/mavlink/DomModel.h \
src/ui/MAVLinkSettingsWidget.h \ src/comm/MAVLinkXMLParser.h \
src/ui/AudioOutputWidget.h \ src/ui/HDDisplay.h \
src/AudioOutput.h \ src/ui/MAVLinkSettingsWidget.h \
src/LogCompressor.h src/ui/AudioOutputWidget.h \
SOURCES += src/main.cc \ src/GAudioOutput.h \
src/Core.cc \ src/LogCompressor.h
src/uas/UASManager.cc \ SOURCES += src/main.cc \
src/uas/UAS.cc \ src/Core.cc \
src/comm/LinkManager.cc \ src/uas/UASManager.cc \
src/comm/SerialLink.cc \ src/uas/UAS.cc \
src/comm/SerialSimulationLink.cc \ src/comm/LinkManager.cc \
src/comm/MAVLinkProtocol.cc \ src/comm/SerialLink.cc \
src/comm/AS4Protocol.cc \ src/comm/SerialSimulationLink.cc \
src/ui/CommConfigurationWindow.cc \ src/comm/MAVLinkProtocol.cc \
src/ui/SerialConfigurationWindow.cc \ src/comm/AS4Protocol.cc \
src/ui/MainWindow.cc \ src/ui/CommConfigurationWindow.cc \
src/ui/uas/UASControlWidget.cc \ src/ui/SerialConfigurationWindow.cc \
src/ui/uas/UASListWidget.cc \ src/ui/MainWindow.cc \
src/ui/uas/UASInfoWidget.cc \ src/ui/uas/UASControlWidget.cc \
src/ui/HUD.cc \ src/ui/uas/UASListWidget.cc \
src/ui/linechart/LinechartWidget.cc \ src/ui/uas/UASInfoWidget.cc \
src/ui/linechart/LinechartContainer.cc \ src/ui/HUD.cc \
src/ui/linechart/LinechartPlot.cc \ src/ui/linechart/LinechartWidget.cc \
src/ui/linechart/Scrollbar.cc \ src/ui/linechart/LinechartContainer.cc \
src/ui/linechart/ScrollZoomer.cc \ src/ui/linechart/LinechartPlot.cc \
src/ui/uas/UASView.cc \ src/ui/linechart/Scrollbar.cc \
src/ui/CameraView.cc \ src/ui/linechart/ScrollZoomer.cc \
src/comm/MAVLinkSimulationLink.cc \ src/ui/uas/UASView.cc \
src/comm/UDPLink.cc \ src/ui/CameraView.cc \
src/ui/ParameterInterface.cc \ src/comm/MAVLinkSimulationLink.cc \
src/ui/WaypointList.cc \ src/comm/UDPLink.cc \
src/Waypoint.cc \ src/ui/ParameterInterface.cc \
src/ui/WaypointView.cc \ src/ui/WaypointList.cc \
src/ui/ObjectDetectionView.cc \ src/Waypoint.cc \
src/input/JoystickInput.cc \ src/ui/WaypointView.cc \
src/ui/JoystickWidget.cc \ src/ui/ObjectDetectionView.cc \
src/ui/PFD.cc \ src/input/JoystickInput.cc \
src/ui/GaugePanel.cc \ src/ui/JoystickWidget.cc \
src/ui/DebugConsole.cc \ src/ui/PFD.cc \
src/ui/MapWidget.cc \ src/ui/GaugePanel.cc \
src/ui/XMLCommProtocolWidget.cc \ src/ui/DebugConsole.cc \
src/ui/mavlink/DomItem.cc \ src/ui/MapWidget.cc \
src/ui/mavlink/DomModel.cc \ src/ui/XMLCommProtocolWidget.cc \
src/comm/MAVLinkXMLParser.cc \ src/ui/mavlink/DomItem.cc \
src/ui/HDDisplay.cc \ src/ui/mavlink/DomModel.cc \
src/ui/MAVLinkSettingsWidget.cc \ src/comm/MAVLinkXMLParser.cc \
src/ui/AudioOutputWidget.cc \ src/ui/HDDisplay.cc \
src/AudioOutput.cc \ src/ui/MAVLinkSettingsWidget.cc \
src/LogCompressor.cc src/ui/AudioOutputWidget.cc \
RESOURCES = mavground.qrc src/GAudioOutput.cc \
src/LogCompressor.cc
RESOURCES = mavground.qrc
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/" >
<file>images/control/launch.svg</file> <file>images/control/launch.svg</file>
<file>images/status/dialog-error.svg</file> <file>images/status/dialog-error.svg</file>
<file>images/status/dialog-warning.svg</file> <file>images/status/dialog-warning.svg</file>
...@@ -76,8 +76,10 @@ ...@@ -76,8 +76,10 @@
<file>images/status/audio-volume-low.svg</file> <file>images/status/audio-volume-low.svg</file>
<file>images/status/audio-volume-high.svg</file> <file>images/status/audio-volume-high.svg</file>
<file>images/style-mission.css</file> <file>images/style-mission.css</file>
<file>images/splash.png</file>
<file>audio/alert.wav</file>
</qresource> </qresource>
<qresource prefix="/general"> <qresource prefix="/general" >
<file alias="vera.ttf">images/Vera.ttf</file> <file alias="vera.ttf" >images/Vera.ttf</file>
</qresource> </qresource>
</RCC> </RCC>
#ifndef AUDIOOUTPUT_H
#define AUDIOOUTPUT_H
#include <QObject>
#include <QStringList>
/* Foward declarations of speech/voice structure */
#ifdef Q_OS_MAC
struct SpeechChannelRecord;
typedef SpeechChannelRecord *SpeechChannel;
#else
struct cst_voice;
#endif
class AudioOutput : public QObject
{
Q_OBJECT
public:
AudioOutput(QString voice="", QObject* parent=NULL);
/** @brief List available voices */
QStringList listVoices(void);
public slots:
/** @brief Say this text if current output priority matches */
bool say(QString text, int severity);
/** @brief Play alert sound */
bool alert(QString text);
/** @brief Start emergency sound */
bool startEmergency();
/** @brief Stop emergency sound */
bool stopEmergency();
/** @brief Select female voice */
void selectFemaleVoice();
/** @brief Select male voice */
void selectMaleVoice();
/** @brief Select neutral voice */
void selectNeutralVoice();
protected:
#ifdef Q_OS_MAC
SpeechChannel *voice;
#else
cst_voice *voice;
#endif
int voiceIndex;
};
#endif // AUDIOOUTPUT_H
...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project ...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project
/** /**
* @file * @file
* @brief Main class * @brief Implementation of main class
* *
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
...@@ -43,7 +43,7 @@ This file is part of the PIXHAWK project ...@@ -43,7 +43,7 @@ This file is part of the PIXHAWK project
#include <Core.h> #include <Core.h>
#include <MG.h> #include <MG.h>
#include <MainWindow.h> #include <MainWindow.h>
#include "AudioOutput.h" #include "GAudioOutput.h"
/** /**
...@@ -56,7 +56,7 @@ This file is part of the PIXHAWK project ...@@ -56,7 +56,7 @@ This file is part of the PIXHAWK project
* @param argv The string array of parameters * @param argv The string array of parameters
**/ **/
MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv) Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
{ {
this->setApplicationName("OpenMAV Ground Control Station"); this->setApplicationName("OpenMAV Ground Control Station");
this->setApplicationVersion("v. 0.0.5"); this->setApplicationVersion("v. 0.0.5");
...@@ -74,7 +74,7 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -74,7 +74,7 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv)
setFont(fontDatabase.font(fontFamilyName, "Roman", 12)); setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
// Show splash screen // Show splash screen
QPixmap splashImage(MG::DIR::getIconDirectory() + "/groundstation-splash.png"); QPixmap splashImage(":images/splash.png");
QSplashScreen* splashScreen = new QSplashScreen(splashImage, Qt::WindowStaysOnTopHint); QSplashScreen* splashScreen = new QSplashScreen(splashImage, Qt::WindowStaysOnTopHint);
splashScreen->show(); splashScreen->show();
...@@ -87,8 +87,10 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -87,8 +87,10 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv)
startUASManager(); startUASManager();
// Start audio output // Start audio output
AudioOutput* audio = new AudioOutput(); //GAudioOutput::instance()->say("Ground Control Station started", 1);
audio->say("Ground Control Station started", 1);
//tarsus = new ViconTarsusProtocol();
//tarsus->start();
// Start the user interface // Start the user interface
splashScreen->showMessage(tr("Starting User Interface")); splashScreen->showMessage(tr("Starting User Interface"));
...@@ -104,7 +106,7 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -104,7 +106,7 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv)
* @brief Destructor for the groundstation. It destroys all loaded instances. * @brief Destructor for the groundstation. It destroys all loaded instances.
* *
**/ **/
MGCore::~MGCore() Core::~Core()
{ {
// Delete singletons // Delete singletons
delete LinkManager::instance(); delete LinkManager::instance();
...@@ -117,7 +119,7 @@ MGCore::~MGCore() ...@@ -117,7 +119,7 @@ MGCore::~MGCore()
* The link manager keeps track of all communication links and provides the global * The link manager keeps track of all communication links and provides the global
* packet queue. It is the main communication hub * packet queue. It is the main communication hub
**/ **/
void MGCore::startLinkManager() void Core::startLinkManager()
{ {
LinkManager::instance(); LinkManager::instance();
} }
...@@ -126,7 +128,7 @@ void MGCore::startLinkManager() ...@@ -126,7 +128,7 @@ void MGCore::startLinkManager()
* @brief Start the Unmanned Air System Manager * @brief Start the Unmanned Air System Manager
* *
**/ **/
void MGCore::startUASManager() void Core::startUASManager()
{ {
UASManager::instance(); UASManager::instance();
} }
...@@ -134,10 +136,10 @@ void MGCore::startUASManager() ...@@ -134,10 +136,10 @@ void MGCore::startUASManager()
/** /**
* @brief Start and show the user interface. * @brief Start and show the user interface.
**/ **/
void MGCore::startUI() void Core::startUI()
{ {
// Start UI // Start UI
mainWindow = new MGMainWindow(); mainWindow = new MainWindow();
// Make UI visible // Make UI visible
mainWindow->show(); mainWindow->show();
} }
......
...@@ -30,14 +30,15 @@ This file is part of the PIXHAWK project ...@@ -30,14 +30,15 @@ This file is part of the PIXHAWK project
*/ */
#ifndef _MGCORE_H_ #ifndef _CORE_H_
#define _MGCORE_H_ #define _CORE_H_
#include <QApplication> #include <QApplication>
#include "MainWindow.h" #include "MainWindow.h"
#include "UASManager.h" #include "UASManager.h"
#include "LinkManager.h" #include "LinkManager.h"
/*#include "ViconTarsusProtocol.h" */
/** /**
* @brief The main application and management class. * @brief The main application and management class.
...@@ -46,13 +47,13 @@ This file is part of the PIXHAWK project ...@@ -46,13 +47,13 @@ This file is part of the PIXHAWK project
* the central management unit of the groundstation application. * the central management unit of the groundstation application.
* *
**/ **/
class MGCore : public QApplication class Core : public QApplication
{ {
Q_OBJECT Q_OBJECT
public: public:
MGCore(int &argc, char* argv[]); Core(int &argc, char* argv[]);
~MGCore(); ~Core();
protected: protected:
void startLinkManager(); void startLinkManager();
...@@ -67,7 +68,8 @@ protected: ...@@ -67,7 +68,8 @@ protected:
void startUI(); void startUI();
private: private:
MGMainWindow* mainWindow; MainWindow* mainWindow;
//ViconTarsusProtocol* tarsus;
}; };
#endif // _MGCORE_H_ #endif /* _CORE_H_ */
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of audio output
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include <QApplication>
#include <QTemporaryFile>
#include "GAudioOutput.h"
#include "MG.h"
#include <QDebug>
#ifdef Q_OS_MAC
#include <ApplicationServices/ApplicationServices.h>
#endif
#ifdef Q_OS_WINDOWS
#include <windows.h>
using System;
using System.Speech.Synthesis;
#endif
#ifdef Q_OS_LINUX
extern "C" {
#include <flite.h>
#include <cmu_us_awb/voxdefs.h>
//#include <cmu_us_slt/voxdefs.h>
//cst_voice *REGISTER_VOX(const char *voxdir);
//void UNREGISTER_VOX(cst_voice *vox);
cst_voice *register_cmu_us_awb(const char *voxdir);
void unregister_cmu_us_awb(cst_voice *vox);
cst_voice *register_cmu_us_slt(const char *voxdir);
void unregister_cmu_us_slt(cst_voice *vox);
cst_voice *register_cmu_us_rms(const char *voxdir);
void unregister_cmu_us_rms(cst_voice *vox);
};
#endif
/**
* This class follows the singleton design pattern
* @see http://en.wikipedia.org/wiki/Singleton_pattern
* A call to this function thus returns the only instance of this object
* the call can occur at any place in the code, no reference to the
* GAudioOutput object has to be passed.
*/
GAudioOutput* GAudioOutput::instance()
{
static GAudioOutput* _instance = 0;
if(_instance == 0) {
_instance = new GAudioOutput();
// Set the application as parent to ensure that this object
// will be destroyed when the main application exits
_instance->setParent(qApp);
}
return _instance;
}
GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent),
#ifdef Q_OS_LINUX
voice(NULL),
#endif
voiceIndex(0),
emergency(false)
{
#ifdef Q_OS_LINUX
flite_init();
#endif
m_media = new Phonon::MediaObject(this);
Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
createPath(m_media, audioOutput);
emergencyTimer = new QTimer();
connect(emergencyTimer, SIGNAL(timeout()), this, SLOT(beep()));
switch (voiceIndex)
{
case 0:
selectFemaleVoice();
break;
case 1:
selectMaleVoice();
break;
default:
selectNeutralVoice();
break;
}
}
bool GAudioOutput::say(QString text, int severity)
{
bool res = false;
if (!emergency)
{
#ifdef Q_OS_WINDOWS
SpeechSynthesizer synth = new SpeechSynthesizer();
synth.SelectVoice("Microsoft Anna");
synth.SpeakText("Hello, world!");
#endif
#ifdef Q_OS_LINUX
QTemporaryFile file;
file.setFileTemplate("XXXXXX.wav");
if (file.open())
{
cst_wave* wav = flite_text_to_wave(text.toStdString().c_str(), this->voice);
// file.fileName() returns the unique file name
cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff");
m_media->setCurrentSource(Phonon::MediaSource(file.fileName().toStdString().c_str()));
qDebug() << "TYPE:" << m_media->currentSource().type();
m_media->play();
qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str();
res = true;
}
#endif
#ifdef Q_OS_MAC
// Slashes necessary to have the right start to the sentence
// copying data prevents SpeakString from reading additional chars
text = "\\" + text;
QStdWString str = text.toStdWString();
unsigned char str2[1024] = {};
memcpy(str2, text.toAscii().data(), str.length());
SpeakString(str2);
qDebug() << "Synthesized: " << text.toAscii();
#endif
#ifdef Q_OS_WIN32
qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!";
#endif
}
return res;
}
/**
* @param text This message will be played after the alert beep
*/
bool GAudioOutput::alert(QString text)
{
if (!emergency)
{
// Play alert sound
m_media->setCurrentSource(Phonon::MediaSource(QString("alert.wav").toStdString().c_str()));
qDebug() << "FILENAME:" << m_media->currentSource().fileName();
qDebug() << "TYPE:" << m_media->currentSource().type();
qDebug() << QString("alert.wav").toStdString().c_str();
m_media->play();
m_media->setCurrentSource(Phonon::MediaSource(QString("alert.wav").toStdString().c_str()));
m_media->play();
// Say alert message
return true;//say(text, 2);
}
else
{
return false;
}
}
/**
* The emergency sound will be played continously during the emergency.
* call stopEmergency() to disable it again. No speech synthesis or other
* audio output is available during the emergency.
*
* @return true if the emergency could be started, false else
*/
bool GAudioOutput::startEmergency()
{
if (!emergency)
{
emergency = true;
emergencyTimer->start(1600);
}
return true;
}
/**
* Stops the continous emergency sound. Use startEmergency() to start
* the emergency sound.
*
* @return true if the emergency could be stopped, false else
*/
bool GAudioOutput::stopEmergency()
{
if (emergency)
{
emergency = false;
emergencyTimer->stop();
}
return true;
}
void GAudioOutput::beep()
{
m_media->setCurrentSource(Phonon::MediaSource(QString("alert.wav").toStdString().c_str()));
m_media->play();
}
void GAudioOutput::selectFemaleVoice()
{
#ifdef Q_OS_LINUX
//this->voice = register_cmu_us_slt(NULL);
#endif
}
void GAudioOutput::selectMaleVoice()
{
#ifdef Q_OS_LINUX
//this->voice = register_cmu_us_rms(NULL);
#endif
}
void GAudioOutput::selectNeutralVoice()
{
#ifdef Q_OS_LINUX
//this->voice = register_cmu_us_awb(NULL);
#endif
}
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
QStringList GAudioOutput::listVoices(void)
{
QStringList l;
#ifdef Q_OS_LINUX
cst_voice *voice;
const cst_val *v;
/*
printf("Voices available: ");
for (v=flite_voice_list; v; v=val_cdr(v))
{
voice = val_voice(val_car(v));
QString s;
s.sprintf("%s",voice->name);
printf("%s",voice->name);
l.append(s);
}
printf("\n");
*/
#endif
return l;
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of audio output
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef GAUDIOOUTPUT_H
#define GAUDIOOUTPUT_H
#include <QObject>
#include <QTimer>
#include <QStringList>
#ifdef Q_OS_MAC
#include <Phonon>
#endif
#ifdef Q_OS_LINUX
#include <flite.h>
#include <phonon>
#endif
#ifdef Q_OS_WIN
#include <Phonon>
#endif
/* For Snow leopard and later
#ifdef Q_OS_MAC
#include <NSSpeechSynthesizer.h>
#endif
*/
/**
* @brief Audio Output (speech synthesizer and "beep" output)
* This class follows the singleton design pattern
* @see http://en.wikipedia.org/wiki/Singleton_pattern
*/
class GAudioOutput : public QObject
{
Q_OBJECT
public:
/** @brief Get the singleton instance */
static GAudioOutput* instance();
/** @brief List available voices */
QStringList listVoices(void);
public slots:
/** @brief Say this text if current output priority matches */
bool say(QString text, int severity=1);
/** @brief Play alert sound */
bool alert(QString text);
/** @brief Start emergency sound */
bool startEmergency();
/** @brief Stop emergency sound */
bool stopEmergency();
/** @brief Select female voice */
void selectFemaleVoice();
/** @brief Select male voice */
void selectMaleVoice();
/** @brief Select neutral voice */
void selectNeutralVoice();
/** @brief Play emergency sound */
void beep();
protected:
#ifdef Q_OS_MAC
//NSSpeechSynthesizer
#endif
#ifdef Q_OS_LINUX
cst_voice* voice; ///< The flite voice object
#endif
int voiceIndex; ///< The index of the flite voice to use (awb, slt, rms)
Phonon::MediaObject* m_media; ///< The output object for audio
Phonon::AudioOutput* m_audioOutput;
bool emergency; ///< Emergency status flag
QTimer* emergencyTimer;
private:
GAudioOutput(QObject* parent=NULL);
};
#endif // AUDIOOUTPUT_H
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project This file is part of the PIXHAWK project
......
...@@ -57,20 +57,9 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile ...@@ -57,20 +57,9 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile
readyBytes(0), readyBytes(0),
timeOffset(0) timeOffset(0)
{ {
this->id = getNextLinkId();
LinkManager::instance()->add(this);
this->rate = rate; this->rate = rate;
_isConnected = false; _isConnected = false;
if (readFile != "")
{
this->name = "Simulation: " + readFile;
}
else
{
this->name = "MAVLink simulation link";
}
// Comments on the variables can be found in the header file // Comments on the variables can be found in the header file
simulationFile = new QFile(readFile, this); simulationFile = new QFile(readFile, this);
...@@ -81,10 +70,20 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile ...@@ -81,10 +70,20 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile
receiveFile = new QFile(writeFile, this); receiveFile = new QFile(writeFile, this);
lastSent = MG::TIME::getGroundTimeNow(); lastSent = MG::TIME::getGroundTimeNow();
if (simulationFile->exists())
{
this->name = "Simulation: " + QFileInfo(simulationFile->fileName()).fileName();
}
else
{
this->name = "MAVLink simulation link";
}
// Initialize the pseudo-random number generator // Initialize the pseudo-random number generator
srand(QTime::currentTime().msec()); srand(QTime::currentTime().msec());
maxTimeNoise = 0; maxTimeNoise = 0;
this->id = getNextLinkId();
LinkManager::instance()->add(this);
} }
MAVLinkSimulationLink::~MAVLinkSimulationLink() MAVLinkSimulationLink::~MAVLinkSimulationLink()
...@@ -390,6 +389,32 @@ void MAVLinkSimulationLink::mainloop() ...@@ -390,6 +389,32 @@ void MAVLinkSimulationLink::mainloop()
memcpy(stream+streampointer,buffer, bufferlength); memcpy(stream+streampointer,buffer, bufferlength);
streampointer += bufferlength; streampointer += bufferlength;
/*
// HEARTBEAT VEHICLE 2
// Pack message and get size of encoded byte string
messageSize = message_heartbeat_pack(42, componentId, &msg, MAV_FIXED_WING);
// Allocate buffer with packet data
bufferlength = message_to_send_buffer(buffer, &msg);
//add data into datastream
memcpy(stream+streampointer,buffer, bufferlength);
streampointer += bufferlength;
// STATUS VEHICLE 2
sys_status_t status2;
status2.mode = MAV_MODE_LOCKED;
status2.vbat = voltage;
status2.status = MAV_STATE_STANDBY;
// Pack message and get size of encoded byte string
messageSize = message_sys_status_encode(systemId, componentId, &msg, &status);
// Allocate buffer with packet data
bufferlength = message_to_send_buffer(buffer, &msg);
//add data into datastream
memcpy(stream+streampointer,buffer, bufferlength);
streampointer += bufferlength;
*/
//qDebug() << "BOOT" << "BUF LEN" << bufferlength << "POINTER" << streampointer; //qDebug() << "BOOT" << "BUF LEN" << bufferlength << "POINTER" << streampointer;
// AUX STATUS // AUX STATUS
......
...@@ -180,9 +180,10 @@ bool MAVLinkXMLParser::generate() ...@@ -180,9 +180,10 @@ bool MAVLinkXMLParser::generate()
QDateTime now = QDateTime::currentDateTime().toUTC(); QDateTime now = QDateTime::currentDateTime().toUTC();
QString dateFormat = "dddd, MMMM d yyyy, hh:mm UTC"; QString dateFormat = "dddd, MMMM d yyyy, hh:mm UTC";
QString date = now.toString(dateFormat); QString date = now.toString(dateFormat);
QString mainHeader = QString("/** @file\n *\t@brief MAVLink comm protocol.\n *\t@see http://pixhawk.ethz.ch/software/mavlink\n *\t Generated on %1\n */\n#ifndef MAVLINK_H\n#define MAVLINK_H\n\n#include \"protocol.h\"\n\n\n").arg(date); // The main header includes all messages QString mainHeader = QString("/** @file\n *\t@brief MAVLink comm protocol.\n *\t@see http://pixhawk.ethz.ch/software/mavlink\n *\t Generated on %1\n */\n#ifndef MAVLINK_H\n#define MAVLINK_H\n\n").arg(date); // The main header includes all messages
// Mark all code as C code // Mark all code as C code
mainHeader += "#ifdef __cplusplus\nextern \"C\" {\n#endif\n"; mainHeader += "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n";
mainHeader += "\n#include \"protocol.h\"\n";
QString includeLine = "#include \"%1\"\n"; QString includeLine = "#include \"%1\"\n";
QString mainHeaderName = "mavlink.h"; QString mainHeaderName = "mavlink.h";
QString messagesDirName = "generated"; QString messagesDirName = "generated";
...@@ -200,6 +201,8 @@ bool MAVLinkXMLParser::generate() ...@@ -200,6 +201,8 @@ bool MAVLinkXMLParser::generate()
mainHeader += "#ifdef __cplusplus\n}\n#endif\n"; mainHeader += "#ifdef __cplusplus\n}\n#endif\n";
mainHeader += "#endif"; mainHeader += "#endif";
// Newline to make compiler happy
mainHeader += "\n";
// Write main header // Write main header
QFile rawHeader(outputDirName + "/" + mainHeaderName); QFile rawHeader(outputDirName + "/" + mainHeaderName);
......
...@@ -48,9 +48,7 @@ UDPLink::UDPLink(QHostAddress host, quint16 port) ...@@ -48,9 +48,7 @@ UDPLink::UDPLink(QHostAddress host, quint16 port)
// Set unique ID and add link to the list of links // Set unique ID and add link to the list of links
this->id = getNextLinkId(); this->id = getNextLinkId();
this->name = tr("UDP link ") + QString::number(getId());
name = tr("UDP link ") + QString::number(getId()) + tr(" (unconfigured)");
LinkManager::instance()->add(this); LinkManager::instance()->add(this);
} }
......
DEPENDPATH += src
INCLUDEPATH += src
# Input
HEADERS += curve.h \
geometry.h \
imagemanager.h \
layer.h \
layermanager.h \
linestring.h \
mapadapter.h \
mapcontrol.h \
mapnetwork.h \
point.h \
tilemapadapter.h \
wmsmapadapter.h \
circlepoint.h \
imagepoint.h \
gps_position.h \
osmmapadapter.h \
maplayer.h \
geometrylayer.h \
yahoomapadapter.h \
googlemapadapter.h \
googlesatmapadapter.h \
openaerialmapadapter.h \
fixedimageoverlay.h \
emptymapadapter.h
SOURCES += curve.cpp \
geometry.cpp \
imagemanager.cpp \
layer.cpp \
layermanager.cpp \
linestring.cpp \
mapadapter.cpp \
mapcontrol.cpp \
mapnetwork.cpp \
point.cpp \
tilemapadapter.cpp \
wmsmapadapter.cpp \
circlepoint.cpp \
imagepoint.cpp \
gps_position.cpp \
osmmapadapter.cpp \
maplayer.cpp \
geometrylayer.cpp \
yahoomapadapter.cpp \
googlemapadapter.cpp \
googlesatmapadapter.cpp \
openaerialmapadapter.cpp \
fixedimageoverlay.cpp \
emptymapadapter.cpp
...@@ -77,7 +77,7 @@ HEADERS += $$QWTSRCDIR/qwt.h \ ...@@ -77,7 +77,7 @@ HEADERS += $$QWTSRCDIR/qwt.h \
$$QWTSRCDIR/qwt_thermo.h \ $$QWTSRCDIR/qwt_thermo.h \
$$QWTSRCDIR/qwt_valuelist.h \ $$QWTSRCDIR/qwt_valuelist.h \
$$QWTSRCDIR/qwt_wheel.h $$QWTSRCDIR/qwt_wheel.h
SOURCES += qwt_abstract_scale.cpp \ SOURCES += $$QWTSRCDIR/qwt_abstract_scale.cpp \
$$QWTSRCDIR/qwt_abstract_scale_draw.cpp \ $$QWTSRCDIR/qwt_abstract_scale_draw.cpp \
$$QWTSRCDIR/qwt_abstract_slider.cpp \ $$QWTSRCDIR/qwt_abstract_slider.cpp \
$$QWTSRCDIR/qwt_analog_clock.cpp \ $$QWTSRCDIR/qwt_analog_clock.cpp \
......
...@@ -48,6 +48,6 @@ This file is part of the PIXHAWK project ...@@ -48,6 +48,6 @@ This file is part of the PIXHAWK project
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
MGCore core(argc, argv); Core core(argc, argv);
return core.exec(); return core.exec();
} }
This diff is collapsed.
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
Please see our website at <http://pixhawk.ethz.ch>
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
...@@ -33,7 +32,6 @@ This file is part of the PIXHAWK project ...@@ -33,7 +32,6 @@ This file is part of the PIXHAWK project
#ifndef _UAS_H_ #ifndef _UAS_H_
#define _UAS_H_ #define _UAS_H_
#include <QDebug>
#include "UASInterface.h" #include "UASInterface.h"
#include "MG.h" #include "MG.h"
#include <mavlink.h> #include <mavlink.h>
...@@ -67,7 +65,7 @@ public: ...@@ -67,7 +65,7 @@ public:
/* MANAGEMENT */ /* MANAGEMENT */
/** @brief The name of the robot */ /** @brief The name of the robot */
QString getUASName(); QString getUASName(void);
/** @brief Get the unique system id */ /** @brief Get the unique system id */
int getUASID(); int getUASID();
/** @brief The time interval the robot is switched on */ /** @brief The time interval the robot is switched on */
...@@ -83,13 +81,13 @@ public: ...@@ -83,13 +81,13 @@ public:
protected: protected:
int type; int type;
quint64 startTime; ///< The time the UAS was switched on quint64 startTime; ///< The time the UAS was switched on
CommStatus commStatus; ///< Communication status CommStatus commStatus; ///< Communication status
int uasId; ///< Unique system ID int uasId; ///< Unique system ID
QString name; ///< Human-friendly name of the vehicle, e.g. bravo QString name; ///< Human-friendly name of the vehicle, e.g. bravo
QList<LinkInterface*>* links; ///< List of links this UAS can be reached by QList<LinkInterface*>* links; ///< List of links this UAS can be reached by
BatteryType batteryType; ///< The battery type BatteryType batteryType; ///< The battery type
int cells; ///< Number of cells int cells; ///< Number of cells
QList<double> actuatorValues; QList<double> actuatorValues;
QList<QString> actuatorNames; QList<QString> actuatorNames;
...@@ -97,27 +95,30 @@ protected: ...@@ -97,27 +95,30 @@ protected:
QList<double> motorValues; QList<double> motorValues;
QList<QString> motorNames; QList<QString> motorNames;
double thrustSum; ///< Sum of forward/up thrust of all thrust actuators double thrustSum; ///< Sum of forward/up thrust of all thrust actuators, in Newtons
double thrustMax; ///< Maximum forward/up thrust of this vehicle, in Newtons
// Battery stats // Battery stats
double fullVoltage; ///< Voltage of the fully charged battery (100%) double fullVoltage; ///< Voltage of the fully charged battery (100%)
double emptyVoltage; ///< Voltage of the empty battery (0%) double emptyVoltage; ///< Voltage of the empty battery (0%)
double startVoltage; ///< Voltage at system start double startVoltage; ///< Voltage at system start
double currentVoltage; ///< Voltage currently measured double currentVoltage; ///< Voltage currently measured
float lpVoltage; ///< Low-pass filtered voltage float lpVoltage; ///< Low-pass filtered voltage
int timeRemaining; ///< Remaining time calculated based on previous and current int timeRemaining; ///< Remaining time calculated based on previous and current
double manualRollAngle; ///< Roll angle set by human pilot (radians) int mode; ///< The current mode of the MAV
double manualPitchAngle; ///< Pitch angle set by human pilot (radians) int status; ///< The current status of the MAV
double manualYawAngle; ///< Yaw angle set by human pilot (radians)
double manualThrust; ///< Thrust set by human pilot (radians)
bool controlRollManual; ///< status flag, true if roll is controlled manually
bool controlPitchManual; ///< status flag, true if pitch is controlled manually
bool controlYawManual; ///< status flag, true if yaw is controlled manually
bool controlThrustManual;///< status flag, true if thrust is controlled manually
int mode; ///< The current mode of the MAV
quint64 onboardTimeOffset; quint64 onboardTimeOffset;
bool controlRollManual; ///< status flag, true if roll is controlled manually
bool controlPitchManual; ///< status flag, true if pitch is controlled manually
bool controlYawManual; ///< status flag, true if yaw is controlled manually
bool controlThrustManual; ///< status flag, true if thrust is controlled manually
double manualRollAngle; ///< Roll angle set by human pilot (radians)
double manualPitchAngle; ///< Pitch angle set by human pilot (radians)
double manualYawAngle; ///< Yaw angle set by human pilot (radians)
double manualThrust; ///< Thrust set by human pilot (radians)
/** @brief Set the current battery type */ /** @brief Set the current battery type */
void setBattery(BatteryType type, int cells); void setBattery(BatteryType type, int cells);
/** @brief Estimate how much flight time is remaining */ /** @brief Estimate how much flight time is remaining */
...@@ -147,8 +148,6 @@ public slots: ...@@ -147,8 +148,6 @@ public slots:
/** @brief Shut the system cleanly down. Will shut down any onboard computers **/ /** @brief Shut the system cleanly down. Will shut down any onboard computers **/
void shutdown(); void shutdown();
/** @brief Set the auto mode. **/
void setAutoMode(bool autoMode);
void requestWaypoints(); void requestWaypoints();
void clearWaypointList(); void clearWaypointList();
/** @brief Enable the motors */ /** @brief Enable the motors */
...@@ -161,9 +160,7 @@ public slots: ...@@ -161,9 +160,7 @@ 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 Add a link associated with this robot */
* @brief Add a link associated with this robot
*/
void addLink(LinkInterface* link); void addLink(LinkInterface* link);
/** @brief Receive a message from one of the communication links. */ /** @brief Receive a message from one of the communication links. */
......
...@@ -110,8 +110,7 @@ public: ...@@ -110,8 +110,7 @@ public:
{ {
///> Color map for plots, includes 20 colors ///> Color map for plots, includes 20 colors
///> Map will start from beginning when the first 20 colors are exceeded ///> Map will start from beginning when the first 20 colors are exceeded
colors.append(QColor(242,255,128));
colors.append(QColor(230,126,23));
colors.append(QColor(203,254,121)); colors.append(QColor(203,254,121));
colors.append(QColor(231,72,28)); colors.append(QColor(231,72,28));
colors.append(QColor(161,252,116)); colors.append(QColor(161,252,116));
...@@ -129,6 +128,8 @@ public: ...@@ -129,6 +128,8 @@ public:
colors.append(QColor(81,183,244)); colors.append(QColor(81,183,244));
colors.append(QColor(104,64,240)); colors.append(QColor(104,64,240));
colors.append(QColor(75,133,243)); colors.append(QColor(75,133,243));
colors.append(QColor(242,255,128));
colors.append(QColor(230,126,23));
nextColor++; nextColor++;
} }
return colors[nextColor++]; return colors[nextColor++];
...@@ -153,12 +154,7 @@ public slots: ...@@ -153,12 +154,7 @@ public slots:
virtual void halt() = 0; virtual void halt() = 0;
/** @brief Start/continue the current robot action */ /** @brief Start/continue the current robot action */
virtual void go() = 0; virtual void go() = 0;
/** @brief Set robot into auto mode /** @brief Set the current mode of operation */
*
* @param autoMode true for autonomous operation, false for manual control
*/
virtual void setAutoMode(bool autoMode) = 0;
virtual void setMode(int mode) = 0; virtual void setMode(int mode) = 0;
/** Stops the robot system. If it is an MAV, the robot starts the emergency landing procedure **/ /** Stops the robot system. If it is an MAV, the robot starts the emergency landing procedure **/
virtual void emergencySTOP() = 0; virtual void emergencySTOP() = 0;
......
...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project ...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project
/** /**
* @file * @file
* @brief Central manager for all connected aerial vehicles * @brief Implementation of central manager for all connected aerial vehicles
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
*/ */
...@@ -41,8 +41,8 @@ UASManager* UASManager::instance() { ...@@ -41,8 +41,8 @@ UASManager* UASManager::instance() {
if(_instance == 0) { if(_instance == 0) {
_instance = new UASManager(); _instance = new UASManager();
/* Set the application as parent to ensure that this object // Set the application as parent to ensure that this object
* will be destroyed when the main application exits */ // will be destroyed when the main application exits
_instance->setParent(qApp); _instance->setParent(qApp);
} }
return _instance; return _instance;
...@@ -144,12 +144,6 @@ bool UASManager::shutdownActiveUAS() ...@@ -144,12 +144,6 @@ bool UASManager::shutdownActiveUAS()
return (activeUAS); return (activeUAS);
} }
bool UASManager::setActiveUASAuto(bool autoMode)
{
if (getActiveUAS()) activeUAS->setAutoMode(autoMode);
return (activeUAS);
}
void UASManager::configureActiveUAS() void UASManager::configureActiveUAS()
{ {
UASInterface* actUAS = getActiveUAS(); UASInterface* actUAS = getActiveUAS();
...@@ -165,14 +159,17 @@ UASInterface* UASManager::getUASForId(int id) ...@@ -165,14 +159,17 @@ UASInterface* UASManager::getUASForId(int id)
return systems.value(id, NULL); return systems.value(id, NULL);
} }
void UASManager::setActiveUAS(UASInterface* UAS) void UASManager::setActiveUAS(UASInterface* uas)
{ {
activeUASMutex.lock(); if (uas != NULL)
activeUAS = UAS; {
activeUASMutex.unlock(); activeUASMutex.lock();
activeUAS = uas;
activeUASMutex.unlock();
qDebug() << __FILE__ << ":" << __LINE__ << " ACTIVE UAS SET TO: " << UAS->getUASName(); qDebug() << __FILE__ << ":" << __LINE__ << " ACTIVE UAS SET TO: " << uas->getUASName();
emit activeUASSet(UAS); emit activeUASSet(uas);
}
} }
...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project ...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project
/** /**
* @file * @file
* @brief Central manager for all connected aerial vehicles * @brief Definition of central manager for all connected aerial vehicles
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
*/ */
...@@ -153,10 +153,9 @@ public slots: ...@@ -153,10 +153,9 @@ public slots:
*/ */
void configureActiveUAS(); void configureActiveUAS();
/** @brief Shut down the onboard operating system down */
bool shutdownActiveUAS(); bool shutdownActiveUAS();
bool setActiveUASAuto(bool autoMode);
protected: protected:
UASManager(); UASManager();
...@@ -164,9 +163,6 @@ protected: ...@@ -164,9 +163,6 @@ protected:
UASInterface* activeUAS; UASInterface* activeUAS;
QMutex activeUASMutex; QMutex activeUASMutex;
private:
static UASManager* _instance;
signals: signals:
void UASCreated(UASInterface* UAS); void UASCreated(UASInterface* UAS);
void activeUASSet(UASInterface* UAS); void activeUASSet(UASInterface* UAS);
......
...@@ -108,10 +108,14 @@ DebugConsole::~DebugConsole() ...@@ -108,10 +108,14 @@ DebugConsole::~DebugConsole()
delete m_ui; delete m_ui;
} }
/**
* Add a link to the debug console output
*/
void DebugConsole::addLink(LinkInterface* link) void DebugConsole::addLink(LinkInterface* link)
{ {
// Add link to link list // Add link to link list
links.insert(link->getId(), link); links.insert(link->getId(), link);
m_ui->linkComboBox->insertItem(link->getId(), link->getName()); m_ui->linkComboBox->insertItem(link->getId(), link->getName());
// Set new item as current // Set new item as current
m_ui->linkComboBox->setCurrentIndex(qMax(0, links.size() - 1)); m_ui->linkComboBox->setCurrentIndex(qMax(0, links.size() - 1));
......
...@@ -134,7 +134,7 @@ void HDDisplay::paintGL() ...@@ -134,7 +134,7 @@ void HDDisplay::paintGL()
for (int i = 0; i < acceptList->size(); ++i) for (int i = 0; i < acceptList->size(); ++i)
{ {
QString value = acceptList->at(i); QString value = acceptList->at(i);
drawGauge(xCoord, yCoord, gaugeWidth/2.0f, minValues.value(value, 0.0f), maxValues.value(value, 1.0f), value, values.value(value, minValues.value(value, 0.0f)), gaugeColor, &painter, goodRanges.value(value, qMakePair(0.0f, 0.5f)), critRanges.value(value, qMakePair(0.7f, 1.0f)), true); drawGauge(xCoord, yCoord, gaugeWidth/2.0f, minValues.value(value, -1.0f), maxValues.value(value, 1.0f), value, values.value(value, minValues.value(value, 0.0f)), gaugeColor, &painter, goodRanges.value(value, qMakePair(0.0f, 0.5f)), critRanges.value(value, qMakePair(0.7f, 1.0f)), true);
xCoord += gaugeWidth + leftSpacing; xCoord += gaugeWidth + leftSpacing;
// Move one row down if necessary // Move one row down if necessary
if (xCoord + gaugeWidth > vwidth) if (xCoord + gaugeWidth > vwidth)
...@@ -511,8 +511,8 @@ float HDDisplay::refLineWidthToPen(float line) ...@@ -511,8 +511,8 @@ float HDDisplay::refLineWidthToPen(float line)
void HDDisplay::updateValue(UASInterface* uas, QString name, double value, quint64 msec) void HDDisplay::updateValue(UASInterface* uas, QString name, double value, quint64 msec)
{ {
if (this->uas == uas) //if (this->uas == uas)
{ //{
// Update mean // Update mean
const float oldMean = valuesMean.value(name, 0.0f); const float oldMean = valuesMean.value(name, 0.0f);
const int meanCount = valuesCount.value(name, 0); const int meanCount = valuesCount.value(name, 0);
...@@ -521,7 +521,7 @@ void HDDisplay::updateValue(UASInterface* uas, QString name, double value, quint ...@@ -521,7 +521,7 @@ void HDDisplay::updateValue(UASInterface* uas, QString name, double value, quint
valuesDot.insert(name, (value - values.value(name, 0.0f)) / ((msec - lastUpdate.value(name, 0))/1000.0f)); valuesDot.insert(name, (value - values.value(name, 0.0f)) / ((msec - lastUpdate.value(name, 0))/1000.0f));
values.insert(name, value); values.insert(name, value);
lastUpdate.insert(name, msec); lastUpdate.insert(name, msec);
} //}
} }
/** /**
......
...@@ -80,23 +80,23 @@ protected: ...@@ -80,23 +80,23 @@ protected:
void drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter); void drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter);
void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter); void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter);
UASInterface* uas; ///< The uas currently monitored UASInterface* uas; ///< The uas currently monitored
QMap<QString, float> values; ///< The variables this HUD displays QMap<QString, float> values; ///< The variables this HUD displays
QMap<QString, float> valuesDot; ///< First derivative of the variable QMap<QString, float> valuesDot; ///< First derivative of the variable
QMap<QString, float> valuesMean; ///< Mean since system startup for this variable QMap<QString, float> valuesMean; ///< Mean since system startup for this variable
QMap<QString, int> valuesCount; ///< Number of values received so far QMap<QString, int> valuesCount; ///< Number of values received so far
QMap<QString, quint64> lastUpdate; ///< The last update time for this variable QMap<QString, quint64> lastUpdate; ///< The last update time for this variable
QMap<QString, float> minValues; ///< The minimum value this variable is assumed to have QMap<QString, float> minValues; ///< The minimum value this variable is assumed to have
QMap<QString, float> maxValues; ///< The maximum value this variable is assumed to have QMap<QString, float> maxValues; ///< The maximum value this variable is assumed to have
QMap<QString, QPair<float, float> > goodRanges; ///< The range of good values QMap<QString, QPair<float, float> > goodRanges; ///< The range of good values
QMap<QString, QPair<float, float> > critRanges; ///< The range of critical values QMap<QString, QPair<float, float> > critRanges; ///< The range of critical values
double scalingFactor; ///< Factor used to scale all absolute values to screen coordinates double scalingFactor; ///< Factor used to scale all absolute values to screen coordinates
float xCenterOffset, yCenterOffset; ///< Offset from center of window in mm coordinates float xCenterOffset, yCenterOffset; ///< Offset from center of window in mm coordinates
float vwidth; ///< Virtual width of this window, 200 mm per default. This allows to hardcode positions and aspect ratios. This virtual image plane is then scaled to the window size. float vwidth; ///< Virtual width of this window, 200 mm per default. This allows to hardcode positions and aspect ratios. This virtual image plane is then scaled to the window size.
float vheight; ///< Virtual height of this window, 150 mm per default float vheight; ///< Virtual height of this window, 150 mm per default
int xCenter; ///< Center of the HUD instrument in pixel coordinates. Allows to off-center the whole instrument in its OpenGL window, e.g. to fit another instrument int xCenter; ///< Center of the HUD instrument in pixel coordinates. Allows to off-center the whole instrument in its OpenGL window, e.g. to fit another instrument
int yCenter; ///< Center of the HUD instrument in pixel coordinates. Allows to off-center the whole instrument in its OpenGL window, e.g. to fit another instrument int yCenter; ///< Center of the HUD instrument in pixel coordinates. Allows to off-center the whole instrument in its OpenGL window, e.g. to fit another instrument
// HUD colors // HUD colors
QColor backgroundColor; ///< Background color QColor backgroundColor; ///< Background color
......
...@@ -45,7 +45,7 @@ This file is part of the PIXHAWK project ...@@ -45,7 +45,7 @@ This file is part of the PIXHAWK project
template<typename T> template<typename T>
inline bool isnan(T value) inline bool isnan(T value)
{ {
return value != value; return value != value;
} }
...@@ -65,48 +65,48 @@ inline bool isinf(T value) ...@@ -65,48 +65,48 @@ inline bool isinf(T value)
* @param parent * @param parent
*/ */
HUD::HUD(int width, int height, QWidget* parent) HUD::HUD(int width, int height, QWidget* parent)
: QGLWidget(parent), : QGLWidget(parent),
uas(NULL), uas(NULL),
values(QMap<QString, float>()), values(QMap<QString, float>()),
valuesDot(QMap<QString, float>()), valuesDot(QMap<QString, float>()),
valuesMean(QMap<QString, float>()), valuesMean(QMap<QString, float>()),
valuesCount(QMap<QString, int>()), valuesCount(QMap<QString, int>()),
lastUpdate(QMap<QString, quint64>()), lastUpdate(QMap<QString, quint64>()),
yawInt(0.0f), yawInt(0.0f),
mode(tr("UNKNOWN MODE")), mode(tr("UNKNOWN MODE")),
state(tr("UNKNOWN STATE")), state(tr("UNKNOWN STATE")),
fuelStatus(tr("00.0V (00m:00s)")), fuelStatus(tr("00.0V (00m:00s)")),
xCenterOffset(0.0f), xCenterOffset(0.0f),
yCenterOffset(0.0f), yCenterOffset(0.0f),
vwidth(200.0f), vwidth(200.0f),
vheight(150.0f), vheight(150.0f),
vGaugeSpacing(50.0f), vGaugeSpacing(50.0f),
vPitchPerDeg(6.0f), ///< 4 mm y translation per degree) vPitchPerDeg(6.0f), ///< 4 mm y translation per degree)
rawBuffer1(NULL), rawBuffer1(NULL),
rawBuffer2(NULL), rawBuffer2(NULL),
rawImage(NULL), rawImage(NULL),
rawLastIndex(0), rawLastIndex(0),
rawExpectedBytes(0), rawExpectedBytes(0),
bytesPerLine(1), bytesPerLine(1),
imageStarted(false), imageStarted(false),
receivedDepth(8), receivedDepth(8),
receivedChannels(1), receivedChannels(1),
receivedWidth(640), receivedWidth(640),
receivedHeight(480), receivedHeight(480),
defaultColor(QColor(70, 200, 70)), defaultColor(QColor(70, 200, 70)),
setPointColor(QColor(200, 20, 200)), setPointColor(QColor(200, 20, 200)),
warningColor(Qt::yellow), warningColor(Qt::yellow),
criticalColor(Qt::red), criticalColor(Qt::red),
infoColor(QColor(20, 200, 20)), infoColor(QColor(20, 200, 20)),
fuelColor(criticalColor), fuelColor(criticalColor),
warningBlinkRate(5), warningBlinkRate(5),
refreshTimer(new QTimer(this)), refreshTimer(new QTimer(this)),
noCamera(true), noCamera(true),
hardwareAcceleration(true), hardwareAcceleration(true),
strongStrokeWidth(1.5f), strongStrokeWidth(1.5f),
normalStrokeWidth(1.0f), normalStrokeWidth(1.0f),
fineStrokeWidth(0.5f), fineStrokeWidth(0.5f),
waypointName("") waypointName("")
{ {
// Set auto fill to false // Set auto fill to false
setAutoFillBackground(false); setAutoFillBackground(false);
...@@ -171,8 +171,9 @@ void HUD::stop() ...@@ -171,8 +171,9 @@ void HUD::stop()
void HUD::updateValue(UASInterface* uas, QString name, double value, quint64 msec) void HUD::updateValue(UASInterface* uas, QString name, double value, quint64 msec)
{ {
// if (this->uas == uas) // if (this->uas == uas)
//{ //{
if (!isnan(value) && !isinf(value)) if (!isnan(value) && !isinf(value))
{ {
// Update mean // Update mean
...@@ -184,11 +185,14 @@ void HUD::updateValue(UASInterface* uas, QString name, double value, quint64 mse ...@@ -184,11 +185,14 @@ void HUD::updateValue(UASInterface* uas, QString name, double value, quint64 mse
valuesCount.insert(name, meanCount + 1); valuesCount.insert(name, meanCount + 1);
// Two-value sliding average // Two-value sliding average
double dot = (valuesDot.value(name) + (value - values.value(name, 0.0f)) / ((msec - lastUpdate.value(name, 0))/1000.0f))/2.0f; double dot = (valuesDot.value(name) + (value - values.value(name, 0.0f)) / ((msec - lastUpdate.value(name, 0))/1000.0f))/2.0f;
if (isnan(dot) || isinf(dot)) dot = 0.0; if (isnan(dot) || isinf(dot))
{
dot = 0.0;
}
valuesDot.insert(name, dot); valuesDot.insert(name, dot);
values.insert(name, value); values.insert(name, value);
lastUpdate.insert(name, msec); lastUpdate.insert(name, msec);
//} //}
//qDebug() << __FILE__ << __LINE__ << "VALUE:" << value << "MEAN:" << mean << "DOT:" << dot << "COUNT:" << meanCount; //qDebug() << __FILE__ << __LINE__ << "VALUE:" << value << "MEAN:" << mean << "DOT:" << dot << "COUNT:" << meanCount;
} }
...@@ -211,7 +215,8 @@ void HUD::setActiveUAS(UASInterface* uas) ...@@ -211,7 +215,8 @@ void HUD::setActiveUAS(UASInterface* uas)
disconnect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); disconnect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64)));
disconnect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); disconnect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64)));
disconnect(uas, SIGNAL(speedChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateSpeed(UASInterface*,double,double,double,quint64))); disconnect(uas, SIGNAL(speedChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateSpeed(UASInterface*,double,double,double,quint64)));
disconnect(uas, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString,QString))); disconnect(uas, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString)));
disconnect(uas, SIGNAL(modeChanged(UASInterface*,QString,QString)), this, SLOT(updateMode(UASInterface*,QString)));
disconnect(uas, SIGNAL(loadChanged(UASInterface*, double)), this, SLOT(updateLoad(UASInterface*, double))); disconnect(uas, SIGNAL(loadChanged(UASInterface*, double)), this, SLOT(updateLoad(UASInterface*, double)));
disconnect(uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateAttitudeThrustSetPoint(UASInterface*,double,double,double,double,quint64))); disconnect(uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateAttitudeThrustSetPoint(UASInterface*,double,double,double,double,quint64)));
disconnect(uas, SIGNAL(valueChanged(UASInterface*,QString,double,quint64)), this, SLOT(updateValue(UASInterface*,QString,double,quint64))); disconnect(uas, SIGNAL(valueChanged(UASInterface*,QString,double,quint64)), this, SLOT(updateValue(UASInterface*,QString,double,quint64)));
...@@ -247,6 +252,7 @@ void HUD::updateAttitudeThrustSetPoint(UASInterface*, double rollDesired, double ...@@ -247,6 +252,7 @@ void HUD::updateAttitudeThrustSetPoint(UASInterface*, double rollDesired, double
void HUD::updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 timestamp) void HUD::updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 timestamp)
{ {
//qDebug() << __FILE__ << __LINE__ << "ROLL" << roll;
updateValue(uas, "roll", roll, timestamp); updateValue(uas, "roll", roll, timestamp);
updateValue(uas, "pitch", pitch, timestamp); updateValue(uas, "pitch", pitch, timestamp);
updateValue(uas, "yaw", yaw, timestamp); updateValue(uas, "yaw", yaw, timestamp);
...@@ -307,14 +313,21 @@ void HUD::updateSpeed(UASInterface* uas,double x,double y,double z,quint64 times ...@@ -307,14 +313,21 @@ void HUD::updateSpeed(UASInterface* uas,double x,double y,double z,quint64 times
* *
* @param uas the system the state message originates from * @param uas the system the state message originates from
* @param state short state text, displayed in HUD * @param state short state text, displayed in HUD
* @param description longer state text, currently unused
*/ */
void HUD::updateState(UASInterface* uas,QString state, QString description) void HUD::updateState(UASInterface* uas,QString state)
{ {
if (this->uas == uas) this->state = state;
{ }
this->state = state;
} /**
* Updates the current system mode, but only if the uas matches the currently monitored uas.
*
* @param uas the system the state message originates from
* @param mode short mode text, displayed in HUD
*/
void HUD::updateMode(UASInterface* uas,QString mode)
{
this->mode = mode;
} }
void HUD::updateLoad(UASInterface* uas, double load) void HUD::updateLoad(UASInterface* uas, double load)
...@@ -501,9 +514,9 @@ void HUD::paintRollPitchStrips() ...@@ -501,9 +514,9 @@ void HUD::paintRollPitchStrips()
void HUD::paintGL() void HUD::paintGL()
{ {
// Read out most important values to limit hash table lookups // Read out most important values to limit hash table lookups
static float roll = roll * 0.5 + 0.5 * values.value("roll", 0.0f); float roll = roll * 0.5 + 0.5 * values.value("roll", 0.0f);
static float pitch = pitch * 0.5 + 0.5 * values.value("pitch", 0.0f); float pitch = pitch * 0.5 + 0.5 * values.value("pitch", 0.0f);
static float yaw = yaw * 0.5 + 0.5 * values.value("yaw", 0.0f); float yaw = yaw * 0.5 + 0.5 * values.value("yaw", 0.0f);
//qDebug() << __FILE__ << __LINE__ << "ROLL:" << roll << "PITCH:" << pitch << "YAW:" << yaw; //qDebug() << __FILE__ << __LINE__ << "ROLL:" << roll << "PITCH:" << pitch << "YAW:" << yaw;
...@@ -557,7 +570,8 @@ void HUD::paintGL() ...@@ -557,7 +570,8 @@ void HUD::paintGL()
// Position the coordinate frame according to the setup // Position the coordinate frame according to the setup
QPainter painter(this); QPainter painter(this);
painter.setRenderHint(QPainter::HighQualityAntialiasing); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
painter.translate((this->vwidth/2.0+xCenterOffset)*scalingFactor, (this->vheight/2.0+yCenterOffset)*scalingFactor); painter.translate((this->vwidth/2.0+xCenterOffset)*scalingFactor, (this->vheight/2.0+yCenterOffset)*scalingFactor);
// COORDINATE FRAME IS NOW (0,0) at CENTER OF WIDGET // COORDINATE FRAME IS NOW (0,0) at CENTER OF WIDGET
...@@ -566,8 +580,10 @@ void HUD::paintGL() ...@@ -566,8 +580,10 @@ void HUD::paintGL()
// Draw all fixed indicators // Draw all fixed indicators
// MODE // MODE
paintText(mode, infoColor, 2.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 10, &painter); paintText(mode, infoColor, 2.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 10, &painter);
// STATE
paintText(state, infoColor, 2.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 15, &painter);
// BATTERY // BATTERY
paintText(fuelStatus, fuelColor, 2.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 15, &painter); paintText(fuelStatus, fuelColor, 2.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 20, &painter);
// Waypoint // Waypoint
paintText(waypointName, defaultColor, 2.0f, (-vwidth/3.0) + 10, +vheight/3.0 + 15, &painter); paintText(waypointName, defaultColor, 2.0f, (-vwidth/3.0) + 10, +vheight/3.0 + 15, &painter);
...@@ -659,13 +675,17 @@ void HUD::paintGL() ...@@ -659,13 +675,17 @@ void HUD::paintGL()
yawInt *= 0.6f; yawInt *= 0.6f;
//qDebug() << "yaw translation" << yawTrans << "integral" << yawInt << "difference" << yawDiff << "yaw" << yaw << "asin(yawInt)" << asinYaw; //qDebug() << "yaw translation" << yawTrans << "integral" << yawInt << "difference" << yawDiff << "yaw" << yaw << "asin(yawInt)" << asinYaw;
painter.translate(0, (pitch/M_PI)* -180.0f * refToScreenY(2.0f));
painter.translate(refToScreenX(yawTrans), 0); painter.translate(refToScreenX(yawTrans), 0);
painter.translate(0, (pitch/M_PI)* -180.0f * refToScreenY(2.0f));
// Rotate view and draw all roll-dependent indicators // Rotate view and draw all roll-dependent indicators
painter.rotate((roll/M_PI)* -180.0f); painter.rotate((roll/M_PI)* -180.0f);
qDebug() << "ROLL" << roll << "PITCH" << pitch << "YAW DIFF" << valuesDot.value("roll", 0.0f);
// CENTER // CENTER
// SETPOINT // SETPOINT
......
...@@ -79,7 +79,8 @@ public slots: ...@@ -79,7 +79,8 @@ public slots:
void updateLocalPosition(UASInterface*,double,double,double,quint64); void updateLocalPosition(UASInterface*,double,double,double,quint64);
void updateGlobalPosition(UASInterface*,double,double,double,quint64); void updateGlobalPosition(UASInterface*,double,double,double,quint64);
void updateSpeed(UASInterface*,double,double,double,quint64); void updateSpeed(UASInterface*,double,double,double,quint64);
void updateState(UASInterface*,QString,QString); void updateState(UASInterface*,QString);
void updateMode(UASInterface*,QString);
void updateLoad(UASInterface*, double); void updateLoad(UASInterface*, double);
void selectWaypoint(UASInterface* uas, int id); void selectWaypoint(UASInterface* uas, int id);
......
...@@ -27,7 +27,9 @@ void JoystickWidget::updateJoystick(double roll, double pitch, double yaw, doubl ...@@ -27,7 +27,9 @@ void JoystickWidget::updateJoystick(double roll, double pitch, double yaw, doubl
{ {
setX(roll); setX(roll);
setY(pitch); setY(pitch);
setZ(yaw);
setThrottle(thrust); setThrottle(thrust);
setHat(xHat, yHat);
} }
void JoystickWidget::changeEvent(QEvent *e) void JoystickWidget::changeEvent(QEvent *e)
...@@ -46,16 +48,29 @@ void JoystickWidget::setThrottle(float thrust) ...@@ -46,16 +48,29 @@ void JoystickWidget::setThrottle(float thrust)
{ {
m_ui->thrust->setValue(thrust*100); m_ui->thrust->setValue(thrust*100);
} }
void JoystickWidget::setX(float x) void JoystickWidget::setX(float x)
{ {
m_ui->xSlider->setValue(x*100); m_ui->xSlider->setValue(x*100);
m_ui->xValue->display(x*100); m_ui->xValue->display(x*100);
} }
void JoystickWidget::setY(float y) void JoystickWidget::setY(float y)
{ {
m_ui->ySlider->setValue(y*100); m_ui->ySlider->setValue(y*100);
m_ui->yValue->display(y*100); m_ui->yValue->display(y*100);
} }
void JoystickWidget::setZ(float z)
{
m_ui->dial->setValue(z*100);
}
void JoystickWidget::setHat(float x, float y)
{
qDebug() << __FILE__ << __LINE__ << "HAT X:" << x << "HAT Y:" << y;
}
void JoystickWidget::pressKey(int key) void JoystickWidget::pressKey(int key)
{ {
QString colorstyle; QString colorstyle;
...@@ -64,5 +79,5 @@ void JoystickWidget::pressKey(int key) ...@@ -64,5 +79,5 @@ void JoystickWidget::pressKey(int key)
heartbeatColor.red(), heartbeatColor.green(), heartbeatColor.blue()); heartbeatColor.red(), heartbeatColor.green(), heartbeatColor.blue());
m_ui->button0Label->setStyleSheet(colorstyle); m_ui->button0Label->setStyleSheet(colorstyle);
m_ui->button0Label->setAutoFillBackground(true); m_ui->button0Label->setAutoFillBackground(true);
qDebug() << "KEY" << key << " pressed on joystick"; qDebug() << __FILE__ << __LINE__ << "KEY" << key << " pressed on joystick";
} }
...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project ...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project
/** /**
* @file * @file
* @brief Definition of joystick interface * @brief Definition of joystick widget
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
*/ */
...@@ -57,14 +57,23 @@ public: ...@@ -57,14 +57,23 @@ public:
* @param yHat hat vector in left-right direction, -1 left, 0 center, +1 right * @param yHat hat vector in left-right direction, -1 left, 0 center, +1 right
*/ */
void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat); void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat);
/** @brief Throttle lever */
void setThrottle(float thrust); void setThrottle(float thrust);
/** @brief Back/forth movement */
void setX(float x); void setX(float x);
/** @brief Left/right movement */
void setY(float y); void setY(float y);
/** @brief Wrist rotation */
void setZ(float z);
/** @brief Hat switch position */
void setHat(float x, float y);
/** @brief Joystick keys, as labeled on the joystick */
void pressKey(int key); void pressKey(int key);
protected: protected:
/** @brief UI change event */
virtual void changeEvent(QEvent *e); virtual void changeEvent(QEvent *e);
JoystickInput* joystick; JoystickInput* joystick; ///< Reference to the joystick
private: private:
Ui::JoystickWidget *m_ui; Ui::JoystickWidget *m_ui;
......
...@@ -45,6 +45,7 @@ This file is part of the PIXHAWK project ...@@ -45,6 +45,7 @@ This file is part of the PIXHAWK project
#include "WaypointList.h" #include "WaypointList.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "JoystickWidget.h" #include "JoystickWidget.h"
#include "GAudioOutput.h"
#include "LogCompressor.h" #include "LogCompressor.h"
...@@ -56,7 +57,7 @@ This file is part of the PIXHAWK project ...@@ -56,7 +57,7 @@ This file is part of the PIXHAWK project
* *
* @see QMainWindow::show() * @see QMainWindow::show()
**/ **/
MGMainWindow::MGMainWindow(QWidget *parent) : QMainWindow(parent) MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{ {
// Quick hack // Quick hack
...@@ -167,20 +168,20 @@ MGMainWindow::MGMainWindow(QWidget *parent) : QMainWindow(parent) ...@@ -167,20 +168,20 @@ MGMainWindow::MGMainWindow(QWidget *parent) : QMainWindow(parent)
udpLink->connect(); udpLink->connect();
simulationLink = new MAVLinkSimulationLink(MG::DIR::getSupportFilesDirectory() + "/demo-log.txt"); simulationLink = new MAVLinkSimulationLink(MG::DIR::getSupportFilesDirectory() + "/demo-log.txt");
connect(simulationLink, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64))); //connect(simulationLink, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)));
LinkManager::instance()->addProtocol(simulationLink, mavlink); LinkManager::instance()->addProtocol(simulationLink, mavlink);
//CommConfigurationWindow* simulationWidget = new CommConfigurationWindow(simulationLink, mavlink, this); //CommConfigurationWindow* simulationWidget = new CommConfigurationWindow(simulationLink, mavlink, this);
//ui.menuNetwork->addAction(commWidget->getAction()); //ui.menuNetwork->addAction(commWidget->getAction());
simulationLink->connect(); simulationLink->connect();
} }
MGMainWindow::~MGMainWindow() MainWindow::~MainWindow()
{ {
delete statusBar; delete statusBar;
statusBar = NULL; statusBar = NULL;
} }
QStatusBar* MGMainWindow::createStatusBar() QStatusBar* MainWindow::createStatusBar()
{ {
QStatusBar* bar = new QStatusBar(); QStatusBar* bar = new QStatusBar();
/* Add status fields and messages */ /* Add status fields and messages */
...@@ -189,7 +190,7 @@ QStatusBar* MGMainWindow::createStatusBar() ...@@ -189,7 +190,7 @@ QStatusBar* MGMainWindow::createStatusBar()
return bar; return bar;
} }
void MGMainWindow::startVideoCapture() void MainWindow::startVideoCapture()
{ {
QString format = "bmp"; QString format = "bmp";
QString initialPath = QDir::currentPath() + tr("/untitled.") + format; QString initialPath = QDir::currentPath() + tr("/untitled.") + format;
...@@ -205,14 +206,14 @@ void MGMainWindow::startVideoCapture() ...@@ -205,14 +206,14 @@ void MGMainWindow::startVideoCapture()
connect(videoTimer, SIGNAL(timeout()), this, SLOT(saveScreen())); connect(videoTimer, SIGNAL(timeout()), this, SLOT(saveScreen()));
} }
void MGMainWindow::stopVideoCapture() void MainWindow::stopVideoCapture()
{ {
videoTimer->stop(); videoTimer->stop();
// TODO Convert raw images to PNG // TODO Convert raw images to PNG
} }
void MGMainWindow::saveScreen() void MainWindow::saveScreen()
{ {
QPixmap window = QPixmap::grabWindow(this->winId()); QPixmap window = QPixmap::grabWindow(this->winId());
QString format = "bmp"; QString format = "bmp";
...@@ -223,7 +224,7 @@ void MGMainWindow::saveScreen() ...@@ -223,7 +224,7 @@ void MGMainWindow::saveScreen()
} }
} }
void MGMainWindow::reloadStylesheet() void MainWindow::reloadStylesheet()
{ {
// Load style sheet // Load style sheet
//QFile styleSheet(MG::DIR::getSupportFilesDirectory() + "/images/style-mission.css"); //QFile styleSheet(MG::DIR::getSupportFilesDirectory() + "/images/style-mission.css");
...@@ -237,17 +238,17 @@ void MGMainWindow::reloadStylesheet() ...@@ -237,17 +238,17 @@ void MGMainWindow::reloadStylesheet()
} }
} }
void MGMainWindow::showStatusMessage(const QString& status, int timeout) void MainWindow::showStatusMessage(const QString& status, int timeout)
{ {
statusBar->showMessage(status, timeout); statusBar->showMessage(status, timeout);
} }
void MGMainWindow::setLastAction(QString status) void MainWindow::setLastAction(QString status)
{ {
showStatusMessage(status, 5); showStatusMessage(status, 5);
} }
void MGMainWindow::setLinkStatus(QString status) void MainWindow::setLinkStatus(QString status)
{ {
showStatusMessage(status, 15); showStatusMessage(status, 15);
} }
...@@ -256,7 +257,7 @@ void MGMainWindow::setLinkStatus(QString status) ...@@ -256,7 +257,7 @@ void MGMainWindow::setLinkStatus(QString status)
* @brief Create all actions associated to the main window * @brief Create all actions associated to the main window
* *
**/ **/
void MGMainWindow::connectActions() void MainWindow::connectActions()
{ {
// Connect actions from ui // Connect actions from ui
connect(ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(addLink())); connect(ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(addLink()));
...@@ -283,12 +284,12 @@ void MGMainWindow::connectActions() ...@@ -283,12 +284,12 @@ void MGMainWindow::connectActions()
connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure())); connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure()));
} }
void MGMainWindow::configure() void MainWindow::configure()
{ {
joystickWidget = new JoystickWidget(joystick, this); joystickWidget = new JoystickWidget(joystick, this);
} }
void MGMainWindow::addLink() void MainWindow::addLink()
{ {
SerialLink* link = new SerialLink(); SerialLink* link = new SerialLink();
// TODO This should be only done in the dialog itself // TODO This should be only done in the dialog itself
...@@ -304,13 +305,19 @@ void MGMainWindow::addLink() ...@@ -304,13 +305,19 @@ void MGMainWindow::addLink()
// TODO Implement the link removal! // TODO Implement the link removal!
} }
void MGMainWindow::UASCreated(UASInterface* uas) void MainWindow::UASCreated(UASInterface* uas)
{ {
// Connect the UAS to the full user interface // Connect the UAS to the full user interface
ui.menuConnected_Systems->addAction(QIcon(":/actions/linechart.svg"), tr("View ") + uas->getUASName(), uas, SLOT(setSelected())); ui.menuConnected_Systems->addAction(QIcon(":/images/mavs/generic.svg"), tr("View ") + uas->getUASName(), uas, SLOT(setSelected()));
// Line chart // Line chart
connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)), Qt::QueuedConnection); // FIXME DO THIS ONLY FOR THE FIRST CONNECTED SYSTEM
static bool sysPresent = false;
if (!sysPresent)
{
connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), linechart, SLOT(appendData(int,QString,double,quint64)), Qt::QueuedConnection);
sysPresent = true;
}
// Health / System status indicator // Health / System status indicator
info->addUAS(uas); info->addUAS(uas);
...@@ -326,12 +333,12 @@ void MGMainWindow::UASCreated(UASInterface* uas) ...@@ -326,12 +333,12 @@ void MGMainWindow::UASCreated(UASInterface* uas)
reloadStylesheet(); reloadStylesheet();
} }
void MGMainWindow::clearView() void MainWindow::clearView()
{ {
// Halt HUD // Halt HUD
hud->stop(); hud->stop();
/*headDown1->stop(); headDown1->stop();
headDown2->stop();*/ headDown2->stop();
// Remove all dock widgets // Remove all dock widgets
QList<QObject*> list = this->children(); QList<QObject*> list = this->children();
...@@ -352,9 +359,10 @@ void MGMainWindow::clearView() ...@@ -352,9 +359,10 @@ void MGMainWindow::clearView()
} }
} }
void MGMainWindow::loadPilotView() void MainWindow::loadPilotView()
{ {
clearView(); clearView();
GAudioOutput::instance()->say("Switched to Pilot View");
// HEAD UP DISPLAY // HEAD UP DISPLAY
centerStack->setCurrentWidget(hud); centerStack->setCurrentWidget(hud);
...@@ -376,10 +384,12 @@ void MGMainWindow::loadPilotView() ...@@ -376,10 +384,12 @@ void MGMainWindow::loadPilotView()
this->show(); this->show();
} }
void MGMainWindow::loadOperatorView() void MainWindow::loadOperatorView()
{ {
clearView(); clearView();
GAudioOutput::instance()->say("Switched to Operator View");
// LINE CHART // LINE CHART
centerStack->setCurrentWidget(map); centerStack->setCurrentWidget(map);
...@@ -416,10 +426,12 @@ void MGMainWindow::loadOperatorView() ...@@ -416,10 +426,12 @@ void MGMainWindow::loadOperatorView()
this->show(); this->show();
} }
void MGMainWindow::loadSettingsView() void MainWindow::loadSettingsView()
{ {
clearView(); clearView();
GAudioOutput::instance()->say("Switched to Settings View");
// LINE CHART // LINE CHART
centerStack->setCurrentWidget(linechart); centerStack->setCurrentWidget(linechart);
...@@ -434,11 +446,13 @@ void MGMainWindow::loadSettingsView() ...@@ -434,11 +446,13 @@ void MGMainWindow::loadSettingsView()
addDockWidget(Qt::RightDockWidgetArea, container6); addDockWidget(Qt::RightDockWidgetArea, container6);
} }
void MGMainWindow::loadEngineerView() void MainWindow::loadEngineerView()
{ {
clearView(); clearView();
// Engineer view, used in EMAV2009 // Engineer view, used in EMAV2009
GAudioOutput::instance()->say("Switched to Engineer View");
// LINE CHART // LINE CHART
centerStack->setCurrentWidget(linechart); centerStack->setCurrentWidget(linechart);
...@@ -470,7 +484,7 @@ void MGMainWindow::loadEngineerView() ...@@ -470,7 +484,7 @@ void MGMainWindow::loadEngineerView()
this->show(); this->show();
} }
void MGMainWindow::loadWidgets() void MainWindow::loadWidgets()
{ {
loadOperatorView(); loadOperatorView();
//loadEngineerView(); //loadEngineerView();
...@@ -478,32 +492,32 @@ void MGMainWindow::loadWidgets() ...@@ -478,32 +492,32 @@ void MGMainWindow::loadWidgets()
} }
/* /*
void MGMainWindow::removeCommConfAct(QAction* action) void MainWindow::removeCommConfAct(QAction* action)
{ {
ui.menuNetwork->removeAction(action); ui.menuNetwork->removeAction(action);
}*/ }*/
//void MGMainWindow::startUAS() //void MainWindow::startUAS()
//{ //{
// UASManager::instance()->getActiveUAS()->launch(); // UASManager::instance()->getActiveUAS()->launch();
//} //}
// //
//void MGMainWindow::returnUAS() //void MainWindow::returnUAS()
//{ //{
// UASManager::instance()->getActiveUAS()->home(); // UASManager::instance()->getActiveUAS()->home();
//} //}
// //
//void MGMainWindow::stopUAS() //void MainWindow::stopUAS()
//{ //{
// UASManager::instance()->getActiveUAS()->emergencySTOP(); // UASManager::instance()->getActiveUAS()->emergencySTOP();
//} //}
// //
//void MGMainWindow::killUAS() //void MainWindow::killUAS()
//{ //{
// UASManager::instance()->getActiveUAS()->emergencyKILL(); // UASManager::instance()->getActiveUAS()->emergencyKILL();
//} //}
void MGMainWindow::runTests() void MainWindow::runTests()
{ {
// TODO Remove after debugging: Add fake data // TODO Remove after debugging: Add fake data
static double testvalue = 0.0f; static double testvalue = 0.0f;
......
...@@ -67,12 +67,12 @@ This file is part of the PIXHAWK project ...@@ -67,12 +67,12 @@ This file is part of the PIXHAWK project
* @brief Main Application Window * @brief Main Application Window
* *
**/ **/
class MGMainWindow : public QMainWindow { class MainWindow : public QMainWindow {
Q_OBJECT Q_OBJECT
public: public:
MGMainWindow(QWidget *parent = 0); MainWindow(QWidget *parent = 0);
~MGMainWindow(); ~MainWindow();
UASControlWidget* control; UASControlWidget* control;
LinechartWidget* linechart; LinechartWidget* linechart;
...@@ -161,7 +161,7 @@ protected: ...@@ -161,7 +161,7 @@ protected:
QTimer* videoTimer; QTimer* videoTimer;
private: private:
Ui::MGMainWindow ui; Ui::MainWindow ui;
}; };
#endif /* _MAINWINDOW_H_ */ #endif /* _MAINWINDOW_H_ */
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MGMainWindow</class> <class>MainWindow</class>
<widget class="QMainWindow" name="MGMainWindow"> <widget class="QMainWindow" name="MainWindow">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
<connection> <connection>
<sender>actionExit</sender> <sender>actionExit</sender>
<signal>triggered()</signal> <signal>triggered()</signal>
<receiver>MGMainWindow</receiver> <receiver>MainWindow</receiver>
<slot>close()</slot> <slot>close()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
......
...@@ -29,14 +29,55 @@ ...@@ -29,14 +29,55 @@
<string>QWidget#colorIcon {} <string>QWidget#colorIcon {}
QWidget { QWidget {
background-color: #252528; background-color: none;
color: #DDDDDF; color: #DDDDDF;
border-color: #EEEEEE; border-color: #EEEEEE;
background-clip: margin; background-clip: margin;
} }
QLabel#nameLabel {
font: bold 16px;
color: #3C7B9E;
}
QLabel#modeLabel {
font: 12px;
}
QLabel#stateLabel {
font: 12px;
}
QLabel#gpsLabel {
font: 8px;
}
QLabel#positionLabel {
font: 8px;
}
QLabel#timeElapsedLabel {
font: 8px;
}
QLabel#groundDistanceLabel {
font: 8px;
}
QLabel#speedLabel {
font: 8px;
}
QLabel#timeRemainingLabel {
font: 8px;
}
QLabel#waypointLabel {
font: 24px;
}
QGroupBox { QGroupBox {
border: 1px solid #EEEEEE; border: 1px solid #4A4A4F;
border-radius: 5px; border-radius: 5px;
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
margin: 0px; margin: 0px;
...@@ -67,6 +108,19 @@ QToolButton { ...@@ -67,6 +108,19 @@ QToolButton {
background-color: none; background-color: none;
} }
QToolButton#typeButton {
font-weight: bold;
font-size: 12px;
border: 2px solid #999999;
border-radius: 5px;
min-width:44px;
max-width: 44px;
min-height: 44px;
max-height: 44px;
padding: 0px;
background-color: none;
}
QPushButton { QPushButton {
font-weight: bold; font-weight: bold;
font-size: 12px; font-size: 12px;
...@@ -84,41 +138,38 @@ QPushButton:pressed { ...@@ -84,41 +138,38 @@ QPushButton:pressed {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #444444, stop: 1 #555555); background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #444444, stop: 1 #555555);
} }
QPushButton#landButton { QPushButton#abortButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #ffee01, stop:1 #ae8f00) url(&quot;ICONDIR/control/emergency-button.png&quot;); stop:0 #ffee01, stop:1 #ae8f00);
} }
QPushButton:pressed#landButton { QPushButton:pressed#abortButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #bbaa00, stop:1 #a05b00) url(&quot;ICONDIR/control/emergency-button.png&quot;); stop:0 #bbaa00, stop:1 #a05b00);
} }
QPushButton#killButton { QPushButton#killButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #ffb917, stop:1 #b37300) url(&quot;ICONDIR/control/emergency-button.png&quot;); stop:0 #ffb917, stop:1 #b37300);
} }
QPushButton:pressed#killButton { QPushButton:pressed#killButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #bb8500, stop:1 #903000) url(&quot;ICONDIR/control/emergency-button.png&quot;); stop:0 #bb8500, stop:1 #903000);
} }
QProgressBar { QProgressBar {
border: 1px solid white; border: 1px solid #4A4A4F;
border-radius: 4px; border-radius: 4px;
text-align: center; text-align: center;
padding: 2px; padding: 2px;
color: white; color: #DDDDDF;
background-color: #111111; background-color: #111118;
} }
QProgressBar:horizontal { QProgressBar:horizontal {
height: 12px; height: 10px;
} }
QProgressBar QLabel { QProgressBar QLabel {
...@@ -180,14 +231,14 @@ QProgressBar::chunk#thrustBar { ...@@ -180,14 +231,14 @@ QProgressBar::chunk#thrustBar {
<widget class="QToolButton" name="typeButton"> <widget class="QToolButton" name="typeButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>46</width> <width>48</width>
<height>46</height> <height>48</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>46</width> <width>48</width>
<height>46</height> <height>48</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
...@@ -234,8 +285,9 @@ QProgressBar::chunk#thrustBar { ...@@ -234,8 +285,9 @@ QProgressBar::chunk#thrustBar {
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>-1</pointsize>
<weight>75</weight> <weight>75</weight>
<italic>false</italic>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
...@@ -254,8 +306,9 @@ QProgressBar::chunk#thrustBar { ...@@ -254,8 +306,9 @@ QProgressBar::chunk#thrustBar {
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>14</pointsize> <pointsize>-1</pointsize>
<weight>50</weight> <weight>50</weight>
<italic>false</italic>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
...@@ -268,7 +321,10 @@ QProgressBar::chunk#thrustBar { ...@@ -268,7 +321,10 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="timeRemainingLabel"> <widget class="QLabel" name="timeRemainingLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
...@@ -280,7 +336,10 @@ QProgressBar::chunk#thrustBar { ...@@ -280,7 +336,10 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="timeElapsedLabel"> <widget class="QLabel" name="timeElapsedLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
...@@ -304,7 +363,10 @@ QProgressBar::chunk#thrustBar { ...@@ -304,7 +363,10 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="groundDistanceLabel"> <widget class="QLabel" name="groundDistanceLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
...@@ -313,14 +375,17 @@ QProgressBar::chunk#thrustBar { ...@@ -313,14 +375,17 @@ QProgressBar::chunk#thrustBar {
</widget> </widget>
</item> </item>
<item row="4" column="4" colspan="2"> <item row="4" column="4" colspan="2">
<widget class="QLabel" name="altitudeLabel"> <widget class="QLabel" name="speedLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>00.00 m</string> <string>00.0 m/s</string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -380,9 +445,10 @@ QProgressBar::chunk#thrustBar { ...@@ -380,9 +445,10 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="stateLabel"> <widget class="QLabel" name="stateLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>10</pointsize> <pointsize>-1</pointsize>
<weight>75</weight> <weight>50</weight>
<bold>true</bold> <italic>false</italic>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
...@@ -394,14 +460,18 @@ QProgressBar::chunk#thrustBar { ...@@ -394,14 +460,18 @@ QProgressBar::chunk#thrustBar {
<widget class="QLabel" name="waypointLabel"> <widget class="QLabel" name="waypointLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>20</pointsize> <pointsize>-1</pointsize>
<weight>75</weight> <weight>50</weight>
<bold>true</bold> <italic>false</italic>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>WPX</string> <string>WPX</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget> </widget>
</item> </item>
<item row="2" column="6"> <item row="2" column="6">
...@@ -420,7 +490,10 @@ QProgressBar::chunk#thrustBar { ...@@ -420,7 +490,10 @@ QProgressBar::chunk#thrustBar {
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
...@@ -444,7 +517,10 @@ QProgressBar::chunk#thrustBar { ...@@ -444,7 +517,10 @@ QProgressBar::chunk#thrustBar {
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize> <pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
...@@ -530,7 +606,7 @@ QProgressBar::chunk#thrustBar { ...@@ -530,7 +606,7 @@ QProgressBar::chunk#thrustBar {
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="returnButton"> <widget class="QPushButton" name="landButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>18</width> <width>18</width>
...@@ -553,12 +629,12 @@ QProgressBar::chunk#thrustBar { ...@@ -553,12 +629,12 @@ QProgressBar::chunk#thrustBar {
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../mavground.qrc">
<normaloff>:/images/actions/go-home.svg</normaloff>:/images/actions/go-home.svg</iconset> <normaloff>:/images/actions/system-log-out.svg</normaloff>:/images/actions/system-log-out.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="landButton"> <widget class="QPushButton" name="abortButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>18</width> <width>18</width>
......
...@@ -73,8 +73,8 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -73,8 +73,8 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect(m_ui->liftoffButton, SIGNAL(clicked()), uas, SLOT(launch())); connect(m_ui->liftoffButton, SIGNAL(clicked()), uas, SLOT(launch()));
connect(m_ui->haltButton, SIGNAL(clicked()), uas, SLOT(halt())); connect(m_ui->haltButton, SIGNAL(clicked()), uas, SLOT(halt()));
connect(m_ui->continueButton, SIGNAL(clicked()), uas, SLOT(go())); connect(m_ui->continueButton, SIGNAL(clicked()), uas, SLOT(go()));
connect(m_ui->returnButton, SIGNAL(clicked()), uas, SLOT(home())); connect(m_ui->landButton, SIGNAL(clicked()), uas, SLOT(home()));
connect(m_ui->landButton, SIGNAL(clicked()), uas, SLOT(emergencySTOP())); connect(m_ui->abortButton, SIGNAL(clicked()), uas, SLOT(emergencySTOP()));
connect(m_ui->killButton, SIGNAL(clicked()), uas, SLOT(emergencyKILL())); connect(m_ui->killButton, SIGNAL(clicked()), uas, SLOT(emergencyKILL()));
connect(m_ui->shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown())); connect(m_ui->shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown()));
...@@ -95,6 +95,15 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -95,6 +95,15 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
//m_ui->speedBar->setMinimum(0); //m_ui->speedBar->setMinimum(0);
//m_ui->speedBar->setMaximum(15); //m_ui->speedBar->setMaximum(15);
// UAS color
QColor uasColor = uas->getColor();
uasColor = uasColor.darker(475);
QString colorstyle;
colorstyle = colorstyle.sprintf("QGroupBox { border: 2px solid #4A4A4F; border-radius: 5px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X;}",
uasColor.red(), uasColor.green(), uasColor.blue());
m_ui->groupBox->setStyleSheet(colorstyle);
//m_ui->groupBox->setAutoFillBackground(true);
// Heartbeat fade // Heartbeat fade
refreshTimer = new QTimer(this); refreshTimer = new QTimer(this);
...@@ -107,6 +116,11 @@ UASView::~UASView() ...@@ -107,6 +116,11 @@ UASView::~UASView()
delete m_ui; delete m_ui;
} }
void UASView::setUASasActive(bool)
{
UASManager::instance()->setActiveUAS(this->uas);
}
void UASView::updateMode(int sysId, QString status, QString description) void UASView::updateMode(int sysId, QString status, QString description)
{ {
if (sysId == this->uas->getUASID()) m_ui->modeLabel->setText(status); if (sysId == this->uas->getUASID()) m_ui->modeLabel->setText(status);
...@@ -182,13 +196,6 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType) ...@@ -182,13 +196,6 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType)
break; break;
} }
} }
// MAV_GENERIC = 0,
// MAV_FIXED_WING,
// MAV_QUADROTOR,
// MAV_COAXIAL,
// MAV_HELICOPTER,
// MAV_GROUND,
// OCU
} }
void UASView::updateLocalPosition(UASInterface* uas, double x, double y, double z, quint64 usec) void UASView::updateLocalPosition(UASInterface* uas, double x, double y, double z, quint64 usec)
......
...@@ -67,6 +67,8 @@ public slots: ...@@ -67,6 +67,8 @@ public slots:
void selectWaypoint(int uasId, int id); void selectWaypoint(int uasId, int id);
/** @brief Set the current system type */ /** @brief Set the current system type */
void setSystemType(UASInterface* uas, unsigned int systemType); void setSystemType(UASInterface* uas, unsigned int systemType);
/** @brief Set the current UAS as the globally active system */
void setUASasActive(bool);
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
......
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