Commit e1270632 authored by Mariano Lizarraga's avatar Mariano Lizarraga

Merge branch 'master' of git@pixhawk.ethz.ch:qgroundcontrol into checkRemote

Conflicts:

	src/ui/MapWidget.h
parents cbfe1775 74746fec
...@@ -101,8 +101,46 @@ QSeparator { ...@@ -101,8 +101,46 @@ QSeparator {
QSpinBox { QSpinBox {
min-height: 12 px; min-height: 14px;
} max-height: 18px;
border: 1px solid #4A4A4F;
border-radius: 5px;
}
QSpinBox::up-button {
subcontrol-origin: border;
subcontrol-position: top right; /* position at the top right corner */
border-image: url(:/images/actions/go-up.svg) 1;
border-width: 1px;
}
QSpinBox::down-button {
subcontrol-origin: border;
subcontrol-position: bottom right; /* position at the top right corner */
border-image: url(:/images/actions/go-down.svg) 1;
border-width: 1px;
}
QDoubleSpinBox {
min-height: 14px;
max-height: 18px;
border: 1px solid #4A4A4F;
border-radius: 5px;
}
QDoubleSpinBox::up-button {
subcontrol-origin: border;
subcontrol-position: top right; /* position at the top right corner */
border-image: url(:/images/actions/go-up.svg) 1;
border-width: 1px;
max-width: 5px;
}
QDoubleSpinBox::down-button {
subcontrol-origin: border;
subcontrol-position: bottom right; /* position at the top right corner */
border-image: url(:/images/actions/go-down.svg) 1;
border-width: 1px;
max-width: 5px;
}
QPushButton { QPushButton {
font-weight: bold; font-weight: bold;
......
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
namespace qmapcontrol namespace qmapcontrol
{ {
GoogleMapAdapter::GoogleMapAdapter() GoogleMapAdapter::GoogleMapAdapter()
: TileMapAdapter("mt2.google.com", "/mt?n=404&x=%2&y=%3&zoom=%1", 256, 17, 0) : TileMapAdapter("mt0.google.com", "/vt/lyrs=&x=%2&s=&y=%3&z=%1", 256, 0, 17)
//: TileMapAdapter("tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 17)
{ {
} }
......
...@@ -29,155 +29,155 @@ ...@@ -29,155 +29,155 @@
namespace qmapcontrol namespace qmapcontrol
{ {
GoogleSatMapAdapter::GoogleSatMapAdapter() GoogleSatMapAdapter::GoogleSatMapAdapter()
: TileMapAdapter("kh2.google.com", "/kh?n=404&v=8&t=trtqtt", 256, 0, 19) : TileMapAdapter("khm.google.com", "/kh?v=51&x=%2&s=&y=%3&z=%1", 256, 0, 17)
{ {
// name = "googlesat"; // // name = "googlesat";
//
numberOfTiles = pow(2, current_zoom+0.0); // numberOfTiles = pow(2, current_zoom+0.0);
coord_per_x_tile = 360. / numberOfTiles; // coord_per_x_tile = 360. / numberOfTiles;
coord_per_y_tile = 180. / numberOfTiles; // coord_per_y_tile = 180. / numberOfTiles;
} }
GoogleSatMapAdapter::~GoogleSatMapAdapter() GoogleSatMapAdapter::~GoogleSatMapAdapter()
{ {
} }
//
QString GoogleSatMapAdapter::getHost() const // QString GoogleSatMapAdapter::getHost() const
{ // {
int random = qrand() % 4; // int random = qrand() % 4;
return QString("kh%1.google.com").arg(random); // return QString("kh%1.google.com").arg(random);
} // }
//
QPoint GoogleSatMapAdapter::coordinateToDisplay(const QPointF& coordinate) const // QPoint GoogleSatMapAdapter::coordinateToDisplay(const QPointF& coordinate) const
{ // {
//double x = ((coordinate.x()+180)*(tilesize*numberOfTiles/360)); // //double x = ((coordinate.x()+180)*(tilesize*numberOfTiles/360));
//double y = (((coordinate.y()*-1)+90)*(tilesize*numberOfTiles/180)); // //double y = (((coordinate.y()*-1)+90)*(tilesize*numberOfTiles/180));
//
qreal x = (coordinate.x()+180.) * (numberOfTiles*mytilesize)/360.; // coord to pixel! // qreal x = (coordinate.x()+180.) * (numberOfTiles*mytilesize)/360.; // coord to pixel!
//double y = -1*(coordinate.y()-90) * (numberOfTiles*tilesize)/180.; // coord to pixel! // //double y = -1*(coordinate.y()-90) * (numberOfTiles*tilesize)/180.; // coord to pixel!
qreal y = (getMercatorYCoord(coordinate.y())-M_PI) * -1 * (numberOfTiles*mytilesize)/(2*M_PI); // coord to pixel! // qreal y = (getMercatorYCoord(coordinate.y())-M_PI) * -1 * (numberOfTiles*mytilesize)/(2*M_PI); // coord to pixel!
return QPoint(int(x), int(y)); // return QPoint(int(x), int(y));
} // }
//
QPointF GoogleSatMapAdapter::displayToCoordinate(const QPoint& point) const // QPointF GoogleSatMapAdapter::displayToCoordinate(const QPoint& point) const
{ // {
//double lon = ((point.x()/tilesize*numberOfTiles)*360)-180; // //double lon = ((point.x()/tilesize*numberOfTiles)*360)-180;
//double lat = (((point.y()/tilesize*numberOfTiles)*180)-90)*-1; // //double lat = (((point.y()/tilesize*numberOfTiles)*180)-90)*-1;
//
qreal lon = (point.x()*(360.0/(numberOfTiles*mytilesize)))-180.0; // qreal lon = (point.x()*(360.0/(numberOfTiles*mytilesize)))-180.0;
// qreal lat = -(point.y()*(180.0/(numberOfTiles*mytilesize)))+90.0; // // qreal lat = -(point.y()*(180.0/(numberOfTiles*mytilesize)))+90.0;
// FIXME Looks buggy // // FIXME Looks buggy
//
qreal lat = getMercatorLatitude(point.y()*-1*(2*M_PI/(numberOfTiles*mytilesize)) + M_PI); // qreal lat = getMercatorLatitude(point.y()*-1*(2*M_PI/(numberOfTiles*mytilesize)) + M_PI);
//qreal lat = lat *180./M_PI; // //qreal lat = lat *180./M_PI;
return QPointF(lon, lat); // return QPointF(lon, lat);
} // }
//
qreal GoogleSatMapAdapter::getMercatorLatitude(qreal YCoord) const // qreal GoogleSatMapAdapter::getMercatorLatitude(qreal YCoord) const
{ // {
//http://welcome.warnercnr.colostate.edu/class_info/nr502/lg4/projection_mathematics/converting.html // //http://welcome.warnercnr.colostate.edu/class_info/nr502/lg4/projection_mathematics/converting.html
if (YCoord > M_PI) return 9999.; // if (YCoord > M_PI) return 9999.;
if (YCoord < -M_PI) return -9999.; // if (YCoord < -M_PI) return -9999.;
//
qreal t = atan(exp(YCoord)); // qreal t = atan(exp(YCoord));
qreal res = (2.*(t))-(M_PI/2.); // qreal res = (2.*(t))-(M_PI/2.);
return res; // return res;
} // }
//
qreal GoogleSatMapAdapter::getMercatorYCoord(qreal lati) const // qreal GoogleSatMapAdapter::getMercatorYCoord(qreal lati) const
{ // {
qreal lat = lati; // qreal lat = lati;
//
// conversion degre=>radians // // conversion degre=>radians
qreal phi = M_PI * lat / 180; // qreal phi = M_PI * lat / 180;
//
qreal res; // qreal res;
//double temp = Math.Tan(Math.PI / 4 - phi / 2); // //double temp = Math.Tan(Math.PI / 4 - phi / 2);
//res = Math.Log(temp); // //res = Math.Log(temp);
res = 0.5 * log((1 + sin(phi)) / (1 - sin(phi))); // res = 0.5 * log((1 + sin(phi)) / (1 - sin(phi)));
//
return res; // return res;
} // }
//
void GoogleSatMapAdapter::zoom_in() // void GoogleSatMapAdapter::zoom_in()
{ // {
current_zoom+=1; // current_zoom+=1;
numberOfTiles = pow(2, current_zoom+0.0); // numberOfTiles = pow(2, current_zoom+0.0);
coord_per_x_tile = 360. / numberOfTiles; // coord_per_x_tile = 360. / numberOfTiles;
coord_per_y_tile = 180. / numberOfTiles; // coord_per_y_tile = 180. / numberOfTiles;
} // }
//
void GoogleSatMapAdapter::zoom_out() // void GoogleSatMapAdapter::zoom_out()
{ // {
current_zoom-=1; // current_zoom-=1;
numberOfTiles = pow(2, current_zoom+0.0); // numberOfTiles = pow(2, current_zoom+0.0);
coord_per_x_tile = 360. / numberOfTiles; // coord_per_x_tile = 360. / numberOfTiles;
coord_per_y_tile = 180. / numberOfTiles; // coord_per_y_tile = 180. / numberOfTiles;
} // }
//
bool GoogleSatMapAdapter::isValid(int x, int y, int z) const // bool GoogleSatMapAdapter::isValid(int x, int y, int z) const
{ // {
if ((x>=0 && x < numberOfTiles) && (y>=0 && y < numberOfTiles) && z>=0) // if ((x>=0 && x < numberOfTiles) && (y>=0 && y < numberOfTiles) && z>=0)
{ // {
return true; // return true;
} // }
return false; // return false;
} // }
QString GoogleSatMapAdapter::query(int i, int j, int z) const // QString GoogleSatMapAdapter::query(int i, int j, int z) const
{ // {
return getQ(-180+i*coord_per_x_tile, // return getQ(-180+i*coord_per_x_tile,
90-(j+1)*coord_per_y_tile, z); // 90-(j+1)*coord_per_y_tile, z);
} // }
//
QString GoogleSatMapAdapter::getQ(qreal longitude, qreal latitude, int zoom) const // QString GoogleSatMapAdapter::getQ(qreal longitude, qreal latitude, int zoom) const
{ // {
qreal xmin=-180; // qreal xmin=-180;
qreal xmax=180; // qreal xmax=180;
qreal ymin=-90; // qreal ymin=-90;
qreal ymax=90; // qreal ymax=90;
//
qreal xmoy=0; // qreal xmoy=0;
qreal ymoy=0; // qreal ymoy=0;
QString location="t"; // QString location="t";
//
//Google uses a latitude divided by 2; // //Google uses a latitude divided by 2;
qreal halflat = latitude; // qreal halflat = latitude;
//
for (int i = 0; i < zoom; i++) // for (int i = 0; i < zoom; i++)
{ // {
xmoy = (xmax + xmin) / 2; // xmoy = (xmax + xmin) / 2;
ymoy = (ymax + ymin) / 2; // ymoy = (ymax + ymin) / 2;
if (halflat >= ymoy) //upper part (q or r) // if (halflat >= ymoy) //upper part (q or r)
{ // {
ymin = ymoy; // ymin = ymoy;
if (longitude < xmoy) // if (longitude < xmoy)
{ /*q*/ // { /*q*/
location+= "q"; // location+= "q";
xmax = xmoy; // xmax = xmoy;
} // }
else // else
{/*r*/ // {/*r*/
location+= "r"; // location+= "r";
xmin = xmoy; // xmin = xmoy;
} // }
} // }
else //lower part (t or s) // else //lower part (t or s)
{ // {
ymax = ymoy; // ymax = ymoy;
if (longitude < xmoy) // if (longitude < xmoy)
{ /*t*/ // { /*t*/
//
location+= "t"; // location+= "t";
xmax = xmoy; // xmax = xmoy;
} // }
else // else
{/*s*/ // {/*s*/
location+= "s"; // location+= "s";
xmin = xmoy; // xmin = xmoy;
} // }
} // }
} // }
return QString("/kh?n=404&v=24&t=%1").arg(location); // return QString("/kh?n=404&v=24&t=%1").arg(location);
} // }
} }
...@@ -44,31 +44,31 @@ namespace qmapcontrol ...@@ -44,31 +44,31 @@ namespace qmapcontrol
*/ */
GoogleSatMapAdapter(); GoogleSatMapAdapter();
virtual ~GoogleSatMapAdapter(); virtual ~GoogleSatMapAdapter();
//
virtual QPoint coordinateToDisplay(const QPointF&) const; // virtual QPoint coordinateToDisplay(const QPointF&) const;
virtual QPointF displayToCoordinate(const QPoint&) const; // virtual QPointF displayToCoordinate(const QPoint&) const;
//
//! returns the host of this MapAdapter // //! returns the host of this MapAdapter
/*! // /*!
* @return the host of this MapAdapter // * @return the host of this MapAdapter
*/ // */
QString getHost () const; // QString getHost () const;
//
//
protected: // protected:
virtual void zoom_in(); // virtual void zoom_in();
virtual void zoom_out(); // virtual void zoom_out();
virtual QString query(int x, int y, int z) const; // virtual QString query(int x, int y, int z) const;
virtual bool isValid(int x, int y, int z) const; // virtual bool isValid(int x, int y, int z) const;
//
private: // private:
virtual QString getQ(qreal longitude, qreal latitude, int zoom) const; // virtual QString getQ(qreal longitude, qreal latitude, int zoom) const;
qreal getMercatorLatitude(qreal YCoord) const; // qreal getMercatorLatitude(qreal YCoord) const;
qreal getMercatorYCoord(qreal lati) const; // qreal getMercatorYCoord(qreal lati) const;
//
qreal coord_per_x_tile; // qreal coord_per_x_tile;
qreal coord_per_y_tile; // qreal coord_per_y_tile;
int srvNum; // int srvNum;
}; };
} }
#endif #endif
price quantity
210 81
250 73
280 64
300 61
320 50
340 46
360 45
380 44
400 43
420 39
440 36
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
message(Qt version $$[QT_VERSION]) message(Qt version $$[QT_VERSION])
release {
# DEFINES += QT_NO_DEBUG_OUTPUT
# DEFINES += QT_NO_WARNING_OUTPUT
}
# MAC OS X # MAC OS X
macx { macx {
......
...@@ -124,7 +124,6 @@ HEADERS += src/MG.h \ ...@@ -124,7 +124,6 @@ HEADERS += src/MG.h \
src/ui/ObjectDetectionView.h \ src/ui/ObjectDetectionView.h \
src/input/JoystickInput.h \ src/input/JoystickInput.h \
src/ui/JoystickWidget.h \ src/ui/JoystickWidget.h \
src/ui/PFD.h \
src/ui/DebugConsole.h \ src/ui/DebugConsole.h \
src/ui/MapWidget.h \ src/ui/MapWidget.h \
src/ui/XMLCommProtocolWidget.h \ src/ui/XMLCommProtocolWidget.h \
...@@ -153,7 +152,10 @@ HEADERS += src/MG.h \ ...@@ -153,7 +152,10 @@ HEADERS += src/MG.h \
src/ui/QGCPxImuFirmwareUpdate.h \ src/ui/QGCPxImuFirmwareUpdate.h \
src/comm/MAVLinkLightProtocol.h \ src/comm/MAVLinkLightProtocol.h \
src/ui/QGCDataPlot2D.h \ src/ui/QGCDataPlot2D.h \
src/ui/linechart/IncrementalPlot.h src/ui/linechart/IncrementalPlot.h \
src/ui/map/Waypoint2DIcon.h \
src/ui/map/MAV2DIcon.h \
src/ui/map/QGC2DIcon.h
SOURCES += src/main.cc \ SOURCES += src/main.cc \
src/Core.cc \ src/Core.cc \
src/uas/UASManager.cc \ src/uas/UASManager.cc \
...@@ -185,7 +187,6 @@ SOURCES += src/main.cc \ ...@@ -185,7 +187,6 @@ SOURCES += src/main.cc \
src/ui/ObjectDetectionView.cc \ src/ui/ObjectDetectionView.cc \
src/input/JoystickInput.cc \ src/input/JoystickInput.cc \
src/ui/JoystickWidget.cc \ src/ui/JoystickWidget.cc \
src/ui/PFD.cc \
src/ui/DebugConsole.cc \ src/ui/DebugConsole.cc \
src/ui/MapWidget.cc \ src/ui/MapWidget.cc \
src/ui/XMLCommProtocolWidget.cc \ src/ui/XMLCommProtocolWidget.cc \
...@@ -214,12 +215,16 @@ SOURCES += src/main.cc \ ...@@ -214,12 +215,16 @@ SOURCES += src/main.cc \
src/ui/QGCPxImuFirmwareUpdate.cc \ src/ui/QGCPxImuFirmwareUpdate.cc \
src/comm/MAVLinkLightProtocol.cc \ src/comm/MAVLinkLightProtocol.cc \
src/ui/QGCDataPlot2D.cc \ src/ui/QGCDataPlot2D.cc \
src/ui/linechart/IncrementalPlot.cc src/ui/linechart/IncrementalPlot.cc \
src/ui/map/Waypoint2DIcon.cc \
src/ui/map/MAV2DIcon.cc \
src/ui/map/QGC2DIcon.cc
RESOURCES = mavground.qrc RESOURCES = mavground.qrc
# Include RT-LAB Library # Include RT-LAB Library
win32 { win32 {
LIBS += -LC:\OPAL-RT\RT-LAB7.2.4\Common\bin -lOpalApi LIBS += -LC:\OPAL-RT\RT-LAB7.2.4\Common\bin \
-lOpalApi
INCLUDEPATH += src/lib/opalrt INCLUDEPATH += src/lib/opalrt
SOURCES += src/comm/OpalLink.cc SOURCES += src/comm/OpalLink.cc
HEADERS += src/comm/OpalLink.h HEADERS += src/comm/OpalLink.h
......
...@@ -36,6 +36,9 @@ This file is part of the QGROUNDCONTROL project ...@@ -36,6 +36,9 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug> #include <QDebug>
/**
* It will only get active upon calling startCompression()
*/
LogCompressor::LogCompressor(QString logFileName, QString outFileName, int uasid) : LogCompressor::LogCompressor(QString logFileName, QString outFileName, int uasid) :
logFileName(logFileName), logFileName(logFileName),
outFileName(outFileName), outFileName(outFileName),
...@@ -44,7 +47,6 @@ LogCompressor::LogCompressor(QString logFileName, QString outFileName, int uasid ...@@ -44,7 +47,6 @@ LogCompressor::LogCompressor(QString logFileName, QString outFileName, int uasid
dataLines(1), dataLines(1),
uasid(uasid) uasid(uasid)
{ {
start();
} }
void LogCompressor::run() void LogCompressor::run()
...@@ -174,9 +176,15 @@ void LogCompressor::run() ...@@ -174,9 +176,15 @@ void LogCompressor::run()
dataLines = 1; dataLines = 1;
delete keys; delete keys;
qDebug() << "Done with logfile processing"; qDebug() << "Done with logfile processing";
emit finishedFile(outfile.fileName());
running = false; running = false;
} }
void LogCompressor::startCompression()
{
start();
}
bool LogCompressor::isFinished() bool LogCompressor::isFinished()
{ {
return !running; return !running;
......
...@@ -5,11 +5,15 @@ ...@@ -5,11 +5,15 @@
class LogCompressor : public QThread class LogCompressor : public QThread
{ {
Q_OBJECT
public: public:
/** @brief Create the log compressor. It will only get active upon calling startCompression() */
LogCompressor(QString logFileName, QString outFileName="", int uasid = 0); LogCompressor(QString logFileName, QString outFileName="", int uasid = 0);
void startCompression();
bool isFinished(); bool isFinished();
int getDataLines(); int getDataLines();
int getCurrentLine(); int getCurrentLine();
protected: protected:
void run(); void run();
QString logFileName; QString logFileName;
...@@ -18,6 +22,12 @@ protected: ...@@ -18,6 +22,12 @@ protected:
int currentDataLine; int currentDataLine;
int dataLines; int dataLines;
int uasid; int uasid;
signals:
/** @brief This signal is emitted once a logfile has been finished writing
* @param fileName The name out the output (CSV) file
*/
void finishedFile(QString fileName);
}; };
#endif // LOGCOMPRESSOR_H #endif // LOGCOMPRESSOR_H
...@@ -258,7 +258,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -258,7 +258,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
//if () //if ()
// If a new loss was detected or we just hit one 128th packet step // If a new loss was detected or we just hit one 128th packet step
if (lastLoss != totalLossCounter || (totalReceiveCounter & 0x7F) == 0) if (lastLoss != totalLossCounter || (totalReceiveCounter == 128))
{ {
// Calculate new loss ratio // Calculate new loss ratio
// Receive loss // Receive loss
......
...@@ -40,6 +40,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -40,6 +40,7 @@ This file is part of the QGROUNDCONTROL project
#include "ProtocolInterface.h" #include "ProtocolInterface.h"
#include "LinkInterface.h" #include "LinkInterface.h"
#include "protocol.h" #include "protocol.h"
#include "mavlink.h"
/** /**
* @brief MAVLink micro air vehicle protocol reference implementation. * @brief MAVLink micro air vehicle protocol reference implementation.
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef ARDUPILOTMAV_H #ifndef ARDUPILOTMAV_H
#define ARDUPILOTMAV_H #define ARDUPILOTMAV_H
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef PXQUADMAV_H #ifndef PXQUADMAV_H
#define PXQUADMAV_H #define PXQUADMAV_H
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef SLUGSMAV_H #ifndef SLUGSMAV_H
#define SLUGSMAV_H #define SLUGSMAV_H
......
...@@ -360,7 +360,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -360,7 +360,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (alt != alt) if (alt != alt)
{ {
alt = 0; alt = 0;
emit textMessageReceived(uasId, 255, "GCS ERROR: RECEIVED NaN FOR ALTITUDE"); emit textMessageReceived(uasId, message.compid, 255, "GCS ERROR: RECEIVED NaN FOR ALTITUDE");
} }
emit valueChanged(uasId, "alt", pos.alt, time); emit valueChanged(uasId, "alt", pos.alt, time);
// Smaller than threshold and not NaN // Smaller than threshold and not NaN
...@@ -372,7 +372,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -372,7 +372,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
} }
else else
{ {
emit textMessageReceived(uasId, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(pos.v)); emit textMessageReceived(uasId, message.compid, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(pos.v));
} }
emit globalPositionChanged(this, pos.lon, pos.lat, alt, time); emit globalPositionChanged(this, pos.lon, pos.lat, alt, time);
} }
...@@ -498,7 +498,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -498,7 +498,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
int severity = mavlink_msg_statustext_get_severity(&message); int severity = mavlink_msg_statustext_get_severity(&message);
//qDebug() << "RECEIVED STATUS:" << text;false //qDebug() << "RECEIVED STATUS:" << text;false
//emit statusTextReceived(severity, text); //emit statusTextReceived(severity, text);
emit textMessageReceived(uasId, severity, text); emit textMessageReceived(uasId, message.compid, severity, text);
} }
break; break;
default: default:
...@@ -1038,6 +1038,11 @@ void UAS::setManualControlCommands(double roll, double pitch, double yaw, double ...@@ -1038,6 +1038,11 @@ void UAS::setManualControlCommands(double roll, double pitch, double yaw, double
} }
} }
int UAS::getSystemType()
{
return this->type;
}
void UAS::receiveButton(int buttonIndex) void UAS::receiveButton(int buttonIndex)
{ {
switch (buttonIndex) switch (buttonIndex)
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
...@@ -142,6 +142,7 @@ protected: ...@@ -142,6 +142,7 @@ protected:
public: public:
UASWaypointManager &getWaypointManager(void) { return waypointManager; } UASWaypointManager &getWaypointManager(void) { return waypointManager; }
int getSystemType();
public slots: public slots:
/** @brief Launches the system **/ /** @brief Launches the system **/
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
...@@ -135,6 +135,9 @@ public: ...@@ -135,6 +135,9 @@ public:
return colors[nextColor++]; return colors[nextColor++];
} }
/** @brief Get the type of the system (airplane, quadrotor, helicopter,..)*/
virtual int getSystemType() = 0;
QColor getColor() QColor getColor()
{ {
return color; return color;
...@@ -228,10 +231,11 @@ signals: ...@@ -228,10 +231,11 @@ signals:
* messages like critical errors. * messages like critical errors.
* *
* @param uasid ID of the sending system * @param uasid ID of the sending system
* @param compid ID of the sending component
* @param text the status text * @param text the status text
* @param severity The severity of the message, 0 for plain debug messages, 10 for very critical messages * @param severity The severity of the message, 0 for plain debug messages, 10 for very critical messages
*/ */
void textMessageReceived(int uasid, int severity, QString text); void textMessageReceived(int uasid, int componentid, int severity, QString text);
/** /**
* @brief Update the error count of a device * @brief Update the error count of a device
* *
......
...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project ...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project
/** /**
* @file * @file
* @brief Implementation of central manager for all connected aerial vehicles * @brief Implementation of class UASManager
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
*/ */
...@@ -81,9 +81,7 @@ void UASManager::addUAS(UASInterface* uas) ...@@ -81,9 +81,7 @@ void UASManager::addUAS(UASInterface* uas)
// If there is no active UAS yet, set the first one as the active UAS // If there is no active UAS yet, set the first one as the active UAS
if (activeUAS == NULL) if (activeUAS == NULL)
{ {
activeUAS = uas; setActiveUAS(uas);
emit activeUASSet(uas);
emit activeUASSet(uas->getUASID());
} }
} }
...@@ -165,6 +163,11 @@ void UASManager::setActiveUAS(UASInterface* uas) ...@@ -165,6 +163,11 @@ void UASManager::setActiveUAS(UASInterface* uas)
if (uas != NULL) if (uas != NULL)
{ {
activeUASMutex.lock(); activeUASMutex.lock();
if (activeUAS != NULL)
{
emit activeUASStatusChanged(activeUAS, false);
emit activeUASStatusChanged(activeUAS->getUASID(), false);
}
activeUAS = uas; activeUAS = uas;
activeUASMutex.unlock(); activeUASMutex.unlock();
...@@ -172,6 +175,8 @@ void UASManager::setActiveUAS(UASInterface* uas) ...@@ -172,6 +175,8 @@ void UASManager::setActiveUAS(UASInterface* uas)
emit activeUASSet(uas); emit activeUASSet(uas);
emit activeUASSet(uas->getUASID()); emit activeUASSet(uas->getUASID());
emit activeUASStatusChanged(uas, true);
emit activeUASStatusChanged(uas->getUASID(), true);
} }
} }
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/** /**
* @file * @file
* @brief Definition of central manager for all connected aerial vehicles * @brief Definition of class UASManager
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
*/ */
...@@ -37,7 +37,7 @@ This file is part of the PIXHAWK project ...@@ -37,7 +37,7 @@ This file is part of the PIXHAWK project
#include <UASInterface.h> #include <UASInterface.h>
/** /**
* @brief Manager class for the UASs * @brief Central manager for all connected aerial vehicles
* *
* This class keeps a list of all connected / configured UASs. It also stores which * This class keeps a list of all connected / configured UASs. It also stores which
* UAS is currently select with respect to user input or manual controls. * UAS is currently select with respect to user input or manual controls.
...@@ -165,8 +165,14 @@ protected: ...@@ -165,8 +165,14 @@ protected:
signals: signals:
void UASCreated(UASInterface* UAS); void UASCreated(UASInterface* UAS);
/** @brief The UAS currently under main operator control changed */
void activeUASSet(UASInterface* UAS); void activeUASSet(UASInterface* UAS);
/** @brief The UAS currently under main operator control changed */
void activeUASSet(int systemId); void activeUASSet(int systemId);
/** @brief The UAS currently under main operator control changed */
void activeUASStatusChanged(UASInterface* UAS, bool active);
/** @brief The UAS currently under main operator control changed */
void activeUASStatusChanged(int systemId, bool active);
}; };
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of class AudioOutputWidget
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include "AudioOutputWidget.h" #include "AudioOutputWidget.h"
#include "ui_AudioOutputWidget.h" #include "ui_AudioOutputWidget.h"
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class AudioOutputWidget
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef AUDIOOUTPUTWIDGET_H #ifndef AUDIOOUTPUTWIDGET_H
#define AUDIOOUTPUTWIDGET_H #define AUDIOOUTPUTWIDGET_H
...@@ -7,7 +37,11 @@ namespace Ui { ...@@ -7,7 +37,11 @@ namespace Ui {
class AudioOutputWidget; class AudioOutputWidget;
} }
class AudioOutputWidget : public QWidget { /**
* @brief Widget to control audio/volume/mute
*/
class AudioOutputWidget : public QWidget
{
Q_OBJECT Q_OBJECT
public: public:
AudioOutputWidget(QWidget *parent = 0); AudioOutputWidget(QWidget *parent = 0);
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
Please see our website at <http://pixhawk.ethz.ch>
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/** /**
* @file * @file
* @brief Definition of configuration window for serial links * @brief Definition of class CommConfigurationWindow
* *
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
...@@ -44,6 +43,9 @@ This file is part of the PIXHAWK project ...@@ -44,6 +43,9 @@ This file is part of the PIXHAWK project
#include "OpalLink.h" #include "OpalLink.h"
#endif #endif
/**
* @brief Configuration window for communication links
*/
class CommConfigurationWindow : public QWidget class CommConfigurationWindow : public QWidget
{ {
Q_OBJECT Q_OBJECT
......
...@@ -33,6 +33,7 @@ This file is part of the PIXHAWK project ...@@ -33,6 +33,7 @@ This file is part of the PIXHAWK project
#include "DebugConsole.h" #include "DebugConsole.h"
#include "ui_DebugConsole.h" #include "ui_DebugConsole.h"
#include "LinkManager.h" #include "LinkManager.h"
#include "UASManager.h"
#include "protocol.h" #include "protocol.h"
#include <QDebug> #include <QDebug>
...@@ -163,9 +164,13 @@ void DebugConsole::setAutoHold(bool hold) ...@@ -163,9 +164,13 @@ void DebugConsole::setAutoHold(bool hold)
autoHold = hold; autoHold = hold;
} }
void DebugConsole::receiveTextMessage(int id, int severity, QString text) /**
* Prints the message in the UAS color
*/
void DebugConsole::receiveTextMessage(int id, int component, int severity, QString text)
{ {
m_ui->receiveText->appendHtml(QString("<font color=\"yellow\">(MAV" + QString::number(id) + QString(":") + QString::number(severity) + QString(") ") + text + QString("</font>"))); Q_UNUSED(severity);
m_ui->receiveText->appendHtml(QString("<font color=\"%1\">(MAV%2:%3) %4</font>").arg(UASManager::instance()->getUASForId(id)->getColor().name(), QString::number(id), QString::number(component), text));
} }
void DebugConsole::updateTrafficMeasurements() void DebugConsole::updateTrafficMeasurements()
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
...@@ -43,7 +43,14 @@ namespace Ui { ...@@ -43,7 +43,14 @@ namespace Ui {
class DebugConsole; class DebugConsole;
} }
class DebugConsole : public QWidget { /**
* @brief Shows a debug console
*
* This class shows the raw data stream of each link
* and the debug / text messages sent by all systems
*/
class DebugConsole : public QWidget
{
Q_OBJECT Q_OBJECT
public: public:
DebugConsole(QWidget *parent = 0); DebugConsole(QWidget *parent = 0);
...@@ -69,7 +76,7 @@ public slots: ...@@ -69,7 +76,7 @@ public slots:
/** @brief Enable auto-freeze mode if traffic intensity is too high to display */ /** @brief Enable auto-freeze mode if traffic intensity is too high to display */
void setAutoHold(bool hold); void setAutoHold(bool hold);
/** @brief Receive plain text message to output to the user */ /** @brief Receive plain text message to output to the user */
void receiveTextMessage(int id, int severity, QString text); void receiveTextMessage(int id, int component, int severity, QString text);
protected slots: protected slots:
/** @brief Draw information overlay */ /** @brief Draw information overlay */
......
...@@ -32,6 +32,8 @@ This file is part of the PIXHAWK project ...@@ -32,6 +32,8 @@ This file is part of the PIXHAWK project
#include <QFile> #include <QFile>
#include <QGLWidget> #include <QGLWidget>
#include <QStringList> #include <QStringList>
#include <QGraphicsTextItem>
#include <QMouseEvent>
#include "UASManager.h" #include "UASManager.h"
#include "HDDisplay.h" #include "HDDisplay.h"
#include "ui_HDDisplay.h" #include "ui_HDDisplay.h"
...@@ -40,7 +42,7 @@ This file is part of the PIXHAWK project ...@@ -40,7 +42,7 @@ This file is part of the PIXHAWK project
#include <QDebug> #include <QDebug>
HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) : HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) :
QWidget(parent), QGraphicsView(parent),
uas(NULL), uas(NULL),
values(QMap<QString, float>()), values(QMap<QString, float>()),
valuesDot(QMap<QString, float>()), valuesDot(QMap<QString, float>()),
...@@ -80,11 +82,47 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) : ...@@ -80,11 +82,47 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) :
acceptList = new QStringList(); acceptList = new QStringList();
} }
// setBackgroundBrush(QBrush(backgroundColor));
// setDragMode(QGraphicsView::ScrollHandDrag);
// setCacheMode(QGraphicsView::CacheBackground);
// // FIXME Handle full update with care - ressource intensive
// setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
//
// setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
//
// //Set-up the scene
// QGraphicsScene* Scene = new QGraphicsScene(this);
// setScene(Scene);
//
// //Populate the scene
// for(int x = 0; x < 1000; x = x + 25) {
// for(int y = 0; y < 1000; y = y + 25) {
//
// if(x % 100 == 0 && y % 100 == 0) {
// Scene->addRect(x, y, 2, 2);
//
// QString pointString;
// QTextStream stream(&pointString);
// stream << "(" << x << "," << y << ")";
// QGraphicsTextItem* item = Scene->addText(pointString);
// item->setPos(x, y);
// } else {
// Scene->addRect(x, y, 1, 1);
// }
// }
// }
//
// //Set-up the view
// setSceneRect(0, 0, 1000, 1000);
// setCenter(QPointF(500.0, 500.0)); //A modified version of centerOn(), handles special cases
// setCursor(Qt::OpenHandCursor);
this->setMinimumHeight(125); this->setMinimumHeight(125);
this->setMinimumWidth(100); this->setMinimumWidth(100);
// Refresh timer // Refresh timer
refreshTimer->setInterval(150); // 200 Hz/5 ms refreshTimer->setInterval(180); //
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(triggerUpdate())); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(triggerUpdate()));
//connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintGL())); //connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintGL()));
...@@ -109,28 +147,27 @@ HDDisplay::~HDDisplay() ...@@ -109,28 +147,27 @@ HDDisplay::~HDDisplay()
delete m_ui; delete m_ui;
} }
void HDDisplay::enableGLRendering(bool enable)
{
}
void HDDisplay::triggerUpdate() void HDDisplay::triggerUpdate()
{ {
// Only repaint the regions necessary // Only repaint the regions necessary
QRect r = geometry(); update(this->geometry());
update(r);
} }
void HDDisplay::paintEvent(QPaintEvent * event) void HDDisplay::paintEvent(QPaintEvent * event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
//paintGL();
static quint64 interval = 0; static quint64 interval = 0;
//qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__; //qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__;
interval = MG::TIME::getGroundTimeNow(); interval = MG::TIME::getGroundTimeNow();
paintDisplay(); renderOverlay();
}
void HDDisplay::paintGL()
{
} }
void HDDisplay::paintDisplay() void HDDisplay::renderOverlay()
{ {
quint64 refreshInterval = 100; quint64 refreshInterval = 100;
quint64 currTime = MG::TIME::getGroundTimeNow(); quint64 currTime = MG::TIME::getGroundTimeNow();
...@@ -148,10 +185,10 @@ void HDDisplay::paintDisplay() ...@@ -148,10 +185,10 @@ void HDDisplay::paintDisplay()
double scalingFactorH = this->height()/vheight; double scalingFactorH = this->height()/vheight;
if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH; if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH;
QPainter painter(this); QPainter painter(viewport());
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::HighQualityAntialiasing, true); painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
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.5f)); const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.5f));
...@@ -628,3 +665,138 @@ void HDDisplay::changeEvent(QEvent *e) ...@@ -628,3 +665,138 @@ void HDDisplay::changeEvent(QEvent *e)
break; break;
} }
} }
///**
// * Sets the current centerpoint. Also updates the scene's center point.
// * Unlike centerOn, which has no way of getting the floating point center
// * back, SetCenter() stores the center point. It also handles the special
// * sidebar case. This function will claim the centerPoint to sceneRec ie.
// * the centerPoint must be within the sceneRec.
// */
////Set the current centerpoint in the
//void HDDisplay::setCenter(const QPointF& centerPoint) {
// //Get the rectangle of the visible area in scene coords
// QRectF visibleArea = mapToScene(rect()).boundingRect();
//
// //Get the scene area
// QRectF sceneBounds = sceneRect();
//
// double boundX = visibleArea.width() / 2.0;
// double boundY = visibleArea.height() / 2.0;
// double boundWidth = sceneBounds.width() - 2.0 * boundX;
// double boundHeight = sceneBounds.height() - 2.0 * boundY;
//
// //The max boundary that the centerPoint can be to
// QRectF bounds(boundX, boundY, boundWidth, boundHeight);
//
// if(bounds.contains(centerPoint)) {
// //We are within the bounds
// currentCenterPoint = centerPoint;
// } else {
// //We need to clamp or use the center of the screen
// if(visibleArea.contains(sceneBounds)) {
// //Use the center of scene ie. we can see the whole scene
// currentCenterPoint = sceneBounds.center();
// } else {
//
// currentCenterPoint = centerPoint;
//
// //We need to clamp the center. The centerPoint is too large
// if(centerPoint.x() > bounds.x() + bounds.width()) {
// currentCenterPoint.setX(bounds.x() + bounds.width());
// } else if(centerPoint.x() < bounds.x()) {
// currentCenterPoint.setX(bounds.x());
// }
//
// if(centerPoint.y() > bounds.y() + bounds.height()) {
// currentCenterPoint.setY(bounds.y() + bounds.height());
// } else if(centerPoint.y() < bounds.y()) {
// currentCenterPoint.setY(bounds.y());
// }
//
// }
// }
//
// //Update the scrollbars
// centerOn(currentCenterPoint);
//}
//
///**
// * Handles when the mouse button is pressed
// */
//void HDDisplay::mousePressEvent(QMouseEvent* event) {
// //For panning the view
// lastPanPoint = event->pos();
// setCursor(Qt::ClosedHandCursor);
//}
//
///**
// * Handles when the mouse button is released
// */
//void HDDisplay::mouseReleaseEvent(QMouseEvent* event) {
// setCursor(Qt::OpenHandCursor);
// lastPanPoint = QPoint();
//}
//
///**
//*Handles the mouse move event
//*/
//void HDDisplay::mouseMoveEvent(QMouseEvent* event) {
// if(!lastPanPoint.isNull()) {
// //Get how much we panned
// QPointF delta = mapToScene(lastPanPoint) - mapToScene(event->pos());
// lastPanPoint = event->pos();
//
// //Update the center ie. do the pan
// setCenter(getCenter() + delta);
// }
//}
//
///**
// * Zoom the view in and out.
// */
//void HDDisplay::wheelEvent(QWheelEvent* event) {
//
// //Get the position of the mouse before scaling, in scene coords
// QPointF pointBeforeScale(mapToScene(event->pos()));
//
// //Get the original screen centerpoint
// QPointF screenCenter = getCenter(); //CurrentCenterPoint; //(visRect.center());
//
// //Scale the view ie. do the zoom
// double scaleFactor = 1.15; //How fast we zoom
// if(event->delta() > 0) {
// //Zoom in
// scale(scaleFactor, scaleFactor);
// } else {
// //Zooming out
// scale(1.0 / scaleFactor, 1.0 / scaleFactor);
// }
//
// //Get the position after scaling, in scene coords
// QPointF pointAfterScale(mapToScene(event->pos()));
//
// //Get the offset of how the screen moved
// QPointF offset = pointBeforeScale - pointAfterScale;
//
// //Adjust to the new center for correct zooming
// QPointF newCenter = screenCenter + offset;
// setCenter(newCenter);
//}
//
///**
// * Need to update the center so there is no jolt in the
// * interaction after resizing the widget.
// */
//void HDDisplay::resizeEvent(QResizeEvent* event) {
// //Get the rectangle of the visible area in scene coords
// QRectF visibleArea = mapToScene(rect()).boundingRect();
// setCenter(visibleArea.center());
//
// //Call the subclass resize so the scrollbars are updated correctly
// QGraphicsView::resizeEvent(event);
//}
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
...@@ -32,7 +32,7 @@ This file is part of the PIXHAWK project ...@@ -32,7 +32,7 @@ This file is part of the PIXHAWK project
#ifndef HDDISPLAY_H #ifndef HDDISPLAY_H
#define HDDISPLAY_H #define HDDISPLAY_H
#include <QtGui/QWidget> #include <QtGui/QGraphicsView>
#include <QColor> #include <QColor>
#include <QTimer> #include <QTimer>
#include <QFontDatabase> #include <QFontDatabase>
...@@ -46,7 +46,16 @@ namespace Ui { ...@@ -46,7 +46,16 @@ namespace Ui {
class HDDisplay; class HDDisplay;
} }
class HDDisplay : public QWidget { /**
* @brief Head Down Display Widget
*
* This widget is used for any head down display as base widget. It handles the basic widget setup
* each head down instrument has a virtual screen size in millimeters as base coordinate system
* this virtual screen size is then scaled to pixels on the screen.
* When the pixel per millimeter ratio is known, a 1:1 representation is possible on the screen
*/
class HDDisplay : public QGraphicsView
{
Q_OBJECT Q_OBJECT
public: public:
HDDisplay(QStringList* plotList, QWidget *parent = 0); HDDisplay(QStringList* plotList, QWidget *parent = 0);
...@@ -60,8 +69,9 @@ public slots: ...@@ -60,8 +69,9 @@ public slots:
void setActiveUAS(UASInterface* uas); void setActiveUAS(UASInterface* uas);
protected slots: protected slots:
void paintGL(); void enableGLRendering(bool enable);
void paintDisplay(); //void render(QPainter* painter, const QRectF& target = QRectF(), const QRect& source = QRect(), Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio);
void renderOverlay();
void triggerUpdate(); void triggerUpdate();
protected: protected:
...@@ -84,6 +94,23 @@ protected: ...@@ -84,6 +94,23 @@ protected:
void drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter); void drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter);
void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter); void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter);
// //Holds the current centerpoint for the view, used for panning and zooming
// QPointF currentCenterPoint;
//
// //From panning the view
// QPoint lastPanPoint;
//
// //Set the current centerpoint in the
// void setCenter(const QPointF& centerPoint);
// QPointF getCenter() { return currentCenterPoint; }
//
// //Take over the interaction
// virtual void mousePressEvent(QMouseEvent* event);
// virtual void mouseReleaseEvent(QMouseEvent* event);
// virtual void mouseMoveEvent(QMouseEvent* event);
// virtual void wheelEvent(QWheelEvent* event);
// virtual void resizeEvent(QResizeEvent* event);
UASInterface* uas; ///< The uas currently monitored UASInterface* uas; ///< The uas currently monitored
QMap<QString, float> values; ///< The variables this HUD displays QMap<QString, float> values; ///< The variables this HUD displays
QMap<QString, float> valuesDot; ///< First derivative of the variable QMap<QString, float> valuesDot; ///< First derivative of the variable
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
...@@ -32,12 +32,16 @@ This file is part of the PIXHAWK project ...@@ -32,12 +32,16 @@ This file is part of the PIXHAWK project
#include <QFile> #include <QFile>
#include <QStringList> #include <QStringList>
#include <QPainter> #include <QPainter>
#include <QGraphicsScene>
#include <QHBoxLayout>
#include <QDoubleSpinBox>
#include "UASManager.h" #include "UASManager.h"
#include "HSIDisplay.h" #include "HSIDisplay.h"
#include "MG.h" #include "MG.h"
#include "QGC.h" #include "QGC.h"
#include "Waypoint.h" #include "Waypoint.h"
#include "UASWaypointManager.h" #include "UASWaypointManager.h"
#include "Waypoint2DIcon.h"
#include <QDebug> #include <QDebug>
...@@ -98,9 +102,28 @@ HSIDisplay::HSIDisplay(QWidget *parent) : ...@@ -98,9 +102,28 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
refreshTimer->setInterval(60); refreshTimer->setInterval(60);
// this->setScene(new QGraphicsScene(-metricWidth/2.0f, -metricWidth/2.0f, metricWidth, metricWidth, this));
xCenterPos = vwidth/2.0f; xCenterPos = vwidth/2.0f;
yCenterPos = vheight/2.0f + topMargin - bottomMargin; yCenterPos = vheight/2.0f + topMargin - bottomMargin;
// Add interaction elements
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(2);
layout->setSpacing(0);
QDoubleSpinBox* spinBox = new QDoubleSpinBox(this);
spinBox->setMinimum(0.1);
spinBox->setMaximum(9999);
connect(spinBox, SIGNAL(valueChanged(double)), this, SLOT(setMetricWidth(double)));
connect(this, SIGNAL(metricWidthChanged(double)), spinBox, SLOT(setValue(double)));
layout->addWidget(spinBox);
layout->setAlignment(spinBox, Qt::AlignBottom | Qt::AlignLeft);
this->setLayout(layout);
this->setVisible(false); this->setVisible(false);
// Do first update
setMetricWidth(metricWidth);
} }
void HSIDisplay::paintEvent(QPaintEvent * event) void HSIDisplay::paintEvent(QPaintEvent * event)
...@@ -110,10 +133,10 @@ void HSIDisplay::paintEvent(QPaintEvent * event) ...@@ -110,10 +133,10 @@ void HSIDisplay::paintEvent(QPaintEvent * event)
static quint64 interval = 0; static quint64 interval = 0;
//qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__; //qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__;
interval = MG::TIME::getGroundTimeNow(); interval = MG::TIME::getGroundTimeNow();
paintDisplay(); renderOverlay();
} }
void HSIDisplay::paintDisplay() void HSIDisplay::renderOverlay()
{ {
// Center location of the HSI gauge items // Center location of the HSI gauge items
...@@ -131,12 +154,13 @@ void HSIDisplay::paintDisplay() ...@@ -131,12 +154,13 @@ void HSIDisplay::paintDisplay()
double scalingFactorH = this->height()/vheight; double scalingFactorH = this->height()/vheight;
if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH; if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH;
QPainter painter(this); QPainter painter(viewport());
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::HighQualityAntialiasing, true); painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
// Draw background // Draw background
painter.fillRect(QRect(0, 0, width(), height()), backgroundColor); //painter.fillRect(QRect(0, 0, width(), height()), backgroundColor);
// Draw base instrument // Draw base instrument
// ---------------------- // ----------------------
...@@ -393,6 +417,15 @@ void HSIDisplay::mouseDoubleClickEvent(QMouseEvent * event) ...@@ -393,6 +417,15 @@ void HSIDisplay::mouseDoubleClickEvent(QMouseEvent * event)
} }
} }
void HSIDisplay::setMetricWidth(double width)
{
if (width != metricWidth)
{
metricWidth = width;
emit metricWidthChanged(metricWidth);
}
}
/** /**
* *
* @param uas the UAS/MAV to monitor/display with the HUD * @param uas the UAS/MAV to monitor/display with the HUD
...@@ -634,6 +667,18 @@ void HSIDisplay::drawWaypoints(QPainter& painter) ...@@ -634,6 +667,18 @@ void HSIDisplay::drawWaypoints(QPainter& painter)
if (uas) if (uas)
{ {
const QVector<Waypoint*>& list = uas->getWaypointManager().getWaypointList(); const QVector<Waypoint*>& list = uas->getWaypointManager().getWaypointList();
// for (int i = 0; i < list.size(); i++)
// {
// QPointF in(list.at(i)->getX(), list.at(i)->getY());
// // Transform from world to body coordinates
// in = metricWorldToBody(in);
// // Scale from metric to screen reference coordinates
// QPointF p = metricBodyToRef(in);
// Waypoint2DIcon* wp = new Waypoint2DIcon();
// wp->setLocalPosition(list.at(i)->getX(), list.at(i)->getY());
// wp->setPos(0, 0);
// scene()->addItem(wp);
// }
QColor color; QColor color;
painter.setBrush(Qt::NoBrush); painter.setBrush(Qt::NoBrush);
...@@ -863,18 +908,22 @@ void HSIDisplay::drawAltitudeSetpoint(float xRef, float yRef, float radius, cons ...@@ -863,18 +908,22 @@ void HSIDisplay::drawAltitudeSetpoint(float xRef, float yRef, float radius, cons
// paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter); // paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter);
} }
/** void HSIDisplay::wheelEvent(QWheelEvent* event)
* @param fix 0: lost, 1: 2D local position hold, 2: 2D localization, 3: 3D localization {
*/ double zoomScale = 0.005; // Scaling of zoom value
void localizationChanged(UASInterface* uas, int fix); if(event->delta() > 0)
/** {
* @param fix 0: lost, 1: at least one satellite, but no GPS fix, 2: 2D localization, 3: 3D localization // Reduce width -> Zoom in
*/ metricWidth -= event->delta() * zoomScale;
void gpsLocalizationChanged(UASInterface* uas, int fix); }
/** else
* @param fix 0: lost, 1: 2D local position hold, 2: 2D localization, 3: 3D localization {
*/ // Increase width -> Zoom out
void visionLocalizationChanged(UASInterface* uas, int fix); metricWidth -= event->delta() * zoomScale;
}
metricWidth = qBound(0.1, metricWidth, 9999.0);
emit metricWidthChanged(metricWidth);
}
void HSIDisplay::updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat) void HSIDisplay::updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat)
{ {
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
...@@ -51,6 +51,8 @@ public: ...@@ -51,6 +51,8 @@ public:
public slots: public slots:
void setActiveUAS(UASInterface* uas); void setActiveUAS(UASInterface* uas);
/** @brief Set the width in meters this widget shows from top */
void setMetricWidth(double width);
void updateSatellite(int uasid, int satid, float azimuth, float direction, float snr, bool used); void updateSatellite(int uasid, int satid, float azimuth, float direction, float snr, bool used);
void updateAttitudeSetpoints(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 usec); void updateAttitudeSetpoints(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 usec);
void updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 time); void updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 time);
...@@ -80,8 +82,11 @@ public slots: ...@@ -80,8 +82,11 @@ public slots:
void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat); void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat);
void pressKey(int key); void pressKey(int key);
signals:
void metricWidthChanged(double width);
protected slots: protected slots:
void paintDisplay(); void renderOverlay();
void drawGPS(QPainter &painter); void drawGPS(QPainter &painter);
void drawObjects(QPainter &painter); void drawObjects(QPainter &painter);
void drawPositionDirection(float xRef, float yRef, float radius, const QColor& color, QPainter* painter); void drawPositionDirection(float xRef, float yRef, float radius, const QColor& color, QPainter* painter);
...@@ -101,8 +106,11 @@ protected slots: ...@@ -101,8 +106,11 @@ protected slots:
void drawSafetyArea(const QPointF &topLeft, const QPointF &bottomRight, const QColor &color, QPainter &painter); void drawSafetyArea(const QPointF &topLeft, const QPointF &bottomRight, const QColor &color, QPainter &painter);
/** @brief Receive mouse clicks */ /** @brief Receive mouse clicks */
void mouseDoubleClickEvent(QMouseEvent* event); void mouseDoubleClickEvent(QMouseEvent* event);
/** @brief Receive mouse wheel events */
void wheelEvent(QWheelEvent* event);
protected: protected:
/** @brief Get color from GPS signal-to-noise colormap */ /** @brief Get color from GPS signal-to-noise colormap */
static QColor getColorForSNR(float snr); static QColor getColorForSNR(float snr);
/** @brief Metric world coordinates to metric body coordinates */ /** @brief Metric world coordinates to metric body coordinates */
...@@ -201,7 +209,7 @@ protected: ...@@ -201,7 +209,7 @@ protected:
float uiYSetCoordinate; ///< Y Setpoint coordinate wanted by the UI float uiYSetCoordinate; ///< Y Setpoint coordinate wanted by the UI
float uiZSetCoordinate; ///< Z Setpoint coordinate wanted by the UI float uiZSetCoordinate; ///< Z Setpoint coordinate wanted by the UI
float uiYawSet; ///< Yaw Setpoint wanted by the UI float uiYawSet; ///< Yaw Setpoint wanted by the UI
float metricWidth; ///< Width the instrument represents in meters (the width of the ground shown by the widget) double metricWidth; ///< Width the instrument represents in meters (the width of the ground shown by the widget)
// //
float xCenterPos; ///< X center of instrument in virtual coordinates float xCenterPos; ///< X center of instrument in virtual coordinates
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
...@@ -145,6 +145,7 @@ void MainWindow::connectWidgets() ...@@ -145,6 +145,7 @@ void MainWindow::connectWidgets()
{ {
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), linechart, SLOT(addSystem(UASInterface*))); connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), linechart, SLOT(addSystem(UASInterface*)));
connect(UASManager::instance(), SIGNAL(activeUASSet(int)), linechart, SLOT(selectSystem(int))); connect(UASManager::instance(), SIGNAL(activeUASSet(int)), linechart, SLOT(selectSystem(int)));
connect(linechart, SIGNAL(logfileWritten(QString)), this, SLOT(loadDataView(QString)));
connect(mavlink, SIGNAL(receiveLossChanged(int, float)), info, SLOT(updateSendLoss(int, float))); connect(mavlink, SIGNAL(receiveLossChanged(int, float)), info, SLOT(updateSendLoss(int, float)));
} }
...@@ -390,29 +391,61 @@ void MainWindow::addLink(LinkInterface *link) ...@@ -390,29 +391,61 @@ void MainWindow::addLink(LinkInterface *link)
void MainWindow::UASCreated(UASInterface* uas) void MainWindow::UASCreated(UASInterface* uas)
{ {
// Connect the UAS to the full user interface // Connect the UAS to the full user interface
//ui.menuConnected_Systems->addAction(QIcon(":/images/mavs/generic.svg"), tr("View ") + uas->getUASName(), uas, SLOT(setSelected()));
// FIXME Should be not inside the mainwindow if (uas != NULL)
connect(uas, SIGNAL(textMessageReceived(int,int,QString)), debugConsole, SLOT(receiveTextMessage(int,int,QString))); {
QIcon icon;
// Set matching icon
switch (uas->getSystemType())
{
case 0:
icon = QIcon(":/images/mavs/generic.svg");
break;
case 1:
icon = QIcon(":/images/mavs/fixed-wing.svg");
break;
case 2:
icon = QIcon(":/images/mavs/quadrotor.svg");
break;
case 3:
icon = QIcon(":/images/mavs/coaxial.svg");
break;
case 4:
icon = QIcon(":/images/mavs/helicopter.svg");
break;
case 5:
icon = QIcon(":/images/mavs/groundstation.svg");
break;
default:
icon = QIcon(":/images/mavs/unknown.svg");
break;
}
// Health / System status indicator ui.menuConnected_Systems->addAction(icon, tr("Select %1 for control").arg(uas->getUASName()), uas, SLOT(setSelected()));
info->addUAS(uas);
// UAS List // FIXME Should be not inside the mainwindow
list->addUAS(uas); connect(uas, SIGNAL(textMessageReceived(int,int,int,QString)), debugConsole, SLOT(receiveTextMessage(int,int,int,QString)));
// Camera view // Health / System status indicator
//camera->addUAS(uas); info->addUAS(uas);
// Revalidate UI // UAS List
// TODO Stylesheet reloading should in theory not be necessary list->addUAS(uas);
reloadStylesheet();
// Camera view
//camera->addUAS(uas);
// Revalidate UI
// TODO Stylesheet reloading should in theory not be necessary
reloadStylesheet();
// Check which type this UAS is of
PxQuadMAV* mav = dynamic_cast<PxQuadMAV*>(uas);
if (mav) loadPixhawkView();
SlugsMAV* mav2 = dynamic_cast<SlugsMAV*>(uas);
if (mav2) loadSlugsView();
// Check which type this UAS is of }
PxQuadMAV* mav = dynamic_cast<PxQuadMAV*>(uas);
if (mav) loadPixhawkView();
SlugsMAV* mav2 = dynamic_cast<SlugsMAV*>(uas);
if (mav2) loadSlugsView();
} }
/** /**
...@@ -544,6 +577,13 @@ void MainWindow::loadDataView() ...@@ -544,6 +577,13 @@ void MainWindow::loadDataView()
centerStack->setCurrentWidget(dataplot); centerStack->setCurrentWidget(dataplot);
} }
void MainWindow::loadDataView(QString fileName)
{
clearView();
centerStack->setCurrentWidget(dataplot);
dataplot->loadFile(fileName);
}
void MainWindow::loadPilotView() void MainWindow::loadPilotView()
{ {
clearView(); clearView();
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/** /**
* @file * @file
* @brief Main application window * @brief Definition of class MainWindow
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
*/ */
...@@ -52,7 +52,6 @@ This file is part of the PIXHAWK project ...@@ -52,7 +52,6 @@ This file is part of the PIXHAWK project
#include "AS4Protocol.h" #include "AS4Protocol.h"
#include "ObjectDetectionView.h" #include "ObjectDetectionView.h"
#include "HUD.h" #include "HUD.h"
#include "PFD.h"
#include "JoystickWidget.h" #include "JoystickWidget.h"
#include "input/JoystickInput.h" #include "input/JoystickInput.h"
#include "DebugConsole.h" #include "DebugConsole.h"
...@@ -119,6 +118,8 @@ public slots: ...@@ -119,6 +118,8 @@ public slots:
void loadMAVLinkView(); void loadMAVLinkView();
/** @brief Load data view, allowing to plot flight data */ /** @brief Load data view, allowing to plot flight data */
void loadDataView(); void loadDataView();
/** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName);
/** @brief Show the online help for users */ /** @brief Show the online help for users */
void showHelp(); void showHelp();
......
...@@ -87,8 +87,14 @@ ...@@ -87,8 +87,14 @@
<addaction name="actionProject_Roadmap"/> <addaction name="actionProject_Roadmap"/>
<addaction name="actionCredits_Developers"/> <addaction name="actionCredits_Developers"/>
</widget> </widget>
<widget class="QMenu" name="menuConnected_Systems">
<property name="title">
<string>Select System</string>
</property>
</widget>
<addaction name="menuMGround"/> <addaction name="menuMGround"/>
<addaction name="menuNetwork"/> <addaction name="menuNetwork"/>
<addaction name="menuConnected_Systems"/>
<addaction name="menuUnmanned_System"/> <addaction name="menuUnmanned_System"/>
<addaction name="menuWindow"/> <addaction name="menuWindow"/>
<addaction name="menuHelp"/> <addaction name="menuHelp"/>
......
This diff is collapsed.
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
...@@ -26,7 +26,7 @@ This file is part of the PIXHAWK project ...@@ -26,7 +26,7 @@ This file is part of the PIXHAWK project
* @brief Definition of MapWidget * @brief Definition of MapWidget
* *
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* @author Mariano Lizzaraga * @author Mariano Lizarraga
* *
*/ */
...@@ -38,12 +38,20 @@ This file is part of the PIXHAWK project ...@@ -38,12 +38,20 @@ This file is part of the PIXHAWK project
#include "qmapcontrol.h" #include "qmapcontrol.h"
#include "UASInterface.h" #include "UASInterface.h"
class QMenu;
namespace Ui { namespace Ui {
class MapWidget; class MapWidget;
} }
using namespace qmapcontrol; using namespace qmapcontrol;
/**
* @brief 2D Moving map
*
* This map displays street maps, aerial images and the MAV position,
* waypoints and trails on top.
*/
class MapWidget : public QWidget { class MapWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
...@@ -61,20 +69,29 @@ protected: ...@@ -61,20 +69,29 @@ protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);
QAction* osmAction;
QAction* yahooActionMap;
QAction* yahooActionSatellite;
QAction* yahooActionOverlay;
QAction* googleActionMap;
QAction* googleSatAction;
QPushButton* followgps; QPushButton* followgps;
QPushButton* createPath; QPushButton* createPath;
QLabel* gpsposition; QLabel* gpsposition;
QMenu* mapMenu;
MapControl* mc; QPushButton* mapButton;
MapControl* mc; ///< QMapControl widget
MapAdapter* mapadapter; ///< Adapter to load the map data
qmapcontrol::Layer* l; ///< Current map layer (background)
qmapcontrol::Layer* overlay; ///< Street overlay (foreground)
qmapcontrol::GeometryLayer* geomLayer; ///< Layer for waypoints
int zoomLevel; int zoomLevel;
int detailZoom; ///< Steps zoomed in further than qMapControl allows int detailZoom; ///< Steps zoomed in further than qMapControl allows
static const int scrollStep = 40; ///< Scroll n pixels per keypress static const int scrollStep = 40; ///< Scroll n pixels per keypress
static const int maxZoom = 50; static const int maxZoom = 50; ///< Maximum zoom level
TileMapAdapter* osmAdapter;
GoogleSatMapAdapter* gSatAdapter;
Layer* osmLayer;
Layer* geomLayer;
//Layer* gSatLayer; //Layer* gSatLayer;
...@@ -87,6 +104,7 @@ protected: ...@@ -87,6 +104,7 @@ protected:
void captureMapClick (const QMouseEvent* event, const QPointF coordinate); void captureMapClick (const QMouseEvent* event, const QPointF coordinate);
void createPathButtonClicked(); void createPathButtonClicked();
void captureGeometryClick(Geometry*, QPoint); void captureGeometryClick(Geometry*, QPoint);
void mapproviderSelected(QAction* action);
void captureGeometryDrag(Geometry* geom, QPointF coordinate); void captureGeometryDrag(Geometry* geom, QPointF coordinate);
private: private:
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009 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 Head Down Display / Primary Flight Display
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include "PFD.h"
PFD::PFD(int width, int height, QWidget* parent)
: HUD(width, height, parent)
{
vGaugeSpacing = 70.0f;
vwidth = 200.0f;
vheight = 200.0f;
}
// xCenterOffset(0.0f),
// yCenterOffset(0.0f),
// vwidth(200.0f),
// vheight(150.0f),
// vGaugeSpacing(50.0f),
// vPitchPerDeg(6.0f), ///< 4 mm y translation per degree)
// noCamera(true),
// hardwareAcceleration(true),
// strongStrokeWidth(1.5f),
// normalStrokeWidth(1.0f),
// fineStrokeWidth(0.5f)
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009 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 Head Down Display / Primary Flight Display
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef PFD_H
#define PFD_H
#include "HUD.h"
class PFD : public HUD
{
public:
PFD(int width, int height, QWidget* parent);
};
#endif // PFD_H
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class ParameterInterface
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include <QTreeWidget> #include <QTreeWidget>
#include "ParameterInterface.h" #include "ParameterInterface.h"
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class ParameterInterface
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef PARAMETERINTERFACE_H #ifndef PARAMETERINTERFACE_H
#define PARAMETERINTERFACE_H #define PARAMETERINTERFACE_H
...@@ -11,7 +42,13 @@ namespace Ui { ...@@ -11,7 +42,13 @@ namespace Ui {
class ParameterInterface; class ParameterInterface;
} }
class ParameterInterface : public QWidget { /**
* @brief Container class for onboard parameter widgets
*
* @see QGCParamWidget
*/
class ParameterInterface : public QWidget
{
Q_OBJECT Q_OBJECT
public: public:
explicit ParameterInterface(QWidget *parent = 0); explicit ParameterInterface(QWidget *parent = 0);
......
This diff is collapsed.
...@@ -16,11 +16,17 @@ public: ...@@ -16,11 +16,17 @@ public:
QGCDataPlot2D(QWidget *parent = 0); QGCDataPlot2D(QWidget *parent = 0);
~QGCDataPlot2D(); ~QGCDataPlot2D();
/** @brief Calculate and display regression function*/
bool calculateRegression(QString xName, QString yName, QString method="linear");
/** @brief Linear regression over data points */ /** @brief Linear regression over data points */
int linearRegression(double *x,double *y,int n,double *a,double *b,double *r); int linearRegression(double* x,double* y,int n,double* a,double* b,double* r);
public slots: public slots:
/** @brief Load previously selected file */
void loadFile(); void loadFile();
/** @brief Load file with this name */
void loadFile(QString file);
/** @brief Reload a file, with filtering enabled */ /** @brief Reload a file, with filtering enabled */
void reloadFile(); void reloadFile();
void selectFile(); void selectFile();
...@@ -29,10 +35,14 @@ public slots: ...@@ -29,10 +35,14 @@ public slots:
void saveCsvLog(); void saveCsvLog();
/** @brief Save plot to PDF or SVG */ /** @brief Save plot to PDF or SVG */
void savePlot(); void savePlot();
/** @brief Export PDF file */
void exportPDF(QString fileName);
/** @brief Export SVG file */ /** @brief Export SVG file */
void exportSVG(QString file); void exportSVG(QString file);
/** @brief Print or save PDF file (MacOS/Linux) */ /** @brief Print or save PDF file (MacOS/Linux) */
void print(); void print();
/** @brief Calculate and display regression function*/
bool calculateRegression();
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
...@@ -40,6 +50,7 @@ protected: ...@@ -40,6 +50,7 @@ protected:
LogCompressor* compressor; LogCompressor* compressor;
QFile* logFile; QFile* logFile;
QString fileName; QString fileName;
QStringList curveNames;
private: private:
Ui::QGCDataPlot2D *ui; Ui::QGCDataPlot2D *ui;
......
...@@ -6,22 +6,22 @@ ...@@ -6,22 +6,22 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>807</width> <width>1073</width>
<height>308</height> <height>308</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout" columnstretch="2,10,2,0,0,0,0,0,0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2"> <item row="0" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>X</string> <string>X</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="1" colspan="2">
<widget class="QComboBox" name="xAxis"/> <widget class="QComboBox" name="xAxis"/>
</item> </item>
<item row="0" column="3"> <item row="0" column="3">
...@@ -53,7 +53,12 @@ ...@@ -53,7 +53,12 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Only dots</string> <string>Only rectangles</string>
</property>
</item>
<item>
<property name="text">
<string>Only symbols</string>
</property> </property>
</item> </item>
<item> <item>
...@@ -68,7 +73,12 @@ ...@@ -68,7 +73,12 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Lines and dots</string> <string>Lines and rects</string>
</property>
</item>
<item>
<property name="text">
<string>Lines and symbols</string>
</property> </property>
</item> </item>
<item> <item>
...@@ -83,7 +93,7 @@ ...@@ -83,7 +93,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Dotted lines and dots</string> <string>Dotted lines and rects</string>
</property> </property>
</item> </item>
<item> <item>
...@@ -98,39 +108,91 @@ ...@@ -98,39 +108,91 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Dashed lines and dots</string> <string>Dashed lines and rects</string>
</property> </property>
</item> </item>
</widget> </widget>
</item> </item>
<item row="0" column="9"> <item row="0" column="7" colspan="2">
<widget class="QPushButton" name="reloadButton"> <widget class="QPushButton" name="reloadButton">
<property name="text"> <property name="text">
<string>Reload</string> <string>Replot</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="10"> <item row="0" column="11">
<spacer name="horizontalSpacer_2"> <widget class="Line" name="line">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0"> </widget>
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
<item row="0" column="11"> <item row="0" column="12" colspan="2">
<widget class="QPushButton" name="savePlotButton"> <widget class="QPushButton" name="savePlotButton">
<property name="text"> <property name="text">
<string>Save Plot</string> <string>Save Image</string>
</property>
</widget>
</item>
<item row="0" column="19">
<widget class="QPushButton" name="printButton">
<property name="text">
<string>Print</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Title</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="3">
<widget class="QLineEdit" name="plotTitle"/>
</item>
<item row="1" column="5">
<widget class="QLabel" name="label_5">
<property name="text">
<string>X label</string>
</property>
</widget>
</item>
<item row="1" column="6" colspan="2">
<widget class="QLineEdit" name="plotXAxisLabel"/>
</item>
<item row="1" column="8">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Y label</string>
</property>
</widget>
</item>
<item row="1" column="9" colspan="3">
<widget class="QLineEdit" name="plotYAxisLabel"/>
</item>
<item row="1" column="12" colspan="2">
<widget class="QCheckBox" name="symmetricCheckBox">
<property name="text">
<string>Symmetric</string>
</property>
</widget>
</item>
<item row="1" column="14" colspan="2">
<widget class="QCheckBox" name="legendCheckBox">
<property name="text">
<string>Legend</string>
</property>
</widget>
</item>
<item row="1" column="16">
<widget class="QCheckBox" name="gridCheckBox">
<property name="text">
<string>Grid</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="13"> <item row="2" column="0" colspan="20">
<widget class="QFrame" name="plotFrame"> <widget class="QFrame" name="plotFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
...@@ -140,14 +202,14 @@ ...@@ -140,14 +202,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>File</string> <string>File</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" colspan="2"> <item row="3" column="1" colspan="2">
<widget class="QComboBox" name="inputFileType"> <widget class="QComboBox" name="inputFileType">
<item> <item>
<property name="text"> <property name="text">
...@@ -166,14 +228,21 @@ ...@@ -166,14 +228,21 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="2" column="3" colspan="4"> <item row="3" column="3" colspan="4">
<widget class="QLabel" name="filenameLabel"> <widget class="QLabel" name="filenameLabel">
<property name="text"> <property name="text">
<string>Please select input file..</string> <string>Please select input file..</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="10"> <item row="3" column="8" colspan="2">
<widget class="QPushButton" name="selectFileButton">
<property name="text">
<string>Select file</string>
</property>
</widget>
</item>
<item row="3" column="10" colspan="2">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -186,41 +255,60 @@ ...@@ -186,41 +255,60 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="12"> <item row="3" column="12">
<widget class="QPushButton" name="printButton"> <widget class="Line" name="line_2">
<property name="text"> <property name="orientation">
<string>Print</string> <enum>Qt::Vertical</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="12"> <item row="3" column="13">
<widget class="QPushButton" name="saveCsvButton"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Save CSV</string> <string>Regression</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="9"> <item row="3" column="14" colspan="2">
<widget class="QPushButton" name="selectFileButton"> <widget class="QComboBox" name="xRegressionComboBox"/>
</item>
<item row="3" column="16" colspan="2">
<widget class="QComboBox" name="yRegressionComboBox"/>
</item>
<item row="3" column="19">
<widget class="QPushButton" name="regressionButton">
<property name="text"> <property name="text">
<string>Select file</string> <string>Calculate</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="7"> <item row="3" column="18">
<widget class="QCheckBox" name="symmetricCheckBox"> <widget class="QLineEdit" name="regressionOutput">
<property name="text"> <property name="readOnly">
<string>Symmetric</string> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="8"> <item row="0" column="14">
<widget class="QCheckBox" name="legendCheckBox"> <widget class="QPushButton" name="saveCsvButton">
<property name="text"> <property name="text">
<string>Legend</string> <string>Save Data</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="9" colspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL/PIXHAWK PROJECT (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
<http://www.qgroundcontrol.org>
<http://pixhawk.ethz.ch>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include "QGCPxImuFirmwareUpdate.h" #include "QGCPxImuFirmwareUpdate.h"
#include "ui_QGCPxImuFirmwareUpdate.h" #include "ui_QGCPxImuFirmwareUpdate.h"
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Declaration of class QGCPxImuFirmwareUpdate
* @author Lorenz Meier <mail@qgroundcontrol.org>
*/
#ifndef QGCPXIMUFIRMWAREUPDATE_H #ifndef QGCPXIMUFIRMWAREUPDATE_H
#define QGCPXIMUFIRMWAREUPDATE_H #define QGCPXIMUFIRMWAREUPDATE_H
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include "QGCSensorSettingsWidget.h" #include "QGCSensorSettingsWidget.h"
#include "ui_QGCSensorSettingsWidget.h" #include "ui_QGCSensorSettingsWidget.h"
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Declaration of class QGCSensorSettingsWidget
* @author Lorenz Meier <mail@qgroundcontrol.org>
*/
#ifndef QGCSENSORSETTINGSWIDGET_H #ifndef QGCSENSORSETTINGSWIDGET_H
#define QGCSENSORSETTINGSWIDGET_H #define QGCSENSORSETTINGSWIDGET_H
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
Please see our website at <http://pixhawk.ethz.ch>
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
Please see our website at <http://pixhawk.ethz.ch>
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
...@@ -6,20 +6,20 @@ ...@@ -6,20 +6,20 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>280</width> <width>287</width>
<height>164</height> <height>354</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>280</width> <width>280</width>
<height>130</height> <height>170</height>
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout" rowminimumheight="5,10,10,0,10,5,0"> <layout class="QGridLayout" name="gridLayout" rowminimumheight="10,20,0,10,10,10,300">
<property name="leftMargin"> <property name="leftMargin">
<number>6</number> <number>6</number>
</property> </property>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>0</height> <height>2</height>
</size> </size>
</property> </property>
</spacer> </spacer>
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class XMLCommProtocolWidget
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef XMLCOMMPROTOCOLWIDGET_H #ifndef XMLCOMMPROTOCOLWIDGET_H
#define XMLCOMMPROTOCOLWIDGET_H #define XMLCOMMPROTOCOLWIDGET_H
......
This diff is collapsed.
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Defition of class IncrementalPlot
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef INCREMENTALPLOT_H #ifndef INCREMENTALPLOT_H
#define INCREMENTALPLOT_H #define INCREMENTALPLOT_H
...@@ -5,21 +35,25 @@ ...@@ -5,21 +35,25 @@
#include <qwt_array.h> #include <qwt_array.h>
#include <qwt_plot.h> #include <qwt_plot.h>
#include <qwt_legend.h> #include <qwt_legend.h>
#include <qwt_plot_grid.h>
#include <QMap> #include <QMap>
#include "ScrollZoomer.h" #include "ScrollZoomer.h"
class QwtPlotCurve; class QwtPlotCurve;
/**
* @brief Plot data container for growing data
*/
class CurveData class CurveData
{ {
// A container class for growing data
public: public:
CurveData(); CurveData();
void append(double *x, double *y, int count); void append(double *x, double *y, int count);
/** @brief The number of datasets held in the data structure */
int count() const; int count() const;
/** @brief The reserved size of the data structure in units */
int size() const; int size() const;
const double *x() const; const double *x() const;
const double *y() const; const double *y() const;
...@@ -32,44 +66,89 @@ private: ...@@ -32,44 +66,89 @@ private:
int d_timerCount; int d_timerCount;
}; };
/**
* @brief Incremental plotting widget
*
* This widget plots data incrementally when new data arrives.
* It will only repaint the minimum screen content necessary to avoid
* a too high CPU consumption. It auto-scales the plot to new data.
*/
class IncrementalPlot : public QwtPlot class IncrementalPlot : public QwtPlot
{ {
Q_OBJECT Q_OBJECT
public: public:
/** @brief Create a new, empty incremental plot */
IncrementalPlot(QWidget *parent = NULL); IncrementalPlot(QWidget *parent = NULL);
virtual ~IncrementalPlot(); virtual ~IncrementalPlot();
/** @brief Get color map of this plot */ /** @brief Get color map of this plot */
QList<QColor> getColorMap(); QList<QColor> getColorMap();
/** @brief Get next color of color map */ /** @brief Get next color of color map */
QColor getNextColor(); QColor getNextColor();
/** @brief Get color for curve id */ /** @brief Get color for curve id */
QColor getColorForCurve(QString id); QColor getColorForCurve(QString id);
/** @brief Get the state of the grid */
bool gridEnabled();
/** @brief Read out data from a curve */
int data(QString key, double* r_x, double* r_y, int maxSize);
float symbolWidth;
float curveWidth;
float gridWidth;
float scaleWidth;
public slots: public slots:
/** @brief Append one data point */
void appendData(QString key, double x, double y); void appendData(QString key, double x, double y);
void appendData(QString key, double *x, double *y, int size);
/** @brief Append multiple data points */
void appendData(QString key, double* x, double* y, int size);
/** @brief Reset the plot scaling to the default value */
void resetScaling(); void resetScaling();
/** @brief Update the plot scale based on current data/symmetric mode */
void updateScale();
/** @brief Remove all data from the plot and repaint */
void removeData(); void removeData();
/** @brief Show the plot legend */ /** @brief Show the plot legend */
void showLegend(bool show); void showLegend(bool show);
/** @brief Show the plot grid */
void showGrid(bool show);
/** @brief Set new plot style */ /** @brief Set new plot style */
void setStyleText(QString style); void setStyleText(QString style);
/** @brief Set symmetric axis scaling mode */
void setSymmetric(bool symmetric);
protected slots:
/** @brief Handle the click on a legend item */
void handleLegendClick(QwtPlotItem* item, bool on);
protected: protected:
QList<QColor> colors; bool symmetric; ///< Enable symmetric plotting
int nextColor; QList<QColor> colors; ///< Colormap for curves
ScrollZoomer* zoomer; int nextColor; ///< Next index in color map
QwtLegend* legend; ScrollZoomer* zoomer; ///< Zoomer class for widget
double xmin; QwtLegend* legend; ///< Plot legend
double xmax; QwtPlotGrid* grid; ///< Plot grid
double ymin; double xmin; ///< Minimum x value seen
double ymax; double xmax; ///< Maximum x value seen
double ymin; ///< Minimum y value seen
double ymax; ///< Maximum y value seen
private: private:
QMap<QString, CurveData* > d_data; QMap<QString, CurveData* > d_data; ///< Data points
QMap<QString, QwtPlotCurve* > d_curve; QMap<QString, QwtPlotCurve* > d_curve; ///< Plot curves
}; };
#endif /* INCREMENTALPLOT_H */ #endif /* INCREMENTALPLOT_H */
...@@ -136,7 +136,7 @@ d_curve(NULL) ...@@ -136,7 +136,7 @@ d_curve(NULL)
// Enable zooming // Enable zooming
//zoomer = new Zoomer(canvas()); //zoomer = new Zoomer(canvas());
zoomer = new ScrollZoomer(canvas()); zoomer = new ScrollZoomer(canvas());
zoomer->setRubberBandPen(QPen(Qt::blue, 2, Qt::DotLine)); zoomer->setRubberBandPen(QPen(Qt::blue, 1.2, Qt::DotLine));
zoomer->setTrackerPen(QPen(Qt::blue)); zoomer->setTrackerPen(QPen(Qt::blue));
// Start QTimer for plot update // Start QTimer for plot update
...@@ -314,7 +314,7 @@ QColor LinechartPlot::getNextColor() ...@@ -314,7 +314,7 @@ QColor LinechartPlot::getNextColor()
{ {
/* Return current color and increment counter for next round */ /* Return current color and increment counter for next round */
nextColor++; nextColor++;
if(nextColor >= colors.size()) nextColor = 0; if(nextColor >= colors.count()) nextColor = 0;
return colors[nextColor++]; return colors[nextColor++];
} }
...@@ -762,15 +762,15 @@ void TimeSeriesData::append(quint64 ms, double value) ...@@ -762,15 +762,15 @@ void TimeSeriesData::append(quint64 ms, double value)
mean = mean / static_cast<double>(qMin(averageWindow,static_cast<unsigned int>(count))); mean = mean / static_cast<double>(qMin(averageWindow,static_cast<unsigned int>(count)));
qSort(medianList); qSort(medianList);
if (medianList.size() > 2) if (medianList.count() > 2)
{ {
if (medianList.size() % 2 == 0) if (medianList.count() % 2 == 0)
{ {
median = (medianList.at(medianList.size()/2) + medianList.at(medianList.size()/2+1)) / 2.0; median = (medianList.at(medianList.count()/2) + medianList.at(medianList.count()/2+1)) / 2.0;
} }
else else
{ {
median = medianList.at(medianList.size()/2+1); median = medianList.at(medianList.count()/2+1);
} }
} }
......
...@@ -214,7 +214,7 @@ public: ...@@ -214,7 +214,7 @@ public:
static const int SCALE_LOGARITHMIC = 2; static const int SCALE_LOGARITHMIC = 2;
static const int DEFAULT_REFRESH_RATE = 40; ///< The default refresh rate is 25 Hz / every 100 ms static const int DEFAULT_REFRESH_RATE = 40; ///< The default refresh rate is 25 Hz / every 100 ms
static const int DEFAULT_PLOT_INTERVAL = 1000 * 10; ///< The default plot interval is 10 seconds static const int DEFAULT_PLOT_INTERVAL = 1000 * 15; ///< The default plot interval is 15 seconds
static const int DEFAULT_SCALE_INTERVAL = 1000 * 5; static const int DEFAULT_SCALE_INTERVAL = 1000 * 5;
public slots: public slots:
......
...@@ -141,8 +141,9 @@ void LinechartWidget::createLayout() ...@@ -141,8 +141,9 @@ void LinechartWidget::createLayout()
// Averaging spin box // Averaging spin box
averageSpinBox = new QSpinBox(this); averageSpinBox = new QSpinBox(this);
averageSpinBox->setValue(2); averageSpinBox->setValue(200);
averageSpinBox->setMinimum(2); averageSpinBox->setMinimum(2);
averageSpinBox->setMaximum(9999);
layout->addWidget(averageSpinBox, 1, 2); layout->addWidget(averageSpinBox, 1, 2);
layout->setColumnStretch(2, 0); layout->setColumnStretch(2, 0);
connect(averageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAverageWindow(int))); connect(averageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAverageWindow(int)));
...@@ -306,6 +307,8 @@ void LinechartWidget::stopLogging() ...@@ -306,6 +307,8 @@ void LinechartWidget::stopLogging()
logFile->close(); logFile->close();
// Postprocess log file // Postprocess log file
compressor = new LogCompressor(logFile->fileName()); compressor = new LogCompressor(logFile->fileName());
connect(compressor, SIGNAL(finishedFile(QString)), this, SIGNAL(logfileWritten(QString)));
compressor->startCompression();
} }
logButton->setText(tr("Start logging")); logButton->setText(tr("Start logging"));
disconnect(logButton, SIGNAL(clicked()), this, SLOT(stopLogging())); disconnect(logButton, SIGNAL(clicked()), this, SLOT(stopLogging()));
......
...@@ -163,6 +163,9 @@ signals: ...@@ -163,6 +163,9 @@ signals:
void plotWindowPositionUpdated(quint64 position); void plotWindowPositionUpdated(quint64 position);
void plotWindowPositionUpdated(int position); void plotWindowPositionUpdated(int position);
/** @brief This signal is emitted once a logfile has been finished writing */
void logfileWritten(QString fileName);
}; };
#endif // LINECHARTWIDGET_H #endif // LINECHARTWIDGET_H
...@@ -55,6 +55,7 @@ void Linecharts::addSystem(UASInterface* uas) ...@@ -55,6 +55,7 @@ void Linecharts::addSystem(UASInterface* uas)
addWidget(widget); addWidget(widget);
plots.insert(uas->getUASID(), widget); plots.insert(uas->getUASID(), widget);
connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), widget, SLOT(appendData(int,QString,double,quint64))); connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), widget, SLOT(appendData(int,QString,double,quint64)));
connect(widget, SIGNAL(logfileWritten(QString)), this, SIGNAL(logfileWritten(QString)));
// Set system active if this is the only system // Set system active if this is the only system
if (active) if (active)
{ {
......
...@@ -14,6 +14,8 @@ public: ...@@ -14,6 +14,8 @@ public:
explicit Linecharts(QWidget *parent = 0); explicit Linecharts(QWidget *parent = 0);
signals: signals:
/** @brief This signal is emitted once a logfile has been finished writing */
void logfileWritten(QString fileName);
public slots: public slots:
/** @brief Set all plots active/inactive */ /** @brief Set all plots active/inactive */
......
#include "MAV2DIcon.h"
#include <QPainter>
MAV2DIcon::MAV2DIcon(QGraphicsItem* parent) :
QGC2DIcon(parent)
{
}
/**
* @return the bounding rectangle of the icon
*/
QRectF MAV2DIcon::boundingRect() const
{
qreal penWidth = 1;
return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
20 + penWidth, 20 + penWidth);
}
/**
* @param painter QPainter to draw with
* @param option Visual style
* @param widget Parent widget
*/
void MAV2DIcon::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
}
#ifndef MAV2DICON_H
#define MAV2DICON_H
#include "QGC2DIcon.h"
class MAV2DIcon : public QGC2DIcon
{
public:
explicit MAV2DIcon(QGraphicsItem* parent = 0);
QRectF boundingRect() const;
void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
};
#endif // MAV2DICON_H
#include "QGC2DIcon.h"
QGC2DIcon::QGC2DIcon(QPointF localOriginInGlobalCoords, bool onlyLocal, QGraphicsItem* parent) :
QGraphicsItem(parent),
localOriginInGlobalCoords(localOriginInGlobalCoords),
local(onlyLocal)
{
}
QGC2DIcon::QGC2DIcon(bool onlyLocal, QGraphicsItem* parent) :
QGraphicsItem(parent),
localOriginInGlobalCoords(QPointF(0, 0)),
local(onlyLocal)
{
}
QGC2DIcon::QGC2DIcon(QGraphicsItem* parent) :
QGraphicsItem(parent),
localOriginInGlobalCoords(QPointF(0, 0)),
local(false)
{
}
QGC2DIcon::~QGC2DIcon()
{
}
QPointF QGC2DIcon::getGlobalPosition()
{
}
QPointF QGC2DIcon::getLocalPosition()
{
}
void QGC2DIcon::setGlobalPosition(QPointF pos)
{
}
void QGC2DIcon::setLocalPosition(QPointF pos)
{
}
void QGC2DIcon::setLocalPosition(float x, float y)
{
}
bool QGC2DIcon::isLocal()
{
return local;
}
#ifndef QGC2DICON_H
#define QGC2DICON_H
#include <QGraphicsItem>
#include <QPointF>
class QGC2DIcon : public QGraphicsItem
{
public:
QGC2DIcon(QPointF localOriginInGlobalCoords, bool onlyLocal=false, QGraphicsItem* parent = 0);
QGC2DIcon(bool onlyLocal=false, QGraphicsItem* parent = 0);
explicit QGC2DIcon(QGraphicsItem* parent = 0);
~QGC2DIcon();
QPointF getGlobalPosition();
QPointF getLocalPosition();
void setGlobalPosition(QPointF pos);
void setLocalPosition(QPointF pos);
void setLocalPosition(float x, float y);
bool isLocal();
virtual QRectF boundingRect() const = 0;
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) = 0;
signals:
public slots:
protected:
QPointF localOriginInGlobalCoords;
QPointF globalPosition;
QPointF localPosition;
bool local;
};
#endif // QGC2DICON_H
#include "Waypoint2DIcon.h"
#include <QPainter>
#include <QDebug>
Waypoint2DIcon::Waypoint2DIcon(QGraphicsItem* parent) :
QGC2DIcon(parent)
{
}
/**
* @return the bounding rectangle of the icon
*/
QRectF Waypoint2DIcon::boundingRect() const
{
qreal penWidth = 1;
return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
20 + penWidth, 20 + penWidth);
}
/**
* @param painter QPainter to draw with
* @param option Visual style
* @param widget Parent widget
*/
void Waypoint2DIcon::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
qDebug() << __FILE__ << __LINE__ << "DRAWING";
painter->setPen(QPen(Qt::red));
painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
}
#ifndef WAYPOINT2DICON_H
#define WAYPOINT2DICON_H
#include <QGraphicsItem>
#include "QGC2DIcon.h"
class Waypoint2DIcon : public QGC2DIcon
{
public:
explicit Waypoint2DIcon(QGraphicsItem* parent = 0);
QRectF boundingRect() const;
void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
};
#endif // WAYPOINT2DICON_H
...@@ -35,6 +35,7 @@ This file is part of the PIXHAWK project ...@@ -35,6 +35,7 @@ This file is part of the PIXHAWK project
#include <QFileDialog> #include <QFileDialog>
#include <QDebug> #include <QDebug>
#include <QProcess> #include <QProcess>
#include <QPalette>
#include <MG.h> #include <MG.h>
#include "UASControlWidget.h" #include "UASControlWidget.h"
...@@ -59,8 +60,8 @@ This file is part of the PIXHAWK project ...@@ -59,8 +60,8 @@ This file is part of the PIXHAWK project
#define CONTROL_MODE_TEST3_INDEX 8 #define CONTROL_MODE_TEST3_INDEX 8
UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent), UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent),
uas(NULL), uas(0),
engineOn(false) engineOn(false)
{ {
ui.setupUi(this); ui.setupUi(this);
...@@ -74,45 +75,66 @@ UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent), ...@@ -74,45 +75,66 @@ UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent),
ui.modeComboBox->insertItem(CONTROL_MODE_TEST1_INDEX, CONTROL_MODE_TEST1); ui.modeComboBox->insertItem(CONTROL_MODE_TEST1_INDEX, CONTROL_MODE_TEST1);
ui.modeComboBox->insertItem(CONTROL_MODE_TEST2_INDEX, CONTROL_MODE_TEST2); ui.modeComboBox->insertItem(CONTROL_MODE_TEST2_INDEX, CONTROL_MODE_TEST2);
ui.modeComboBox->insertItem(CONTROL_MODE_TEST3_INDEX, CONTROL_MODE_TEST3); ui.modeComboBox->insertItem(CONTROL_MODE_TEST3_INDEX, CONTROL_MODE_TEST3);
connect(ui.modeComboBox, SIGNAL(activated(int)), this, SLOT(setMode(int)));
connect(ui.setModeButton, SIGNAL(clicked()), this, SLOT(transmitMode()));
ui.modeComboBox->setCurrentIndex(0); ui.modeComboBox->setCurrentIndex(0);
} }
void UASControlWidget::setUAS(UASInterface* uas) void UASControlWidget::setUAS(UASInterface* uas)
{ {
if (this->uas != NULL) if (this->uas != 0)
{ {
disconnect(ui.controlButton, SIGNAL(clicked()), uas, SLOT(enable_motors())); UASInterface* oldUAS = UASManager::instance()->getUASForId(this->uas);
disconnect(ui.liftoffButton, SIGNAL(clicked()), uas, SLOT(launch())); disconnect(ui.controlButton, SIGNAL(clicked()), oldUAS, SLOT(enable_motors()));
disconnect(ui.landButton, SIGNAL(clicked()), uas, SLOT(home())); disconnect(ui.liftoffButton, SIGNAL(clicked()), oldUAS, SLOT(launch()));
disconnect(ui.shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown())); disconnect(ui.landButton, SIGNAL(clicked()), oldUAS, SLOT(home()));
disconnect(ui.modeComboBox, SIGNAL(activated(int)), this, SLOT(setMode(int))); disconnect(ui.shutdownButton, SIGNAL(clicked()), oldUAS, SLOT(shutdown()));
disconnect(ui.setModeButton, SIGNAL(clicked()), this, SLOT(transmitMode())); disconnect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
disconnect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int)));
} }
else
{
// Connect user interface controls
connect(ui.controlButton, SIGNAL(clicked()), this, SLOT(cycleContextButton()));
connect(ui.liftoffButton, SIGNAL(clicked()), uas, SLOT(launch()));
connect(ui.landButton, SIGNAL(clicked()), uas, SLOT(home()));
connect(ui.shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown()));
connect(ui.modeComboBox, SIGNAL(activated(int)), this, SLOT(setMode(int)));
connect(ui.setModeButton, SIGNAL(clicked()), this, SLOT(transmitMode()));
ui.modeComboBox->insertItem(0, "Select..");
ui.controlStatusLabel->setText(tr("Connected to ") + uas->getUASName()); // Connect user interface controls
connect(ui.controlButton, SIGNAL(clicked()), this, SLOT(cycleContextButton()));
connect(ui.liftoffButton, SIGNAL(clicked()), uas, SLOT(launch()));
connect(ui.landButton, SIGNAL(clicked()), uas, SLOT(home()));
connect(ui.shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown()));
connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
connect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int)));
connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); ui.controlStatusLabel->setText(tr("Connected to ") + uas->getUASName());
connect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int)));
this->uas = uas; this->uas = uas->getUASID();
} setBackgroundColor(uas->getColor());
} }
UASControlWidget::~UASControlWidget() { UASControlWidget::~UASControlWidget()
{
}
/**
* Set the background color based on the MAV color. If the MAV is selected as the
* currently actively controlled system, the frame color is highlighted
*/
void UASControlWidget::setBackgroundColor(QColor color)
{
// UAS color
QColor uasColor = color;
QString colorstyle;
QString borderColor = "#4A4A4F";
borderColor = "#FA4A4F";
uasColor = uasColor.darker(900);
colorstyle = colorstyle.sprintf("QLabel { border-radius: 3px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X; border: 0px solid %s; }",
uasColor.red(), uasColor.green(), uasColor.blue(), borderColor.toStdString().c_str());
setStyleSheet(colorstyle);
QPalette palette = this->palette();
palette.setBrush(QPalette::Window, QBrush(uasColor));
setPalette(palette);
setAutoFillBackground(true);
} }
void UASControlWidget::updateMode(int uas,QString mode,QString description) void UASControlWidget::updateMode(int uas,QString mode,QString description)
{ {
Q_UNUSED(uas); Q_UNUSED(uas);
...@@ -187,14 +209,14 @@ void UASControlWidget::transmitMode() ...@@ -187,14 +209,14 @@ void UASControlWidget::transmitMode()
{ {
if (uasMode != 0) if (uasMode != 0)
{ {
this->uas->setMode(uasMode); UASManager::instance()->getUASForId(this->uas)->setMode(uasMode);
ui.lastActionLabel->setText(QString("Set new mode for system %1").arg(uas->getUASName())); ui.lastActionLabel->setText(QString("Set new mode for system %1").arg(UASManager::instance()->getUASForId(uas)->getUASName()));
} }
} }
void UASControlWidget::cycleContextButton() void UASControlWidget::cycleContextButton()
{ {
UAS* mav = dynamic_cast<UAS*>(this->uas); UAS* mav = dynamic_cast<UAS*>(UASManager::instance()->getUASForId(this->uas));
if (mav) if (mav)
{ {
...@@ -202,16 +224,16 @@ void UASControlWidget::cycleContextButton() ...@@ -202,16 +224,16 @@ void UASControlWidget::cycleContextButton()
{ {
ui.controlButton->setText(tr("Stop Engine")); ui.controlButton->setText(tr("Stop Engine"));
mav->enable_motors(); mav->enable_motors();
ui.lastActionLabel->setText(QString("Attempted to enable motors on %1").arg(uas->getUASName())); ui.lastActionLabel->setText(QString("Attempted to enable motors on %1").arg(mav->getUASName()));
} }
else else
{ {
ui.controlButton->setText(tr("Activate Engine")); ui.controlButton->setText(tr("Activate Engine"));
mav->disable_motors(); mav->disable_motors();
ui.lastActionLabel->setText(QString("Attempted to disable motors on %1").arg(uas->getUASName())); ui.lastActionLabel->setText(QString("Attempted to disable motors on %1").arg(mav->getUASName()));
} }
//ui.controlButton->setText(tr("Force Landing")); //ui.controlButton->setText(tr("Force Landing"));
//ui.controlButton->setText(tr("KILL VEHICLE")); //ui.controlButton->setText(tr("KILL VEHICLE"));
} }
} }
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/** /**
* @file * @file
* @brief Definition of widget controlling one MAV * @brief Definition of class UASControlWidget
* *
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
...@@ -39,7 +39,11 @@ This file is part of the PIXHAWK project ...@@ -39,7 +39,11 @@ This file is part of the PIXHAWK project
#include <ui_UASControl.h> #include <ui_UASControl.h>
#include <UASInterface.h> #include <UASInterface.h>
class UASControlWidget : public QWidget { /**
* @brief Widget controlling one MAV
*/
class UASControlWidget : public QWidget
{
Q_OBJECT Q_OBJECT
public: public:
...@@ -60,10 +64,14 @@ public slots: ...@@ -60,10 +64,14 @@ public slots:
/** @brief Update state */ /** @brief Update state */
void updateState(int state); void updateState(int state);
protected slots:
/** @brief Set the background color for the widget */
void setBackgroundColor(QColor color);
protected: protected:
UASInterface* uas; int uas; ///< Reference to the current uas
unsigned int uasMode; unsigned int uasMode; ///< Current uas mode
bool engineOn; bool engineOn; ///< Engine state
private: private:
Ui::uasControl ui; Ui::uasControl ui;
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/** /**
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
......
...@@ -78,6 +78,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -78,6 +78,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect(uas, SIGNAL(waypointSelected(int,int)), this, SLOT(selectWaypoint(int,int))); connect(uas, SIGNAL(waypointSelected(int,int)), this, SLOT(selectWaypoint(int,int)));
connect(&(uas->getWaypointManager()), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointUpdated(quint16))); connect(&(uas->getWaypointManager()), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointUpdated(quint16)));
connect(uas, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint))); connect(uas, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint)));
connect(UASManager::instance(), SIGNAL(activeUASStatusChanged(UASInterface*,bool)), this, SLOT(updateActiveUAS(UASInterface*,bool)));
// Setup UAS selection // Setup UAS selection
connect(m_ui->uasViewFrame, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool))); connect(m_ui->uasViewFrame, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool)));
...@@ -108,7 +109,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -108,7 +109,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
// Heartbeat fade // Heartbeat fade
refreshTimer = new QTimer(this); refreshTimer = new QTimer(this);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
refreshTimer->start(100); refreshTimer->start(180);
} }
UASView::~UASView() UASView::~UASView()
...@@ -142,9 +143,19 @@ void UASView::setBackgroundColor() ...@@ -142,9 +143,19 @@ void UASView::setBackgroundColor()
void UASView::setUASasActive(bool active) void UASView::setUASasActive(bool active)
{ {
UASManager::instance()->setActiveUAS(this->uas); if (active)
this->isActive = active; {
setBackgroundColor(); UASManager::instance()->setActiveUAS(this->uas);
}
}
void UASView::updateActiveUAS(UASInterface* uas, bool active)
{
if (uas == this->uas)
{
this->isActive = active;
setBackgroundColor();
}
} }
void UASView::updateMode(int sysId, QString status, QString description) void UASView::updateMode(int sysId, QString status, QString description)
......
/*===================================================================== /*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit QGroundControl Open Source Ground Control Station
(c) 2009 PIXHAWK PROJECT <http://pixhawk.ethz.ch> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the PIXHAWK project This file is part of the QGROUNDCONTROL project
PIXHAWK is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
...@@ -42,7 +42,8 @@ namespace Ui { ...@@ -42,7 +42,8 @@ namespace Ui {
class UASView; class UASView;
} }
class UASView : public QWidget { class UASView : public QWidget
{
Q_OBJECT Q_OBJECT
public: public:
UASView(UASInterface* uas, QWidget *parent = 0); UASView(UASInterface* uas, QWidget *parent = 0);
...@@ -71,6 +72,8 @@ public slots: ...@@ -71,6 +72,8 @@ public slots:
void setSystemType(UASInterface* uas, unsigned int systemType); void setSystemType(UASInterface* uas, unsigned int systemType);
/** @brief Set the current UAS as the globally active system */ /** @brief Set the current UAS as the globally active system */
void setUASasActive(bool); void setUASasActive(bool);
/** @brief Update the view if an UAS has been set to active */
void updateActiveUAS(UASInterface* uas, bool active);
/** @brief Set the background color for the widget */ /** @brief Set the background color for the widget */
void setBackgroundColor(); void setBackgroundColor();
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of class WatchdogControl
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include "WatchdogControl.h" #include "WatchdogControl.h"
#include "WatchdogView.h" #include "WatchdogView.h"
#include "WatchdogProcessView.h" #include "WatchdogProcessView.h"
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class WatchdogControl
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef WATCHDOGCONTROL_H #ifndef WATCHDOGCONTROL_H
#define WATCHDOGCONTROL_H #define WATCHDOGCONTROL_H
...@@ -19,6 +49,9 @@ namespace Ui { ...@@ -19,6 +49,9 @@ namespace Ui {
class WatchdogControl; class WatchdogControl;
} }
/**
* @brief Overall widget for controlling all watchdogs of all connected MAVs
*/
class WatchdogControl : public QWidget { class WatchdogControl : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of class WatchdogControl
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include "WatchdogProcessView.h" #include "WatchdogProcessView.h"
#include "ui_WatchdogProcessView.h" #include "ui_WatchdogProcessView.h"
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class WatchdogProcessView
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef WATCHDOGPROCESSVIEW_H #ifndef WATCHDOGPROCESSVIEW_H
#define WATCHDOGPROCESSVIEW_H #define WATCHDOGPROCESSVIEW_H
...@@ -8,6 +38,9 @@ namespace Ui { ...@@ -8,6 +38,9 @@ namespace Ui {
class WatchdogProcessView; class WatchdogProcessView;
} }
/**
* @brief Represents one process monitored by the linux onboard watchdog
*/
class WatchdogProcessView : public QWidget { class WatchdogProcessView : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of class WatchdogControl
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include "WatchdogView.h" #include "WatchdogView.h"
#include "ui_WatchdogView.h" #include "ui_WatchdogView.h"
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class WatchdogView
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef WATCHDOGVIEW_H #ifndef WATCHDOGVIEW_H
#define WATCHDOGVIEW_H #define WATCHDOGVIEW_H
...@@ -7,6 +37,9 @@ namespace Ui { ...@@ -7,6 +37,9 @@ namespace Ui {
class WatchdogView; class WatchdogView;
} }
/**
* @brief Represents one onboard watchdog
*/
class WatchdogView : public QWidget { class WatchdogView : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
......
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