After Width: | Height: | Size: 354 KiB |
After Width: | Height: | Size: 374 KiB |
After Width: | Height: | Size: 380 KiB |
After Width: | Height: | Size: 397 KiB |
After Width: | Height: | Size: 354 KiB |
After Width: | Height: | Size: 184 KiB |
After Width: | Height: | Size: 217 KiB |
After Width: | Height: | Size: 159 KiB |
After Width: | Height: | Size: 450 KiB |
After Width: | Height: | Size: 451 KiB |
After Width: | Height: | Size: 317 KiB |
After Width: | Height: | Size: 328 KiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 232 KiB |
After Width: | Height: | Size: 168 KiB |
After Width: | Height: | Size: 200 KiB |
After Width: | Height: | Size: 176 KiB |
After Width: | Height: | Size: 280 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 278 KiB |
After Width: | Height: | Size: 247 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 571 KiB |
After Width: | Height: | Size: 571 KiB |
After Width: | Height: | Size: 487 KiB |
After Width: | Height: | Size: 488 KiB |
After Width: | Height: | Size: 301 KiB |
After Width: | Height: | Size: 301 KiB |
After Width: | Height: | Size: 354 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 439 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 530 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 306 B |
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
moc_* |
||||
*.o |
||||
Makefile |
||||
Makefile.Debug |
||||
Makefile.Release |
@ -0,0 +1,114 @@
@@ -0,0 +1,114 @@
|
||||
#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) |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
#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
|
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
# 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 |
@ -0,0 +1,174 @@
@@ -0,0 +1,174 @@
|
||||
/*=====================================================================
|
||||
|
||||
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); |
||||
} |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
/*=====================================================================
|
||||
|
||||
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
|
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
/****************************************************************************
|
||||
** 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! |
||||
****************************************************************************/ |
||||
|
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
/****************************************************************************
|
||||
** 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! |
||||
****************************************************************************/ |
||||
|
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
/****************************************************************************
|
||||
** 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! |
||||
****************************************************************************/ |
||||
|
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
/****************************************************************************
|
||||
** 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! |
||||
****************************************************************************/ |
||||
|
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
/****************************************************************************
|
||||
** 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! |
||||
****************************************************************************/ |
||||
|
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
/****************************************************************************
|
||||
** 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! |
||||
****************************************************************************/ |
||||
|