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
R21=-0.000563
R22=0.999999
R23=0.001235
R33=-0.005926
R31=-0.005926
R32=-0.001239
R33=0.999982
Tx=-0.024287
......
......@@ -12,6 +12,7 @@ cp -r ../bin/mac/qgroundcontrol.app mac/.
cp -r ../audio mac/qgroundcontrol.app/Contents/MacOs/.
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/.
echo -e '\n\nStarting to create disk image. This may take a while..\n'
macdeployqt mac/qgroundcontrol.app -dmg
......
......@@ -16,20 +16,20 @@ LicenseData ..\license.txt
Section ""
SetOutPath $INSTDIR
File qgroundcontrol\*.*
WriteUninstaller $INSTDIR\QGroundcontrol_uninstall.exe
File ..\release\*.*
WriteUninstaller $INSTDIR\QGroundControl_uninstall.exe
SectionEnd
Section "Uninstall"
Delete $INSTDIR\QGroundcontrol_uninstall.exe
Delete $INSTDIR\QGroundControl_uninstall.exe
Delete $INSTDIR\*.*
RMDir $INSTDIR
Delete "$SMPROGRAMS\QGroundcontrol\*.*"
RMDir "$SMPROGRAMS\QGroundcontrol\"
Delete "$SMPROGRAMS\QGroundControl\*.*"
RMDir "$SMPROGRAMS\QGroundControl\"
SectionEnd
Section "create Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\QGroundcontrol"
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
CreateDirectory "$SMPROGRAMS\QGroundControl"
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
SectionEnd
\ No newline at end of file
......@@ -7,6 +7,7 @@
<!-- QGroundControl -->
<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 *** -->
<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">
google.load("earth", "1", { 'language': 'en'});
......@@ -47,8 +48,10 @@ var aircraft = [];
var attitudes = [];
var locations = [];
var trails = [];
var trail;
var lineStringPlacemark;
var trailPlacemarks = [];
var trailsVisible = [];
var trailColors = [];
//var trailPlacemarks[id];
var lineStyle;
// Aircraft class
......@@ -134,54 +137,72 @@ function createAircraft(id, type, color)
locations[id] = planeLoc;
//planeColor = color;
//createTrail(id, color);
createTrail(id, color);
console.log(color);
}
function createTrail(id, color)
{
lineStringPlacemark = ge.createPlacemark('');
trailPlacemarks[id] = ge.createPlacemark('');
// Create the placemark
// Create the LineString; set it to extend down to the ground
// and set the altitude mode
trail = ge.createLineString('');
lineStringPlacemark.setGeometry(trail);
trail.setExtrude(false);
trail.setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
trails[id] = ge.createLineString('');
trailPlacemarks[id].setGeometry(trails[id]);
trails[id].setExtrude(false);
trails[id].setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
// Add LineString points
//lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700);
// Create a style and set width and color of line
lineStringPlacemark.setStyleSelector(ge.createStyle(''));
lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle();
trailPlacemarks[id].setStyleSelector(ge.createStyle(''));
lineStyle = trailPlacemarks[id].getStyleSelector().getLineStyle();
lineStyle.setWidth(5);
lineStyle.getColor().set(planeColor);  // aabbggrr format
//lineStyle.getColor().set(color);
//lineStyle.getColor().set(color);  // aabbggrr format
trailColors[id] = color;
lineStyle.getColor().set('00000000');  // aabbggrr format
trailsVisible[id] = false;
// 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)
{
trail.setExtrude(false);
trail.setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
trails[id].setExtrude(false);
trails[id].setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
// Add LineString points
//lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700);
trail.getCoordinates().pushLatLngAlt(currLat, currLon, currAlt);
trails[id].getCoordinates().pushLatLngAlt(lat, lon, alt);
// Create a style and set width and color of line
lineStringPlacemark.setStyleSelector(ge.createStyle(''));
lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle();
trailPlacemarks[id].setStyleSelector(ge.createStyle(''));
lineStyle = trailPlacemarks[id].getStyleSelector().getLineStyle();
lineStyle.setWidth(5);
lineStyle.getColor().set(planeColor);  // aabbggrr format
lineStyle.getColor().set(trailColors[id]);  // aabbggrr format
//lineStyle.getColor().set(color);  // aabbggrr format
// Add the feature to Earth
ge.getFeatures().replaceChild(lineStringPlacemark, lineStringPlacemark);
if (trailsVisible[id] == true) ge.getFeatures().replaceChild(trailPlacemarks[id], trailPlacemarks[id]);
}
function initCallback(object)
......@@ -199,9 +220,6 @@ function initCallback(object)
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
ge.getLayerRoot().enableLayerById(ge.LAYER_TREES, true);
createTrail(220, 'bb2222ff');
createAircraft(220);
initialized = true;
......
......@@ -99,9 +99,10 @@ namespace qmapcontrol
Geometry* Layer::get_Geometry(int index)
{
Geometry* geo = NULL;
if(geometrySelected)
{
return geometrySelected;
geo = geometrySelected;
}
else
{
......@@ -110,7 +111,7 @@ namespace qmapcontrol
Geometry *geometry = geometries[i];
if(geometry->name() == QString::number(index))
{
return geometry;
geo = geometry;
}
}
......@@ -124,7 +125,7 @@ namespace qmapcontrol
// }
}
return geo;
}
bool Layer::isVisible() const
......
......@@ -112,7 +112,14 @@ namespace qmapcontrol
void LayerManager::setView(const QPointF& coordinate)
{
QPoint oldMapPx = mapmiddle_px;
mapmiddle_px = layer()->mapadapter()->coordinateToDisplay(coordinate);
scroll += mapmiddle_px - oldMapPx;
zoomImageScroll+= mapmiddle_px - oldMapPx;
mapmiddle = coordinate;
//TODO: muss wegen moveTo() raus
......@@ -125,7 +132,8 @@ namespace qmapcontrol
//TODO:
// verschiebung ausrechnen
// oder immer neues offscreenimage
newOffscreenImage();
//newOffscreenImage();
moveWidgets();
}
}
......
......@@ -29,6 +29,7 @@
# $$BASEDIR/lib/openjaus/libopenJaus/include
message(Qt version $$[QT_VERSION])
message(Using Qt from $QTDIR)
release {
# DEFINES += QT_NO_DEBUG_OUTPUT
......@@ -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 ) {
# x86 Mac OS X Leopard 10.5 and earlier
CONFIG += x86 cocoa phonon
CONFIG -= x86_64
message(Building for Mac OS X 32bit/Leopard 10.5 and earlier)
# Enable function-profiling with the OS X saturn tool
......
......@@ -145,13 +145,15 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QGCWebView.ui \
src/ui/map3D/QGCGoogleEarthView.ui \
src/ui/map3D/QGCGoogleEarthViewWin.ui \
src/ui/map3D/QGCGoogleEarthControls.ui \
src/ui/SlugsDataSensorView.ui \
src/ui/SlugsHilSim.ui \
src/ui/SlugsPIDControl.ui \
src/ui/SlugsVideoCamControl.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 \
src/ui \
......@@ -166,7 +168,8 @@ INCLUDEPATH += src \
src/ui/mavlink \
src/ui/param \
src/ui/watchdog \
src/ui/map3D
src/ui/map3D \
src/ui/designer
HEADERS += src/MG.h \
src/Core.h \
......@@ -252,7 +255,11 @@ HEADERS += src/MG.h \
src/ui/SlugsPadCameraControl.h \
src/ui/QGCMainWindowAPConfigurator.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
macx|win32-msvc2008: {
......@@ -369,7 +376,11 @@ SOURCES += src/main.cc \
src/ui/SlugsPadCameraControl.cpp \
src/ui/QGCMainWindowAPConfigurator.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: {
SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
......@@ -122,6 +122,7 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
#endif
// MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(MG::DIR::getSupportFilesDirectory() + "/demo-log.txt");
MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(":/demo-log.txt");
simulationLink->disconnect();
//mainWindow->addLink(simulationLink);
mainWindow = MainWindow::instance();
......
......@@ -30,6 +30,7 @@ This file is part of the QGROUNDCONTROL project
*/
#include <QApplication>
#include <QSettings>
#include <QTemporaryFile>
#include "GAudioOutput.h"
#include "MG.h"
......@@ -85,10 +86,19 @@ GAudioOutput* GAudioOutput::instance()
return _instance;
}
#define QGC_GAUDIOOUTPUT_KEY QString("QGC_AUDIOOUTPUT_")
GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent),
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
flite_init();
#endif
......@@ -134,13 +144,28 @@ emergency(false)
GAudioOutput::~GAudioOutput()
{
QSettings settings;
settings.setValue(QGC_GAUDIOOUTPUT_KEY+"muted", muted);
settings.sync();
#ifdef _MSC_VER2
::CoUninitialize();
#endif
}
void GAudioOutput::mute(bool mute)
{
this->muted = mute;
}
bool GAudioOutput::isMuted()
{
return this->muted;
}
bool GAudioOutput::say(QString text, int severity)
{
if (!muted)
{
// TODO Add severity filter
Q_UNUSED(severity);
bool res = false;
......@@ -183,13 +208,18 @@ bool GAudioOutput::say(QString text, int severity)
}
return res;
}
else
{
return false;
}
}
/**
* @param text This message will be played after the alert beep
*/
bool GAudioOutput::alert(QString text)
{
if (!emergency)
if (!emergency || !muted)
{
// Play alert sound
beep();
......@@ -205,19 +235,25 @@ bool GAudioOutput::alert(QString text)
void GAudioOutput::notifyPositive()
{
if (!muted)
{
// Use QFile to transform path for all OS
QFile f(QCoreApplication::applicationDirPath()+QString("/audio/double_notify.wav"));
m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
m_media->play();
}
}
void GAudioOutput::notifyNegative()
{
if (!muted)
{
// Use QFile to transform path for all OS
QFile f(QCoreApplication::applicationDirPath()+QString("/audio/flat_notify.wav"));
m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
m_media->play();
}
}
/**
* The emergency sound will be played continously during the emergency.
......@@ -232,7 +268,7 @@ bool GAudioOutput::startEmergency()
{
emergency = true;
// Beep immediately and then start timer
beep();
if (!muted) beep();
emergencyTimer->start(1500);
QTimer::singleShot(5000, this, SLOT(stopEmergency()));
}
......@@ -257,11 +293,14 @@ bool GAudioOutput::stopEmergency()
void GAudioOutput::beep()
{
if (!muted)
{
// Use QFile to transform path for all OS
QFile f(QCoreApplication::applicationDirPath()+QString("/audio/alert.wav"));
m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
m_media->play();
}
}
void GAudioOutput::selectFemaleVoice()
{
......
......@@ -99,6 +99,10 @@ public slots:
void notifyPositive();
/** @brief Notify about negative event */
void notifyNegative();
/** @brief Mute/unmute sound */
void mute(bool mute);
/** @brief Get the mute state */
bool isMuted();
protected:
#ifdef Q_OS_MAC
......@@ -112,6 +116,7 @@ protected:
Phonon::AudioOutput* m_audioOutput;
bool emergency; ///< Emergency status flag
QTimer* emergencyTimer;
bool muted;
private:
GAudioOutput(QObject* parent=NULL);
~GAudioOutput();
......
......@@ -11,6 +11,7 @@ namespace QGC
const QColor colorGreen(20, 200, 20);
const QColor colorYellow(255, 255, 0);
const QColor colorDarkYellow(180, 180, 0);
const QColor colorBackground("#050508");
/** @brief Get the current ground time in microseconds */
quint64 groundTimeUsecs();
......
......@@ -42,6 +42,7 @@ along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
class LinkInterface : public QThread {
Q_OBJECT
public:
LinkInterface(QObject* parent = 0) : QThread(parent) {}
//virtual ~LinkInterface() = 0;
/* Connection management */
......
......@@ -33,6 +33,7 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug>
#include <QTime>
#include <QApplication>
#include <QMessageBox>
#include "MG.h"
#include "MAVLinkProtocol.h"
......@@ -45,6 +46,7 @@ This file is part of the QGROUNDCONTROL project
#include "ArduPilotMegaMAV.h"
#include "configuration.h"
#include "LinkManager.h"
#include "MainWindow.h"
#include <QGCMAVLink.h>
#include "QGC.h"
......@@ -141,8 +143,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// of its existence, as it only then can send and receive
// 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())
{
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)
// First create new UAS object
// Decode heartbeat message
mavlink_heartbeat_t heartbeat;
// Reset version field to 0
heartbeat.mavlink_version = 0;
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)
{
case MAV_AUTOPILOT_GENERIC:
......
......@@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project
* @param writeFile The received messages are written to that file
* @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),
timeOffset(0)
{
......@@ -289,16 +289,19 @@ void MAVLinkSimulationLink::mainloop()
if (keys.value(i, "") == "Gyro_Phi")
{
rawImuValues.xgyro = d;
attitude.rollspeed = ((d-29.000)/15000.0)*2.7-2.7-2.65;
}
if (keys.value(i, "") == "Gyro_Theta")
{
rawImuValues.ygyro = d;
attitude.pitchspeed = ((d-29.000)/15000.0)*2.7-2.7-2.65;
}
if (keys.value(i, "") == "Gyro_Psi")
{
rawImuValues.zgyro = d;
attitude.yawspeed = ((d-29.000)/3000.0)*2.7-2.7-2.65;
}
#ifdef MAVLINK_ENABLED_PIXHAWK
if (keys.value(i, "") == "Pressure")
......@@ -419,6 +422,20 @@ void MAVLinkSimulationLink::mainloop()
memcpy(stream+streampointer,buffer, 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;
if (rcCounter == 2)
{
......@@ -431,6 +448,7 @@ void MAVLinkSimulationLink::mainloop()
chan.chan6_raw = (chan.chan3_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.rssi = 100;
messageSize = mavlink_msg_rc_channels_raw_encode(systemId, componentId, &msg, &chan);
// Allocate buffer with packet data
bufferlength = mavlink_msg_to_send_buffer(buffer, &msg);
......@@ -594,6 +612,16 @@ void MAVLinkSimulationLink::mainloop()
memcpy(stream+streampointer,buffer, 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
mavlink_sys_status_t status2;
status2.mode = MAV_MODE_LOCKED;
......
......@@ -47,7 +47,7 @@ class MAVLinkSimulationLink : public LinkInterface
{
Q_OBJECT
public:
MAVLinkSimulationLink(QString readFile="", QString writeFile="", int rate=5);
MAVLinkSimulationLink(QString readFile="", QString writeFile="", int rate=5, QObject* parent = 0);
~MAVLinkSimulationLink();
bool isConnected();
qint64 bytesAvailable();
......@@ -128,7 +128,7 @@ protected:
void enqueue(uint8_t* stream, uint8_t* index, mavlink_message_t* msg);
static const uint8_t systemId = 220;
static const uint8_t componentId = 0;
static const uint8_t componentId = 200;
static const uint16_t version = 1000;
signals:
......
#include "MAVLinkSwarmSimulationLink.h"
MAVLinkSwarmSimulationLink::MAVLinkSwarmSimulationLink(QObject *parent) :
MAVLinkSimulationLink()
MAVLinkSwarmSimulationLink::MAVLinkSwarmSimulationLink(QString readFile, QString writeFile, int rate, QObject *parent) :
MAVLinkSimulationLink(readFile, writeFile, rate, parent)
{
}
......
......@@ -7,7 +7,7 @@ class MAVLinkSwarmSimulationLink : public MAVLinkSimulationLink
{
Q_OBJECT
public:
explicit MAVLinkSwarmSimulationLink(QObject *parent = 0);
MAVLinkSwarmSimulationLink(QString readFile="", QString writeFile="", int rate=5, QObject *parent = 0);
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
......@@ -58,34 +38,16 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
// Set unique ID and add link to the list of links
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
port = new QextSerialPort(porthandle, QextSerialPort::Polling);
//port = new QextSerialPort(porthandle, QextSerialPort::EventDriven);
if (settings.contains("SERIALLINK_COMM_PORT"))
{
setBaudRate(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());
}
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.
}
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->setBaudRate(baudrate);
port->setFlowControl(flow);
......@@ -96,7 +58,7 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
// Set the port name
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());
}
else
......@@ -134,6 +96,33 @@ SerialLink::~SerialLink()
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
......@@ -189,13 +178,13 @@ void SerialLink::writeBytes(const char* data, qint64 size)
// Increase write counter
bitsSentTotal += size * 8;
// int i;
// for (i=0; i<size; i++)
// {
// unsigned char v=data[i];
// int i;
// for (i=0; i<size; i++)
// {
// unsigned char v=data[i];
// //fprintf(stderr,"%02x ", v);
// }
// //fprintf(stderr,"%02x ", v);
// }
}
}
......@@ -321,18 +310,12 @@ bool SerialLink::hardwareConnect()
statisticsMutex.unlock();
bool connectionUp = isConnected();
if(connectionUp) {
if(connectionUp)
{
emit connected();
emit connected(true);
// Store settings
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();
writeSettings();
}
return connectionUp;
......@@ -376,7 +359,8 @@ void SerialLink::setName(QString name)
qint64 SerialLink::getNominalDataRate()
{
qint64 dataRate = 0;
switch (baudrate) {
switch (baudrate)
{
case BAUD50:
dataRate = 50;
break;
......@@ -442,6 +426,13 @@ qint64 SerialLink::getNominalDataRate()
break;
case BAUD256000:
dataRate = 256000;
// Windows-specific high-end baudrates
case BAUD230400:
dataRate = 230400;
case BAUD460800:
dataRate = 460800;
case BAUD921600:
dataRate = 921600;
break;
}
return dataRate;
......@@ -543,7 +534,8 @@ bool SerialLink::setPortName(QString portName)
if(portName.trimmed().length() > 0)
{
bool reconnect = false;
if(isConnected()) {
if(isConnected())
{
disconnect();
reconnect = true;
}
......@@ -650,8 +642,17 @@ bool SerialLink::setBaudRateType(int rateIndex)
baudrate = BAUD128000;
break;
case 21:
baudrate = BAUD230400;
break;
case 22:
baudrate = BAUD256000;
break;
case 23:
baudrate = BAUD460800;
break;
case 24:
baudrate = BAUD921600;
break;
default:
// If none of the above cases matches, there must be an error
accepted = false;
......@@ -671,12 +672,14 @@ bool SerialLink::setBaudRate(int rate)
{
bool reconnect = false;
bool accepted = true; // This is changed if none of the data rates matches
if(isConnected()) {
if(isConnected())
{
disconnect();
reconnect = true;
}
switch (rate) {
switch (rate)
{
case 50:
baudrate = BAUD50;
break;
......@@ -740,9 +743,18 @@ bool SerialLink::setBaudRate(int rate)
case 128000:
baudrate = BAUD128000;
break;
case 230400:
baudrate = BAUD230400;
break;
case 256000:
baudrate = BAUD256000;
break;
case 460800:
baudrate = BAUD460800;
break;
case 921600:
baudrate = BAUD921600;
break;
default:
// If none of the above cases matches, there must be an error
accepted = false;
......@@ -765,12 +777,14 @@ bool SerialLink::setFlowType(int flow)
{
bool reconnect = false;
bool accepted = true;
if(isConnected()) {
if(isConnected())
{
disconnect();
reconnect = true;
}
switch (flow) {
switch (flow)
{
case FLOW_OFF:
this->flow = FLOW_OFF;
break;
......@@ -794,12 +808,14 @@ bool SerialLink::setParityType(int parity)
{
bool reconnect = false;
bool accepted = true;
if(isConnected()) {
if(isConnected())
{
disconnect();
reconnect = true;
}
switch (parity) {
switch (parity)
{
case PAR_NONE:
this->parity = PAR_NONE;
break;
......@@ -826,11 +842,14 @@ bool SerialLink::setParityType(int parity)
return accepted;
}
// FIXME Works not as anticipated by user!
bool SerialLink::setDataBitsType(int dataBits)
{
bool accepted = true;
switch (dataBits) {
switch (dataBits)
{
case 5:
this->dataBits = DATA_5;
break;
......@@ -858,6 +877,7 @@ bool SerialLink::setDataBitsType(int dataBits)
return accepted;
}
// FIXME WORKS NOT AS ANTICIPATED BY USER!
bool SerialLink::setStopBitsType(int stopBits)
{
bool reconnect = false;
......@@ -867,7 +887,8 @@ bool SerialLink::setStopBitsType(int stopBits)
reconnect = true;
}
switch (stopBits) {
switch (stopBits)
{
case 1:
this->stopBits = STOP_1;
break;
......
......@@ -91,6 +91,9 @@ public:
qint64 getBitsSent();
qint64 getBitsReceived();
void loadSettings();
void writeSettings();
void run();
int getLinkQuality();
......
......@@ -57,6 +57,8 @@ public slots:
virtual bool setParityType(int parity) = 0;
virtual bool setDataBitsType(int dataBits) = 0;
virtual bool setStopBitsType(int stopBits) = 0;
virtual void loadSettings() = 0;
virtual void writeSettings() = 0;
};
......
......@@ -92,8 +92,11 @@ enum BaudRateType
BAUD57600,
BAUD76800, //POSIX ONLY
BAUD115200,
BAUD128000, //WINDOWS ONLY
BAUD256000 //WINDOWS ONLY
BAUD128000, // WINDOWS ONLY
BAUD230400, // WINDOWS ONLY
BAUD256000, // WINDOWS ONLY
BAUD460800, // WINDOWS ONLY
BAUD921600 // WINDOWS ONLY
};
enum DataBitsType
......
......@@ -5,6 +5,16 @@
#include <windows.h>
#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*/
#ifdef _TTY_NOWARN_
......
......@@ -54,11 +54,11 @@ void ArduPilotMegaMAV::receiveMessage(LinkInterface* link, mavlink_message_t mes
{
case MAVLINK_MSG_ID_HEARTBEAT:
{
qDebug() << "ARDUPILOT RECEIVED HEARTBEAT";
//qDebug() << "ARDUPILOT RECEIVED HEARTBEAT";
break;
}
default:
qDebug() << "\nARDUPILOT RECEIVED MESSAGE WITH ID" << message.msgid;
//qDebug() << "\nARDUPILOT RECEIVED MESSAGE WITH ID" << message.msgid;
break;
}
}
......
This diff is collapsed.
......@@ -153,6 +153,8 @@ protected:
double pitch;
double yaw;
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 */
void setBattery(BatteryType type, int cells);
......@@ -199,7 +201,7 @@ public slots:
//void requestWaypoints(); FIXME tbd
//void clearWaypointList(); FIXME tbd
void requestParameters();
/** @brief Enable the motors */
void enable_motors();
/** @brief Disable the motors */
......@@ -230,6 +232,9 @@ public slots:
/** @brief Set current mode of operation, e.g. auto or manual */
void setMode(int mode);
/** @brief Request all parameters */
void requestParameters();
/** @brief Set a system parameter */
void setParameter(int component, QString id, float value);
......@@ -238,6 +243,12 @@ public slots:
/** @brief Read parameters from permanent storage */
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 enableRawSensorDataTransmission(int rate);
void enableExtendedSystemStatusTransmission(int rate);
......
......@@ -126,6 +126,7 @@ public:
///> Map will start from beginning when the first 20 colors are exceeded
colors.append(QColor(231,72,28));
colors.append(QColor(104,64,240));
colors.append(QColor(203,254,121));
colors.append(QColor(161,252,116));
colors.append(QColor(232,33,47));
......@@ -140,11 +141,10 @@ public:
colors.append(QColor(87,231,246));
colors.append(QColor(151,59,239));
colors.append(QColor(81,183,244));
colors.append(QColor(104,64,240));
colors.append(QColor(75,133,243));
colors.append(QColor(242,255,128));
colors.append(QColor(230,126,23));
nextColor++;
nextColor = 0;
}
return colors[nextColor++];
}
......
......@@ -104,12 +104,12 @@ QList<UASInterface*> UASManager::getUASList()
UASInterface* UASManager::getActiveUAS()
{
if(!activeUAS)
{
QMessageBox msgBox;
msgBox.setText(tr("No Micro Air Vehicle connected. Please connect one first."));
msgBox.exec();
}
// if(!activeUAS)
// {
// QMessageBox msgBox;
// msgBox.setText(tr("No Micro Air Vehicle connected. Please connect one first."));
// msgBox.exec();
// }
return activeUAS; ///< Return zero pointer if no UAS has been loaded
}
......
......@@ -394,11 +394,14 @@ void UASWaypointManager::loadWaypoints(const QString &loadFile)
void UASWaypointManager::globalAddWaypoint(Waypoint *wp)
{
// FIXME Will be removed
Q_UNUSED(wp);
}
int UASWaypointManager::globalRemoveWaypoint(quint16 seq)
{
// FIXME Will be removed
Q_UNUSED(seq);
return 0;
}
......
This diff is collapsed.
......@@ -37,6 +37,7 @@ This file is part of the QGROUNDCONTROL project
#include <QTimer>
#include <QFontDatabase>
#include <QMap>
#include <QContextMenuEvent>
#include <QPair>
#include <cmath>
......@@ -58,14 +59,31 @@ class HDDisplay : public QGraphicsView
{
Q_OBJECT
public:
HDDisplay(QStringList* plotList, QWidget *parent = 0);
HDDisplay(QStringList* plotList, QString title="", QWidget *parent = 0);
~HDDisplay();
public slots:
/** @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);
/** @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:
void enableGLRendering(bool enable);
//void render(QPainter* painter, const QRectF& target = QRectF(), const QRect& source = QRect(), Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio);
......@@ -73,10 +91,13 @@ protected slots:
void triggerUpdate();
protected:
void changeEvent(QEvent *e);
void paintEvent(QPaintEvent * event);
void changeEvent(QEvent* e);
void paintEvent(QPaintEvent* event);
void showEvent(QShowEvent* event);
void hideEvent(QHideEvent* event);
void contextMenuEvent(QContextMenuEvent* event);
QList<QAction*> getItemRemoveActions();
void createActions();
float refLineWidthToPen(float line);
float refToScreenX(float x);
float refToScreenY(float y);
......@@ -155,6 +176,11 @@ protected:
QStringList* acceptList; ///< Variable names to plot
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:
Ui::HDDisplay *m_ui;
......
......@@ -46,7 +46,7 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug>
HSIDisplay::HSIDisplay(QWidget *parent) :
HDDisplay(NULL, parent),
HDDisplay(NULL, "", parent),
gpsSatellites(),
satellitesUsed(0),
attXSet(0),
......
......@@ -26,6 +26,7 @@
#include "MainWindow.h"
#include "JoystickWidget.h"
#include "GAudioOutput.h"
#include "QGCToolWidget.h"
#ifdef QGC_OSG_ENABLED
#include "Q3DWidgetFactory.h"
......@@ -107,6 +108,11 @@ MainWindow::MainWindow(QWidget *parent):
// Create actions
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
setDockOptions(AnimatedDocks | AllowTabbedDocks | AllowNestedDocks);
......@@ -201,17 +207,19 @@ void MainWindow::buildPxWidgets()
{
//FIXME: memory of acceptList will never be freed again
QStringList* acceptList = new QStringList();
acceptList->append("roll IMU");
acceptList->append("pitch IMU");
acceptList->append("yaw IMU");
acceptList->append("rollspeed IMU");
acceptList->append("pitchspeed IMU");
acceptList->append("yawspeed IMU");
acceptList->append("-180,roll (deg),+180");
acceptList->append("-180,pitch (deg),+180");
acceptList->append("-180,yaw (deg),+180");
acceptList->append("-500,roll V (deg/s),+500");
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
QStringList* acceptList2 = new QStringList();
acceptList2->append("Battery");
acceptList2->append("Pressure");
acceptList2->append("0,Abs pressure,65500");
acceptList2->append("-2000,Accel. X, 2000");
acceptList2->append("-2000,Accel. Y, 2000");
if (!linechartWidget)
{
......@@ -290,15 +298,15 @@ void MainWindow::buildPxWidgets()
if (!headDown1DockWidget)
{
headDown1DockWidget = new QDockWidget(tr("System Stats"), this);
headDown1DockWidget->setWidget( new HDDisplay(acceptList, this) );
headDown1DockWidget = new QDockWidget(tr("Flight Display"), this);
headDown1DockWidget->setWidget( new HDDisplay(acceptList, "Flight Display", this) );
addToToolsMenu (headDown1DockWidget, tr("Flight Display"), SLOT(showToolWidget()), MENU_HDD_1, Qt::RightDockWidgetArea);
}
if (!headDown2DockWidget)
{
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);
}
......@@ -694,7 +702,16 @@ void MainWindow::connectCommonWidgets()
// 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)));
}
}
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()
......
......@@ -140,6 +140,9 @@ public slots:
/** @brief Reload the CSS style sheet */
void reloadStylesheet();
/** @brief Add a custom tool widget */
void createCustomWidget();
void closeEvent(QCloseEvent* event);
/*
......
......@@ -46,6 +46,8 @@
<string>File</string>
</property>
<addaction name="actionJoystick_Settings"/>
<addaction name="actionNewCustomWidget"/>
<addaction name="actionMuteAudioOutput"/>
<addaction name="actionSimulate"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
......@@ -108,7 +110,6 @@
<addaction name="menuPerspectives"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionExit">
<property name="icon">
......@@ -430,6 +431,27 @@
<string>Pilot</string>
</property>
</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>
<layoutdefault spacing="6" margin="11"/>
<resources>
......@@ -454,5 +476,3 @@
</connection>
</connections>
</ui>
This diff is collapsed.
......@@ -81,6 +81,10 @@ protected:
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);
void resizeEvent(QResizeEvent* event);
/** @brief Start widget updating */
void showEvent(QShowEvent* event);
/** @brief Stop widget updating */
void hideEvent(QHideEvent* event);
QAction* osmAction;
QAction* yahooActionMap;
......
......@@ -10,7 +10,7 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent
/* Add title */
QHBoxLayout *titleLayout = new QHBoxLayout();
QLabel *title;
QLabel* title;
if (type == AILERON)
{
title = new QLabel(tr("Aileron"));
......@@ -23,6 +23,10 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent
{
title = new QLabel(tr("Rudder"));
}
else
{
title = new QLabel(tr("Unknown"));
}
titleLayout->addWidget(title);
grid->addLayout(titleLayout, 0, 0, 1, 3, Qt::AlignHCenter);
......
......@@ -55,6 +55,9 @@ const QVector<float>& RadioCalibrationData::operator ()(int i) const
return (*data)[i];
}
// FIXME Bryan
// FIXME James
// This is not good. If it is ever used after being returned it will cause a crash
// return QVector<float>();
}
......
......@@ -84,6 +84,9 @@ void RadioCalibrationWindow::setChannelRaw(int ch, float raw)
void RadioCalibrationWindow::setChannelScaled(int ch, float normalized)
{
// FIXME James
// FIXME Bryan
// /** this expects a particular channel to function mapping
// \todo allow run-time channel mapping
// */
......
......@@ -234,6 +234,7 @@ userConfigured(false)
if(serialLink != 0)
{
serialLink->loadSettings();
this->link = serialLink;
// Setup the user interface according to link type
......
......@@ -159,11 +159,26 @@
<string>128000</string>
</property>
</item>
<item>
<property name="text">
<string>230400</string>
</property>
</item>
<item>
<property name="text">
<string>256000</string>
</property>
</item>
<item>
<property name="text">
<string>460800</string>
</property>
</item>
<item>
<property name="text">
<string>921600</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
......
......@@ -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;
mavlink_message_t msg;
......@@ -144,7 +146,6 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){
// GPS
mavlink_gps_raw_t tmpGpsRaw;
#ifdef MAVLINK_ENABLED_SLUGS
mavlink_gps_date_time_t tmpGpsTime;
tmpGpsTime.year = datagram->at(i++);
......@@ -167,7 +168,6 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){
mavlink_msg_gps_date_time_encode(MG::SYSTEM::ID,MG::SYSTEM::COMPID, &msg, &tmpGpsTime);
activeUas->sendMessage(hilLink, msg);
#endif
memset(&msg, 0, sizeof(mavlink_message_t));
......@@ -180,6 +180,9 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){
ui->ed_1->setText(QString::number(tmpGpsRaw.hdg));
ui->ed_2->setText(QString::number(tmpGpsRaw.v));
ui->ed_3->setText(QString::number(tmpGpsRaw.eph));
#else
Q_UNUSED(datagram);
#endif
}
float SlugsHilSim::getFloatFromDatagram (const QByteArray* datagram, unsigned char * i){
......@@ -205,4 +208,5 @@ uint16_t SlugsHilSim::getUint16FromDatagram (const QByteArray* datagram, unsigne
void SlugsHilSim::linkSelected(int cbIndex){
//hilLink = linksAvailable
// FIXME Mariano
}
......@@ -640,6 +640,8 @@ void SlugsPIDControl::sendMessagePIDStatus(int PIDtype)
}
}
#else
Q_UNUSED(PIDtype);
#endif // MAVLINK_ENABLED_SLUG
}
......
......@@ -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)
{
double cateto_opuesto,cateto_adyacente, hipotenusa, distancia, marcacion;
double cateto_opuesto,cateto_adyacente, hipotenusa, distancia;
double marcacion = 0.0;
//latitude and longitude first point
......@@ -234,7 +235,7 @@ QPointF SlugsPadCameraControl::ObtenerMarcacionDistanciaPixel(double lon1, doubl
cateto_adyacente = abs((lon1-lon2));
hipotenusa = sqrt(pow(cateto_opuesto,2) + pow(cateto_adyacente,2));
distancia = hipotenusa*60;
distancia = hipotenusa*60.0;
if ((lat1 < lat2) && (lon1 > lon2)) //primer cuadrante
......
......@@ -570,5 +570,7 @@ void WaypointList::setIsLoadFileWP()
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 "ui_QGCParamSlider.h"
QGCParamSlider::QGCParamSlider(QWidget *parent) :
QWidget(parent),
QGCToolWidgetItem(parent),
ui(new Ui::QGCParamSlider)
{
ui->setupUi(this);
endEditMode();
connect(ui->doneButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
}
QGCParamSlider::~QGCParamSlider()
......@@ -13,6 +18,36 @@ QGCParamSlider::~QGCParamSlider()
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)
{
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:
public slots:
void addCurve(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 setPlotWindowPosition(int scrollBarValue);
void setPlotWindowPosition(quint64 position);
......
This diff is collapsed.
......@@ -241,7 +241,7 @@ Pixhawk3DWidget::insertWaypoint(void)
{
if (uas)
{
Waypoint* wp;
Waypoint* wp = NULL;
if (frame == MAV_FRAME_GLOBAL)
{
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