Commit 34290c05 authored by pixhawk's avatar pixhawk

merged. Added Waypoint changes, only retrieving waypoints works at the moment

parent daf07a1f
...@@ -25,21 +25,6 @@ ...@@ -25,21 +25,6 @@
# #
#------------------------------------------------- #-------------------------------------------------
QT += network opengl svg xml phonon
TEMPLATE = app
TARGET = qgroundcontrol
BASEDIR = .
BUILDDIR = build
LANGUAGE = C++
CONFIG += debug_and_release console
OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc
UI_HEADERS_DIR = src/ui/generated
#$$BASEDIR/lib/qextserialport/include #$$BASEDIR/lib/qextserialport/include
# $$BASEDIR/lib/openjaus/libjaus/include \ # $$BASEDIR/lib/openjaus/libjaus/include \
# $$BASEDIR/lib/openjaus/libopenJaus/include # $$BASEDIR/lib/openjaus/libopenJaus/include
......
...@@ -8,6 +8,22 @@ ...@@ -8,6 +8,22 @@
include(lib/QMapControl/QMapControl.pri) include(lib/QMapControl/QMapControl.pri)
message("Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows") message("Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows")
QT += network opengl svg xml phonon
TEMPLATE = app
TARGET = qgroundcontrol
BASEDIR = .
BUILDDIR = build
LANGUAGE = C++
CONFIG += debug_and_release console
OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc
UI_HEADERS_DIR = src/ui/generated
# } # }
# Include general settings for MAVGround # Include general settings for MAVGround
# necessary as last include to override any non-acceptable settings # necessary as last include to override any non-acceptable settings
...@@ -22,7 +38,8 @@ include(src/lib/qextserialport/qextserialport.pri) ...@@ -22,7 +38,8 @@ include(src/lib/qextserialport/qextserialport.pri)
include(src/lib/qwt/qwt.pri) include(src/lib/qwt/qwt.pri)
DEPENDPATH += . \ DEPENDPATH += . \
lib/QMapControl \ lib/QMapControl \
lib/QMapControl/src lib/QMapControl/src \
plugins
INCLUDEPATH += . \ INCLUDEPATH += . \
lib/QMapControl \ lib/QMapControl \
../mavlink/include \ ../mavlink/include \
...@@ -124,7 +141,8 @@ HEADERS += src/MG.h \ ...@@ -124,7 +141,8 @@ HEADERS += src/MG.h \
src/ui/watchdog/WatchdogControl.h \ src/ui/watchdog/WatchdogControl.h \
src/ui/watchdog/WatchdogProcessView.h \ src/ui/watchdog/WatchdogProcessView.h \
src/ui/watchdog/WatchdogView.h \ src/ui/watchdog/WatchdogView.h \
src/uas/UASWaypointManager.h src/uas/UASWaypointManager.h \
src/ui/HSIDisplay.h
SOURCES += src/main.cc \ SOURCES += src/main.cc \
src/Core.cc \ src/Core.cc \
src/uas/UASManager.cc \ src/uas/UASManager.cc \
...@@ -178,5 +196,6 @@ SOURCES += src/main.cc \ ...@@ -178,5 +196,6 @@ SOURCES += src/main.cc \
src/ui/watchdog/WatchdogControl.cc \ src/ui/watchdog/WatchdogControl.cc \
src/ui/watchdog/WatchdogProcessView.cc \ src/ui/watchdog/WatchdogProcessView.cc \
src/ui/watchdog/WatchdogView.cc \ src/ui/watchdog/WatchdogView.cc \
src/uas/UASWaypointManager.cc src/uas/UASWaypointManager.cc \
src/ui/HSIDisplay.cc
RESOURCES = mavground.qrc RESOURCES = mavground.qrc
...@@ -131,7 +131,7 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -131,7 +131,7 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
} }
} }
// MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(MG::DIR::getSupportFilesDirectory() + "/demo-log.txt"); // MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(MG::DIR::getSupportFilesDirectory() + "/demo-log.txt");
MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(":/demo-log.txt"); MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(":/demo-log.txt");
mainWindow->addLink(simulationLink); mainWindow->addLink(simulationLink);
} }
...@@ -164,7 +164,42 @@ void Core::startLinkManager() ...@@ -164,7 +164,42 @@ void Core::startLinkManager()
**/ **/
void Core::startUASManager() void Core::startUASManager()
{ {
UASManager::instance(); // Load UAS plugins
QDir pluginsDir = QDir(qApp->applicationDirPath());
#if defined(Q_OS_WIN)
if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
pluginsDir.cdUp();
#elif defined(Q_OS_LINUX)
if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
pluginsDir.cdUp();
#elif defined(Q_OS_MAC)
if (pluginsDir.dirName() == "MacOS")
{
pluginsDir.cdUp();
pluginsDir.cdUp();
pluginsDir.cdUp();
}
#endif
pluginsDir.cd("plugins");
UASManager* m = UASManager::instance();
// Load plugins
QStringList pluginFileNames;
foreach (QString fileName, pluginsDir.entryList(QDir::Files))
{
QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
QObject *plugin = loader.instance();
if (plugin)
{
//populateMenus(plugin);
pluginFileNames += fileName;
printf(QString("Loaded plugin from " + fileName + "\n").toStdString().c_str());
}
}
} }
moc_*
*.o
Makefile
Makefile.Debug
Makefile.Release
#include "PxMAV.h"
#include <QtCore>
PxMAV::PxMAV() :
UAS(NULL, 0)
{
}
PxMAV::PxMAV(MAVLinkProtocol* mavlink, int id) :
UAS(mavlink, id)
{
}
/**
* This function is called by MAVLink once a complete, uncorrupted (CRC check valid)
* mavlink packet is received.
*
* @param link Hardware link the message came from (e.g. /dev/ttyUSB0 or UDP port).
* messages can be sent back to the system via this link
* @param message MAVLink message, as received from the MAVLink protocol stack
*/
void PxMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
// Let UAS handle the default message set
UAS::receiveMessage(link, message);
mavlink_message_t* msg = &message;
//qDebug() << "PX RECEIVED" << msg->sysid << msg->compid << msg->msgid;
// Handle your special messages
switch (msg->msgid)
{
case MAVLINK_MSG_ID_WATCHDOG_HEARTBEAT:
{
mavlink_watchdog_heartbeat_t payload;
mavlink_msg_watchdog_heartbeat_decode(msg, &payload);
emit watchdogReceived(this->uasId, payload.watchdog_id, payload.process_count);
}
break;
case MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO:
{
mavlink_watchdog_process_info_t payload;
mavlink_msg_watchdog_process_info_decode(msg, &payload);
emit processReceived(this->uasId, payload.watchdog_id, payload.process_id, QString((const char*)payload.name), QString((const char*)payload.arguments), payload.timeout);
}
break;
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_DEBUG_VECT:
{
mavlink_debug_vect_t vect;
mavlink_msg_debug_vect_decode(msg, &vect);
QString str((const char*)vect.name);
emit valueChanged(uasId, str+".x", vect.x, MG::TIME::getGroundTimeNow());
emit valueChanged(uasId, str+".y", vect.y, MG::TIME::getGroundTimeNow());
emit valueChanged(uasId, str+".z", vect.z, MG::TIME::getGroundTimeNow());
}
break;
case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE:
{
mavlink_vision_position_estimate_t pos;
mavlink_msg_vision_position_estimate_decode(&message, &pos);
quint64 time = getUnixTime(pos.usec);
emit valueChanged(uasId, "vis. time", pos.usec, time);
emit valueChanged(uasId, "vis. roll", pos.roll, time);
emit valueChanged(uasId, "vis. pitch", pos.pitch, time);
emit valueChanged(uasId, "vis. yaw", pos.yaw, time);
emit valueChanged(uasId, "vis. x", pos.x, time);
emit valueChanged(uasId, "vis. y", pos.y, time);
emit valueChanged(uasId, "vis. z", pos.z, time);
emit valueChanged(uasId, "vis. vx", pos.vx, time);
emit valueChanged(uasId, "vis. vy", pos.vy, time);
emit valueChanged(uasId, "vis. vz", pos.vz, time);
emit valueChanged(uasId, "vis. vyaw", pos.vyaw, time);
// Set internal state
if (!positionLock)
{
// If position was not locked before, notify positive
// GAudioOutput::instance()->notifyPositive();
}
positionLock = true;
}
break;
default:
// Do nothing
break;
}
}
void PxMAV::sendProcessCommand(int watchdogId, int processId, unsigned int command)
{
mavlink_watchdog_command_t payload;
payload.target_system_id = uasId;
payload.watchdog_id = watchdogId;
payload.process_id = processId;
payload.command_id = (uint8_t)command;
mavlink_message_t msg;
mavlink_msg_watchdog_command_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &payload);
sendMessage(msg);
}
Q_EXPORT_PLUGIN2(pixhawk_plugins, PxMAV)
#ifndef PXMAV_H
#define PXMAV_H
#include "UAS.h"
class PxMAV : public UAS
{
Q_OBJECT
Q_INTERFACES(UASInterface)
public:
PxMAV(MAVLinkProtocol* mavlink, int id);
PxMAV();
public slots:
/** @brief Receive a MAVLink message from this MAV */
void receiveMessage(LinkInterface* link, mavlink_message_t message);
/** @brief Send a command to an onboard process */
void sendProcessCommand(int watchdogId, int processId, unsigned int command);
signals:
void watchdogReceived(int systemId, int watchdogId, unsigned int processCount);
void processReceived(int systemId, int watchdogId, int processId, QString name, QString arguments, int timeout);
void processChanged(int systemId, int watchdogId, int processId, int state, bool muted, int crashed, int pid);
};
#endif // PXMAV_H
# This plugin is also identified by this line in PxMAV.cc
# Q_EXPORT_PLUGIN2(pixhawk_plugins, PxMAV)
include(../../qgroundcontrol.pri)
TEMPLATE = lib
CONFIG += plugin
QT += phonon
INCLUDEPATH += ../. \
../../../mavlink/include \
../../MAVLink/include \
../../mavlink/include \
../uas \
../comm
HEADERS = PxMAV.h
SOURCES = PxMAV.cc \
../uas/UAS.cc \
../GAudioOutput.cc \
../comm/MAVLinkProtocol.cc \
../uas/UASManager.cc
TARGET = $$qtLibraryTarget(pixhawk_plugins)
DESTDIR = ../../plugins
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
class PxQuadMAV : public UAS class PxQuadMAV : public UAS
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(UASInterface)
public: public:
PxQuadMAV(MAVLinkProtocol* mavlink, int id); PxQuadMAV(MAVLinkProtocol* mavlink, int id);
public slots: public slots:
......
...@@ -43,7 +43,7 @@ This file is part of the PIXHAWK project ...@@ -43,7 +43,7 @@ This file is part of the PIXHAWK project
#include "MAVLinkProtocol.h" #include "MAVLinkProtocol.h"
#include <mavlink.h> #include <mavlink.h>
UAS::UAS(MAVLinkProtocol* protocol, int id) : UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
uasId(id), uasId(id),
startTime(MG::TIME::getGroundTimeNow()), startTime(MG::TIME::getGroundTimeNow()),
commStatus(COMM_DISCONNECTED), commStatus(COMM_DISCONNECTED),
...@@ -74,6 +74,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : ...@@ -74,6 +74,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) :
positionLock(false), positionLock(false),
statusTimeout(new QTimer(this)) statusTimeout(new QTimer(this))
{ {
color = UASInterface::getNextColor();
setBattery(LIPOLY, 3); setBattery(LIPOLY, 3);
statusTimeout->setInterval(500); statusTimeout->setInterval(500);
connect(statusTimeout, SIGNAL(timeout()), this, SLOT(updateState())); connect(statusTimeout, SIGNAL(timeout()), this, SLOT(updateState()));
......
...@@ -51,10 +51,6 @@ class UASInterface : public QObject ...@@ -51,10 +51,6 @@ class UASInterface : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
UASInterface() :
color(UASInterface::getNextColor())
{
}
virtual ~UASInterface() {} virtual ~UASInterface() {}
/* MANAGEMENT */ /* MANAGEMENT */
...@@ -315,4 +311,6 @@ signals: ...@@ -315,4 +311,6 @@ signals:
void systemTypeSet(UASInterface* uas, unsigned int type); void systemTypeSet(UASInterface* uas, unsigned int type);
}; };
Q_DECLARE_INTERFACE(UASInterface, "org.qgroundcontrol/1.0");
#endif // _UASINTERFACE_H_ #endif // _UASINTERFACE_H_
...@@ -74,6 +74,12 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) : ...@@ -74,6 +74,12 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) :
{ {
//m_ui->setupUi(this); //m_ui->setupUi(this);
// Check if acceptlist exists
if (!acceptList)
{
acceptList = new QStringList();
}
this->setMinimumHeight(125); this->setMinimumHeight(125);
this->setMinimumWidth(100); this->setMinimumWidth(100);
...@@ -146,7 +152,7 @@ void HDDisplay::paintDisplay() ...@@ -146,7 +152,7 @@ void HDDisplay::paintDisplay()
painter.fillRect(QRect(0, 0, width(), height()), backgroundColor); painter.fillRect(QRect(0, 0, width(), height()), backgroundColor);
const int columns = 3; const int columns = 3;
const float spacing = 0.4f; // 40% of width const float spacing = 0.4f; // 40% of width
const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.1f)); const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.5f));
const QColor gaugeColor = QColor(200, 200, 200); const QColor gaugeColor = QColor(200, 200, 200);
//drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter); //drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter);
//drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true); //drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true);
......
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of Horizontal Situation Indicator class
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include <QFile>
#include <QStringList>
#include <QPainter>
#include "UASManager.h"
#include "HSIDisplay.h"
#include "MG.h"
#include <QDebug>
HSIDisplay::HSIDisplay(QWidget *parent) :
HDDisplay(NULL, parent)
{
}
void HSIDisplay::paintDisplay()
{
quint64 refreshInterval = 100;
quint64 currTime = MG::TIME::getGroundTimeNow();
if (currTime - lastPaintTime < refreshInterval)
{
// FIXME Need to find the source of the spurious paint events
//return;
}
lastPaintTime = currTime;
// Draw instruments
// TESTING THIS SHOULD BE MOVED INTO A QGRAPHICSVIEW
// Update scaling factor
// adjust scaling to fit both horizontally and vertically
scalingFactor = this->width()/vwidth;
double scalingFactorH = this->height()/vheight;
if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH;
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
painter.fillRect(QRect(0, 0, width(), height()), backgroundColor);
const int columns = 3;
const float spacing = 0.4f; // 40% of width
const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.1f));
const QColor ringColor = QColor(200, 200, 200);
//drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter);
//drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true);
//drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true);
// Left spacing from border / other gauges, measured from left edge to center
// float leftSpacing = gaugeWidth * spacing;
// float xCoord = leftSpacing + gaugeWidth/2.0f;
//
// float topSpacing = leftSpacing;
// float yCoord = topSpacing + gaugeWidth/2.0f;
//
// for (int i = 0; i < acceptList->size(); ++i)
// {
// QString value = acceptList->at(i);
// drawGauge(xCoord, yCoord, gaugeWidth/2.0f, minValues.value(value, -1.0f), maxValues.value(value, 1.0f), value, values.value(value, minValues.value(value, 0.0f)), gaugeColor, &painter, goodRanges.value(value, qMakePair(0.0f, 0.5f)), critRanges.value(value, qMakePair(0.7f, 1.0f)), true);
// xCoord += gaugeWidth + leftSpacing;
// // Move one row down if necessary
// if (xCoord + gaugeWidth > vwidth)
// {
// yCoord += topSpacing + gaugeWidth;
// xCoord = leftSpacing + gaugeWidth/2.0f;
// }
// }
}
/**
*
* @param uas the UAS/MAV to monitor/display with the HUD
*/
void HSIDisplay::setActiveUAS(UASInterface* uas)
{
HDDisplay::setActiveUAS(uas);
//qDebug() << "ATTEMPTING TO SET UAS";
if (this->uas != NULL && this->uas != uas)
{
// Disconnect any previously connected active MAV
//disconnect(uas, SIGNAL(valueChanged(UASInterface*,QString,double,quint64)), this, SLOT(updateValue(UASInterface*,QString,double,quint64)));
}
// Now connect the new UAS
//if (this->uas != uas)
// {
//qDebug() << "UAS SET!" << "ID:" << uas->getUASID();
// Setup communication
//connect(uas, SIGNAL(valueChanged(UASInterface*,QString,double,quint64)), this, SLOT(updateValue(UASInterface*,QString,double,quint64)));
//}
}
void HSIDisplay::drawGPS()
{
}
void HSIDisplay::drawObjects()
{
}
void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw, const QColor& color, QPainter* painter, bool solid)
{
// Draw the circle
QPen circlePen(Qt::SolidLine);
if (!solid) circlePen.setStyle(Qt::DotLine);
circlePen.setWidth(refLineWidthToPen(0.5f));
circlePen.setColor(defaultColor);
painter->setBrush(Qt::NoBrush);
painter->setPen(circlePen);
drawCircle(xRef, yRef, radius, 200.0f, color, painter);
//drawCircle(xRef, yRef, radius, 200.0f, 170.0f, 1.0f, color, painter);
// // Draw the value
// QString label;
// label.sprintf("%05.1f", value);
// paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter);
// Draw the needle
// Scale the rotation so that the gauge does one revolution
// per max. change
const float rangeScale = (2.0f * M_PI);
const float maxWidth = radius / 10.0f;
const float minWidth = maxWidth * 0.3f;
QPolygonF p(6);
p.replace(0, QPointF(xRef-maxWidth/2.0f, yRef-radius * 0.5f));
p.replace(1, QPointF(xRef-minWidth/2.0f, yRef-radius * 0.9f));
p.replace(2, QPointF(xRef+minWidth/2.0f, yRef-radius * 0.9f));
p.replace(3, QPointF(xRef+maxWidth/2.0f, yRef-radius * 0.5f));
p.replace(4, QPointF(xRef, yRef-radius * 0.46f));
p.replace(5, QPointF(xRef-maxWidth/2.0f, yRef-radius * 0.5f));
rotatePolygonClockWiseRad(p, yaw*rangeScale, QPointF(xRef, yRef));
QBrush indexBrush;
indexBrush.setColor(defaultColor);
indexBrush.setStyle(Qt::SolidPattern);
painter->setPen(Qt::SolidLine);
painter->setPen(defaultColor);
painter->setBrush(indexBrush);
drawPolygon(p, painter);
}
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of of Horizontal Situation Indicator class
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef HSIDISPLAY_H
#define HSIDISPLAY_H
#include <QtGui/QWidget>
#include <QColor>
#include <QTimer>
#include <QMap>
#include <QPair>
#include <cmath>
#include "HDDisplay.h"
class HSIDisplay : public HDDisplay {
Q_OBJECT
public:
HSIDisplay(QWidget *parent = 0);
// ~HSIDisplay();
public slots:
void setActiveUAS(UASInterface* uas);
protected slots:
void paintDisplay();
void drawGPS();
void drawObjects();
void drawBaseLines(float xRef, float yRef, float radius, float yaw, const QColor& color, QPainter* painter, bool solid);
protected:
private:
};
#endif // HSIDISPLAY_H
...@@ -100,6 +100,8 @@ settings() ...@@ -100,6 +100,8 @@ settings()
parameters->setVisible(false); parameters->setVisible(false);
watchdogControl = new WatchdogControl(this); watchdogControl = new WatchdogControl(this);
watchdogControl->setVisible(false); watchdogControl->setVisible(false);
hsi = new HSIDisplay(this);
hsi->setVisible(false);
QStringList* acceptList = new QStringList(); QStringList* acceptList = new QStringList();
acceptList->append("roll IMU"); acceptList->append("roll IMU");
......
...@@ -61,6 +61,7 @@ This file is part of the PIXHAWK project ...@@ -61,6 +61,7 @@ This file is part of the PIXHAWK project
#include "XMLCommProtocolWidget.h" #include "XMLCommProtocolWidget.h"
#include "HDDisplay.h" #include "HDDisplay.h"
#include "WatchdogControl.h" #include "WatchdogControl.h"
#include "HSIDisplay.h"
#include "LogCompressor.h" #include "LogCompressor.h"
...@@ -148,6 +149,7 @@ protected: ...@@ -148,6 +149,7 @@ protected:
HDDisplay* headDown1; HDDisplay* headDown1;
HDDisplay* headDown2; HDDisplay* headDown2;
WatchdogControl* watchdogControl; WatchdogControl* watchdogControl;
HSIDisplay* hsi;
// Popup widgets // Popup widgets
JoystickWidget* joystickWidget; JoystickWidget* joystickWidget;
......
...@@ -38,6 +38,8 @@ This file is part of the PIXHAWK project ...@@ -38,6 +38,8 @@ This file is part of the PIXHAWK project
#include <QDebug> #include <QDebug>
#include "MG.h"
ObjectDetectionView::ObjectDetectionView(QString folder, QWidget *parent) : ObjectDetectionView::ObjectDetectionView(QString folder, QWidget *parent) :
QWidget(parent), QWidget(parent),
patternList(), patternList(),
...@@ -90,8 +92,9 @@ void ObjectDetectionView::newDetection(int uasId, QString patternPath, int x1, i ...@@ -90,8 +92,9 @@ void ObjectDetectionView::newDetection(int uasId, QString patternPath, int x1, i
{ {
if (patternList.contains(patternPath)) if (patternList.contains(patternPath))
{ {
qDebug() << "REDETECTED"; //qDebug() << "REDETECTED";
/*
QList<QAction*> actions = m_ui->listWidget->actions(); QList<QAction*> actions = m_ui->listWidget->actions();
// Find action and update it // Find action and update it
foreach (QAction* act, actions) foreach (QAction* act, actions)
...@@ -112,6 +115,7 @@ void ObjectDetectionView::newDetection(int uasId, QString patternPath, int x1, i ...@@ -112,6 +115,7 @@ void ObjectDetectionView::newDetection(int uasId, QString patternPath, int x1, i
// Set name and label // Set name and label
m_ui->nameLabel->setText(patternName); m_ui->nameLabel->setText(patternName);
*/
} }
else else
{ {
...@@ -120,7 +124,11 @@ void ObjectDetectionView::newDetection(int uasId, QString patternPath, int x1, i ...@@ -120,7 +124,11 @@ void ObjectDetectionView::newDetection(int uasId, QString patternPath, int x1, i
patternList.insert(patternPath, confidence); patternList.insert(patternPath, confidence);
patternCount.insert(patternPath, 1); patternCount.insert(patternPath, 1);
QPixmap image = QPixmap(patternFolder + "/" + patternPath);
QString filePath = MG::DIR::getSupportFilesDirectory() + "/" + patternFolder + "/" + patternPath.split("/").last();
qDebug() << "Loading:" << filePath;
QPixmap image = QPixmap(filePath);
QIcon ico(image); QIcon ico(image);
QAction* act = new QAction(ico, patternPath + separator + "(#" + QString::number(1) + ")" + separator + QString::number(confidence), this); QAction* act = new QAction(ico, patternPath + separator + "(#" + QString::number(1) + ")" + separator + QString::number(confidence), this);
connect(act, SIGNAL(triggered()), this, SLOT(takeAction())); connect(act, SIGNAL(triggered()), this, SLOT(takeAction()));
......
...@@ -48,7 +48,7 @@ class ObjectDetectionView : public QWidget { ...@@ -48,7 +48,7 @@ class ObjectDetectionView : public QWidget {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(ObjectDetectionView) Q_DISABLE_COPY(ObjectDetectionView)
public: public:
explicit ObjectDetectionView(QString folder="test", QWidget *parent = 0); explicit ObjectDetectionView(QString folder="patterns", QWidget *parent = 0);
virtual ~ObjectDetectionView(); virtual ~ObjectDetectionView();
/** @brief Resize widget contents */ /** @brief Resize widget contents */
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4" colspan="4"> <item row="0" column="4" colspan="2">
<widget class="QProgressBar" name="batteryBar"> <widget class="QProgressBar" name="batteryBar">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="8" rowspan="6"> <item row="0" column="6" rowspan="6">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="4" colspan="4"> <item row="1" column="4" colspan="2">
<widget class="QProgressBar" name="receiveLossBar"> <widget class="QProgressBar" name="receiveLossBar">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="4" colspan="4"> <item row="2" column="4" colspan="2">
<widget class="QProgressBar" name="sendLossBar"> <widget class="QProgressBar" name="sendLossBar">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
...@@ -343,7 +343,7 @@ ...@@ -343,7 +343,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="4" colspan="4"> <item row="3" column="4" colspan="2">
<widget class="QProgressBar" name="loadBar"> <widget class="QProgressBar" name="loadBar">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
...@@ -380,56 +380,14 @@ ...@@ -380,56 +380,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="8"> <item row="4" column="0" colspan="6">
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0" colspan="7">
<widget class="QLabel" name="label_4">
<property name="text">
<string>I2C Errors</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLabel" name="i2cErrorLabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QLabel" name="label_5">
<property name="text">
<string>SPI Errors</string>
</property>
</widget>
</item>
<item row="5" column="5">
<widget class="QLabel" name="spiErrorLabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="5" column="6">
<widget class="QLabel" name="label_10">
<property name="text">
<string>UART Errors</string>
</property>
</widget>
</item>
<item row="5" column="7">
<widget class="QLabel" name="uartErrorLabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="9">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
...@@ -445,6 +403,13 @@ ...@@ -445,6 +403,13 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="5" column="0" colspan="6">
<widget class="QLabel" name="errorLabel">
<property name="text">
<string>No error status received yet</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
......
...@@ -85,8 +85,8 @@ void WaypointList::setUAS(UASInterface* uas) ...@@ -85,8 +85,8 @@ void WaypointList::setUAS(UASInterface* uas)
if (this->uas == NULL && uas != NULL) if (this->uas == NULL && uas != NULL)
{ {
this->uas = uas; this->uas = uas;
connect(uas, SIGNAL(waypointUpdated(int,int,double,double,double,double,bool,bool)), this, SLOT(setWaypoint(int,int,double,double,double,double,bool,bool))); connect(&uas->getWaypointManager(), SIGNAL(waypointUpdated(int,int,double,double,double,double,bool,bool)), this, SLOT(setWaypoint(int,int,double,double,double,double,bool,bool)));
connect(uas, SIGNAL(waypointReached(UASInterface*,int)), this, SLOT(waypointReached(UASInterface*,int))); connect(&uas->getWaypointManager(), SIGNAL(waypointReached(UASInterface*,int)), this, SLOT(waypointReached(UASInterface*,int)));
connect(this, SIGNAL(waypointChanged(Waypoint*)), &uas->getWaypointManager(), SLOT(setWaypoint(Waypoint*))); connect(this, SIGNAL(waypointChanged(Waypoint*)), &uas->getWaypointManager(), SLOT(setWaypoint(Waypoint*)));
connect(this, SIGNAL(currentWaypointChanged(int)), &uas->getWaypointManager(), SLOT(setWaypointActive(int))); connect(this, SIGNAL(currentWaypointChanged(int)), &uas->getWaypointManager(), SLOT(setWaypointActive(int)));
// This slot is not implemented in UAS: connect(this, SIGNAL(removeWaypointId(int)), uas, SLOT(removeWaypoint(Waypoint*))); // This slot is not implemented in UAS: connect(this, SIGNAL(removeWaypointId(int)), uas, SLOT(removeWaypoint(Waypoint*)));
...@@ -315,7 +315,7 @@ void WaypointList::setCurrentWaypoint(Waypoint* wp) ...@@ -315,7 +315,7 @@ void WaypointList::setCurrentWaypoint(Waypoint* wp)
{ {
waypoints[i]->current = true; waypoints[i]->current = true;
// Retransmit waypoint // Retransmit waypoint
uas->setWaypointActive(i); //uas->getWaypointManager().setWaypointActive(i);
} }
else else
{ {
......
/****************************************************************************
** Form interface generated from reading ui file 'src/ui/CommSettings.ui'
**
** Created: Tue Jun 1 20:21:32 2010
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
/****************************************************************************
** Form interface generated from reading ui file 'src/ui/MainWindow.ui'
**
** Created: Tue Jun 1 20:21:32 2010
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
/****************************************************************************
** Form interface generated from reading ui file 'src/ui/SerialSettings.ui'
**
** Created: Tue Jun 1 20:21:32 2010
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
/****************************************************************************
** Form interface generated from reading ui file 'src/ui/UASControl.ui'
**
** Created: Tue Jun 1 20:21:32 2010
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
/****************************************************************************
** Form interface generated from reading ui file 'src/ui/UASInfo.ui'
**
** Created: Tue Jun 1 20:21:32 2010
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
/****************************************************************************
** Form interface generated from reading ui file 'src/ui/UASList.ui'
**
** Created: Tue Jun 1 20:21:32 2010
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
...@@ -110,7 +110,7 @@ void UASInfoWidget::updateBattery(UASInterface* uas, double voltage, double perc ...@@ -110,7 +110,7 @@ void UASInfoWidget::updateBattery(UASInterface* uas, double voltage, double perc
void UASInfoWidget::updateErrorCount(int uasid, QString component, QString device, int count) void UASInfoWidget::updateErrorCount(int uasid, QString component, QString device, int count)
{ {
qDebug() << __FILE__ << __LINE__ << activeUAS->getUASID() << "=" << uasid; //qDebug() << __FILE__ << __LINE__ << activeUAS->getUASID() << "=" << uasid;
if (activeUAS->getUASID() == uasid) if (activeUAS->getUASID() == uasid)
{ {
errors.remove(component + ":" + device); errors.remove(component + ":" + device);
...@@ -182,5 +182,16 @@ void UASInfoWidget::refresh() ...@@ -182,5 +182,16 @@ void UASInfoWidget::refresh()
ui.sendLossLabel->setText(QString::number(sendLoss, 'f', 2)); ui.sendLossLabel->setText(QString::number(sendLoss, 'f', 2));
QString errorString; QString errorString;
// ui. QMapIterator<QString, int> i(errors);
while (i.hasNext())
{
i.next();
errorString += QString(i.key() + ": %1 ").arg(i.value());
// FIXME
errorString.replace("IMU:", "");
}
ui.errorLabel->setText(errorString);
} }
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