Commit 8e0714eb authored by Mariano Lizarraga's avatar Mariano Lizarraga

Merge branch 'experimental' of github.com:pixhawk/qgroundcontrol into experimental

parents 9d08a152 ed692bfd
*Makefile*
tags
build
Info.plist
obj
*.log
*~
*qtc*
bin/*.exe
bin/*.txt
bin/mac
*pro.user*
qrc_*.cpp
*.Debug
*.Release
tmp
debug
release
qgroundcontrol
mavlinkgen
*.wav
qgroundcontrol.xcodeproj/**
doc/html
doc/doxy.log
deploy/mac
deploy/linux
controller_log*
user_config.pri
*.app
*Makefile*
tags
build
Info.plist
obj
*.log
*~
*qtc*
bin/*.exe
bin/*.txt
bin/mac
*pro.user*
qrc_*.cpp
*.Debug
*.Release
tmp
debug
release
qgroundcontrol
mavlinkgen
*.wav
qgroundcontrol.xcodeproj/**
doc/html
doc/doxy.log
deploy/mac
deploy/linux
deploy/qgroundcontrol*
controller_log*
user_config.pri
*.app
*.ncb
*.vcproj
......@@ -39,4 +40,4 @@ user_config.pri
*.project
*.cproject
*.sln
*.suo
\ No newline at end of file
*.suo
......@@ -7,6 +7,8 @@ Files:
http://github.com/pixhawk/qgroundcontrol
http://github.com/pixhawk/mavlink
Credits:
http://qgroundcontrol.org/credits
**********************************************************************************************
* PLEASE NOTE: YOU NEED TO DOWNLOAD THE MAVLINK LIBRARY IN ORDER TO COMPILE THIS APPLICATION *
......@@ -49,9 +51,9 @@ Linux
To build on Linux:
sudo apt-get install phonon libqt4-dev libqt4-phonon-dev \
libqt4-phonon libphonon-dev libphonon4 phonon-backend-gstreamer \
qt-creator libsdl1.2-dev libflite1 flite1-dev
sudo apt-get install phonon libqt4-dev \
libphonon-dev libphonon4 phonon-backend-gstreamer \
qtcreator libsdl1.2-dev libflite1 flite1-dev build-essential
cd directory
......
#!/bin/sh
# Clean build directories
rm -rf mac
mkdir -p mac
# Change to build directory and compile application
cd ..
make -j4
# Copy and build the application bundle
cd deploy
cp -r ../bin/mac/qgroundcontrol.app mac/.
cp -r ../../qgroundcontrol-build-desktop/qgroundcontrol.app .
cp -r ../audio mac/qgroundcontrol.app/Contents/MacOs/.
mkdir -p mac/qgroundcontrol.app/Contents/Frameworks/
cp -r ../audio qgroundcontrol.app/Contents/MacOs/.
mkdir -p qgroundcontrol.app/Contents/Frameworks/
# SDL is not copied by Qt - for whatever reason
cp -r SDL.framework mac/qgroundcontrol.app/Contents/Frameworks/.
cp -r /Library/Frameworks/SDL.framework qgroundcontrol.app/Contents/Frameworks/.
echo -e '\n\nStarting to create disk image. This may take a while..\n'
macdeployqt mac/qgroundcontrol.app -dmg
rm -rf mac/qgroundcontrol.app
macdeployqt qgroundcontrol.app -dmg
rm -rf qgroundcontrol.app
echo -e '\n\n QGroundControl .DMG file is now ready for publishing\n'
This diff is collapsed.
......@@ -356,3 +356,38 @@ QProgressBar::chunk#speedBar {
QProgressBar::chunk#thrustBar {
background-color: orange;
}
QDialog {
border: 1px solid #62676B;
border-radius: 2px;
}
QTabWidget::pane { /* The tab widget frame */
border: 1px solid #62676B;
border-radius: 2px;
position: absolute;
top: -0.5em;
}
QTabWidget::tab-bar {
alignment: center;
}
/* Style the tab using the tab sub-control. Note that
it reads QTabBar _not_ QTabWidget */
QTabBar::tab {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #090909, stop: 1 #353535);
border: 2px solid #62676B;
border-radius: 4px;
min-width: 8ex;
padding: 2px;
}
QTabBar::tab:selected, QTabBar::tab:hover {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #090909, stop: 1 #353535);
border: 2px solid #379AC3;
}
QTabBar::tab:selected {
border: 2px solid #379AC3;
}
......@@ -49,7 +49,7 @@ border: 1px solid #111111;
}
QCheckBox::indicator:checked {
background-color: #222222;
background-color: #333333;
}
QCheckBox::indicator:checked:hover {
......@@ -92,12 +92,14 @@ border: 1px solid #111111;
/* titlebar-close-icon: url(close.png);
titlebar-normal-icon: url(undock.png);*/
}
QDockWidget::title {
text-align: left; /* align the text to the left */
background: lightgray;
padding-left: 5px;
}
text-align: left;
background: #EEEEEE;
color: #111111;
padding-left: 5px;
height: 10px;
border-bottom: 1px solid #222222;
}
QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid transparent;
......@@ -120,15 +122,6 @@ QDockWidget::close-button, QDockWidget::float-button {
color: #EEEEEE;
}
QDockWidget::title {
text-align: left;
background: #121214;
color: #4A4A4F;
padding-left: 5px;
height: 10px;
border-bottom: 1px solid #222222;
}
QSeparator {
color: #EEEEEE;
}
......@@ -184,7 +177,7 @@ QPushButton {
border-radius: 5px;
padding-left: 10px;
padding-right: 10px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208);
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C3C2C8, stop: 1 #828288);
}
QPushButton:checked {
......@@ -202,7 +195,7 @@ QToolButton {
max-height: 18px;
border: 2px solid #4A4A4F;
border-radius: 5px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208);
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C3C2C8, stop: 1 #828288);
}
QToolButton:checked {
......
......@@ -63,10 +63,10 @@ namespace qmapcontrol
void MapNetwork::requestFinished(int id, bool error)
{
// sleep(1);
// qDebug() << "MapNetwork::requestFinished" << http->state() << ", id: " << id;
qDebug() << "QMapControl: MapNetwork::requestFinished" << http->state() << ", id: " << id;
if (error)
{
qDebug() << "network error: " << http->errorString();
qDebug() << "QMapControl: network error: " << http->errorString();
//restart query
}
......@@ -79,7 +79,7 @@ namespace qmapcontrol
QString url = loadingMap[id];
loadingMap.remove(id);
vectorMutex.unlock();
// qDebug() << "request finished for id: " << id << ", belongs to: " << notifier.url << endl;
//qDebug() << "QMapControl: request finished for id: " << id << ", belongs to: " << notifier.url << endl;
QByteArray ax;
if (http->bytesAvailable()>0)
......@@ -87,17 +87,20 @@ namespace qmapcontrol
QPixmap pm;
ax = http->readAll();
qDebug() << "QMapControl: Request consisted of " << ax.size() << "bytes";
if (pm.loadFromData(ax))
{
loaded += pm.size().width()*pm.size().height()*pm.depth()/8/1024;
// qDebug() << "Network loaded: " << (loaded);
qDebug() << "QMapControl: Network loaded: " << (loaded);
parent->receivedImage(pm, url);
}
else if (pm.width() == 0 || pm.height() == 0)
{
// Silently ignore map request for a
// 0xn pixel map
qDebug() << "QMapControl: IGNORED 0x0 pixel map request, widthxheight:" << pm.width() << "x" << pm.height();
qDebug() << "QMapControl: HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
}
else
{
......@@ -105,7 +108,7 @@ namespace qmapcontrol
// TODO Error is currently undetected
//qDebug() << "NETWORK_PIXMAP_ERROR: " << ax;
qDebug() << "QMapControl external library: ERROR loading map:" << "width:" << pm.width() << "heigh:" << pm.height() << "at " << __FILE__ << __LINE__;
//qDebug() << "HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
qDebug() << "QMapControl: HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
}
}
......
......@@ -85,6 +85,7 @@
<file>images/earth.html</file>
<file>images/mapproviders/googleearth.svg</file>
<file>images/contrib/slugs.png</file>
<file>images/style-outdoor.css</file>
</qresource>
<qresource prefix="/general">
<file alias="vera.ttf">images/Vera.ttf</file>
......
......@@ -6,14 +6,15 @@ UASUnitTest::UASUnitTest()
void UASUnitTest::initTestCase()
{
mav= new MAVLinkProtocol();
uas=new UAS(mav,UASID);
mav= new MAVLinkProtocol();
link = new SerialLink();
uas=new UAS(mav,UASID);
}
void UASUnitTest::cleanupTestCase()
{
delete uas;
delete mav;
delete uas;
delete mav;
}
......@@ -34,123 +35,244 @@ void UASUnitTest::getUASID_test()
void UASUnitTest::getUASName_test()
{
// Test that the name is build as MAV + ID
QCOMPARE(uas->getUASName(), "MAV 0" + QString::number(UASID));
// Test that the name is build as MAV + ID
QCOMPARE(uas->getUASName(), "MAV 0" + QString::number(UASID));
}
void UASUnitTest::getUpTime_test()
{
UAS* uas2 = new UAS(mav);
// Test that the uptime starts at zero to a
// precision of seconds
QCOMPARE(floor(uas2->getUptime()/1000.0), 0.0);
UAS* uas2 = new UAS(mav);
// Test that the uptime starts at zero to a
// precision of seconds
QCOMPARE(floor(uas2->getUptime()/1000.0), 0.0);
// Sleep for three seconds
QTest::qSleep(3000);
// Sleep for three seconds
QTest::qSleep(3000);
// Test that the up time is computed correctly to a
// precision of seconds
QCOMPARE(floor(uas2->getUptime()/1000.0), 3.0);
// Test that the up time is computed correctly to a
// precision of seconds
QCOMPARE(floor(uas2->getUptime()/1000.0), 3.0);
delete uas2;
delete uas2;
}
void UASUnitTest::getCommunicationStatus_test()
{
// Verify that upon construction the Comm status is disconnected
QCOMPARE(uas->getCommunicationStatus(), static_cast<int>(UASInterface::COMM_DISCONNECTED));
// Verify that upon construction the Comm status is disconnected
QCOMPARE(uas->getCommunicationStatus(), static_cast<int>(UASInterface::COMM_DISCONNECTED));
}
void UASUnitTest::filterVoltage_test()
{
float verificar=uas->filterVoltage(0.4f);
// Verify that upon construction the Comm status is disconnected
QCOMPARE(verificar, 8.52f);
// Verify that upon construction the Comm status is disconnected
QCOMPARE(verificar, 8.52f);
}
void UASUnitTest:: getAutopilotType_test()
{
int verificar=uas->getAutopilotType();
// Verify that upon construction the autopilot is set to -1
QCOMPARE(verificar, -1);
int type = uas->getAutopilotType();
// Verify that upon construction the autopilot is set to -1
QCOMPARE(type, -1);
}
void UASUnitTest::setAutopilotType_test()
{
uas->setAutopilotType(2);
// Verify that the autopilot is set
QCOMPARE(uas->getAutopilotType(), 2);
uas->setAutopilotType(2);
// Verify that the autopilot is set
QCOMPARE(uas->getAutopilotType(), 2);
}
void UASUnitTest::getStatusForCode_test()
{
QString state, desc;
state = "";
desc = "";
QString state, desc;
state = "";
desc = "";
uas->getStatusForCode(MAV_STATE_UNINIT, state, desc);
QVERIFY(state == "UNINIT");
uas->getStatusForCode(MAV_STATE_UNINIT, state, desc);
QVERIFY(state == "UNINIT");
uas->getStatusForCode(MAV_STATE_UNINIT, state, desc);
QVERIFY(state == "UNINIT");
uas->getStatusForCode(MAV_STATE_UNINIT, state, desc);
QVERIFY(state == "UNINIT");
uas->getStatusForCode(MAV_STATE_BOOT, state, desc);
QVERIFY(state == "BOOT");
uas->getStatusForCode(MAV_STATE_BOOT, state, desc);
QVERIFY(state == "BOOT");
uas->getStatusForCode(MAV_STATE_CALIBRATING, state, desc);
QVERIFY(state == "CALIBRATING");
uas->getStatusForCode(MAV_STATE_CALIBRATING, state, desc);
QVERIFY(state == "CALIBRATING");
uas->getStatusForCode(MAV_STATE_ACTIVE, state, desc);
QVERIFY(state == "ACTIVE");
uas->getStatusForCode(MAV_STATE_ACTIVE, state, desc);
QVERIFY(state == "ACTIVE");
uas->getStatusForCode(MAV_STATE_STANDBY, state, desc);
QVERIFY(state == "STANDBY");
uas->getStatusForCode(MAV_STATE_STANDBY, state, desc);
QVERIFY(state == "STANDBY");
uas->getStatusForCode(MAV_STATE_CRITICAL, state, desc);
QVERIFY(state == "CRITICAL");
uas->getStatusForCode(MAV_STATE_CRITICAL, state, desc);
QVERIFY(state == "CRITICAL");
uas->getStatusForCode(MAV_STATE_EMERGENCY, state, desc);
QVERIFY(state == "EMERGENCY");
uas->getStatusForCode(MAV_STATE_EMERGENCY, state, desc);
QVERIFY(state == "EMERGENCY");
uas->getStatusForCode(MAV_STATE_POWEROFF, state, desc);
QVERIFY(state == "SHUTDOWN");
uas->getStatusForCode(MAV_STATE_POWEROFF, state, desc);
QVERIFY(state == "SHUTDOWN");
uas->getStatusForCode(5325, state, desc);
QVERIFY(state == "UNKNOWN");
uas->getStatusForCode(5325, state, desc);
QVERIFY(state == "UNKNOWN");
}
void UASUnitTest::getLocalX_test()
{
QCOMPARE(uas->getLocalX(), 0.0);
QCOMPARE(uas->getLocalX(), 0.0);
}
void UASUnitTest::getLocalY_test()
{
QCOMPARE(uas->getLocalY(), 0.0);
QCOMPARE(uas->getLocalY(), 0.0);
}
void UASUnitTest::getLocalZ_test()
{
QCOMPARE(uas->getLocalZ(), 0.0);
QCOMPARE(uas->getLocalZ(), 0.0);
}
void UASUnitTest::getLatitude_test()
{ QCOMPARE(uas->getLatitude(), 0.0);
}
void UASUnitTest::getLongitude_test()
{
QCOMPARE(uas->getLongitude(), 0.0);
QCOMPARE(uas->getLongitude(), 0.0);
}
void UASUnitTest::getAltitude_test()
{
QCOMPARE(uas->getAltitude(), 0.0);
QCOMPARE(uas->getAltitude(), 0.0);
}
void UASUnitTest::getRoll_test()
{
QCOMPARE(uas->getRoll(), 0.0);
QCOMPARE(uas->getRoll(), 0.0);
}
void UASUnitTest::getPitch_test()
{
QCOMPARE(uas->getPitch(), 0.0);
QCOMPARE(uas->getPitch(), 0.0);
}
void UASUnitTest::getYaw_test()
{
QCOMPARE(uas->getYaw(), 0.0);
QCOMPARE(uas->getYaw(), 0.0);
}
void UASUnitTest::attitudeLimitsZero_test()
{
mavlink_message_t msg;
mavlink_attitude_t att;
// Set zero values and encode them
att.roll = 0.0f;
att.pitch = 0.0f;
att.yaw = 0.0f;
mavlink_msg_attitude_encode(uas->getUASID(), MAV_COMP_ID_IMU, &msg, &att);
// Let UAS decode message
uas->receiveMessage(link, msg);
// Check result
QCOMPARE(uas->getRoll(), 0.0);
QCOMPARE(uas->getPitch(), 0.0);
QCOMPARE(uas->getYaw(), 0.0);
}
void UASUnitTest::attitudeLimitsPi_test()
{
mavlink_message_t msg;
mavlink_attitude_t att;
// Set PI values and encode them
att.roll = M_PI;
att.pitch = M_PI;
att.yaw = M_PI;
mavlink_msg_attitude_encode(uas->getUASID(), MAV_COMP_ID_IMU, &msg, &att);
// Let UAS decode message
uas->receiveMessage(link, msg);
// Check result
QVERIFY((uas->getRoll() < M_PI+0.000001) && (uas->getRoll() > M_PI+-0.000001));
QVERIFY((uas->getPitch() < M_PI+0.000001) && (uas->getPitch() > M_PI+-0.000001));
QVERIFY((uas->getYaw() < M_PI+0.000001) && (uas->getYaw() > M_PI+-0.000001));
}
void UASUnitTest::attitudeLimitsMinusPi_test()
{
mavlink_message_t msg;
mavlink_attitude_t att;
// Set -PI values and encode them
att.roll = -M_PI;
att.pitch = -M_PI;
att.yaw = -M_PI;
mavlink_msg_attitude_encode(uas->getUASID(), MAV_COMP_ID_IMU, &msg, &att);
// Let UAS decode message
uas->receiveMessage(link, msg);
// Check result
QVERIFY((uas->getRoll() > -M_PI-0.000001) && (uas->getRoll() < -M_PI+0.000001));
QVERIFY((uas->getPitch() > -M_PI-0.000001) && (uas->getPitch() < -M_PI+0.000001));
QVERIFY((uas->getYaw() > -M_PI-0.000001) && (uas->getYaw() < -M_PI+0.000001));
}
void UASUnitTest::attitudeLimitsTwoPi_test()
{
mavlink_message_t msg;
mavlink_attitude_t att;
// Set off-limit values and check
// correct wrapping
// Set 2PI values and encode them
att.roll = 2*M_PI;
att.pitch = 2*M_PI;
att.yaw = 2*M_PI;
mavlink_msg_attitude_encode(uas->getUASID(), MAV_COMP_ID_IMU, &msg, &att);
// Let UAS decode message
uas->receiveMessage(link, msg);
// Check result
QVERIFY((uas->getRoll() < 0.000001) && (uas->getRoll() > -0.000001));
QVERIFY((uas->getPitch() < 0.000001) && (uas->getPitch() > -0.000001));
QVERIFY((uas->getYaw() < 0.000001) && (uas->getYaw() > -0.000001));
}
void UASUnitTest::attitudeLimitsMinusTwoPi_test()
{
mavlink_message_t msg;
mavlink_attitude_t att;
// Set -2PI values and encode them
att.roll = -2*M_PI;
att.pitch = -2*M_PI;
att.yaw = -2*M_PI;
mavlink_msg_attitude_encode(uas->getUASID(), MAV_COMP_ID_IMU, &msg, &att);
// Let UAS decode message
uas->receiveMessage(link, msg);
// Check result
QVERIFY((uas->getRoll() < 0.000001) && (uas->getRoll() > -0.000001));
QVERIFY((uas->getPitch() < 0.000001) && (uas->getPitch() > -0.000001));
QVERIFY((uas->getYaw() < 0.000001) && (uas->getYaw() > -0.000001));
}
void UASUnitTest::attitudeLimitsTwoPiOne_test()
{
mavlink_message_t msg;
mavlink_attitude_t att;
// Set over 2 PI values and encode them
att.roll = 2*M_PI+1.0f;
att.pitch = 2*M_PI+1.0f;
att.yaw = 2*M_PI+1.0f;
mavlink_msg_attitude_encode(uas->getUASID(), MAV_COMP_ID_IMU, &msg, &att);
// Let UAS decode message
uas->receiveMessage(link, msg);
// Check result
QVERIFY((uas->getRoll() < 1.000001) && (uas->getRoll() > 0.999999));
QVERIFY((uas->getPitch() < 1.000001) && (uas->getPitch() > 0.999999));
QVERIFY((uas->getYaw() < 1.000001) && (uas->getYaw() > 0.999999));
}
void UASUnitTest::attitudeLimitsMinusTwoPiOne_test()
{
mavlink_message_t msg;
mavlink_attitude_t att;
// Set 3PI values and encode them
att.roll = -2*M_PI-1.0f;
att.pitch = -2*M_PI-1.0f;
att.yaw = -2*M_PI-1.0f;
mavlink_msg_attitude_encode(uas->getUASID(), MAV_COMP_ID_IMU, &msg, &att);
// Let UAS decode message
uas->receiveMessage(link, msg);
// Check result
QVERIFY((uas->getRoll() > -1.000001) && (uas->getRoll() < -0.999999));
QVERIFY((uas->getPitch() > -1.000001) && (uas->getPitch() < -0.999999));
QVERIFY((uas->getYaw() > -1.000001) && (uas->getYaw() < -0.999999));
}
......@@ -6,6 +6,7 @@
#include <QtTest/QtTest>
#include "UAS.h"
#include "MAVLinkProtocol.h"
#include "SerialLink.h"
#include "UASInterface.h"
#include "AutoTest.h"
......@@ -13,36 +14,44 @@ class UASUnitTest : public QObject
{
Q_OBJECT
public:
#define UASID 50
MAVLinkProtocol* mav;
UAS* uas;
UASUnitTest();
#define UASID 50
MAVLinkProtocol* mav;
UAS* uas;
SerialLink* link;
UASUnitTest();
signals:
private slots:
void initTestCase();
void cleanupTestCase();
void getUASID_test();
void getUASName_test();
void getUpTime_test();
void getCommunicationStatus_test();
void filterVoltage_test();
void getAutopilotType_test();
void setAutopilotType_test();
void getStatusForCode_test();
void getLocalX_test();
void getLocalY_test();
void getLocalZ_test();
void getLatitude_test();
void getLongitude_test();
void getAltitude_test();
void getRoll_test();
void getPitch_test();
void getYaw_test();
void initTestCase();
void cleanupTestCase();
void getUASID_test();
void getUASName_test();
void getUpTime_test();
void getCommunicationStatus_test();
void filterVoltage_test();
void getAutopilotType_test();
void setAutopilotType_test();
void getStatusForCode_test();
void getLocalX_test();
void getLocalY_test();
void getLocalZ_test();
void getLatitude_test();
void getLongitude_test();
void getAltitude_test();
void getRoll_test();
void getPitch_test();
void getYaw_test();
void attitudeLimitsZero_test();
void attitudeLimitsPi_test();
void attitudeLimitsMinusPi_test();
void attitudeLimitsTwoPi_test();
void attitudeLimitsMinusTwoPi_test();
void attitudeLimitsTwoPiOne_test();
void attitudeLimitsMinusTwoPiOne_test();
protected:
UAS *prueba;
UAS *prueba;
};
......
# -------------------------------------------------
# QGroundControl - Micro Air Vehicle Groundstation
# Please see our website at <http://qgroundcontrol.org>
# Author:
# Lorenz Meier <mavteam@student.ethz.ch>
# (c) 2009-2010 PIXHAWK Team
# This file is part of the mav groundstation 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/>.
# -------------------------------------------------
# Include QMapControl map library
# prefer version from external directory /
# from http://github.com/pixhawk/qmapcontrol/
# over bundled version in lib directory
# Version from GIT repository is preferred
# include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{
# Include bundled version if necessary
CONFIG += designer plugin
TARGET = $$qtLibraryTarget($$TARGET)
TEMPLATE = lib
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
FORMS = src/ui/designer/QGCParamSlider.ui
HEADERS = src/ui/designer/QGCParamSlider.h \
src/ui/designer/QGCParamSliderPlugin.h
SOURCES = src/ui/designer/QGCParamSlider.cc \
src/ui/designer/QGCParamSliderPlugin.cc
# install
target.path = $$[QT_INSTALL_PLUGINS]/designer
sources.files = $$SOURCES $$HEADERS *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/designer/worldtimeclockplugin
INSTALLS += target
symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
......@@ -38,39 +38,44 @@ release {
QMAKE_POST_LINK += echo "Copying files"
# Turn off serial port warnings
DEFINES += _TTY_NOWARN_
#QMAKE_POST_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/debug/.
#QMAKE_POST_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/release/.
# MAC OS X
macx {
COMPILER_VERSION = $$system(gcc -v)
message(Using compiler $$COMPILER_VERSION)
# COMPILER_VERSION = $$system(gcc -v)
#message(Using compiler $$COMPILER_VERSION)
HARDWARE_PLATFORM = $$system(uname -a)
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)
#HARDWARE_PLATFORM = $$system(uname -a)
#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
#message(Building for Mac OS X 32bit/Leopard 10.5 and earlier)
# Enable function-profiling with the OS X saturn tool
debug {
#debug {
#QMAKE_CXXFLAGS += -finstrument-functions
#LIBS += -lSaturn
CONFIG += console
}
} else {
# CONFIG += console
#}
#} else {
# x64 Mac OS X Snow Leopard 10.6 and later
CONFIG += x86_64 cocoa
CONFIG -= x86 phonon
message(Building for Mac OS X 64bit/Snow Leopard 10.6 and later)
debug {
# CONFIG += x86_64 x86 cocoa phonon
#CONFIG -= x86 # phonon
#message(Building for Mac OS X 64bit/Snow Leopard 10.6 and later)
# debug {
#QMAKE_CXXFLAGS += -finstrument-functions
#LIBS += -lSaturn
CONFIG += console
}
}
# }
#}
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
......
......@@ -144,7 +144,6 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QMap3D.ui \
src/ui/QGCWebView.ui \
src/ui/map3D/QGCGoogleEarthView.ui \
src/ui/map3D/QGCGoogleEarthViewWin.ui \
src/ui/SlugsDataSensorView.ui \
src/ui/SlugsHilSim.ui \
src/ui/SlugsPIDControl.ui \
......@@ -155,7 +154,10 @@ FORMS += src/ui/MainWindow.ui \
src/ui/designer/QGCParamSlider.ui \
src/ui/designer/QGCActionButton.ui \
src/ui/QGCMAVLinkLogPlayer.ui \
src/ui/QGCWaypointListMulti.ui
src/ui/QGCWaypointListMulti.ui \
src/ui/mission/QGCCustomWaypointAction.ui \
src/ui/QGCUDPLinkConfiguration.ui \
src/ui/QGCSettingsWidget.ui
INCLUDEPATH += src \
src/ui \
......@@ -265,7 +267,9 @@ HEADERS += src/MG.h \
src/comm/MAVLinkSimulationWaypointPlanner.h \
src/comm/MAVLinkSimulationMAV.h \
src/uas/QGCMAVLinkUASFactory.h \
src/ui/QGCWaypointListMulti.h
src/ui/QGCWaypointListMulti.h \
src/ui/QGCUDPLinkConfiguration.h \
src/ui/QGCSettingsWidget.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|win32-msvc2008: {
......@@ -390,7 +394,9 @@ SOURCES += src/main.cc \
src/comm/MAVLinkSimulationWaypointPlanner.cc \
src/comm/MAVLinkSimulationMAV.cc \
src/uas/QGCMAVLinkUASFactory.cc \
src/ui/QGCWaypointListMulti.cc
src/ui/QGCWaypointListMulti.cc \
src/ui/QGCUDPLinkConfiguration.cc \
src/ui/QGCSettingsWidget.cc
macx|win32-msvc2008: {
SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
This diff is collapsed.
......@@ -151,10 +151,14 @@ GAudioOutput::~GAudioOutput()
void GAudioOutput::mute(bool mute)
{
this->muted = mute;
QSettings settings;
settings.setValue(QGC_GAUDIOOUTPUT_KEY+"muted", this->muted);
settings.sync();
if (mute != muted)
{
this->muted = mute;
QSettings settings;
settings.setValue(QGC_GAUDIOOUTPUT_KEY+"muted", this->muted);
settings.sync();
emit mutedChanged(muted);
}
}
bool GAudioOutput::isMuted()
......@@ -295,11 +299,12 @@ 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();
}
// Use QFile to transform path for all OS
QFile f(QCoreApplication::applicationDirPath()+QString("/audio/alert.wav"));
qDebug() << "FILE:" << f.fileName();
m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
m_media->play();
}
}
void GAudioOutput::selectFemaleVoice()
......
......@@ -40,8 +40,8 @@ This file is part of the PIXHAWK project
#endif
#ifdef Q_OS_LINUX
//#include <flite/flite.h>
#include <phonon/MediaObject>
#include <phonon/AudioOutput>
#include <Phonon/MediaObject>
#include <Phonon/AudioOutput>
#endif
#ifdef Q_OS_WIN
#include <Phonon/MediaObject>
......@@ -80,6 +80,9 @@ public:
VOICE_FEMALE
} QGVoice;
/** @brief Get the mute state */
bool isMuted();
public slots:
/** @brief Say this text if current output priority matches */
bool say(QString text, int severity=1);
......@@ -101,8 +104,9 @@ public slots:
void notifyNegative();
/** @brief Mute/unmute sound */
void mute(bool mute);
/** @brief Get the mute state */
bool isMuted();
signals:
void mutedChanged(bool);
protected:
#ifdef Q_OS_MAC
......
......@@ -23,6 +23,9 @@ This file is part of the QGROUNDCONTROL project
#include "QGC.h"
#include <qmath.h>
#include <float.h>
namespace QGC {
quint64 groundTimeUsecs()
......@@ -34,6 +37,49 @@ quint64 groundTimeUsecs()
return static_cast<quint64>(microseconds + (time.time().msec()*1000));
}
quint64 groundTimeMilliseconds()
{
QDateTime time = QDateTime::currentDateTime();
time = time.toUTC();
/* Return seconds and milliseconds, in milliseconds unit */
quint64 seconds = time.toTime_t() * static_cast<quint64>(1000);
return static_cast<quint64>(seconds + (time.time().msec()));
}
float limitAngleToPMPIf(float angle)
{
while (angle > ((float)M_PI+FLT_EPSILON))
{
angle -= 2.0f * (float)M_PI;
}
while (angle <= -((float)M_PI+FLT_EPSILON))
{
angle += 2.0f * (float)M_PI;
}
return angle;
}
double limitAngleToPMPId(double angle)
{
if (angle < -M_PI)
{
while (angle < -M_PI)
{
angle += M_PI;
}
}
else if (angle > M_PI)
{
while (angle > M_PI)
{
angle -= M_PI;
}
}
return angle;
}
int applicationVersion()
{
return APPLICATIONVERSION;
......
......@@ -9,15 +9,26 @@
namespace QGC
{
const static int defaultSystemId = 255;
const static int defaultComponentId = 0;
const QColor colorCyan(55, 154, 195);
const QColor colorRed(154, 20, 20);
const QColor colorGreen(20, 200, 20);
const QColor colorYellow(255, 255, 0);
const QColor colorOrange(255, 140, 0);
const QColor colorDarkYellow(180, 180, 0);
const QColor colorBackground("#050508");
const QColor colorBlack(0, 0, 0);
/** @brief Get the current ground time in microseconds */
quint64 groundTimeUsecs();
/** @brief Get the current ground time in milliseconds */
quint64 groundTimeMilliseconds();
/** @brief Returns the angle limited to -pi - pi */
float limitAngleToPMPIf(float angle);
/** @brief Returns the angle limited to -pi - pi */
double limitAngleToPMPId(double angle);
int applicationVersion();
const static int MAX_FLIGHT_TIME = 60 * 60 * 24 * 21;
......
......@@ -32,18 +32,20 @@ This file is part of the QGROUNDCONTROL project
#include "Waypoint.h"
#include <QStringList>
Waypoint::Waypoint(quint16 _id, double _x, double _y, double _z, double _yaw, bool _autocontinue, bool _current, double _orbit, int _holdTime, MAV_FRAME _frame, MAV_ACTION _action)
Waypoint::Waypoint(quint16 _id, double _x, double _y, double _z, double _param1, double _param2, double _param3, double _param4,
bool _autocontinue, bool _current, MAV_FRAME _frame, MAV_CMD _action)
: id(_id),
x(_x),
y(_y),
z(_z),
yaw(_yaw),
yaw(_param4),
frame(_frame),
action(_action),
autocontinue(_autocontinue),
current(_current),
orbit(_orbit),
holdTime(_holdTime),
orbit(_param3),
param1(_param1),
param2(_param2),
name(QString("WP%1").arg(id, 2, 10, QChar('0')))
{
}
......@@ -55,32 +57,34 @@ Waypoint::~Waypoint()
void Waypoint::save(QTextStream &saveStream)
{
QString position("%1\t%2\t%3\t%4");
QString position("%1\t%2\t%3");
position = position.arg(x, 0, 'g', 18);
position = position.arg(y, 0, 'g', 18);
position = position.arg(z, 0, 'g', 18);
position = position.arg(yaw, 0, 'g', 8);
saveStream << this->getId() << "\t" << this->getFrame() << "\t" << this->getAction() << "\t" << this->getOrbit() << "\t" << /*Orbit Direction*/ 0 << "\t" << this->getOrbit() << "\t" << this->getHoldTime() << "\t" << this->getCurrent() << "\t" << position << "\t" << this->getAutoContinue() << "\r\n";
QString parameters("%1\t%2\t%3\t%4");
parameters = parameters.arg(param1, 0, 'g', 18).arg(param2, 0, 'g', 18).arg(orbit, 0, 'g', 18).arg(yaw, 0, 'g', 18);
// FORMAT: <INDEX> <CURRENT WP> <COORD FRAME> <COMMAND> <PARAM1> <PARAM2> <PARAM3> <PARAM4> <PARAM5/X/LONGITUDE> <PARAM6/Y/LATITUDE> <PARAM7/Z/ALTITUDE> <AUTOCONTINUE>
// as documented here: http://qgroundcontrol.org/waypoint_protocol
saveStream << this->getId() << "\t" << this->getCurrent() << "\t" << this->getFrame() << "\t" << this->getAction() << "\t" << parameters << "\t" << position << "\t" << this->getAutoContinue() << "\r\n";
}
bool Waypoint::load(QTextStream &loadStream)
{
const QStringList &wpParams = loadStream.readLine().split("\t");
if (wpParams.size() == 13)
if (wpParams.size() == 12)
{
this->id = wpParams[0].toInt();
this->frame = (MAV_FRAME) wpParams[1].toInt();
this->action = (MAV_ACTION) wpParams[2].toInt();
this->orbit = wpParams[3].toDouble();
//TODO: orbit direction
//TODO: param1
this->holdTime = wpParams[6].toInt();
this->current = (wpParams[7].toInt() == 1 ? true : false);
this->current = (wpParams[1].toInt() == 1 ? true : false);
this->frame = (MAV_FRAME) wpParams[2].toInt();
this->action = (MAV_CMD) wpParams[3].toInt();
this->param1 = wpParams[4].toDouble();
this->param2 = wpParams[5].toDouble();
this->orbit = wpParams[6].toDouble();
this->yaw = wpParams[7].toDouble();
this->x = wpParams[8].toDouble();
this->y = wpParams[9].toDouble();
this->z = wpParams[10].toDouble();
this->yaw = wpParams[11].toDouble();
this->autocontinue = (wpParams[12].toInt() == 1 ? true : false);
this->autocontinue = (wpParams[11].toInt() == 1 ? true : false);
return true;
}
return false;
......@@ -121,6 +125,45 @@ void Waypoint::setZ(double z)
}
}
void Waypoint::setLatitude(double lat)
{
if (this->x != lat)
{
this->x = lat;
this->frame = MAV_FRAME_GLOBAL;
emit changed(this);
}
}
void Waypoint::setLongitude(double lon)
{
if (this->y != lon)
{
this->y = lon;
this->frame = MAV_FRAME_GLOBAL;
emit changed(this);
}
}
void Waypoint::setAltitude(double altitude)
{
if (this->z != altitude)
{
this->z = altitude;
this->frame = MAV_FRAME_GLOBAL;
emit changed(this);
}
}
void Waypoint::setYaw(int yaw)
{
if (this->yaw != yaw)
{
this->yaw = yaw;
emit changed(this);
}
}
void Waypoint::setYaw(double yaw)
{
if (this->yaw != yaw)
......@@ -130,7 +173,16 @@ void Waypoint::setYaw(double yaw)
}
}
void Waypoint::setAction(MAV_ACTION action)
void Waypoint::setAction(int action)
{
if (this->action != (MAV_CMD)action)
{
this->action = (MAV_CMD)action;
emit changed(this);
}
}
void Waypoint::setAction(MAV_CMD action)
{
if (this->action != action)
{
......@@ -166,7 +218,79 @@ void Waypoint::setCurrent(bool current)
}
}
void Waypoint::setOrbit(double orbit)
void Waypoint::setAcceptanceRadius(double radius)
{
if (this->param2 != radius)
{
this->param2 = radius;
emit changed(this);
}
}
void Waypoint::setParam1(double param1)
{
if (this->param1 != param1)
{
this->param1 = param1;
emit changed(this);
}
}
void Waypoint::setParam2(double param2)
{
if (this->param2 != param2)
{
this->param2 = param2;
emit changed(this);
}
}
void Waypoint::setParam3(double param3)
{
if (this->orbit != param3)
{
this->orbit = param3;
emit changed(this);
}
}
void Waypoint::setParam4(double param4)
{
if (this->yaw != param4)
{
this->yaw = param4;
emit changed(this);
}
}
void Waypoint::setParam5(double param5)
{
if (this->x != param5)
{
this->x = param5;
emit changed(this);
}
}
void Waypoint::setParam6(double param6)
{
if (this->z != param6)
{
this->z = param6;
emit changed(this);
}
}
void Waypoint::setParam7(double param7)
{
if (this->z != param7)
{
this->z = param7;
emit changed(this);
}
}
void Waypoint::setLoiterOrbit(double orbit)
{
if (this->orbit != orbit)
{
......@@ -177,54 +301,27 @@ void Waypoint::setOrbit(double orbit)
void Waypoint::setHoldTime(int holdTime)
{
if (this->holdTime != holdTime)
{
this->holdTime = holdTime;
emit changed(this);
}
}
//void Waypoint::setX(double x)
//{
// if (this->x != static_cast<double>(x))
// {
// this->x = x;
// emit changed(this);
// }
//}
//void Waypoint::setY(double y)
//{
// if (this->y != static_cast<double>(y))
// {
// this->y = y;
// emit changed(this);
// }
//}
//void Waypoint::setZ(double z)
//{
// if (this->z != static_cast<double>(z))
// {
// this->z = z;
// emit changed(this);
// }
//}
//void Waypoint::setYaw(double yaw)
//{
// if (this->yaw != static_cast<double>(yaw))
// {
// this->yaw = yaw;
// emit changed(this);
// }
//}
//void Waypoint::setOrbit(double orbit)
//{
// if (this->orbit != static_cast<double>(orbit))
// {
// this->orbit = orbit;
// emit changed(this);
// }
//}
if (this->param1 != holdTime)
{
this->param1 = holdTime;
emit changed(this);
}
}
void Waypoint::setHoldTime(double holdTime)
{
if (this->param1 != holdTime)
{
this->param1 = holdTime;
emit changed(this);
}
}
void Waypoint::setTurns(int turns)
{
if (this->param1 != turns)
{
this->param1 = turns;
emit changed(this);
}
}
......@@ -36,29 +36,40 @@ This file is part of the PIXHAWK project
#include <QObject>
#include <QString>
#include <QTextStream>
#include "mavlink_types.h"
#include "QGCMAVLink.h"
class Waypoint : public QObject
{
Q_OBJECT
public:
Waypoint(quint16 id = 0, double x = 0.0f, double y = 0.0f, double z = 0.0f, double yaw = 0.0f, bool autocontinue = false,
bool current = false, double orbit = 0.15f, int holdTime = 0,
MAV_FRAME frame=MAV_FRAME_GLOBAL, MAV_ACTION action=MAV_ACTION_NAVIGATE);
Waypoint(quint16 id = 0, double x = 0.0, double y = 0.0, double z = 0.0, double param1 = 0.0, double param2 = 0.0, double param3 = 0.0, double param4 = 0.0,
bool autocontinue = true, bool current = false, MAV_FRAME frame=MAV_FRAME_GLOBAL, MAV_CMD action=MAV_CMD_NAV_WAYPOINT);
~Waypoint();
quint16 getId() const { return id; }
double getX() const { return x; }
double getY() const { return y; }
double getZ() const { return z; }
double getLatitude() const { return x; }
double getLongitude() const { return y; }
double getAltitude() const { return z; }
double getYaw() const { return yaw; }
bool getAutoContinue() const { return autocontinue; }
bool getCurrent() const { return current; }
double getOrbit() const { return orbit; }
double getHoldTime() const { return holdTime; }
double getLoiterOrbit() const { return orbit; }
double getAcceptanceRadius() const { return param2; }
double getHoldTime() const { return param1; }
double getParam1() const { return param1; }
double getParam2() const { return param2; }
double getParam3() const { return orbit; }
double getParam4() const { return yaw; }
double getParam5() const { return x; }
double getParam6() const { return y; }
double getParam7() const { return z; }
int getTurns() const { return param1; }
MAV_FRAME getFrame() const { return frame; }
MAV_ACTION getAction() const { return action; }
MAV_CMD getAction() const { return action; }
const QString& getName() const { return name; }
void save(QTextStream &saveStream);
......@@ -72,11 +83,13 @@ protected:
double z;
double yaw;
MAV_FRAME frame;
MAV_ACTION action;
MAV_CMD action;
bool autocontinue;
bool current;
double orbit;
int holdTime;
double param1;
double param2;
int turns;
QString name;
public slots:
......@@ -84,21 +97,32 @@ public slots:
void setX(double x);
void setY(double y);
void setZ(double z);
void setLatitude(double lat);
void setLongitude(double lon);
void setAltitude(double alt);
/** @brief Yaw angle in COMPASS DEGREES: 0-360 */
void setYaw(int yaw);
/** @brief Yaw angle in COMPASS DEGREES: 0-360 */
void setYaw(double yaw);
void setAction(MAV_ACTION action);
/** @brief Set the waypoint action */
void setAction(int action);
void setAction(MAV_CMD action);
void setFrame(MAV_FRAME frame);
void setAutocontinue(bool autoContinue);
void setCurrent(bool current);
void setOrbit(double orbit);
void setLoiterOrbit(double orbit);
void setParam1(double param1);
void setParam2(double param2);
void setParam3(double param3);
void setParam4(double param4);
void setParam5(double param5);
void setParam6(double param6);
void setParam7(double param7);
void setAcceptanceRadius(double radius);
void setHoldTime(int holdTime);
// //for QDoubleSpin
// void setX(double x);
// void setY(double y);
// void setZ(double z);
// void setYaw(double yaw);
// void setOrbit(double orbit);
void setHoldTime(double holdTime);
/** @brief Number of turns for loiter waypoints */
void setTurns(int turns);
signals:
/** @brief Announces a change to the waypoint data */
......
......@@ -62,6 +62,9 @@ public:
/** @brief Get a list of all links */
const QList<LinkInterface*> getLinks();
/** @brief Get a list of all protocols */
const QList<ProtocolInterface*> getProtocols() { return protocolLinks.uniqueKeys(); }
public slots:
void add(LinkInterface* link);
......
This diff is collapsed.
......@@ -40,6 +40,7 @@ This file is part of the QGROUNDCONTROL project
#include "ProtocolInterface.h"
#include "LinkInterface.h"
#include "QGCMAVLink.h"
#include "QGC.h"
/**
* @brief MAVLink micro air vehicle protocol reference implementation.
......@@ -65,15 +66,27 @@ public:
/** @brief The auto heartbeat emission rate in Hertz */
int getHeartbeatRate();
/** @brief Get heartbeat state */
bool heartbeatsEnabled(void);
bool heartbeatsEnabled() const { return m_heartbeatsEnabled; }
/** @brief Get logging state */
bool loggingEnabled(void);
bool loggingEnabled() const { return m_loggingEnabled; }
/** @brief Get protocol version check state */
bool versionCheckEnabled(void);
bool versionCheckEnabled() const { return m_enable_version_check; }
/** @brief Get the multiplexing state */
bool multiplexingEnabled() const { return m_multiplexingEnabled; }
/** @brief Get the protocol version */
int getVersion() { return MAVLINK_VERSION; }
/** @brief Get the name of the packet log file */
QString getLogfileName();
/** @brief Get state of parameter retransmission */
bool paramGuardEnabled() { return m_paramGuardEnabled; }
/** @brief Get parameter read timeout */
int getParamRetransmissionTimeout() { return m_paramRetransmissionTimeout; }
/** @brief Get parameter write timeout */
int getParamRewriteTimeout() { return m_paramRewriteTimeout; }
/** @brief Get state of action retransmission */
bool actionGuardEnabled() { return m_actionGuardEnabled; }
/** @brief Get parameter read timeout */
int getActionRetransmissionTimeout() { return m_actionRetransmissionTimeout; }
public slots:
/** @brief Receive bytes from a communication interface */
......@@ -84,6 +97,8 @@ public slots:
void sendMessage(LinkInterface* link, mavlink_message_t message);
/** @brief Set the rate at which heartbeats are emitted */
void setHeartbeatRate(int rate);
/** @brief Set the system id of this application */
void setSystemId(int id);
/** @brief Enable / disable the heartbeat emission */
void enableHeartbeats(bool enabled);
......@@ -91,6 +106,24 @@ public slots:
/** @brief Enable/disable binary packet logging */
void enableLogging(bool enabled);
/** @brief Enabled/disable packet multiplexing */
void enableMultiplexing(bool enabled);
/** @brief Enable / disable parameter retransmission */
void enableParamGuard(bool enabled);
/** @brief Enable / disable action retransmission */
void enableActionGuard(bool enabled);
/** @brief Set parameter read timeout */
void setParamRetransmissionTimeout(int ms);
/** @brief Set parameter write timeout */
void setParamRewriteTimeout(int ms);
/** @brief Set parameter read timeout */
void setActionRetransmissionTimeout(int ms);
/** @brief Set log file name */
void setLogfileName(const QString& filename);
......@@ -100,13 +133,24 @@ public slots:
/** @brief Send an extra heartbeat to all connected units */
void sendHeartbeat();
/** @brief Load protocol settings */
void loadSettings();
/** @brief Store protocol settings */
void storeSettings();
protected:
QTimer* heartbeatTimer; ///< Timer to emit heartbeats
int heartbeatRate; ///< Heartbeat rate, controls the timer interval
bool m_heartbeatsEnabled; ///< Enabled/disable heartbeat emission
bool m_loggingEnabled; ///< Enable/disable packet logging
bool m_multiplexingEnabled; ///< Enable/disable packet multiplexing
QFile* m_logfile; ///< Logfile
bool m_enable_version_check; ///< Enable checking of version match of MAV and QGC
int m_paramRetransmissionTimeout; ///< Timeout for parameter retransmission
int m_paramRewriteTimeout; ///< Timeout for sending re-write request
bool m_paramGuardEnabled; ///< Parameter retransmission/rewrite enabled
bool m_actionGuardEnabled; ///< Action request retransmission enabled
int m_actionRetransmissionTimeout; ///< Timeout for parameter retransmission
QMutex receiveMutex; ///< Mutex to protect receiveBytes function
int lastIndex[256][256];
int totalReceiveCounter;
......@@ -114,6 +158,7 @@ protected:
int currReceiveCounter;
int currLossCounter;
bool versionMismatchIgnore;
int systemId;
signals:
/** @brief Message received and directly copied via signal */
......@@ -122,10 +167,24 @@ signals:
void heartbeatChanged(bool heartbeats);
/** @brief Emitted if logging is started / stopped */
void loggingChanged(bool enabled);
/** @brief Emitted if multiplexing is started / stopped */
void multiplexingChanged(bool enabled);
/** @brief Emitted if version check is enabled / disabled */
void versionCheckChanged(bool enabled);
/** @brief Emitted if a message from the protocol should reach the user */
void protocolStatusMessage(const QString& title, const QString& message);
/** @brief Emitted if a new system ID was set */
void systemIdChanged(int systemId);
/** @brief Emitted if param guard status changed */
void paramGuardChanged(bool enabled);
/** @brief Emitted if param read timeout changed */
void paramRetransmissionTimeoutChanged(int ms);
/** @brief Emitted if param write timeout changed */
void paramRewriteTimeoutChanged(int ms);
/** @brief Emitted if action guard status changed */
void actionGuardChanged(bool enabled);
/** @brief Emitted if actiion request timeout changed */
void actionRetransmissionTimeoutChanged(int ms);
};
#endif // MAVLINKPROTOCOL_H_
This diff is collapsed.
This diff is collapsed.
......@@ -11,7 +11,7 @@ class MAVLinkSimulationMAV : public QObject
{
Q_OBJECT
public:
explicit MAVLinkSimulationMAV(MAVLinkSimulationLink *parent, int systemid, double lat=47.376389, double lon=8.548056);
explicit MAVLinkSimulationMAV(MAVLinkSimulationLink *parent, int systemid, double lat=47.376389, double lon=8.548056, int version=MAVLINK_VERSION);
signals:
......@@ -53,6 +53,19 @@ protected:
uint8_t sys_state;
uint8_t nav_mode;
bool flying;
int mavlink_version;
static inline uint16_t mavlink_msg_heartbeat_pack_version_free(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t type, uint8_t autopilot, uint8_t version)
{
uint16_t i = 0;
msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
i += put_uint8_t_by_index(type, i, msg->payload); // Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
i += put_uint8_t_by_index(autopilot, i, msg->payload); // Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
i += put_uint8_t_by_index(version, i, msg->payload); // MAVLink version
return mavlink_finalize_message(msg, system_id, component_id, i);
}
};
......
......@@ -205,6 +205,7 @@ MAVLinkSimulationWaypointPlanner::MAVLinkSimulationWaypointPlanner(MAVLinkSimula
silent(false)
{
connect(parent, SIGNAL(messageReceived(mavlink_message_t)), this, SLOT(handleMessage(mavlink_message_t)));
qDebug() << "PLANNER FOR SYSTEM" << systemid << "INITIALIZED";
}
......@@ -283,7 +284,7 @@ void MAVLinkSimulationWaypointPlanner::send_setpoint(uint16_t seq)
PControlSetPoint.x = cur->x;
PControlSetPoint.y = cur->y;
PControlSetPoint.z = cur->z;
PControlSetPoint.yaw = cur->yaw;
PControlSetPoint.yaw = cur->param4;
mavlink_msg_local_position_setpoint_set_encode(systemid, compid, &msg, &PControlSetPoint);
link->sendMAVLinkMessage(&msg);
......@@ -298,7 +299,7 @@ void MAVLinkSimulationWaypointPlanner::send_setpoint(uint16_t seq)
PControlSetPoint.x = cur->x;
PControlSetPoint.y = cur->y;
PControlSetPoint.z = cur->z;
PControlSetPoint.yaw = cur->yaw;
PControlSetPoint.yaw = cur->param4;
mavlink_msg_local_position_setpoint_set_encode(systemid, compid, &msg, &PControlSetPoint);
link->sendMAVLinkMessage(&msg);
......@@ -336,7 +337,7 @@ void MAVLinkSimulationWaypointPlanner::send_waypoint(uint8_t target_systemid, ui
wp->target_system = target_systemid;
wp->target_component = target_compid;
if (verbose) qDebug("Sent waypoint %u (%u / %u / %u / %u / %u / %f / %u / %f / %f / %u / %f / %f / %f / %f / %u)\n", wp->seq, wp->target_system, wp->target_component, wp->seq, wp->frame, wp->action, wp->orbit, wp->orbit_direction, wp->param1, wp->param2, wp->current, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue);
if (verbose) qDebug("Sent waypoint %u (%u / %u / %u / %u / %u / %f / %f / %f / %u / %f / %f / %f / %f / %u)\n", wp->seq, wp->target_system, wp->target_component, wp->seq, wp->frame, wp->command, wp->param3, wp->param1, wp->param2, wp->current, wp->x, wp->y, wp->z, wp->param4, wp->autocontinue);
mavlink_msg_waypoint_encode(systemid, compid, &msg, wp);
link->sendMAVLinkMessage(&msg);
......@@ -501,19 +502,19 @@ void MAVLinkSimulationWaypointPlanner::mavlink_handler (const mavlink_message_t*
//compare current yaw
if (att.yaw - yaw_tolerance >= 0.0f && att.yaw + yaw_tolerance < 2.f*M_PI)
{
if (att.yaw - yaw_tolerance <= wp->yaw && att.yaw + yaw_tolerance >= wp->yaw)
if (att.yaw - yaw_tolerance <= wp->param4 && att.yaw + yaw_tolerance >= wp->param4)
yawReached = true;
}
else if(att.yaw - yaw_tolerance < 0.0f)
{
float lowerBound = 360.0f + att.yaw - yaw_tolerance;
if (lowerBound < wp->yaw || wp->yaw < att.yaw + yaw_tolerance)
if (lowerBound < wp->param4 || wp->param4 < att.yaw + yaw_tolerance)
yawReached = true;
}
else
{
float upperBound = att.yaw + yaw_tolerance - 2.f*M_PI;
if (att.yaw - yaw_tolerance < wp->yaw || wp->yaw < upperBound)
if (att.yaw - yaw_tolerance < wp->param4 || wp->param4 < upperBound)
yawReached = true;
}
......@@ -535,7 +536,7 @@ void MAVLinkSimulationWaypointPlanner::mavlink_handler (const mavlink_message_t*
{
mavlink_local_position_t pos;
mavlink_msg_local_position_decode(msg, &pos);
qDebug() << "Received new position: x:" << pos.x << "| y:" << pos.y << "| z:" << pos.z;
//qDebug() << "Received new position: x:" << pos.x << "| y:" << pos.y << "| z:" << pos.z;
posReached = false;
......@@ -572,18 +573,18 @@ void MAVLinkSimulationWaypointPlanner::mavlink_handler (const mavlink_message_t*
mavlink_global_position_int_t pos;
mavlink_msg_global_position_int_decode(msg, &pos);
float x = static_cast<double>(pos.lon)/1E7;
float y = static_cast<double>(pos.lat)/1E7;
float z = static_cast<double>(pos.alt)/1000;
float x = static_cast<double>(pos.lat)/1E7;
float y = static_cast<double>(pos.lon)/1E7;
//float z = static_cast<double>(pos.alt)/1000;
qDebug() << "Received new position: x:" << x << "| y:" << y << "| z:" << z;
//qDebug() << "Received new position: x:" << x << "| y:" << y << "| z:" << z;
posReached = false;
yawReached = true;
// FIXME big hack for simulation!
//float oneDegreeOfLatMeters = 111131.745f;
float orbit = 0.00008;
float orbit = 0.00008f;
// compare current position (given in message) with current waypoint
//float orbit = wp->param1;
......@@ -706,6 +707,10 @@ void MAVLinkSimulationWaypointPlanner::mavlink_handler (const mavlink_message_t*
}
}
}
else
{
qDebug() << "SYSTEM / COMPONENT ID MISMATCH: target sys:" << wpc.target_system << "this system:" << systemid << "target comp:" << wpc.target_component << "this comp:" << compid;
}
break;
}
......@@ -1004,7 +1009,7 @@ void MAVLinkSimulationWaypointPlanner::mavlink_handler (const mavlink_message_t*
if (cur_wp->autocontinue)
{
cur_wp->current = 0;
if (current_active_wp_id == waypoints->size() - 1 && waypoints->size() > 1)
if (current_active_wp_id == waypoints->size() - 1 && waypoints->size() > 0)
{
//the last waypoint was reached, if auto continue is
//activated restart the waypoint list from the beginning
......
......@@ -247,11 +247,11 @@ bool MAVLinkXMLParser::generate()
// Everything sane, starting with enum content
currEnum = "enum " + enumName.toUpper() + "\n{\n";
currEnumEnd = "};\n\n";
currEnumEnd = QString("\t%1_ENUM_END\n};\n\n").arg(enumName.toUpper());
int nextEnumValue = 0;
// Get the message fields
// Get the enum fields
QDomNode f = e.firstChild();
while (!f.isNull())
{
......@@ -285,20 +285,22 @@ bool MAVLinkXMLParser::generate()
if (e2.text().length() > 0)
{
fieldComment = " /* " + e2.text() + "*/";
fieldComment = fieldComment.replace("\n", " ");
}
currEnum += "\t" + fieldName.toUpper() + "=" + fieldValue + "," + fieldComment + "\n";
}
else if(!e2.isNull() && e2.tagName() == "description")
{
comment = e2.text() + comment;
comment = e2.text().replace("\n", " ") + comment;
}
f = f.nextSibling();
}
}
// Add the last parsed enum
// Remove the last comma, as the last value has none
int commaPosition = currEnum.lastIndexOf(",");
currEnum.remove(commaPosition, 1);
// ENUM END MARKER IS LAST ENTRY, COMMA REMOVAL NOT NEEDED
//int commaPosition = currEnum.lastIndexOf(",");
//currEnum.remove(commaPosition, 1);
enums += "/** @brief " + comment + " */\n" + currEnum + currEnumEnd;
} // Element is non-zero and element name is <enum>
......@@ -407,7 +409,7 @@ bool MAVLinkXMLParser::generate()
{
// Send arguments are the same for integral types and arrays
sendArguments += ", " + fieldName;
commentLines += commentEntry.arg(fieldName, fieldText);
commentLines += commentEntry.arg(fieldName, fieldText.replace("\n", " "));
}
// MAVLink version field
......
......@@ -39,22 +39,12 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
// Set unique ID and add link to the list of links
this->id = getNextLinkId();
// *nix (Linux, MacOS tested) serial port support
// port = new QextSerialPort(porthandle, QextSerialPort::Polling);
//port = new QextSerialPort(porthandle, QextSerialPort::EventDriven);
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);
// port->setParity(parity);
// port->setDataBits(dataBits);
// port->setStopBits(stopBits);
// Set the port name
if (porthandle == "")
......@@ -103,7 +93,7 @@ void SerialLink::loadSettings()
settings.sync();
if (settings.contains("SERIALLINK_COMM_PORT"))
{
setPortName(settings.value("SERIALLINK_COMM_PORT").toString());
if (porthandle == "") setPortName(settings.value("SERIALLINK_COMM_PORT").toString());
setBaudRateType(settings.value("SERIALLINK_COMM_BAUD").toInt());
setParityType(settings.value("SERIALLINK_COMM_PARITY").toInt());
setStopBits(settings.value("SERIALLINK_COMM_STOPBITS").toInt());
......@@ -179,18 +169,18 @@ void SerialLink::writeBytes(const char* data, qint64 size)
if (b > 0)
{
qDebug() << "Serial link " << this->getName() << "transmitted" << b << "bytes:";
// qDebug() << "Serial link " << this->getName() << "transmitted" << b << "bytes:";
// Increase write counter
bitsSentTotal += size * 8;
int i;
for (i=0; i<size; i++)
{
unsigned char v =data[i];
qDebug("%02x ", v);
}
qDebug("\n");
// int i;
// for (i=0; i<size; i++)
// {
// unsigned char v =data[i];
// qDebug("%02x ", v);
// }
// qDebug("\n");
}
else
{
......
......@@ -64,10 +64,11 @@ UDPLink::~UDPLink()
**/
void UDPLink::run()
{
forever
{
QGC::SLEEP::msleep(5000);
}
// forever
// {
// QGC::SLEEP::msleep(5000);
// }
exec();
}
void UDPLink::setAddress(QString address)
......@@ -77,9 +78,32 @@ void UDPLink::setAddress(QString address)
//socket->setLocalAddress(QHostAddress(address));
}
void UDPLink::setPort(quint16 port)
void UDPLink::setPort(int port)
{
this->port = port;
disconnect();
connect();
}
/**
* @param host Hostname in standard formatting, e.g. localhost:14551 or 192.168.1.1:14551
*/
void UDPLink::addHost(const QString& host)
{
if (host.contains(":"))
{
// Add host
hosts->append(QHostAddress(host.split(":").first()));
// Set port according to user input
ports->append(host.split(":").last().toInt());
}
else
{
// Add host
hosts->append(QHostAddress(host));
// Set port according to default (this port)
ports->append(port);
}
}
......
......@@ -51,6 +51,7 @@ public:
bool isConnected();
qint64 bytesAvailable();
int getPort() const { return port; }
/**
* @brief The human readable port name
......@@ -82,7 +83,9 @@ public:
public slots:
void setAddress(QString address);
void setPort(quint16 port);
void setPort(int port);
/** @brief Add a new host to broadcast messages to */
void addHost(const QString& host);
// void readPendingDatagrams();
void readBytes();
......
......@@ -17,7 +17,7 @@
#define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_APPLICATION_VERSION "v. 0.8.3 (Alpha RC6)"
#define QGC_APPLICATION_VERSION "v. 0.8.3 (Alpha RC7)"
namespace QGC
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
......@@ -10,15 +9,15 @@ This file is part of the QGROUNDCONTROL project
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/>.
======================================================================*/
#include "PxQuadMAV.h"
......@@ -39,20 +38,12 @@ PxQuadMAV::PxQuadMAV(MAVLinkProtocol* mavlink, int id) :
*/
void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
// Let UAS handle the default message set
UAS::receiveMessage(link, message);
//qDebug() << "PX RECEIVED" << msg->sysid << msg->compid << msg->msgid;
// Only compile this portion if matching MAVLink packets have been compiled
// Only compile this portion if matching MAVLink packets have been compiled
#ifdef MAVLINK_ENABLED_PIXHAWK
mavlink_message_t* msg = &message;
if (message.sysid == uasId)
{
QString uasState;
QString stateDescription;
QString patternPath;
switch (message.msgid)
{
case MAVLINK_MSG_ID_RAW_AUX:
......@@ -88,7 +79,7 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit letterDetected(uasId, name, detected.confidence, detected.detected);
}
break;
case MAVLINK_MSG_ID_WATCHDOG_HEARTBEAT:
case MAVLINK_MSG_ID_WATCHDOG_HEARTBEAT:
{
mavlink_watchdog_heartbeat_t payload;
mavlink_msg_watchdog_heartbeat_decode(msg, &payload);
......@@ -97,7 +88,7 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
}
break;
case MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO:
case MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO:
{
mavlink_watchdog_process_info_t payload;
mavlink_msg_watchdog_process_info_decode(msg, &payload);
......@@ -106,14 +97,14 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
}
break;
case MAVLINK_MSG_ID_WATCHDOG_PROCESS_STATUS:
case MAVLINK_MSG_ID_WATCHDOG_PROCESS_STATUS:
{
mavlink_watchdog_process_status_t payload;
mavlink_msg_watchdog_process_status_decode(msg, &payload);
emit processChanged(this->uasId, payload.watchdog_id, payload.process_id, payload.state, (payload.muted == 1) ? true : false, payload.crashes, payload.pid);
}
break;
case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE:
case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE:
{
mavlink_vision_position_estimate_t pos;
mavlink_msg_vision_position_estimate_decode(&message, &pos);
......@@ -128,21 +119,21 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
}
break;
case MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE:
{
mavlink_vicon_position_estimate_t pos;
mavlink_msg_vicon_position_estimate_decode(&message, &pos);
quint64 time = getUnixTime(pos.usec);
//emit valueChanged(uasId, "vis. time", pos.usec, time);
emit valueChanged(uasId, "vicon roll", "rad", pos.roll, time);
emit valueChanged(uasId, "vicon pitch", "rad", pos.pitch, time);
emit valueChanged(uasId, "vicon yaw", "rad", pos.yaw, time);
emit valueChanged(uasId, "vicon x", "m", pos.x, time);
emit valueChanged(uasId, "vicon y", "m", pos.y, time);
emit valueChanged(uasId, "vicon z", "m", pos.z, time);
emit localPositionChanged(this, pos.x, pos.y, pos.z, time);
}
break;
case MAVLINK_MSG_ID_AUX_STATUS:
{
mavlink_vicon_position_estimate_t pos;
mavlink_msg_vicon_position_estimate_decode(&message, &pos);
quint64 time = getUnixTime(pos.usec);
//emit valueChanged(uasId, "vis. time", pos.usec, time);
emit valueChanged(uasId, "vicon roll", "rad", pos.roll, time);
emit valueChanged(uasId, "vicon pitch", "rad", pos.pitch, time);
emit valueChanged(uasId, "vicon yaw", "rad", pos.yaw, time);
emit valueChanged(uasId, "vicon x", "m", pos.x, time);
emit valueChanged(uasId, "vicon y", "m", pos.y, time);
emit valueChanged(uasId, "vicon z", "m", pos.z, time);
emit localPositionChanged(this, pos.x, pos.y, pos.z, time);
}
break;
case MAVLINK_MSG_ID_AUX_STATUS:
{
mavlink_aux_status_t status;
mavlink_msg_aux_status_decode(&message, &status);
......@@ -152,31 +143,21 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit errCountChanged(uasId, "IMU", "SPI0", status.spi0_err_count);
emit errCountChanged(uasId, "IMU", "SPI1", status.spi1_err_count);
emit errCountChanged(uasId, "IMU", "UART", status.uart_total_err_count);
emit valueChanged(uasId, "Load", "%", ((float)status.load)/1000.0f, MG::TIME::getGroundTimeNow());
}
break;
case MAVLINK_MSG_ID_CONTROL_STATUS:
{
mavlink_control_status_t status;
mavlink_msg_control_status_decode(&message, &status);
// Emit control status vector
emit attitudeControlEnabled(static_cast<bool>(status.control_att));
emit positionXYControlEnabled(static_cast<bool>(status.control_pos_xy));
emit positionZControlEnabled(static_cast<bool>(status.control_pos_z));
emit positionYawControlEnabled(static_cast<bool>(status.control_pos_yaw));
// Emit localization status vector
emit localizationChanged(this, status.position_fix);
emit visionLocalizationChanged(this, status.vision_fix);
emit gpsLocalizationChanged(this, status.gps_fix);
emit valueChanged(uasId, "Load", "%", ((float)status.load)/10.0f, getUnixTime());
}
break;
default:
// Do nothing
default:
// Let UAS handle the default message set
UAS::receiveMessage(link, message);
break;
}
}
#else
// Let UAS handle the default message set
UAS::receiveMessage(link, message);
Q_UNUSED(link);
Q_UNUSED(message);
#endif
}
......
......@@ -64,11 +64,12 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (message.sysid == uasId)
{
// Handle your special messages mavlink_message_t* msg = &message;
#ifdef MAVLINK_ENABLED_SLUGS
// Handle your special messages mavlink_message_t* msg = &message;
switch (message.msgid)
{
#ifdef MAVLINK_ENABLED_SLUGS
case MAVLINK_MSG_ID_RAW_IMU:
mavlink_msg_raw_imu_decode(&message, &mlRawImuData);
......@@ -151,12 +152,11 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
break;
#endif
default:
// qDebug() << "\nSLUGS RECEIVED MESSAGE WITH ID" << message.msgid;
break;
}
#endif
}
}
......
This diff is collapsed.
......@@ -120,14 +120,19 @@ protected: //COMMENTS FOR TEST UNIT
double thrustMax; ///< Maximum forward/up thrust of this vehicle, in Newtons
// Battery stats
double fullVoltage; ///< Voltage of the fully charged battery (100%)
double emptyVoltage; ///< Voltage of the empty battery (0%)
double startVoltage; ///< Voltage at system start
float fullVoltage; ///< Voltage of the fully charged battery (100%)
float emptyVoltage; ///< Voltage of the empty battery (0%)
float startVoltage; ///< Voltage at system start
float warnVoltage; ///< Voltage where QGC will start to warn about low battery
float warnLevelPercent; ///< Warning level, in percent
double currentVoltage; ///< Voltage currently measured
float lpVoltage; ///< Low-pass filtered voltage
bool batteryRemainingEstimateEnabled; ///< If the estimate is enabled, QGC will try to estimate the remaining battery life
float chargeLevel; ///< Charge level of battery, in percent
int timeRemaining; ///< Remaining time calculated based on previous and current
unsigned int mode; ///< The current mode of the MAV
int mode; ///< The current mode of the MAV
int status; ///< The current status of the MAV
int navMode; ///< The current navigation mode of the MAV
quint64 onboardTimeOffset;
bool controlRollManual; ///< status flag, true if roll is controlled manually
......@@ -157,37 +162,56 @@ protected: //COMMENTS FOR TEST UNIT
double yaw;
quint64 lastHeartbeat; ///< Time of the last heartbeat message
QTimer* statusTimeout; ///< Timer for various status timeouts
int imageSize; ///< Image size being transmitted (bytes)
int imagePackets; ///< Number of data packets being sent for this image
int imagePacketsArrived; ///< Number of data packets recieved
int imagePayload; ///< Payload size per transmitted packet (bytes). Standard is 254, and decreases when image resolution increases.
int imageQuality; ///< JPEG-Quality of the transmitted image (percentage)
QByteArray imageRecBuffer; ///< Buffer for the incoming bytestream
QImage image; ///< Image data of last completely transmitted image
quint64 imageStart;
QMap<int, QMap<QString, float>* > parameters; ///< All parameters
bool paramsOnceRequested; ///< If the parameter list has been read at least once
int airframe; ///< The airframe type
bool attitudeKnown; ///< True if attitude was received, false else
public:
/** @brief Set the current battery type */
void setBattery(BatteryType type, int cells);
/** @brief Estimate how much flight time is remaining */
int calculateTimeRemaining();
/** @brief Get the current charge level */
double getChargeLevel();
float getChargeLevel();
/** @brief Get the human-readable status message for this code */
void getStatusForCode(int statusCode, QString& uasState, QString& stateDescription);
/** @brief Get the human-readable navigation mode translation for this mode */
QString getNavModeText(int mode);
/** @brief Check if vehicle is in autonomous mode */
bool isAuto();
public:
UASWaypointManager* getWaypointManager() { return &waypointManager; }
int getSystemType();
QImage getImage();
void requestImage(); // ?
int getAutopilotType() {return autopilot;}
public slots:
/** @brief Set the autopilot type */
void setAutopilotType(int apType) { autopilot = apType; emit systemSpecsChanged(uasId); }
/** @brief Set the type of airframe */
void setSystemType(int systemType) { type = systemType; emit systemSpecsChanged(uasId); }
void setSystemType(int systemType);
/** @brief Set the specific airframe type */
void setAirframe(int airframe) { this->airframe = airframe; emit systemSpecsChanged(uasId); }
/** @brief Set a new name **/
void setUASName(const QString& name);
/** @brief Executes an action **/
void setAction(MAV_ACTION action);
/** @brief Set the current battery type and voltages */
void setBatterySpecs(const QString& specs);
/** @brief Get the current battery type and specs */
QString getBatterySpecs();
/** @brief Launches the system **/
void launch();
......@@ -252,6 +276,9 @@ public slots:
/** @brief Request all parameters */
void requestParameters();
/** @brief Request a single parameter by index */
void requestParameter(int component, int parameter);
/** @brief Set a system parameter */
void setParameter(const int component, const QString& id, const float value);
......@@ -271,7 +298,7 @@ public slots:
void enableExtendedSystemStatusTransmission(int rate);
void enableRCChannelDataTransmission(int rate);
void enableRawControllerDataTransmission(int rate);
void enableRawSensorFusionTransmission(int rate);
//void enableRawSensorFusionTransmission(int rate);
void enablePositionTransmission(int rate);
void enableExtra1Transmission(int rate);
void enableExtra2Transmission(int rate);
......@@ -310,10 +337,12 @@ signals:
/** @brief Propagate a heartbeat received from the system */
void heartbeat(UASInterface* uas);
void imageStarted(quint64 timestamp);
/** @brief A new camera image has arrived */
void imageReady(UASInterface* uas);
protected:
/** @brief Get the UNIX timestamp in microseconds */
quint64 getUnixTime(quint64 time);
/** @brief Get the UNIX timestamp in milliseconds */
quint64 getUnixTime(quint64 time=0);
protected slots:
/** @brief Write settings to disk */
......
......@@ -226,6 +226,8 @@ public slots:
virtual void setLocalOriginAtCurrentGPSPosition() = 0;
/** @brief Request all onboard parameters of all components */
virtual void requestParameters() = 0;
/** @brief Request one specific onboard parameter */
virtual void requestParameter(int component, int parameter) = 0;
/** @brief Write parameter to permanent storage */
virtual void writeParametersToStorage() = 0;
/** @brief Read parameter from permanent storage */
......@@ -259,7 +261,7 @@ public slots:
virtual void enableExtendedSystemStatusTransmission(int rate) = 0;
virtual void enableRCChannelDataTransmission(int rate) = 0;
virtual void enableRawControllerDataTransmission(int rate) = 0;
virtual void enableRawSensorFusionTransmission(int rate) = 0;
//virtual void enableRawSensorFusionTransmission(int rate) = 0;
virtual void setLocalPositionSetpoint(float x, float y, float z, float yaw) = 0;
virtual void setLocalPositionOffset(float x, float y, float z, float yaw) = 0;
......@@ -269,7 +271,10 @@ public slots:
virtual void startGyroscopeCalibration() = 0;
virtual void startPressureCalibration() = 0;
/** @brief Set the current battery type and voltages */
virtual void setBatterySpecs(const QString& specs) = 0;
/** @brief Get the current battery type and specs */
virtual QString getBatterySpecs() = 0;
protected:
QColor color;
......@@ -301,7 +306,11 @@ signals:
void poiFound(UASInterface* uas, int type, int colorIndex, QString message, float x, float y, float z);
void poiConnectionFound(UASInterface* uas, int type, int colorIndex, QString message, float x1, float y1, float z1, float x2, float y2, float z2);
/** @brief A text message from the system has been received */
void textMessageReceived(int uasid, int componentid, int severity, QString text);
void navModeChanged(int uasid, int mode, const QString& text);
/**
* @brief Update the error count of a device
*
......@@ -366,6 +375,7 @@ signals:
void waypointReached(UASInterface* uas, int id);
void autoModeChanged(bool autoMode);
void parameterChanged(int uas, int component, QString parameterName, float value);
void parameterChanged(int uas, int component, int parameterCount, int parameterId, QString parameterName, float value);
void patternDetected(int uasId, QString patternPath, float confidence, bool detected);
void letterDetected(int uasId, QString letter, float confidence, bool detected);
/**
......@@ -382,10 +392,12 @@ signals:
void thrustChanged(UASInterface*, double thrust);
void heartbeat(UASInterface* uas);
void attitudeChanged(UASInterface*, double roll, double pitch, double yaw, quint64 usec);
void attitudeSpeedChanged(int uas, double rollspeed, double pitchspeed, double yawspeed, quint64 usec);
void attitudeThrustSetPointChanged(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 usec);
void positionSetPointsChanged(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired, quint64 usec);
void localPositionChanged(UASInterface*, double x, double y, double z, quint64 usec);
void globalPositionChanged(UASInterface*, double lat, double lon, double alt, quint64 usec);
void altitudeChanged(int uasid, double altitude);
/** @brief Update the status of one satellite used for localization */
void gpsSatelliteStatusChanged(int uasid, int satid, float azimuth, float direction, float snr, bool used);
void speedChanged(UASInterface*, double x, double y, double z, quint64 usec);
......
......@@ -58,21 +58,26 @@ UASManager* UASManager::instance()
UASManager::UASManager() :
activeUAS(NULL)
{
systems = QList<UASInterface*>();
start(QThread::LowPriority);
}
UASManager::~UASManager()
{
// Delete all systems
foreach (UASInterface* mav, systems)
{
delete mav;
}
}
void UASManager::run()
{
forever
{
QGC::SLEEP::msleep(5000);
}
// forever
// {
// QGC::SLEEP::msleep(5000);
// }
exec();
}
void UASManager::addUAS(UASInterface* uas)
......
This diff is collapsed.
......@@ -86,7 +86,13 @@ public:
/** @name Waypoint list operations */
/*@{*/
const QVector<Waypoint *> &getWaypointList(void) { return waypoints; } ///< Returns a const reference to the waypoint list.
int getIndexOf(Waypoint* wp); ///< Get the index of a waypoint in the list
const QVector<Waypoint *> getGlobalFrameWaypointList(); ///< Returns a global waypoint list
int getIndexOf(Waypoint* wp); ///< Get the index of a waypoint in the list
int getGlobalFrameIndexOf(Waypoint* wp); ///< Get the index of a waypoint in the list, counting only global waypoints
int getLocalFrameIndexOf(Waypoint* wp); ///< Get the index of a waypoint in the list, counting only local waypoints
int getMissionFrameIndexOf(Waypoint* wp); ///< Get the index of a waypoint in the list, counting only mission waypoints
int getGlobalFrameCount(); ///< Get the count of global waypoints in the list
int getLocalFrameCount(); ///< Get the count of local waypoints in the list
/*@}*/
UAS& getUAS() { return this->uas; } ///< Returns the owning UAS
......
......@@ -47,6 +47,7 @@ This file is part of the QGROUNDCONTROL project
#endif
#include "MAVLinkProtocol.h"
#include "MAVLinkSettingsWidget.h"
#include "QGCUDPLinkConfiguration.h"
#include "LinkManager.h"
CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolInterface* protocol, QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags)
......@@ -57,20 +58,24 @@ CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolIn
ui.setupUi(this);
// add link types
ui.linkType->addItem("Serial",QGC_LINK_SERIAL);
ui.linkType->addItem("UDP",QGC_LINK_UDP);
ui.linkType->addItem("Simulation",QGC_LINK_SIMULATION);
ui.linkType->addItem("Serial Forwarding",QGC_LINK_FORWARDING);
ui.linkType->addItem(tr("Serial"), QGC_LINK_SERIAL);
ui.linkType->addItem(tr("UDP"), QGC_LINK_UDP);
ui.linkType->addItem(tr("Simulation"), QGC_LINK_SIMULATION);
ui.linkType->addItem(tr("Opal-RT Link"), QGC_LINK_OPAL);
ui.linkType->setEditable(false);
//ui.linkType->setEnabled(false);
ui.connectionType->addItem("MAVLink", QGC_PROTOCOL_MAVLINK);
ui.connectionType->addItem("GPS NMEA", QGC_PROTOCOL_NMEA);
//ui.connectionType->addItem("GPS NMEA", QGC_PROTOCOL_NMEA);
// Create action to open this menu
// Create configuration action for this link
// Connect the current UAS
action = new QAction(QIcon(":/images/devices/network-wireless.svg"), "", link);
action = new QAction(QIcon(":/images/devices/network-wireless.svg"), "", this);
LinkManager::instance()->add(link);
action->setData(LinkManager::instance()->getLinks().indexOf(link));
action->setEnabled(true);
action->setVisible(true);
setLinkName(link->getName());
connect(action, SIGNAL(triggered()), this, SLOT(show()));
......@@ -110,17 +115,24 @@ CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolIn
layout->addWidget(conf);
ui.linkGroupBox->setLayout(layout);
ui.linkGroupBox->setTitle(tr("Serial Link"));
ui.linkType->setCurrentIndex(0);
//ui.linkGroupBox->setTitle(link->getName());
//connect(link, SIGNAL(nameChanged(QString)), ui.linkGroupBox, SLOT(setTitle(QString)));
}
UDPLink* udp = dynamic_cast<UDPLink*>(link);
if (udp != 0)
{
QWidget* conf = new QGCUDPLinkConfiguration(udp, this);
QBoxLayout* layout = new QBoxLayout(QBoxLayout::LeftToRight, ui.linkGroupBox);
layout->addWidget(conf);
ui.linkGroupBox->setLayout(layout);
ui.linkGroupBox->setTitle(tr("UDP Link"));
ui.linkType->setCurrentIndex(1);
}
MAVLinkSimulationLink* sim = dynamic_cast<MAVLinkSimulationLink*>(link);
if (sim != 0)
{
ui.linkType->setCurrentIndex(2);
ui.linkGroupBox->setTitle(tr("MAVLink Simulation Link"));
}
#ifdef OPAL_RT
......@@ -131,6 +143,7 @@ CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolIn
QBoxLayout* layout = new QBoxLayout(QBoxLayout::LeftToRight, ui.linkGroupBox);
layout->addWidget(conf);
ui.linkGroupBox->setLayout(layout);
ui.linkType->setCurrentIndex(3);
ui.linkGroupBox->setTitle(tr("Opal-RT Link"));
}
#endif
......@@ -201,10 +214,9 @@ void CommConfigurationWindow::setConnection()
void CommConfigurationWindow::setLinkName(QString name)
{
Q_UNUSED(name); // FIXME
action->setText(tr("Configure ") + link->getName());
action->setStatusTip(tr("Configure ") + link->getName());
this->window()->setWindowTitle(tr("Settings for ") + this->link->getName());
action->setText(tr("%1 Settings").arg(name));
action->setStatusTip(tr("Adjust setting for link %1").arg(name));
this->window()->setWindowTitle(tr("Settings for %1").arg(name));
}
void CommConfigurationWindow::remove()
......
......@@ -44,7 +44,8 @@ enum qgc_link_t
QGC_LINK_SERIAL,
QGC_LINK_UDP,
QGC_LINK_SIMULATION,
QGC_LINK_FORWARDING
QGC_LINK_FORWARDING,
QGC_LINK_OPAL
};
enum qgc_protocol_t
......
This diff is collapsed.
......@@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project
#include <QList>
#include <QByteArray>
#include <QTimer>
#include <QKeyEvent>
#include "LinkInterface.h"
......@@ -95,10 +96,20 @@ public slots:
void paintEvent(QPaintEvent *event);
/** @brief Update traffic measurements */
void updateTrafficMeasurements();
void loadSettings();
void storeSettings();
protected:
void changeEvent(QEvent *e);
void hideEvent(QHideEvent* event);
/** @brief Convert a symbol name to the byte representation */
QByteArray symbolNameToBytes(const QString& symbol);
/** @brief Convert a symbol byte to the name */
QString bytesToSymbolNames(const QByteArray& b);
/** @brief Handle keypress events */
void keyPressEvent(QKeyEvent * event);
/** @brief Cycle through the command history */
void cycleCommandHistory(bool up);
QList<LinkInterface*> links;
LinkInterface* currLink;
......@@ -106,6 +117,7 @@ protected:
bool holdOn; ///< Hold current view, ignore new data
bool convertToAscii; ///< Convert data to ASCII
bool filterMAVLINK; ///< Set true to filter out MAVLink in output
bool autoHold; ///< Auto-hold mode sets view into hold if the data rate is too high
int bytesToIgnore; ///< Number of bytes to ignore
char lastByte; ///< The last received byte
QList<QString> sentBytes; ///< Transmitted bytes, per transmission
......@@ -118,7 +130,9 @@ protected:
float dataRate; ///< Current data rate
float lowpassDataRate; ///< Lowpass filtered data rate
float dataRateThreshold; ///< Threshold where to enable auto-hold
bool autoHold; ///< Auto-hold mode sets view into hold if the data rate is too high
QStringList commandHistory;
QString currCommand;
int commandIndex;
private:
Ui::DebugConsole *m_ui;
......
This diff is collapsed.
This diff is collapsed.
......@@ -63,9 +63,11 @@ public:
~HDDisplay();
public slots:
/** @brief Update a HDD value */
/** @brief Update a HDD double value */
void updateValue(const int uasId, const QString& name, const QString& unit, const double value, const quint64 msec);
void setActiveUAS(UASInterface* uas);
/** @brief Update a HDD integer value */
void updateValue(const int uasId, const QString& name, const QString& unit, const int value, const quint64 msec);
virtual void setActiveUAS(UASInterface* uas);
/** @brief Removes a plot item by the action data */
void removeItemByAction();
......@@ -137,14 +139,15 @@ protected:
UASInterface* uas; ///< The uas currently monitored
QMap<QString, float> values; ///< The variables this HUD displays
QMap<QString, QString> units; ///< The units
QMap<QString, QString> units; ///< The units
QMap<QString, float> valuesDot; ///< First derivative of the variable
QMap<QString, float> valuesMean; ///< Mean since system startup for this variable
QMap<QString, int> valuesCount; ///< Number of values received so far
QMap<QString, quint64> lastUpdate; ///< The last update time for this variable
QMap<QString, float> minValues; ///< The minimum value this variable is assumed to have
QMap<QString, float> maxValues; ///< The maximum value this variable is assumed to have
QMap<QString, bool> symmetric; ///< Draw the gauge / dial symmetric bool = yes
QMap<QString, bool> symmetric; ///< Draw the gauge / dial symmetric bool = yes
QMap<QString, bool> intValues; ///< Is the gauge value an integer?
QMap<QString, QPair<float, float> > goodRanges; ///< The range of good values
QMap<QString, QPair<float, float> > critRanges; ///< The range of critical values
double scalingFactor; ///< Factor used to scale all absolute values to screen coordinates
......
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.
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.
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.
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.
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.
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.
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