Commit 2d8aacd0 authored by lm's avatar lm

Merge branch 'experimental' of pixhawk.ethz.ch:qgroundcontrol

parents 363fe653 73b9e202
...@@ -27,7 +27,7 @@ R13=0.005927 ...@@ -27,7 +27,7 @@ R13=0.005927
R21=-0.000563 R21=-0.000563
R22=0.999999 R22=0.999999
R23=0.001235 R23=0.001235
R33=-0.005926 R31=-0.005926
R32=-0.001239 R32=-0.001239
R33=0.999982 R33=0.999982
Tx=-0.024287 Tx=-0.024287
......
...@@ -12,6 +12,7 @@ cp -r ../bin/mac/qgroundcontrol.app mac/. ...@@ -12,6 +12,7 @@ cp -r ../bin/mac/qgroundcontrol.app mac/.
cp -r ../audio mac/qgroundcontrol.app/Contents/MacOs/. cp -r ../audio mac/qgroundcontrol.app/Contents/MacOs/.
mkdir -p mac/qgroundcontrol.app/Contents/Frameworks/ mkdir -p mac/qgroundcontrol.app/Contents/Frameworks/
# SDL is not copied by Qt - for whatever reason
cp -r SDL.framework mac/qgroundcontrol.app/Contents/Frameworks/. cp -r SDL.framework mac/qgroundcontrol.app/Contents/Frameworks/.
echo -e '\n\nStarting to create disk image. This may take a while..\n' echo -e '\n\nStarting to create disk image. This may take a while..\n'
macdeployqt mac/qgroundcontrol.app -dmg macdeployqt mac/qgroundcontrol.app -dmg
......
...@@ -16,20 +16,20 @@ LicenseData ..\license.txt ...@@ -16,20 +16,20 @@ LicenseData ..\license.txt
Section "" Section ""
SetOutPath $INSTDIR SetOutPath $INSTDIR
File qgroundcontrol\*.* File ..\release\*.*
WriteUninstaller $INSTDIR\QGroundcontrol_uninstall.exe WriteUninstaller $INSTDIR\QGroundControl_uninstall.exe
SectionEnd SectionEnd
Section "Uninstall" Section "Uninstall"
Delete $INSTDIR\QGroundcontrol_uninstall.exe Delete $INSTDIR\QGroundControl_uninstall.exe
Delete $INSTDIR\*.* Delete $INSTDIR\*.*
RMDir $INSTDIR RMDir $INSTDIR
Delete "$SMPROGRAMS\QGroundcontrol\*.*" Delete "$SMPROGRAMS\QGroundControl\*.*"
RMDir "$SMPROGRAMS\QGroundcontrol\" RMDir "$SMPROGRAMS\QGroundControl\"
SectionEnd SectionEnd
Section "create Start Menu Shortcuts" Section "create Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\QGroundcontrol" CreateDirectory "$SMPROGRAMS\QGroundControl"
CreateShortCut "$SMPROGRAMS\QGroundcontrol\uninstall.lnk" "$INSTDIR\QGroundcontrol_uninstall.exe" "" "$INSTDIR\QGroundcontrol_uninstall.exe" 0 CreateShortCut "$SMPROGRAMS\QGroundControl\uninstall.lnk" "$INSTDIR\QGroundControl_uninstall.exe" "" "$INSTDIR\QGroundControl_uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\QGroundcontrol\QGroundcontrol.lnk" "$INSTDIR\qgroundcontrol.exe" "" "$INSTDIR\qgroundcontrol.exe" 0 CreateShortCut "$SMPROGRAMS\QGroundControl\QGroundControl.lnk" "$INSTDIR\qgroundcontrol.exe" "" "$INSTDIR\qgroundcontrol.exe" 0
SectionEnd SectionEnd
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<!-- QGroundControl --> <!-- QGroundControl -->
<title>QGroundControl Google Earth View</title> <title>QGroundControl Google Earth View</title>
<!-- *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** --> <!-- *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** -->
<script type="text/javascript" src="https://getfirebug.com/firebug-lite-beta.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAwbkbZLyhsmTCWXbTcjbgbRSzHs7K5SvaUdm8ua-Xxy_-2dYwMxQMhnagaawTo7L1FE1-amhuQxIlXw"></script> <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAwbkbZLyhsmTCWXbTcjbgbRSzHs7K5SvaUdm8ua-Xxy_-2dYwMxQMhnagaawTo7L1FE1-amhuQxIlXw"></script>
<script type="text/javascript"> <script type="text/javascript">
google.load("earth", "1", { 'language': 'en'}); google.load("earth", "1", { 'language': 'en'});
...@@ -47,8 +48,10 @@ var aircraft = []; ...@@ -47,8 +48,10 @@ var aircraft = [];
var attitudes = []; var attitudes = [];
var locations = []; var locations = [];
var trails = []; var trails = [];
var trail; var trailPlacemarks = [];
var lineStringPlacemark; var trailsVisible = [];
var trailColors = [];
//var trailPlacemarks[id];
var lineStyle; var lineStyle;
// Aircraft class // Aircraft class
...@@ -134,54 +137,72 @@ function createAircraft(id, type, color) ...@@ -134,54 +137,72 @@ function createAircraft(id, type, color)
locations[id] = planeLoc; locations[id] = planeLoc;
//planeColor = color; //planeColor = color;
//createTrail(id, color); createTrail(id, color);
console.log(color);
} }
function createTrail(id, color) function createTrail(id, color)
{ {
lineStringPlacemark = ge.createPlacemark(''); trailPlacemarks[id] = ge.createPlacemark('');
// Create the placemark // Create the placemark
// Create the LineString; set it to extend down to the ground // Create the LineString; set it to extend down to the ground
// and set the altitude mode // and set the altitude mode
trail = ge.createLineString(''); trails[id] = ge.createLineString('');
lineStringPlacemark.setGeometry(trail); trailPlacemarks[id].setGeometry(trails[id]);
trail.setExtrude(false); trails[id].setExtrude(false);
trail.setAltitudeMode(ge.ALTITUDE_ABSOLUTE); trails[id].setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
// Add LineString points // Add LineString points
//lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700); //lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700);
// Create a style and set width and color of line // Create a style and set width and color of line
lineStringPlacemark.setStyleSelector(ge.createStyle('')); trailPlacemarks[id].setStyleSelector(ge.createStyle(''));
lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle(); lineStyle = trailPlacemarks[id].getStyleSelector().getLineStyle();
lineStyle.setWidth(5); lineStyle.setWidth(5);
lineStyle.getColor().set(planeColor);  // aabbggrr format trailColors[id] = color;
//lineStyle.getColor().set(color); lineStyle.getColor().set('00000000');  // aabbggrr format
//lineStyle.getColor().set(color);  // aabbggrr format
trailsVisible[id] = false;
// Add the feature to Earth // Add the feature to Earth
ge.getFeatures().appendChild(lineStringPlacemark); //ge.getFeatures().appendChild(trailPlacemarks[id]);
} }
function hideTrail(id)
{
trailsVisible[id] = false;
ge.getFeatures().removeChild(trailPlacemarks[id]);
}
function showTrail(id)
{
ge.getFeatures().appendChild(trailPlacemarks[id]);
trailsVisible[id] = true;
}
function setViewRange(dist)
{
currViewRange = dist;
}
function addTrailPosition(id, lat, lon, alt) function addTrailPosition(id, lat, lon, alt)
{ {
trail.setExtrude(false); trails[id].setExtrude(false);
trail.setAltitudeMode(ge.ALTITUDE_ABSOLUTE); trails[id].setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
// Add LineString points // Add LineString points
//lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700); trails[id].getCoordinates().pushLatLngAlt(lat, lon, alt);
trail.getCoordinates().pushLatLngAlt(currLat, currLon, currAlt);
// Create a style and set width and color of line // Create a style and set width and color of line
lineStringPlacemark.setStyleSelector(ge.createStyle('')); trailPlacemarks[id].setStyleSelector(ge.createStyle(''));
lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle(); lineStyle = trailPlacemarks[id].getStyleSelector().getLineStyle();
lineStyle.setWidth(5); lineStyle.setWidth(5);
lineStyle.getColor().set(planeColor);  // aabbggrr format lineStyle.getColor().set(trailColors[id]);  // aabbggrr format
//lineStyle.getColor().set(color);  // aabbggrr format //lineStyle.getColor().set(color);  // aabbggrr format
// Add the feature to Earth // Add the feature to Earth
ge.getFeatures().replaceChild(lineStringPlacemark, lineStringPlacemark); if (trailsVisible[id] == true) ge.getFeatures().replaceChild(trailPlacemarks[id], trailPlacemarks[id]);
} }
function initCallback(object) function initCallback(object)
...@@ -199,9 +220,6 @@ function initCallback(object) ...@@ -199,9 +220,6 @@ function initCallback(object)
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true); ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
ge.getLayerRoot().enableLayerById(ge.LAYER_TREES, true); ge.getLayerRoot().enableLayerById(ge.LAYER_TREES, true);
createTrail(220, 'bb2222ff');
createAircraft(220);
initialized = true; initialized = true;
......
...@@ -99,9 +99,10 @@ namespace qmapcontrol ...@@ -99,9 +99,10 @@ namespace qmapcontrol
Geometry* Layer::get_Geometry(int index) Geometry* Layer::get_Geometry(int index)
{ {
Geometry* geo = NULL;
if(geometrySelected) if(geometrySelected)
{ {
return geometrySelected; geo = geometrySelected;
} }
else else
{ {
...@@ -110,7 +111,7 @@ namespace qmapcontrol ...@@ -110,7 +111,7 @@ namespace qmapcontrol
Geometry *geometry = geometries[i]; Geometry *geometry = geometries[i];
if(geometry->name() == QString::number(index)) if(geometry->name() == QString::number(index))
{ {
return geometry; geo = geometry;
} }
} }
...@@ -124,7 +125,7 @@ namespace qmapcontrol ...@@ -124,7 +125,7 @@ namespace qmapcontrol
// } // }
} }
return geo;
} }
bool Layer::isVisible() const bool Layer::isVisible() const
......
...@@ -112,7 +112,14 @@ namespace qmapcontrol ...@@ -112,7 +112,14 @@ namespace qmapcontrol
void LayerManager::setView(const QPointF& coordinate) void LayerManager::setView(const QPointF& coordinate)
{ {
QPoint oldMapPx = mapmiddle_px;
mapmiddle_px = layer()->mapadapter()->coordinateToDisplay(coordinate); mapmiddle_px = layer()->mapadapter()->coordinateToDisplay(coordinate);
scroll += mapmiddle_px - oldMapPx;
zoomImageScroll+= mapmiddle_px - oldMapPx;
mapmiddle = coordinate; mapmiddle = coordinate;
//TODO: muss wegen moveTo() raus //TODO: muss wegen moveTo() raus
...@@ -125,7 +132,8 @@ namespace qmapcontrol ...@@ -125,7 +132,8 @@ namespace qmapcontrol
//TODO: //TODO:
// verschiebung ausrechnen // verschiebung ausrechnen
// oder immer neues offscreenimage // oder immer neues offscreenimage
newOffscreenImage(); //newOffscreenImage();
moveWidgets();
} }
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
# $$BASEDIR/lib/openjaus/libopenJaus/include # $$BASEDIR/lib/openjaus/libopenJaus/include
message(Qt version $$[QT_VERSION]) message(Qt version $$[QT_VERSION])
message(Using Qt from $QTDIR)
release { release {
# DEFINES += QT_NO_DEBUG_OUTPUT # DEFINES += QT_NO_DEBUG_OUTPUT
...@@ -50,6 +51,7 @@ macx { ...@@ -50,6 +51,7 @@ macx {
contains( HARDWARE_PLATFORM, 9.6.0 ) || contains( HARDWARE_PLATFORM, 9.7.0 ) || contains( HARDWARE_PLATFORM, 9.8.0 ) || contains( HARDWARE_PLATFORM, 9.9.0 ) { contains( HARDWARE_PLATFORM, 9.6.0 ) || contains( HARDWARE_PLATFORM, 9.7.0 ) || contains( HARDWARE_PLATFORM, 9.8.0 ) || contains( HARDWARE_PLATFORM, 9.9.0 ) {
# x86 Mac OS X Leopard 10.5 and earlier # x86 Mac OS X Leopard 10.5 and earlier
CONFIG += x86 cocoa phonon CONFIG += x86 cocoa phonon
CONFIG -= x86_64
message(Building for Mac OS X 32bit/Leopard 10.5 and earlier) message(Building for Mac OS X 32bit/Leopard 10.5 and earlier)
# Enable function-profiling with the OS X saturn tool # Enable function-profiling with the OS X saturn tool
......
...@@ -145,13 +145,15 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -145,13 +145,15 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QGCWebView.ui \ src/ui/QGCWebView.ui \
src/ui/map3D/QGCGoogleEarthView.ui \ src/ui/map3D/QGCGoogleEarthView.ui \
src/ui/map3D/QGCGoogleEarthViewWin.ui \ src/ui/map3D/QGCGoogleEarthViewWin.ui \
src/ui/map3D/QGCGoogleEarthControls.ui \
src/ui/SlugsDataSensorView.ui \ src/ui/SlugsDataSensorView.ui \
src/ui/SlugsHilSim.ui \ src/ui/SlugsHilSim.ui \
src/ui/SlugsPIDControl.ui \ src/ui/SlugsPIDControl.ui \
src/ui/SlugsVideoCamControl.ui \ src/ui/SlugsVideoCamControl.ui \
src/ui/SlugsPadCameraControl.ui \ src/ui/SlugsPadCameraControl.ui \
src/ui/uas/QGCUnconnectedInfoWidget.ui src/ui/uas/QGCUnconnectedInfoWidget.ui \
src/ui/designer/QGCToolWidget.ui \
src/ui/designer/QGCParamSlider.ui \
src/ui/designer/QGCActionButton.ui
INCLUDEPATH += src \ INCLUDEPATH += src \
src/ui \ src/ui \
...@@ -166,7 +168,8 @@ INCLUDEPATH += src \ ...@@ -166,7 +168,8 @@ INCLUDEPATH += src \
src/ui/mavlink \ src/ui/mavlink \
src/ui/param \ src/ui/param \
src/ui/watchdog \ src/ui/watchdog \
src/ui/map3D src/ui/map3D \
src/ui/designer
HEADERS += src/MG.h \ HEADERS += src/MG.h \
src/Core.h \ src/Core.h \
...@@ -252,7 +255,11 @@ HEADERS += src/MG.h \ ...@@ -252,7 +255,11 @@ HEADERS += src/MG.h \
src/ui/SlugsPadCameraControl.h \ src/ui/SlugsPadCameraControl.h \
src/ui/QGCMainWindowAPConfigurator.h \ src/ui/QGCMainWindowAPConfigurator.h \
src/comm/MAVLinkSwarmSimulationLink.h \ src/comm/MAVLinkSwarmSimulationLink.h \
src/ui/uas/QGCUnconnectedInfoWidget.h src/ui/uas/QGCUnconnectedInfoWidget.h \
src/ui/designer/QGCToolWidget.h \
src/ui/designer/QGCParamSlider.h \
src/ui/designer/QGCActionButton.h \
src/ui/designer/QGCToolWidgetItem.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|win32-msvc2008: { macx|win32-msvc2008: {
...@@ -369,7 +376,11 @@ SOURCES += src/main.cc \ ...@@ -369,7 +376,11 @@ SOURCES += src/main.cc \
src/ui/SlugsPadCameraControl.cpp \ src/ui/SlugsPadCameraControl.cpp \
src/ui/QGCMainWindowAPConfigurator.cc \ src/ui/QGCMainWindowAPConfigurator.cc \
src/comm/MAVLinkSwarmSimulationLink.cc \ src/comm/MAVLinkSwarmSimulationLink.cc \
src/ui/uas/QGCUnconnectedInfoWidget.cc src/ui/uas/QGCUnconnectedInfoWidget.cc \
src/ui/designer/QGCToolWidget.cc \
src/ui/designer/QGCParamSlider.cc \
src/ui/designer/QGCActionButton.cc \
src/ui/designer/QGCToolWidgetItem.cc
macx|win32-msvc2008: { macx|win32-msvc2008: {
SOURCES += src/ui/map3D/QGCGoogleEarthView.cc SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
...@@ -122,6 +122,7 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -122,6 +122,7 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
#endif #endif
// MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(MG::DIR::getSupportFilesDirectory() + "/demo-log.txt"); // MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(MG::DIR::getSupportFilesDirectory() + "/demo-log.txt");
MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(":/demo-log.txt"); MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(":/demo-log.txt");
simulationLink->disconnect();
//mainWindow->addLink(simulationLink); //mainWindow->addLink(simulationLink);
mainWindow = MainWindow::instance(); mainWindow = MainWindow::instance();
......
...@@ -30,6 +30,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -30,6 +30,7 @@ This file is part of the QGROUNDCONTROL project
*/ */
#include <QApplication> #include <QApplication>
#include <QSettings>
#include <QTemporaryFile> #include <QTemporaryFile>
#include "GAudioOutput.h" #include "GAudioOutput.h"
#include "MG.h" #include "MG.h"
...@@ -85,10 +86,19 @@ GAudioOutput* GAudioOutput::instance() ...@@ -85,10 +86,19 @@ GAudioOutput* GAudioOutput::instance()
return _instance; return _instance;
} }
#define QGC_GAUDIOOUTPUT_KEY QString("QGC_AUDIOOUTPUT_")
GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent), GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent),
voiceIndex(0), voiceIndex(0),
emergency(false) emergency(false),
muted(false)
{ {
// Load settings
QSettings settings;
settings.sync();
muted = settings.value(QGC_GAUDIOOUTPUT_KEY+"muted", muted).toBool();
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
flite_init(); flite_init();
#endif #endif
...@@ -134,13 +144,28 @@ emergency(false) ...@@ -134,13 +144,28 @@ emergency(false)
GAudioOutput::~GAudioOutput() GAudioOutput::~GAudioOutput()
{ {
QSettings settings;
settings.setValue(QGC_GAUDIOOUTPUT_KEY+"muted", muted);
settings.sync();
#ifdef _MSC_VER2 #ifdef _MSC_VER2
::CoUninitialize(); ::CoUninitialize();
#endif #endif
} }
void GAudioOutput::mute(bool mute)
{
this->muted = mute;
}
bool GAudioOutput::isMuted()
{
return this->muted;
}
bool GAudioOutput::say(QString text, int severity) bool GAudioOutput::say(QString text, int severity)
{ {
if (!muted)
{
// TODO Add severity filter // TODO Add severity filter
Q_UNUSED(severity); Q_UNUSED(severity);
bool res = false; bool res = false;
...@@ -183,13 +208,18 @@ bool GAudioOutput::say(QString text, int severity) ...@@ -183,13 +208,18 @@ bool GAudioOutput::say(QString text, int severity)
} }
return res; return res;
} }
else
{
return false;
}
}
/** /**
* @param text This message will be played after the alert beep * @param text This message will be played after the alert beep
*/ */
bool GAudioOutput::alert(QString text) bool GAudioOutput::alert(QString text)
{ {
if (!emergency) if (!emergency || !muted)
{ {
// Play alert sound // Play alert sound
beep(); beep();
...@@ -205,19 +235,25 @@ bool GAudioOutput::alert(QString text) ...@@ -205,19 +235,25 @@ bool GAudioOutput::alert(QString text)
void GAudioOutput::notifyPositive() void GAudioOutput::notifyPositive()
{ {
if (!muted)
{
// Use QFile to transform path for all OS // Use QFile to transform path for all OS
QFile f(QCoreApplication::applicationDirPath()+QString("/audio/double_notify.wav")); QFile f(QCoreApplication::applicationDirPath()+QString("/audio/double_notify.wav"));
m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str())); m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
m_media->play(); m_media->play();
} }
}
void GAudioOutput::notifyNegative() void GAudioOutput::notifyNegative()
{ {
if (!muted)
{
// Use QFile to transform path for all OS // Use QFile to transform path for all OS
QFile f(QCoreApplication::applicationDirPath()+QString("/audio/flat_notify.wav")); QFile f(QCoreApplication::applicationDirPath()+QString("/audio/flat_notify.wav"));
m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str())); m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
m_media->play(); m_media->play();
} }
}
/** /**
* The emergency sound will be played continously during the emergency. * The emergency sound will be played continously during the emergency.
...@@ -232,7 +268,7 @@ bool GAudioOutput::startEmergency() ...@@ -232,7 +268,7 @@ bool GAudioOutput::startEmergency()
{ {
emergency = true; emergency = true;
// Beep immediately and then start timer // Beep immediately and then start timer
beep(); if (!muted) beep();
emergencyTimer->start(1500); emergencyTimer->start(1500);
QTimer::singleShot(5000, this, SLOT(stopEmergency())); QTimer::singleShot(5000, this, SLOT(stopEmergency()));
} }
...@@ -257,11 +293,14 @@ bool GAudioOutput::stopEmergency() ...@@ -257,11 +293,14 @@ bool GAudioOutput::stopEmergency()
void GAudioOutput::beep() void GAudioOutput::beep()
{ {
if (!muted)
{
// Use QFile to transform path for all OS // Use QFile to transform path for all OS
QFile f(QCoreApplication::applicationDirPath()+QString("/audio/alert.wav")); QFile f(QCoreApplication::applicationDirPath()+QString("/audio/alert.wav"));
m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str())); m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
m_media->play(); m_media->play();
} }
}
void GAudioOutput::selectFemaleVoice() void GAudioOutput::selectFemaleVoice()
{ {
......
...@@ -99,6 +99,10 @@ public slots: ...@@ -99,6 +99,10 @@ public slots:
void notifyPositive(); void notifyPositive();
/** @brief Notify about negative event */ /** @brief Notify about negative event */
void notifyNegative(); void notifyNegative();
/** @brief Mute/unmute sound */
void mute(bool mute);
/** @brief Get the mute state */
bool isMuted();
protected: protected:
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
...@@ -112,6 +116,7 @@ protected: ...@@ -112,6 +116,7 @@ protected:
Phonon::AudioOutput* m_audioOutput; Phonon::AudioOutput* m_audioOutput;
bool emergency; ///< Emergency status flag bool emergency; ///< Emergency status flag
QTimer* emergencyTimer; QTimer* emergencyTimer;
bool muted;
private: private:
GAudioOutput(QObject* parent=NULL); GAudioOutput(QObject* parent=NULL);
~GAudioOutput(); ~GAudioOutput();
......
...@@ -11,6 +11,7 @@ namespace QGC ...@@ -11,6 +11,7 @@ namespace QGC
const QColor colorGreen(20, 200, 20); const QColor colorGreen(20, 200, 20);
const QColor colorYellow(255, 255, 0); const QColor colorYellow(255, 255, 0);
const QColor colorDarkYellow(180, 180, 0); const QColor colorDarkYellow(180, 180, 0);
const QColor colorBackground("#050508");
/** @brief Get the current ground time in microseconds */ /** @brief Get the current ground time in microseconds */
quint64 groundTimeUsecs(); quint64 groundTimeUsecs();
......
...@@ -42,6 +42,7 @@ along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. ...@@ -42,6 +42,7 @@ along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
class LinkInterface : public QThread { class LinkInterface : public QThread {
Q_OBJECT Q_OBJECT
public: public:
LinkInterface(QObject* parent = 0) : QThread(parent) {}
//virtual ~LinkInterface() = 0; //virtual ~LinkInterface() = 0;
/* Connection management */ /* Connection management */
......
...@@ -33,6 +33,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -33,6 +33,7 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug> #include <QDebug>
#include <QTime> #include <QTime>
#include <QApplication> #include <QApplication>
#include <QMessageBox>
#include "MG.h" #include "MG.h"
#include "MAVLinkProtocol.h" #include "MAVLinkProtocol.h"
...@@ -45,6 +46,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -45,6 +46,7 @@ This file is part of the QGROUNDCONTROL project
#include "ArduPilotMegaMAV.h" #include "ArduPilotMegaMAV.h"
#include "configuration.h" #include "configuration.h"
#include "LinkManager.h" #include "LinkManager.h"
#include "MainWindow.h"
#include <QGCMAVLink.h> #include <QGCMAVLink.h>
#include "QGC.h" #include "QGC.h"
...@@ -141,8 +143,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -141,8 +143,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// of its existence, as it only then can send and receive // of its existence, as it only then can send and receive
// it's first messages. // it's first messages.
// FIXME Current debugging // Check if the UAS has the same id like this system
// check if the UAS has the same id like this system
if (message.sysid == getSystemId()) if (message.sysid == getSystemId())
{ {
qDebug() << "WARNING\nWARNING\nWARNING\nWARNING\nWARNING\nWARNING\nWARNING\n\n RECEIVED MESSAGE FROM THIS SYSTEM WITH ID" << message.msgid << "FROM COMPONENT" << message.compid; qDebug() << "WARNING\nWARNING\nWARNING\nWARNING\nWARNING\nWARNING\nWARNING\n\n RECEIVED MESSAGE FROM THIS SYSTEM WITH ID" << message.msgid << "FROM COMPONENT" << message.compid;
...@@ -155,7 +156,26 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -155,7 +156,26 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// First create new UAS object // First create new UAS object
// Decode heartbeat message // Decode heartbeat message
mavlink_heartbeat_t heartbeat; mavlink_heartbeat_t heartbeat;
// Reset version field to 0
heartbeat.mavlink_version = 0;
mavlink_msg_heartbeat_decode(&message, &heartbeat); mavlink_msg_heartbeat_decode(&message, &heartbeat);
// Check if the UAS has a different protocol version
if (heartbeat.mavlink_version != MAVLINK_VERSION)
{
// Bring up dialog to inform user
QMessageBox msgBox(MainWindow::instance());
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(tr("The MAVLink protocol version on the MAV and QGroundControl mismatch!"));
msgBox.setInformativeText(tr("It is unsafe to use different MAVLink versions. QGroundControl therefore refuses to connect to system %1, which sends MAVLink version %2 (QGroundControl uses version %3).").arg(message.sysid).arg(heartbeat.mavlink_version).arg(MAVLINK_VERSION));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
// Ignore this message and continue gracefully
continue;
}
switch (heartbeat.autopilot) switch (heartbeat.autopilot)
{ {
case MAV_AUTOPILOT_GENERIC: case MAV_AUTOPILOT_GENERIC:
......
...@@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project
* @param writeFile The received messages are written to that file * @param writeFile The received messages are written to that file
* @param rate The rate at which the messages are sent (in intervals of milliseconds) * @param rate The rate at which the messages are sent (in intervals of milliseconds)
**/ **/
MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile, int rate) : MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile, int rate, QObject* parent) : LinkInterface(parent),
readyBytes(0), readyBytes(0),
timeOffset(0) timeOffset(0)
{ {
...@@ -289,16 +289,19 @@ void MAVLinkSimulationLink::mainloop() ...@@ -289,16 +289,19 @@ void MAVLinkSimulationLink::mainloop()
if (keys.value(i, "") == "Gyro_Phi") if (keys.value(i, "") == "Gyro_Phi")
{ {
rawImuValues.xgyro = d; rawImuValues.xgyro = d;
attitude.rollspeed = ((d-29.000)/15000.0)*2.7-2.7-2.65;
} }
if (keys.value(i, "") == "Gyro_Theta") if (keys.value(i, "") == "Gyro_Theta")
{ {
rawImuValues.ygyro = d; rawImuValues.ygyro = d;
attitude.pitchspeed = ((d-29.000)/15000.0)*2.7-2.7-2.65;
} }
if (keys.value(i, "") == "Gyro_Psi") if (keys.value(i, "") == "Gyro_Psi")
{ {
rawImuValues.zgyro = d; rawImuValues.zgyro = d;
attitude.yawspeed = ((d-29.000)/3000.0)*2.7-2.7-2.65;
} }
#ifdef MAVLINK_ENABLED_PIXHAWK #ifdef MAVLINK_ENABLED_PIXHAWK
if (keys.value(i, "") == "Pressure") if (keys.value(i, "") == "Pressure")
...@@ -419,6 +422,20 @@ void MAVLinkSimulationLink::mainloop() ...@@ -419,6 +422,20 @@ void MAVLinkSimulationLink::mainloop()
memcpy(stream+streampointer,buffer, bufferlength); memcpy(stream+streampointer,buffer, bufferlength);
streampointer += bufferlength; streampointer += bufferlength;
// GLOBAL POSITION VEHICLE 2
mavlink_msg_global_position_int_pack(54, componentId, &ret, (473780.28137103+(x+0.002))*1E3, (85489.9892510421+((y/2)+0.3))*1E3, (z+570.0)*1000.0, 0*100.0, 0*100.0, 0*100.0);
bufferlength = mavlink_msg_to_send_buffer(buffer, &ret);
//add data into datastream
memcpy(stream+streampointer,buffer, bufferlength);
streampointer += bufferlength;
// // GLOBAL POSITION VEHICLE 3
// mavlink_msg_global_position_int_pack(60, componentId, &ret, (473780.28137103+(x/2+0.002))*1E3, (85489.9892510421+((y*2)+0.3))*1E3, (z+590.0)*1000.0, 0*100.0, 0*100.0, 0*100.0);
// bufferlength = mavlink_msg_to_send_buffer(buffer, &ret);
// //add data into datastream
// memcpy(stream+streampointer,buffer, bufferlength);
// streampointer += bufferlength;
static int rcCounter = 0; static int rcCounter = 0;
if (rcCounter == 2) if (rcCounter == 2)
{ {
...@@ -431,6 +448,7 @@ void MAVLinkSimulationLink::mainloop() ...@@ -431,6 +448,7 @@ void MAVLinkSimulationLink::mainloop()
chan.chan6_raw = (chan.chan3_raw + chan.chan2_raw) / 2.0f; chan.chan6_raw = (chan.chan3_raw + chan.chan2_raw) / 2.0f;
chan.chan7_raw = (chan.chan4_raw + chan.chan2_raw) / 2.0f; chan.chan7_raw = (chan.chan4_raw + chan.chan2_raw) / 2.0f;
chan.chan8_raw = (chan.chan6_raw + chan.chan2_raw) / 2.0f; chan.chan8_raw = (chan.chan6_raw + chan.chan2_raw) / 2.0f;
chan.rssi = 100;
messageSize = mavlink_msg_rc_channels_raw_encode(systemId, componentId, &msg, &chan); messageSize = mavlink_msg_rc_channels_raw_encode(systemId, componentId, &msg, &chan);
// Allocate buffer with packet data // Allocate buffer with packet data
bufferlength = mavlink_msg_to_send_buffer(buffer, &msg); bufferlength = mavlink_msg_to_send_buffer(buffer, &msg);
...@@ -594,6 +612,16 @@ void MAVLinkSimulationLink::mainloop() ...@@ -594,6 +612,16 @@ void MAVLinkSimulationLink::mainloop()
memcpy(stream+streampointer,buffer, bufferlength); memcpy(stream+streampointer,buffer, bufferlength);
streampointer += bufferlength; streampointer += bufferlength;
// // HEARTBEAT VEHICLE 3
// // Pack message and get size of encoded byte string
// messageSize = mavlink_msg_heartbeat_pack(60, componentId, &msg, MAV_FIXED_WING, MAV_AUTOPILOT_PIXHAWK);
// // Allocate buffer with packet data
// bufferlength = mavlink_msg_to_send_buffer(buffer, &msg);
// //add data into datastream
// memcpy(stream+streampointer,buffer, bufferlength);
// streampointer += bufferlength;
// STATUS VEHICLE 2 // STATUS VEHICLE 2
mavlink_sys_status_t status2; mavlink_sys_status_t status2;
status2.mode = MAV_MODE_LOCKED; status2.mode = MAV_MODE_LOCKED;
......
...@@ -47,7 +47,7 @@ class MAVLinkSimulationLink : public LinkInterface ...@@ -47,7 +47,7 @@ class MAVLinkSimulationLink : public LinkInterface
{ {
Q_OBJECT Q_OBJECT
public: public:
MAVLinkSimulationLink(QString readFile="", QString writeFile="", int rate=5); MAVLinkSimulationLink(QString readFile="", QString writeFile="", int rate=5, QObject* parent = 0);
~MAVLinkSimulationLink(); ~MAVLinkSimulationLink();
bool isConnected(); bool isConnected();
qint64 bytesAvailable(); qint64 bytesAvailable();
...@@ -128,7 +128,7 @@ protected: ...@@ -128,7 +128,7 @@ protected:
void enqueue(uint8_t* stream, uint8_t* index, mavlink_message_t* msg); void enqueue(uint8_t* stream, uint8_t* index, mavlink_message_t* msg);
static const uint8_t systemId = 220; static const uint8_t systemId = 220;
static const uint8_t componentId = 0; static const uint8_t componentId = 200;
static const uint16_t version = 1000; static const uint16_t version = 1000;
signals: signals:
......
#include "MAVLinkSwarmSimulationLink.h" #include "MAVLinkSwarmSimulationLink.h"
MAVLinkSwarmSimulationLink::MAVLinkSwarmSimulationLink(QObject *parent) : MAVLinkSwarmSimulationLink::MAVLinkSwarmSimulationLink(QString readFile, QString writeFile, int rate, QObject *parent) :
MAVLinkSimulationLink() MAVLinkSimulationLink(readFile, writeFile, rate, parent)
{ {
} }
......
...@@ -7,7 +7,7 @@ class MAVLinkSwarmSimulationLink : public MAVLinkSimulationLink ...@@ -7,7 +7,7 @@ class MAVLinkSwarmSimulationLink : public MAVLinkSimulationLink
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MAVLinkSwarmSimulationLink(QObject *parent = 0); MAVLinkSwarmSimulationLink(QString readFile="", QString writeFile="", int rate=5, QObject *parent = 0);
signals: signals:
......
This diff is collapsed.
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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.
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/** /**
* @file * @file
...@@ -58,34 +38,16 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P ...@@ -58,34 +38,16 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
// 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();
// Load defaults from settings
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
settings.sync();
if (settings.contains("SERIALLINK_COMM_PORT"))
{
this->porthandle = settings.value("SERIALLINK_COMM_PORT").toString();
}
// *nix (Linux, MacOS tested) serial port support // *nix (Linux, MacOS tested) serial port support
port = new QextSerialPort(porthandle, QextSerialPort::Polling); port = new QextSerialPort(porthandle, QextSerialPort::Polling);
//port = new QextSerialPort(porthandle, QextSerialPort::EventDriven); //port = new QextSerialPort(porthandle, QextSerialPort::EventDriven);
if (settings.contains("SERIALLINK_COMM_PORT")) this->baudrate = baudrate;
{ this->flow = flow;
setBaudRate(settings.value("SERIALLINK_COMM_BAUD").toInt()); this->parity = parity;
setParityType(settings.value("SERIALLINK_COMM_PARITY").toInt()); this->dataBits = dataBits;
setStopBitsType(settings.value("SERIALLINK_COMM_STOPBITS").toInt()); this->stopBits = stopBits;
setDataBitsType(settings.value("SERIALLINK_COMM_DATABITS").toInt()); this->timeout = 1; ///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
}
else
{
this->baudrate = baudrate;
this->flow = flow;
this->parity = parity;
this->dataBits = dataBits;
this->stopBits = stopBits;
this->timeout = 1; ///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
}
port->setTimeout(timeout); // Timeout of 0 ms, we don't want to wait for data, we just poll again next time port->setTimeout(timeout); // Timeout of 0 ms, we don't want to wait for data, we just poll again next time
port->setBaudRate(baudrate); port->setBaudRate(baudrate);
port->setFlowControl(flow); port->setFlowControl(flow);
...@@ -96,7 +58,7 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P ...@@ -96,7 +58,7 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
// Set the port name // Set the port name
if (porthandle == "") if (porthandle == "")
{ {
// name = tr("serial link ") + QString::number(getId()) + tr(" (unconfigured)"); // name = tr("serial link ") + QString::number(getId()) + tr(" (unconfigured)");
name = tr("Serial Link ") + QString::number(getId()); name = tr("Serial Link ") + QString::number(getId());
} }
else else
...@@ -134,6 +96,33 @@ SerialLink::~SerialLink() ...@@ -134,6 +96,33 @@ SerialLink::~SerialLink()
port = NULL; port = NULL;
} }
void SerialLink::loadSettings()
{
// Load defaults from settings
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
settings.sync();
if (settings.contains("SERIALLINK_COMM_PORT"))
{
setPortName(settings.value("SERIALLINK_COMM_PORT").toString());
setBaudRateType(settings.value("SERIALLINK_COMM_BAUD").toInt());
setParityType(settings.value("SERIALLINK_COMM_PARITY").toInt());
setStopBitsType(settings.value("SERIALLINK_COMM_STOPBITS").toInt());
setDataBitsType(settings.value("SERIALLINK_COMM_DATABITS").toInt());
}
}
void SerialLink::writeSettings()
{
// Store settings
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
settings.setValue("SERIALLINK_COMM_PORT", this->porthandle);
settings.setValue("SERIALLINK_COMM_BAUD", getBaudRateType());
settings.setValue("SERIALLINK_COMM_PARITY", getParityType());
settings.setValue("SERIALLINK_COMM_STOPBITS", getStopBitsType());
settings.setValue("SERIALLINK_COMM_DATABITS", getDataBitsType());
settings.sync();
}
/** /**
* @brief Runs the thread * @brief Runs the thread
...@@ -189,13 +178,13 @@ void SerialLink::writeBytes(const char* data, qint64 size) ...@@ -189,13 +178,13 @@ void SerialLink::writeBytes(const char* data, qint64 size)
// Increase write counter // Increase write counter
bitsSentTotal += size * 8; bitsSentTotal += size * 8;
// int i; // int i;
// for (i=0; i<size; i++) // for (i=0; i<size; i++)
// { // {
// unsigned char v=data[i]; // unsigned char v=data[i];
// //fprintf(stderr,"%02x ", v); // //fprintf(stderr,"%02x ", v);
// } // }
} }
} }
...@@ -321,18 +310,12 @@ bool SerialLink::hardwareConnect() ...@@ -321,18 +310,12 @@ bool SerialLink::hardwareConnect()
statisticsMutex.unlock(); statisticsMutex.unlock();
bool connectionUp = isConnected(); bool connectionUp = isConnected();
if(connectionUp) { if(connectionUp)
{
emit connected(); emit connected();
emit connected(true); emit connected(true);
// Store settings writeSettings();
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
settings.setValue("SERIALLINK_COMM_PORT", this->porthandle);
settings.setValue("SERIALLINK_COMM_BAUD", getBaudRate());
settings.setValue("SERIALLINK_COMM_PARITY", getParityType());
settings.setValue("SERIALLINK_COMM_STOPBITS", getStopBitsType());
settings.setValue("SERIALLINK_COMM_DATABITS", getDataBitsType());
settings.sync();
} }
return connectionUp; return connectionUp;
...@@ -376,7 +359,8 @@ void SerialLink::setName(QString name) ...@@ -376,7 +359,8 @@ void SerialLink::setName(QString name)
qint64 SerialLink::getNominalDataRate() qint64 SerialLink::getNominalDataRate()
{ {
qint64 dataRate = 0; qint64 dataRate = 0;
switch (baudrate) { switch (baudrate)
{
case BAUD50: case BAUD50:
dataRate = 50; dataRate = 50;
break; break;
...@@ -442,6 +426,13 @@ qint64 SerialLink::getNominalDataRate() ...@@ -442,6 +426,13 @@ qint64 SerialLink::getNominalDataRate()
break; break;
case BAUD256000: case BAUD256000:
dataRate = 256000; dataRate = 256000;
// Windows-specific high-end baudrates
case BAUD230400:
dataRate = 230400;
case BAUD460800:
dataRate = 460800;
case BAUD921600:
dataRate = 921600;
break; break;
} }
return dataRate; return dataRate;
...@@ -543,7 +534,8 @@ bool SerialLink::setPortName(QString portName) ...@@ -543,7 +534,8 @@ bool SerialLink::setPortName(QString portName)
if(portName.trimmed().length() > 0) if(portName.trimmed().length() > 0)
{ {
bool reconnect = false; bool reconnect = false;
if(isConnected()) { if(isConnected())
{
disconnect(); disconnect();
reconnect = true; reconnect = true;
} }
...@@ -650,8 +642,17 @@ bool SerialLink::setBaudRateType(int rateIndex) ...@@ -650,8 +642,17 @@ bool SerialLink::setBaudRateType(int rateIndex)
baudrate = BAUD128000; baudrate = BAUD128000;
break; break;
case 21: case 21:
baudrate = BAUD230400;
break;
case 22:
baudrate = BAUD256000; baudrate = BAUD256000;
break; break;
case 23:
baudrate = BAUD460800;
break;
case 24:
baudrate = BAUD921600;
break;
default: default:
// If none of the above cases matches, there must be an error // If none of the above cases matches, there must be an error
accepted = false; accepted = false;
...@@ -671,12 +672,14 @@ bool SerialLink::setBaudRate(int rate) ...@@ -671,12 +672,14 @@ bool SerialLink::setBaudRate(int rate)
{ {
bool reconnect = false; bool reconnect = false;
bool accepted = true; // This is changed if none of the data rates matches bool accepted = true; // This is changed if none of the data rates matches
if(isConnected()) { if(isConnected())
{
disconnect(); disconnect();
reconnect = true; reconnect = true;
} }
switch (rate) { switch (rate)
{
case 50: case 50:
baudrate = BAUD50; baudrate = BAUD50;
break; break;
...@@ -740,9 +743,18 @@ bool SerialLink::setBaudRate(int rate) ...@@ -740,9 +743,18 @@ bool SerialLink::setBaudRate(int rate)
case 128000: case 128000:
baudrate = BAUD128000; baudrate = BAUD128000;
break; break;
case 230400:
baudrate = BAUD230400;
break;
case 256000: case 256000:
baudrate = BAUD256000; baudrate = BAUD256000;
break; break;
case 460800:
baudrate = BAUD460800;
break;
case 921600:
baudrate = BAUD921600;
break;
default: default:
// If none of the above cases matches, there must be an error // If none of the above cases matches, there must be an error
accepted = false; accepted = false;
...@@ -765,12 +777,14 @@ bool SerialLink::setFlowType(int flow) ...@@ -765,12 +777,14 @@ bool SerialLink::setFlowType(int flow)
{ {
bool reconnect = false; bool reconnect = false;
bool accepted = true; bool accepted = true;
if(isConnected()) { if(isConnected())
{
disconnect(); disconnect();
reconnect = true; reconnect = true;
} }
switch (flow) { switch (flow)
{
case FLOW_OFF: case FLOW_OFF:
this->flow = FLOW_OFF; this->flow = FLOW_OFF;
break; break;
...@@ -794,12 +808,14 @@ bool SerialLink::setParityType(int parity) ...@@ -794,12 +808,14 @@ bool SerialLink::setParityType(int parity)
{ {
bool reconnect = false; bool reconnect = false;
bool accepted = true; bool accepted = true;
if(isConnected()) { if(isConnected())
{
disconnect(); disconnect();
reconnect = true; reconnect = true;
} }
switch (parity) { switch (parity)
{
case PAR_NONE: case PAR_NONE:
this->parity = PAR_NONE; this->parity = PAR_NONE;
break; break;
...@@ -826,11 +842,14 @@ bool SerialLink::setParityType(int parity) ...@@ -826,11 +842,14 @@ bool SerialLink::setParityType(int parity)
return accepted; return accepted;
} }
// FIXME Works not as anticipated by user!
bool SerialLink::setDataBitsType(int dataBits) bool SerialLink::setDataBitsType(int dataBits)
{ {
bool accepted = true; bool accepted = true;
switch (dataBits) { switch (dataBits)
{
case 5: case 5:
this->dataBits = DATA_5; this->dataBits = DATA_5;
break; break;
...@@ -858,6 +877,7 @@ bool SerialLink::setDataBitsType(int dataBits) ...@@ -858,6 +877,7 @@ bool SerialLink::setDataBitsType(int dataBits)
return accepted; return accepted;
} }
// FIXME WORKS NOT AS ANTICIPATED BY USER!
bool SerialLink::setStopBitsType(int stopBits) bool SerialLink::setStopBitsType(int stopBits)
{ {
bool reconnect = false; bool reconnect = false;
...@@ -867,7 +887,8 @@ bool SerialLink::setStopBitsType(int stopBits) ...@@ -867,7 +887,8 @@ bool SerialLink::setStopBitsType(int stopBits)
reconnect = true; reconnect = true;
} }
switch (stopBits) { switch (stopBits)
{
case 1: case 1:
this->stopBits = STOP_1; this->stopBits = STOP_1;
break; break;
......
...@@ -91,6 +91,9 @@ public: ...@@ -91,6 +91,9 @@ public:
qint64 getBitsSent(); qint64 getBitsSent();
qint64 getBitsReceived(); qint64 getBitsReceived();
void loadSettings();
void writeSettings();
void run(); void run();
int getLinkQuality(); int getLinkQuality();
......
...@@ -57,6 +57,8 @@ public slots: ...@@ -57,6 +57,8 @@ public slots:
virtual bool setParityType(int parity) = 0; virtual bool setParityType(int parity) = 0;
virtual bool setDataBitsType(int dataBits) = 0; virtual bool setDataBitsType(int dataBits) = 0;
virtual bool setStopBitsType(int stopBits) = 0; virtual bool setStopBitsType(int stopBits) = 0;
virtual void loadSettings() = 0;
virtual void writeSettings() = 0;
}; };
......
...@@ -92,8 +92,11 @@ enum BaudRateType ...@@ -92,8 +92,11 @@ enum BaudRateType
BAUD57600, BAUD57600,
BAUD76800, //POSIX ONLY BAUD76800, //POSIX ONLY
BAUD115200, BAUD115200,
BAUD128000, //WINDOWS ONLY BAUD128000, // WINDOWS ONLY
BAUD256000 //WINDOWS ONLY BAUD230400, // WINDOWS ONLY
BAUD256000, // WINDOWS ONLY
BAUD460800, // WINDOWS ONLY
BAUD921600 // WINDOWS ONLY
}; };
enum DataBitsType enum DataBitsType
......
...@@ -5,6 +5,16 @@ ...@@ -5,6 +5,16 @@
#include <windows.h> #include <windows.h>
#include <QThread> #include <QThread>
/* These baudrates work on windows, but are not part of the windows headers */
#ifndef CBR_230400
#define CBR_230400 230400
#endif
#ifndef CBR_460800
#define CBR_460800 460800
#endif
#ifndef CBR_921600
#define CBR_921600 921600
#endif
/*if all warning messages are turned off, flag portability warnings to be turned off as well*/ /*if all warning messages are turned off, flag portability warnings to be turned off as well*/
#ifdef _TTY_NOWARN_ #ifdef _TTY_NOWARN_
......
...@@ -54,11 +54,11 @@ void ArduPilotMegaMAV::receiveMessage(LinkInterface* link, mavlink_message_t mes ...@@ -54,11 +54,11 @@ void ArduPilotMegaMAV::receiveMessage(LinkInterface* link, mavlink_message_t mes
{ {
case MAVLINK_MSG_ID_HEARTBEAT: case MAVLINK_MSG_ID_HEARTBEAT:
{ {
qDebug() << "ARDUPILOT RECEIVED HEARTBEAT"; //qDebug() << "ARDUPILOT RECEIVED HEARTBEAT";
break; break;
} }
default: default:
qDebug() << "\nARDUPILOT RECEIVED MESSAGE WITH ID" << message.msgid; //qDebug() << "\nARDUPILOT RECEIVED MESSAGE WITH ID" << message.msgid;
break; break;
} }
} }
......
This diff is collapsed.
...@@ -153,6 +153,8 @@ protected: ...@@ -153,6 +153,8 @@ protected:
double pitch; double pitch;
double yaw; double yaw;
QTimer* statusTimeout; ///< Timer for various status timeouts QTimer* statusTimeout; ///< Timer for various status timeouts
QMap<int, QMap<QString, float>* > parameters; ///< All parameters
bool paramsOnceRequested; ///< If the parameter list has been read at least once
/** @brief Set the current battery type */ /** @brief Set the current battery type */
void setBattery(BatteryType type, int cells); void setBattery(BatteryType type, int cells);
...@@ -199,7 +201,7 @@ public slots: ...@@ -199,7 +201,7 @@ public slots:
//void requestWaypoints(); FIXME tbd //void requestWaypoints(); FIXME tbd
//void clearWaypointList(); FIXME tbd //void clearWaypointList(); FIXME tbd
void requestParameters();
/** @brief Enable the motors */ /** @brief Enable the motors */
void enable_motors(); void enable_motors();
/** @brief Disable the motors */ /** @brief Disable the motors */
...@@ -230,6 +232,9 @@ public slots: ...@@ -230,6 +232,9 @@ public slots:
/** @brief Set current mode of operation, e.g. auto or manual */ /** @brief Set current mode of operation, e.g. auto or manual */
void setMode(int mode); void setMode(int mode);
/** @brief Request all parameters */
void requestParameters();
/** @brief Set a system parameter */ /** @brief Set a system parameter */
void setParameter(int component, QString id, float value); void setParameter(int component, QString id, float value);
...@@ -238,6 +243,12 @@ public slots: ...@@ -238,6 +243,12 @@ public slots:
/** @brief Read parameters from permanent storage */ /** @brief Read parameters from permanent storage */
void readParametersFromStorage(); void readParametersFromStorage();
/** @brief Get the names of all parameters */
QList<QString> getParameterNames(int component);
/** @brief Get the ids of all components */
QList<int> getComponentIds();
void enableAllDataTransmission(int rate); void enableAllDataTransmission(int rate);
void enableRawSensorDataTransmission(int rate); void enableRawSensorDataTransmission(int rate);
void enableExtendedSystemStatusTransmission(int rate); void enableExtendedSystemStatusTransmission(int rate);
......
...@@ -126,6 +126,7 @@ public: ...@@ -126,6 +126,7 @@ public:
///> 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(231,72,28)); colors.append(QColor(231,72,28));
colors.append(QColor(104,64,240));
colors.append(QColor(203,254,121)); colors.append(QColor(203,254,121));
colors.append(QColor(161,252,116)); colors.append(QColor(161,252,116));
colors.append(QColor(232,33,47)); colors.append(QColor(232,33,47));
...@@ -140,11 +141,10 @@ public: ...@@ -140,11 +141,10 @@ public:
colors.append(QColor(87,231,246)); colors.append(QColor(87,231,246));
colors.append(QColor(151,59,239)); colors.append(QColor(151,59,239));
colors.append(QColor(81,183,244)); colors.append(QColor(81,183,244));
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(242,255,128));
colors.append(QColor(230,126,23)); colors.append(QColor(230,126,23));
nextColor++; nextColor = 0;
} }
return colors[nextColor++]; return colors[nextColor++];
} }
......
...@@ -104,12 +104,12 @@ QList<UASInterface*> UASManager::getUASList() ...@@ -104,12 +104,12 @@ QList<UASInterface*> UASManager::getUASList()
UASInterface* UASManager::getActiveUAS() UASInterface* UASManager::getActiveUAS()
{ {
if(!activeUAS) // if(!activeUAS)
{ // {
QMessageBox msgBox; // QMessageBox msgBox;
msgBox.setText(tr("No Micro Air Vehicle connected. Please connect one first.")); // msgBox.setText(tr("No Micro Air Vehicle connected. Please connect one first."));
msgBox.exec(); // msgBox.exec();
} // }
return activeUAS; ///< Return zero pointer if no UAS has been loaded return activeUAS; ///< Return zero pointer if no UAS has been loaded
} }
......
...@@ -394,11 +394,14 @@ void UASWaypointManager::loadWaypoints(const QString &loadFile) ...@@ -394,11 +394,14 @@ void UASWaypointManager::loadWaypoints(const QString &loadFile)
void UASWaypointManager::globalAddWaypoint(Waypoint *wp) void UASWaypointManager::globalAddWaypoint(Waypoint *wp)
{ {
// FIXME Will be removed
Q_UNUSED(wp);
} }
int UASWaypointManager::globalRemoveWaypoint(quint16 seq) int UASWaypointManager::globalRemoveWaypoint(quint16 seq)
{ {
// FIXME Will be removed
Q_UNUSED(seq);
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -37,6 +37,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -37,6 +37,7 @@ This file is part of the QGROUNDCONTROL project
#include <QTimer> #include <QTimer>
#include <QFontDatabase> #include <QFontDatabase>
#include <QMap> #include <QMap>
#include <QContextMenuEvent>
#include <QPair> #include <QPair>
#include <cmath> #include <cmath>
...@@ -58,14 +59,31 @@ class HDDisplay : public QGraphicsView ...@@ -58,14 +59,31 @@ class HDDisplay : public QGraphicsView
{ {
Q_OBJECT Q_OBJECT
public: public:
HDDisplay(QStringList* plotList, QWidget *parent = 0); HDDisplay(QStringList* plotList, QString title="", QWidget *parent = 0);
~HDDisplay(); ~HDDisplay();
public slots: public slots:
/** @brief Update a HDD value */ /** @brief Update a HDD value */
void updateValue(UASInterface* uas, QString name, double value, quint64 msec); void updateValue(int uasId, QString name, double value, quint64 msec);
void setActiveUAS(UASInterface* uas); void setActiveUAS(UASInterface* uas);
/** @brief Removes a plot item by the action data */
void removeItemByAction();
/** @brief Bring up the menu to add a gauge */
void addGauge();
/** @brief Add a gauge using this spec string */
void addGauge(const QString& gauge);
/** @brief Set the title of this widget and any existing parent dock widget */
void setTitle();
/** @brief Set the number of colums via popup */
void setColumns();
/** @brief Set the number of colums */
void setColumns(int cols);
/** @brief Save the current layout and state to disk */
void saveState();
/** @brief Restore the last layout and state from disk */
void restoreState();
protected slots: protected slots:
void enableGLRendering(bool enable); void enableGLRendering(bool enable);
//void render(QPainter* painter, const QRectF& target = QRectF(), const QRect& source = QRect(), Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio); //void render(QPainter* painter, const QRectF& target = QRectF(), const QRect& source = QRect(), Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio);
...@@ -73,10 +91,13 @@ protected slots: ...@@ -73,10 +91,13 @@ protected slots:
void triggerUpdate(); void triggerUpdate();
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent* e);
void paintEvent(QPaintEvent * event); void paintEvent(QPaintEvent* event);
void showEvent(QShowEvent* event); void showEvent(QShowEvent* event);
void hideEvent(QHideEvent* event); void hideEvent(QHideEvent* event);
void contextMenuEvent(QContextMenuEvent* event);
QList<QAction*> getItemRemoveActions();
void createActions();
float refLineWidthToPen(float line); float refLineWidthToPen(float line);
float refToScreenX(float x); float refToScreenX(float x);
float refToScreenY(float y); float refToScreenY(float y);
...@@ -155,6 +176,11 @@ protected: ...@@ -155,6 +176,11 @@ protected:
QStringList* acceptList; ///< Variable names to plot QStringList* acceptList; ///< Variable names to plot
quint64 lastPaintTime; ///< Last time this widget was refreshed quint64 lastPaintTime; ///< Last time this widget was refreshed
int columns; ///< Number of instrument columns
QAction* addGaugeAction; ///< Action adding a gauge
QAction* setTitleAction; ///< Action setting the title
QAction* setColumnsAction; ///< Action setting the number of columns
private: private:
Ui::HDDisplay *m_ui; Ui::HDDisplay *m_ui;
......
...@@ -46,7 +46,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -46,7 +46,7 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug> #include <QDebug>
HSIDisplay::HSIDisplay(QWidget *parent) : HSIDisplay::HSIDisplay(QWidget *parent) :
HDDisplay(NULL, parent), HDDisplay(NULL, "", parent),
gpsSatellites(), gpsSatellites(),
satellitesUsed(0), satellitesUsed(0),
attXSet(0), attXSet(0),
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "JoystickWidget.h" #include "JoystickWidget.h"
#include "GAudioOutput.h" #include "GAudioOutput.h"
#include "QGCToolWidget.h"
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSG_ENABLED
#include "Q3DWidgetFactory.h" #include "Q3DWidgetFactory.h"
...@@ -107,6 +108,11 @@ MainWindow::MainWindow(QWidget *parent): ...@@ -107,6 +108,11 @@ MainWindow::MainWindow(QWidget *parent):
// Create actions // Create actions
connectCommonActions(); connectCommonActions();
// Add option for custom widgets
connect(ui.actionNewCustomWidget, SIGNAL(triggered()), this, SLOT(createCustomWidget()));
// Allow to mute audio
ui.actionMuteAudioOutput->setChecked(GAudioOutput::instance()->isMuted());
connect(ui.actionMuteAudioOutput, SIGNAL(triggered(bool)), GAudioOutput::instance(), SLOT(mute(bool)));
// Set dock options // Set dock options
setDockOptions(AnimatedDocks | AllowTabbedDocks | AllowNestedDocks); setDockOptions(AnimatedDocks | AllowTabbedDocks | AllowNestedDocks);
...@@ -201,17 +207,19 @@ void MainWindow::buildPxWidgets() ...@@ -201,17 +207,19 @@ void MainWindow::buildPxWidgets()
{ {
//FIXME: memory of acceptList will never be freed again //FIXME: memory of acceptList will never be freed again
QStringList* acceptList = new QStringList(); QStringList* acceptList = new QStringList();
acceptList->append("roll IMU"); acceptList->append("-180,roll (deg),+180");
acceptList->append("pitch IMU"); acceptList->append("-180,pitch (deg),+180");
acceptList->append("yaw IMU"); acceptList->append("-180,yaw (deg),+180");
acceptList->append("rollspeed IMU");
acceptList->append("pitchspeed IMU"); acceptList->append("-500,roll V (deg/s),+500");
acceptList->append("yawspeed IMU"); acceptList->append("-500,pitch V (deg/s),+500");
acceptList->append("-500,yaw V (deg/s),+500");
//FIXME: memory of acceptList2 will never be freed again //FIXME: memory of acceptList2 will never be freed again
QStringList* acceptList2 = new QStringList(); QStringList* acceptList2 = new QStringList();
acceptList2->append("Battery"); acceptList2->append("0,Abs pressure,65500");
acceptList2->append("Pressure"); acceptList2->append("-2000,Accel. X, 2000");
acceptList2->append("-2000,Accel. Y, 2000");
if (!linechartWidget) if (!linechartWidget)
{ {
...@@ -290,15 +298,15 @@ void MainWindow::buildPxWidgets() ...@@ -290,15 +298,15 @@ void MainWindow::buildPxWidgets()
if (!headDown1DockWidget) if (!headDown1DockWidget)
{ {
headDown1DockWidget = new QDockWidget(tr("System Stats"), this); headDown1DockWidget = new QDockWidget(tr("Flight Display"), this);
headDown1DockWidget->setWidget( new HDDisplay(acceptList, this) ); headDown1DockWidget->setWidget( new HDDisplay(acceptList, "Flight Display", this) );
addToToolsMenu (headDown1DockWidget, tr("Flight Display"), SLOT(showToolWidget()), MENU_HDD_1, Qt::RightDockWidgetArea); addToToolsMenu (headDown1DockWidget, tr("Flight Display"), SLOT(showToolWidget()), MENU_HDD_1, Qt::RightDockWidgetArea);
} }
if (!headDown2DockWidget) if (!headDown2DockWidget)
{ {
headDown2DockWidget = new QDockWidget(tr("Payload Status"), this); headDown2DockWidget = new QDockWidget(tr("Payload Status"), this);
headDown2DockWidget->setWidget( new HDDisplay(acceptList2, this) ); headDown2DockWidget->setWidget( new HDDisplay(acceptList2, "Payload Status", this) );
addToToolsMenu (headDown2DockWidget, tr("Payload Status"), SLOT(showToolWidget()), MENU_HDD_2, Qt::RightDockWidgetArea); addToToolsMenu (headDown2DockWidget, tr("Payload Status"), SLOT(showToolWidget()), MENU_HDD_2, Qt::RightDockWidgetArea);
} }
...@@ -694,7 +702,16 @@ void MainWindow::connectCommonWidgets() ...@@ -694,7 +702,16 @@ void MainWindow::connectCommonWidgets()
// it notifies that a waypoint global goes to do create and a map graphic too // it notifies that a waypoint global goes to do create and a map graphic too
connect(waypointsDockWidget->widget(), SIGNAL(createWaypointAtMap(QPointF)), mapWidget, SLOT(createWaypointGraphAtMap(QPointF))); connect(waypointsDockWidget->widget(), SIGNAL(createWaypointAtMap(QPointF)), mapWidget, SLOT(createWaypointGraphAtMap(QPointF)));
} }
}
void MainWindow::createCustomWidget()
{
qDebug() << "ADDING CUSTOM WIDGET";
QGCToolWidget* tool = new QGCToolWidget(this);
QDockWidget* dock = new QDockWidget("Unnamed Tool", this);
dock->setWidget(tool);
this->addDockWidget(Qt::LeftDockWidgetArea, dock);
dock->setVisible(true);
} }
void MainWindow::connectPxWidgets() void MainWindow::connectPxWidgets()
......
...@@ -140,6 +140,9 @@ public slots: ...@@ -140,6 +140,9 @@ public slots:
/** @brief Reload the CSS style sheet */ /** @brief Reload the CSS style sheet */
void reloadStylesheet(); void reloadStylesheet();
/** @brief Add a custom tool widget */
void createCustomWidget();
void closeEvent(QCloseEvent* event); void closeEvent(QCloseEvent* event);
/* /*
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
<string>File</string> <string>File</string>
</property> </property>
<addaction name="actionJoystick_Settings"/> <addaction name="actionJoystick_Settings"/>
<addaction name="actionNewCustomWidget"/>
<addaction name="actionMuteAudioOutput"/>
<addaction name="actionSimulate"/> <addaction name="actionSimulate"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
...@@ -108,7 +110,6 @@ ...@@ -108,7 +110,6 @@
<addaction name="menuPerspectives"/> <addaction name="menuPerspectives"/>
<addaction name="menuHelp"/> <addaction name="menuHelp"/>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
<action name="actionExit"> <action name="actionExit">
<property name="icon"> <property name="icon">
...@@ -430,6 +431,27 @@ ...@@ -430,6 +431,27 @@
<string>Pilot</string> <string>Pilot</string>
</property> </property>
</action> </action>
<action name="actionNewCustomWidget">
<property name="text">
<string>New Custom Widget</string>
</property>
</action>
<action name="actionMuteAudioOutput">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/audio-volume-high.svg</normaloff>
<normalon>:/images/status/audio-volume-muted.svg</normalon>
<activeon>:/images/status/audio-volume-muted.svg</activeon>
<selectedoff>:/images/status/audio-volume-high.svg</selectedoff>
<selectedon>:/images/status/audio-volume-muted.svg</selectedon>:/images/status/audio-volume-high.svg</iconset>
</property>
<property name="text">
<string>Mute Audio Output</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>
...@@ -454,5 +476,3 @@ ...@@ -454,5 +476,3 @@
</connection> </connection>
</connections> </connections>
</ui> </ui>
This diff is collapsed.
...@@ -81,6 +81,10 @@ protected: ...@@ -81,6 +81,10 @@ protected:
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);
/** @brief Start widget updating */
void showEvent(QShowEvent* event);
/** @brief Stop widget updating */
void hideEvent(QHideEvent* event);
QAction* osmAction; QAction* osmAction;
QAction* yahooActionMap; QAction* yahooActionMap;
......
...@@ -10,7 +10,7 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent ...@@ -10,7 +10,7 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent
/* Add title */ /* Add title */
QHBoxLayout *titleLayout = new QHBoxLayout(); QHBoxLayout *titleLayout = new QHBoxLayout();
QLabel *title; QLabel* title;
if (type == AILERON) if (type == AILERON)
{ {
title = new QLabel(tr("Aileron")); title = new QLabel(tr("Aileron"));
...@@ -23,6 +23,10 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent ...@@ -23,6 +23,10 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent
{ {
title = new QLabel(tr("Rudder")); title = new QLabel(tr("Rudder"));
} }
else
{
title = new QLabel(tr("Unknown"));
}
titleLayout->addWidget(title); titleLayout->addWidget(title);
grid->addLayout(titleLayout, 0, 0, 1, 3, Qt::AlignHCenter); grid->addLayout(titleLayout, 0, 0, 1, 3, Qt::AlignHCenter);
......
...@@ -55,6 +55,9 @@ const QVector<float>& RadioCalibrationData::operator ()(int i) const ...@@ -55,6 +55,9 @@ const QVector<float>& RadioCalibrationData::operator ()(int i) const
return (*data)[i]; return (*data)[i];
} }
// FIXME Bryan
// FIXME James
// This is not good. If it is ever used after being returned it will cause a crash // This is not good. If it is ever used after being returned it will cause a crash
// return QVector<float>(); // return QVector<float>();
} }
......
...@@ -84,6 +84,9 @@ void RadioCalibrationWindow::setChannelRaw(int ch, float raw) ...@@ -84,6 +84,9 @@ void RadioCalibrationWindow::setChannelRaw(int ch, float raw)
void RadioCalibrationWindow::setChannelScaled(int ch, float normalized) void RadioCalibrationWindow::setChannelScaled(int ch, float normalized)
{ {
// FIXME James
// FIXME Bryan
// /** this expects a particular channel to function mapping // /** this expects a particular channel to function mapping
// \todo allow run-time channel mapping // \todo allow run-time channel mapping
// */ // */
......
...@@ -234,6 +234,7 @@ userConfigured(false) ...@@ -234,6 +234,7 @@ userConfigured(false)
if(serialLink != 0) if(serialLink != 0)
{ {
serialLink->loadSettings();
this->link = serialLink; this->link = serialLink;
// Setup the user interface according to link type // Setup the user interface according to link type
......
...@@ -159,11 +159,26 @@ ...@@ -159,11 +159,26 @@
<string>128000</string> <string>128000</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>230400</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>256000</string> <string>256000</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>460800</string>
</property>
</item>
<item>
<property name="text">
<string>921600</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
......
...@@ -136,7 +136,9 @@ void SlugsHilSim::activeUasSet(UASInterface* uas){ ...@@ -136,7 +136,9 @@ void SlugsHilSim::activeUasSet(UASInterface* uas){
} }
void SlugsHilSim::processHilDatagram(const QByteArray* datagram){ void SlugsHilSim::processHilDatagram(const QByteArray* datagram)
{
#ifdef MAVLINK_ENABLED_SLUGS
unsigned char i = 0; unsigned char i = 0;
mavlink_message_t msg; mavlink_message_t msg;
...@@ -144,7 +146,6 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){ ...@@ -144,7 +146,6 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){
// GPS // GPS
mavlink_gps_raw_t tmpGpsRaw; mavlink_gps_raw_t tmpGpsRaw;
#ifdef MAVLINK_ENABLED_SLUGS
mavlink_gps_date_time_t tmpGpsTime; mavlink_gps_date_time_t tmpGpsTime;
tmpGpsTime.year = datagram->at(i++); tmpGpsTime.year = datagram->at(i++);
...@@ -167,7 +168,6 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){ ...@@ -167,7 +168,6 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){
mavlink_msg_gps_date_time_encode(MG::SYSTEM::ID,MG::SYSTEM::COMPID, &msg, &tmpGpsTime); mavlink_msg_gps_date_time_encode(MG::SYSTEM::ID,MG::SYSTEM::COMPID, &msg, &tmpGpsTime);
activeUas->sendMessage(hilLink, msg); activeUas->sendMessage(hilLink, msg);
#endif
memset(&msg, 0, sizeof(mavlink_message_t)); memset(&msg, 0, sizeof(mavlink_message_t));
...@@ -180,6 +180,9 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){ ...@@ -180,6 +180,9 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){
ui->ed_1->setText(QString::number(tmpGpsRaw.hdg)); ui->ed_1->setText(QString::number(tmpGpsRaw.hdg));
ui->ed_2->setText(QString::number(tmpGpsRaw.v)); ui->ed_2->setText(QString::number(tmpGpsRaw.v));
ui->ed_3->setText(QString::number(tmpGpsRaw.eph)); ui->ed_3->setText(QString::number(tmpGpsRaw.eph));
#else
Q_UNUSED(datagram);
#endif
} }
float SlugsHilSim::getFloatFromDatagram (const QByteArray* datagram, unsigned char * i){ float SlugsHilSim::getFloatFromDatagram (const QByteArray* datagram, unsigned char * i){
...@@ -205,4 +208,5 @@ uint16_t SlugsHilSim::getUint16FromDatagram (const QByteArray* datagram, unsigne ...@@ -205,4 +208,5 @@ uint16_t SlugsHilSim::getUint16FromDatagram (const QByteArray* datagram, unsigne
void SlugsHilSim::linkSelected(int cbIndex){ void SlugsHilSim::linkSelected(int cbIndex){
//hilLink = linksAvailable //hilLink = linksAvailable
// FIXME Mariano
} }
...@@ -640,6 +640,8 @@ void SlugsPIDControl::sendMessagePIDStatus(int PIDtype) ...@@ -640,6 +640,8 @@ void SlugsPIDControl::sendMessagePIDStatus(int PIDtype)
} }
} }
#else
Q_UNUSED(PIDtype);
#endif // MAVLINK_ENABLED_SLUG #endif // MAVLINK_ENABLED_SLUG
} }
......
...@@ -221,7 +221,8 @@ double SlugsPadCameraControl::getDistPixel(int x1, int y1, int x2, int y2) ...@@ -221,7 +221,8 @@ double SlugsPadCameraControl::getDistPixel(int x1, int y1, int x2, int y2)
*/ */
QPointF SlugsPadCameraControl::ObtenerMarcacionDistanciaPixel(double lon1, double lat1, double lon2, double lat2) QPointF SlugsPadCameraControl::ObtenerMarcacionDistanciaPixel(double lon1, double lat1, double lon2, double lat2)
{ {
double cateto_opuesto,cateto_adyacente, hipotenusa, distancia, marcacion; double cateto_opuesto,cateto_adyacente, hipotenusa, distancia;
double marcacion = 0.0;
//latitude and longitude first point //latitude and longitude first point
...@@ -234,7 +235,7 @@ QPointF SlugsPadCameraControl::ObtenerMarcacionDistanciaPixel(double lon1, doubl ...@@ -234,7 +235,7 @@ QPointF SlugsPadCameraControl::ObtenerMarcacionDistanciaPixel(double lon1, doubl
cateto_adyacente = abs((lon1-lon2)); cateto_adyacente = abs((lon1-lon2));
hipotenusa = sqrt(pow(cateto_opuesto,2) + pow(cateto_adyacente,2)); hipotenusa = sqrt(pow(cateto_opuesto,2) + pow(cateto_adyacente,2));
distancia = hipotenusa*60; distancia = hipotenusa*60.0;
if ((lat1 < lat2) && (lon1 > lon2)) //primer cuadrante if ((lat1 < lat2) && (lon1 > lon2)) //primer cuadrante
......
...@@ -570,5 +570,7 @@ void WaypointList::setIsLoadFileWP() ...@@ -570,5 +570,7 @@ void WaypointList::setIsLoadFileWP()
void WaypointList::setIsReadGlobalWP(bool value) void WaypointList::setIsReadGlobalWP(bool value)
{ {
// readGlobalWP = value; // FIXME James Check this
Q_UNUSED(value);
// readGlobalWP = value;
} }
#include "QGCActionButton.h"
#include "ui_QGCActionButton.h"
QGCActionButton::QGCActionButton(QWidget *parent) :
QGCToolWidgetItem(parent),
ui(new Ui::QGCActionButton)
{
ui->setupUi(this);
connect(ui->editFinishButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
endEditMode();
}
QGCActionButton::~QGCActionButton()
{
delete ui;
}
void QGCActionButton::startEditMode()
{
ui->editActionComboBox->show();
ui->editActionsRefreshButton->show();
ui->editFinishButton->show();
isInEditMode = true;
}
void QGCActionButton::endEditMode()
{
ui->editActionComboBox->hide();
ui->editActionsRefreshButton->hide();
ui->editFinishButton->hide();
isInEditMode = false;
}
#ifndef QGCACTIONBUTTON_H
#define QGCACTIONBUTTON_H
#include "QGCToolWidgetItem.h"
namespace Ui {
class QGCActionButton;
}
class QGCActionButton : public QGCToolWidgetItem
{
Q_OBJECT
public:
explicit QGCActionButton(QWidget *parent = 0);
~QGCActionButton();
public slots:
void startEditMode();
void endEditMode();
private:
Ui::QGCActionButton *ui;
};
#endif // QGCACTIONBUTTON_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCActionButton</class>
<widget class="QWidget" name="QGCActionButton">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>111</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="actionButton">
<property name="text">
<string>Button name</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="editActionComboBox"/>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="editActionsRefreshButton">
<property name="text">
<string>Refresh Actions</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="editFinishButton">
<property name="text">
<string>Done</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="editButtonName">
<property name="text">
<string>Button name</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLineEdit" name="editNameLabel">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>editButtonName</sender>
<signal>textChanged(QString)</signal>
<receiver>actionButton</receiver>
<slot>setWindowTitle(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>310</x>
<y>22</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>55</y>
</hint>
</hints>
</connection>
<connection>
<sender>editNameLabel</sender>
<signal>textChanged(QString)</signal>
<receiver>nameLabel</receiver>
<slot>setText(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>116</x>
<y>22</y>
</hint>
<hint type="destinationlabel">
<x>116</x>
<y>55</y>
</hint>
</hints>
</connection>
</connections>
</ui>
#include <QMenu>
#include <QContextMenuEvent>
#include "QGCParamSlider.h" #include "QGCParamSlider.h"
#include "ui_QGCParamSlider.h" #include "ui_QGCParamSlider.h"
QGCParamSlider::QGCParamSlider(QWidget *parent) : QGCParamSlider::QGCParamSlider(QWidget *parent) :
QWidget(parent), QGCToolWidgetItem(parent),
ui(new Ui::QGCParamSlider) ui(new Ui::QGCParamSlider)
{ {
ui->setupUi(this); ui->setupUi(this);
endEditMode();
connect(ui->doneButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
} }
QGCParamSlider::~QGCParamSlider() QGCParamSlider::~QGCParamSlider()
...@@ -13,6 +18,36 @@ QGCParamSlider::~QGCParamSlider() ...@@ -13,6 +18,36 @@ QGCParamSlider::~QGCParamSlider()
delete ui; delete ui;
} }
void QGCParamSlider::startEditMode()
{
ui->doneButton->show();
ui->maxLabel->show();
ui->minLabel->show();
ui->nameLineEdit->show();
ui->instructionsLabel->show();
ui->refreshParamsButton->show();
ui->selectParamComboBox->show();
ui->minSpinBox->show();
ui->maxSpinBox->show();
ui->typeComboBox->show();
isInEditMode = true;
}
void QGCParamSlider::endEditMode()
{
ui->doneButton->hide();
ui->maxLabel->hide();
ui->minLabel->hide();
ui->nameLineEdit->hide();
ui->instructionsLabel->hide();
ui->refreshParamsButton->hide();
ui->selectParamComboBox->hide();
ui->minSpinBox->hide();
ui->maxSpinBox->hide();
ui->typeComboBox->hide();
isInEditMode = false;
}
void QGCParamSlider::changeEvent(QEvent *e) void QGCParamSlider::changeEvent(QEvent *e)
{ {
QWidget::changeEvent(e); QWidget::changeEvent(e);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
public slots: public slots:
void addCurve(QString curve); void addCurve(QString curve);
void removeCurve(QString curve); void removeCurve(QString curve);
void appendData(int sysId, QString curve, double data, quint64 usec); void appendData(int uasId, QString curve, double data, quint64 usec);
void takeButtonClick(bool checked); void takeButtonClick(bool checked);
void setPlotWindowPosition(int scrollBarValue); void setPlotWindowPosition(int scrollBarValue);
void setPlotWindowPosition(quint64 position); void setPlotWindowPosition(quint64 position);
......
This diff is collapsed.
...@@ -241,7 +241,7 @@ Pixhawk3DWidget::insertWaypoint(void) ...@@ -241,7 +241,7 @@ Pixhawk3DWidget::insertWaypoint(void)
{ {
if (uas) if (uas)
{ {
Waypoint* wp; Waypoint* wp = NULL;
if (frame == MAV_FRAME_GLOBAL) if (frame == MAV_FRAME_GLOBAL)
{ {
double latitude = uas->getLatitude(); double latitude = uas->getLatitude();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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