From e00852897939471f386d2e55c56ed93ebec36328 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Sun, 22 Aug 2010 23:30:45 +0200 Subject: [PATCH] Working on QGraphicsView-based local waypoints interface supporting drag-and-drop, commented code, fixed Google Maps interface, added mouse and SpinBox zoom to HSIWidget, fixed MAV-based coloring and stylesheets - MEGA COMMIT --- images/style-mission.css | 42 ++- lib/QMapControl/src/googlemapadapter.cpp | 3 +- lib/QMapControl/src/googlesatmapadapter.cpp | 288 ++++++++++---------- lib/QMapControl/src/googlesatmapadapter.h | 50 ++-- qgroundcontrol.pri | 5 +- qgroundcontrol.pro | 10 +- src/comm/MAVLinkProtocol.cc | 2 +- src/comm/MAVLinkProtocol.h | 1 + src/uas/ArduPilotMAV.h | 23 ++ src/uas/PxQuadMAV.h | 23 ++ src/uas/SlugsMAV.h | 23 ++ src/uas/UAS.cc | 5 + src/uas/UAS.h | 13 +- src/uas/UASInterface.h | 15 +- src/uas/UASManager.cc | 13 +- src/uas/UASManager.h | 22 +- src/uas/UASWaypointManager.h | 12 +- src/ui/HDDisplay.cc | 181 +++++++++++- src/ui/HDDisplay.h | 17 ++ src/ui/HSIDisplay.cc | 75 ++++- src/ui/HSIDisplay.h | 9 +- src/ui/MainWindow.cc | 66 +++-- src/ui/MainWindow.ui | 2 +- src/ui/MapWidget.cc | 5 +- src/ui/PFD.cc | 53 ---- src/ui/PFD.h | 43 --- src/ui/UASControl.ui | 10 +- src/ui/linechart/IncrementalPlot.cc | 7 +- src/ui/linechart/LinechartPlot.h | 2 +- src/ui/map/MAV2DIcon.cc | 27 ++ src/ui/map/MAV2DIcon.h | 16 ++ src/ui/map/QGC2DIcon.cc | 58 ++++ src/ui/map/QGC2DIcon.h | 38 +++ src/ui/map/Waypoint2DIcon.cc | 31 +++ src/ui/map/Waypoint2DIcon.h | 18 ++ src/ui/uas/UASControlWidget.cc | 66 +++-- src/ui/uas/UASControlWidget.h | 10 +- src/ui/uas/UASInfoWidget.h | 26 +- src/ui/uas/UASListWidget.h | 12 +- src/ui/uas/UASView.cc | 19 +- src/ui/uas/UASView.h | 17 +- 41 files changed, 953 insertions(+), 405 deletions(-) delete mode 100644 src/ui/PFD.cc delete mode 100644 src/ui/PFD.h create mode 100644 src/ui/map/MAV2DIcon.cc create mode 100644 src/ui/map/MAV2DIcon.h create mode 100644 src/ui/map/QGC2DIcon.cc create mode 100644 src/ui/map/QGC2DIcon.h create mode 100644 src/ui/map/Waypoint2DIcon.cc create mode 100644 src/ui/map/Waypoint2DIcon.h diff --git a/images/style-mission.css b/images/style-mission.css index 8a201d100..c911b6761 100644 --- a/images/style-mission.css +++ b/images/style-mission.css @@ -101,8 +101,46 @@ QSeparator { 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 { font-weight: bold; diff --git a/lib/QMapControl/src/googlemapadapter.cpp b/lib/QMapControl/src/googlemapadapter.cpp index 9715e2f50..945aca765 100644 --- a/lib/QMapControl/src/googlemapadapter.cpp +++ b/lib/QMapControl/src/googlemapadapter.cpp @@ -27,8 +27,7 @@ namespace qmapcontrol { GoogleMapAdapter::GoogleMapAdapter() - : TileMapAdapter("mt2.google.com", "/mt?n=404&x=%2&y=%3&zoom=%1", 256, 17, 0) - //: TileMapAdapter("tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 17) + : TileMapAdapter("mt0.google.com", "/vt/lyrs=&x=%2&s=&y=%3&z=%1", 256, 0, 17) { } diff --git a/lib/QMapControl/src/googlesatmapadapter.cpp b/lib/QMapControl/src/googlesatmapadapter.cpp index 55ab1084e..f5bbda83a 100644 --- a/lib/QMapControl/src/googlesatmapadapter.cpp +++ b/lib/QMapControl/src/googlesatmapadapter.cpp @@ -29,155 +29,155 @@ namespace qmapcontrol { 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"; - - numberOfTiles = pow(2, current_zoom+0.0); - coord_per_x_tile = 360. / numberOfTiles; - coord_per_y_tile = 180. / numberOfTiles; +// // name = "googlesat"; +// +// numberOfTiles = pow(2, current_zoom+0.0); +// coord_per_x_tile = 360. / numberOfTiles; +// coord_per_y_tile = 180. / numberOfTiles; } GoogleSatMapAdapter::~GoogleSatMapAdapter() { } - - QString GoogleSatMapAdapter::getHost() const - { - int random = qrand() % 4; - return QString("kh%1.google.com").arg(random); - } - - QPoint GoogleSatMapAdapter::coordinateToDisplay(const QPointF& coordinate) const - { - //double x = ((coordinate.x()+180)*(tilesize*numberOfTiles/360)); - //double y = (((coordinate.y()*-1)+90)*(tilesize*numberOfTiles/180)); - - qreal x = (coordinate.x()+180.) * (numberOfTiles*mytilesize)/360.; // 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! - return QPoint(int(x), int(y)); - } - - QPointF GoogleSatMapAdapter::displayToCoordinate(const QPoint& point) const - { - //double lon = ((point.x()/tilesize*numberOfTiles)*360)-180; - //double lat = (((point.y()/tilesize*numberOfTiles)*180)-90)*-1; - - qreal lon = (point.x()*(360.0/(numberOfTiles*mytilesize)))-180.0; - // qreal lat = -(point.y()*(180.0/(numberOfTiles*mytilesize)))+90.0; - // FIXME Looks buggy - - qreal lat = getMercatorLatitude(point.y()*-1*(2*M_PI/(numberOfTiles*mytilesize)) + M_PI); - //qreal lat = lat *180./M_PI; - return QPointF(lon, lat); - } - - qreal GoogleSatMapAdapter::getMercatorLatitude(qreal YCoord) const - { - //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.; - - qreal t = atan(exp(YCoord)); - qreal res = (2.*(t))-(M_PI/2.); - return res; - } - - qreal GoogleSatMapAdapter::getMercatorYCoord(qreal lati) const - { - qreal lat = lati; - - // conversion degre=>radians - qreal phi = M_PI * lat / 180; - - qreal res; - //double temp = Math.Tan(Math.PI / 4 - phi / 2); - //res = Math.Log(temp); - res = 0.5 * log((1 + sin(phi)) / (1 - sin(phi))); - - return res; - } - - void GoogleSatMapAdapter::zoom_in() - { - current_zoom+=1; - numberOfTiles = pow(2, current_zoom+0.0); - coord_per_x_tile = 360. / numberOfTiles; - coord_per_y_tile = 180. / numberOfTiles; - } - - void GoogleSatMapAdapter::zoom_out() - { - current_zoom-=1; - numberOfTiles = pow(2, current_zoom+0.0); - coord_per_x_tile = 360. / numberOfTiles; - coord_per_y_tile = 180. / numberOfTiles; - } - - bool GoogleSatMapAdapter::isValid(int x, int y, int z) const - { - if ((x>=0 && x < numberOfTiles) && (y>=0 && y < numberOfTiles) && z>=0) - { - return true; - } - return false; - } - QString GoogleSatMapAdapter::query(int i, int j, int z) const - { - return getQ(-180+i*coord_per_x_tile, - 90-(j+1)*coord_per_y_tile, z); - } - - QString GoogleSatMapAdapter::getQ(qreal longitude, qreal latitude, int zoom) const - { - qreal xmin=-180; - qreal xmax=180; - qreal ymin=-90; - qreal ymax=90; - - qreal xmoy=0; - qreal ymoy=0; - QString location="t"; - - //Google uses a latitude divided by 2; - qreal halflat = latitude; - - for (int i = 0; i < zoom; i++) - { - xmoy = (xmax + xmin) / 2; - ymoy = (ymax + ymin) / 2; - if (halflat >= ymoy) //upper part (q or r) - { - ymin = ymoy; - if (longitude < xmoy) - { /*q*/ - location+= "q"; - xmax = xmoy; - } - else - {/*r*/ - location+= "r"; - xmin = xmoy; - } - } - else //lower part (t or s) - { - ymax = ymoy; - if (longitude < xmoy) - { /*t*/ - - location+= "t"; - xmax = xmoy; - } - else - {/*s*/ - location+= "s"; - xmin = xmoy; - } - } - } - return QString("/kh?n=404&v=24&t=%1").arg(location); - } +// +// QString GoogleSatMapAdapter::getHost() const +// { +// int random = qrand() % 4; +// return QString("kh%1.google.com").arg(random); +// } +// +// QPoint GoogleSatMapAdapter::coordinateToDisplay(const QPointF& coordinate) const +// { +// //double x = ((coordinate.x()+180)*(tilesize*numberOfTiles/360)); +// //double y = (((coordinate.y()*-1)+90)*(tilesize*numberOfTiles/180)); +// +// qreal x = (coordinate.x()+180.) * (numberOfTiles*mytilesize)/360.; // 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! +// return QPoint(int(x), int(y)); +// } +// +// QPointF GoogleSatMapAdapter::displayToCoordinate(const QPoint& point) const +// { +// //double lon = ((point.x()/tilesize*numberOfTiles)*360)-180; +// //double lat = (((point.y()/tilesize*numberOfTiles)*180)-90)*-1; +// +// qreal lon = (point.x()*(360.0/(numberOfTiles*mytilesize)))-180.0; +// // qreal lat = -(point.y()*(180.0/(numberOfTiles*mytilesize)))+90.0; +// // FIXME Looks buggy +// +// qreal lat = getMercatorLatitude(point.y()*-1*(2*M_PI/(numberOfTiles*mytilesize)) + M_PI); +// //qreal lat = lat *180./M_PI; +// return QPointF(lon, lat); +// } +// +// qreal GoogleSatMapAdapter::getMercatorLatitude(qreal YCoord) const +// { +// //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.; +// +// qreal t = atan(exp(YCoord)); +// qreal res = (2.*(t))-(M_PI/2.); +// return res; +// } +// +// qreal GoogleSatMapAdapter::getMercatorYCoord(qreal lati) const +// { +// qreal lat = lati; +// +// // conversion degre=>radians +// qreal phi = M_PI * lat / 180; +// +// qreal res; +// //double temp = Math.Tan(Math.PI / 4 - phi / 2); +// //res = Math.Log(temp); +// res = 0.5 * log((1 + sin(phi)) / (1 - sin(phi))); +// +// return res; +// } +// +// void GoogleSatMapAdapter::zoom_in() +// { +// current_zoom+=1; +// numberOfTiles = pow(2, current_zoom+0.0); +// coord_per_x_tile = 360. / numberOfTiles; +// coord_per_y_tile = 180. / numberOfTiles; +// } +// +// void GoogleSatMapAdapter::zoom_out() +// { +// current_zoom-=1; +// numberOfTiles = pow(2, current_zoom+0.0); +// coord_per_x_tile = 360. / numberOfTiles; +// coord_per_y_tile = 180. / numberOfTiles; +// } +// +// bool GoogleSatMapAdapter::isValid(int x, int y, int z) const +// { +// if ((x>=0 && x < numberOfTiles) && (y>=0 && y < numberOfTiles) && z>=0) +// { +// return true; +// } +// return false; +// } +// QString GoogleSatMapAdapter::query(int i, int j, int z) const +// { +// return getQ(-180+i*coord_per_x_tile, +// 90-(j+1)*coord_per_y_tile, z); +// } +// +// QString GoogleSatMapAdapter::getQ(qreal longitude, qreal latitude, int zoom) const +// { +// qreal xmin=-180; +// qreal xmax=180; +// qreal ymin=-90; +// qreal ymax=90; +// +// qreal xmoy=0; +// qreal ymoy=0; +// QString location="t"; +// +// //Google uses a latitude divided by 2; +// qreal halflat = latitude; +// +// for (int i = 0; i < zoom; i++) +// { +// xmoy = (xmax + xmin) / 2; +// ymoy = (ymax + ymin) / 2; +// if (halflat >= ymoy) //upper part (q or r) +// { +// ymin = ymoy; +// if (longitude < xmoy) +// { /*q*/ +// location+= "q"; +// xmax = xmoy; +// } +// else +// {/*r*/ +// location+= "r"; +// xmin = xmoy; +// } +// } +// else //lower part (t or s) +// { +// ymax = ymoy; +// if (longitude < xmoy) +// { /*t*/ +// +// location+= "t"; +// xmax = xmoy; +// } +// else +// {/*s*/ +// location+= "s"; +// xmin = xmoy; +// } +// } +// } +// return QString("/kh?n=404&v=24&t=%1").arg(location); +// } } diff --git a/lib/QMapControl/src/googlesatmapadapter.h b/lib/QMapControl/src/googlesatmapadapter.h index a74d3e909..0c56a6d5e 100644 --- a/lib/QMapControl/src/googlesatmapadapter.h +++ b/lib/QMapControl/src/googlesatmapadapter.h @@ -44,31 +44,31 @@ namespace qmapcontrol */ GoogleSatMapAdapter(); virtual ~GoogleSatMapAdapter(); - - virtual QPoint coordinateToDisplay(const QPointF&) const; - virtual QPointF displayToCoordinate(const QPoint&) const; - - //! returns the host of this MapAdapter - /*! - * @return the host of this MapAdapter - */ - QString getHost () const; - - - protected: - virtual void zoom_in(); - virtual void zoom_out(); - virtual QString query(int x, int y, int z) const; - virtual bool isValid(int x, int y, int z) const; - - private: - virtual QString getQ(qreal longitude, qreal latitude, int zoom) const; - qreal getMercatorLatitude(qreal YCoord) const; - qreal getMercatorYCoord(qreal lati) const; - - qreal coord_per_x_tile; - qreal coord_per_y_tile; - int srvNum; +// +// virtual QPoint coordinateToDisplay(const QPointF&) const; +// virtual QPointF displayToCoordinate(const QPoint&) const; +// +// //! returns the host of this MapAdapter +// /*! +// * @return the host of this MapAdapter +// */ +// QString getHost () const; +// +// +// protected: +// virtual void zoom_in(); +// virtual void zoom_out(); +// virtual QString query(int x, int y, int z) const; +// virtual bool isValid(int x, int y, int z) const; +// +// private: +// virtual QString getQ(qreal longitude, qreal latitude, int zoom) const; +// qreal getMercatorLatitude(qreal YCoord) const; +// qreal getMercatorYCoord(qreal lati) const; +// +// qreal coord_per_x_tile; +// qreal coord_per_y_tile; +// int srvNum; }; } #endif diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index 04fb7a478..310446340 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -31,7 +31,10 @@ message(Qt version $$[QT_VERSION]) - +release { +# DEFINES += QT_NO_DEBUG_OUTPUT +# DEFINES += QT_NO_WARNING_OUTPUT +} # MAC OS X macx { diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index fd0a106ca..44a1974de 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -152,7 +152,10 @@ HEADERS += src/MG.h \ src/ui/QGCPxImuFirmwareUpdate.h \ src/comm/MAVLinkLightProtocol.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 \ src/Core.cc \ src/uas/UASManager.cc \ @@ -212,7 +215,10 @@ SOURCES += src/main.cc \ src/ui/QGCPxImuFirmwareUpdate.cc \ src/comm/MAVLinkLightProtocol.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 # Include RT-LAB Library diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 60fdcb85a..e2184f3bf 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -258,7 +258,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) //if () // 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 // Receive loss diff --git a/src/comm/MAVLinkProtocol.h b/src/comm/MAVLinkProtocol.h index 93aac97e3..73bd6cd61 100644 --- a/src/comm/MAVLinkProtocol.h +++ b/src/comm/MAVLinkProtocol.h @@ -40,6 +40,7 @@ This file is part of the QGROUNDCONTROL project #include "ProtocolInterface.h" #include "LinkInterface.h" #include "protocol.h" +#include "mavlink.h" /** * @brief MAVLink micro air vehicle protocol reference implementation. diff --git a/src/uas/ArduPilotMAV.h b/src/uas/ArduPilotMAV.h index 15e9d3071..29f4a183d 100644 --- a/src/uas/ArduPilotMAV.h +++ b/src/uas/ArduPilotMAV.h @@ -1,3 +1,26 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2010 QGROUNDCONTROL PROJECT + +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 . + +======================================================================*/ + #ifndef ARDUPILOTMAV_H #define ARDUPILOTMAV_H diff --git a/src/uas/PxQuadMAV.h b/src/uas/PxQuadMAV.h index 6170bc863..cac17453e 100644 --- a/src/uas/PxQuadMAV.h +++ b/src/uas/PxQuadMAV.h @@ -1,3 +1,26 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2010 QGROUNDCONTROL PROJECT + +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 . + +======================================================================*/ + #ifndef PXQUADMAV_H #define PXQUADMAV_H diff --git a/src/uas/SlugsMAV.h b/src/uas/SlugsMAV.h index 84f04ad4f..e62866f3f 100644 --- a/src/uas/SlugsMAV.h +++ b/src/uas/SlugsMAV.h @@ -1,3 +1,26 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2010 QGROUNDCONTROL PROJECT + +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 . + +======================================================================*/ + #ifndef SLUGSMAV_H #define SLUGSMAV_H diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 987f4b953..1a5b2a6f4 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -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) { switch (buttonIndex) diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 37e82e117..426bebcda 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -1,23 +1,23 @@ /*===================================================================== -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit +QGroundControl Open Source Ground Control Station -(c) 2009, 2010 PIXHAWK PROJECT +(c) 2009, 2010 QGROUNDCONTROL PROJECT -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 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, + 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 PIXHAWK. If not, see . + along with QGROUNDCONTROL. If not, see . ======================================================================*/ @@ -142,6 +142,7 @@ protected: public: UASWaypointManager &getWaypointManager(void) { return waypointManager; } + int getSystemType(); public slots: /** @brief Launches the system **/ diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index ea042b9cf..a0ad5ad18 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -1,23 +1,23 @@ /*===================================================================== -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit +QGroundControl Open Source Ground Control Station -(c) 2009, 2010 PIXHAWK PROJECT +(c) 2009, 2010 QGROUNDCONTROL PROJECT -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 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, + 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 PIXHAWK. If not, see . + along with QGROUNDCONTROL. If not, see . ======================================================================*/ @@ -135,6 +135,9 @@ public: return colors[nextColor++]; } + /** @brief Get the type of the system (airplane, quadrotor, helicopter,..)*/ + virtual int getSystemType() = 0; + QColor getColor() { return color; diff --git a/src/uas/UASManager.cc b/src/uas/UASManager.cc index ea1411681..c974dc84b 100644 --- a/src/uas/UASManager.cc +++ b/src/uas/UASManager.cc @@ -23,7 +23,7 @@ This file is part of the PIXHAWK project /** * @file - * @brief Implementation of central manager for all connected aerial vehicles + * @brief Implementation of class UASManager * @author Lorenz Meier * */ @@ -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 (activeUAS == NULL) { - activeUAS = uas; - emit activeUASSet(uas); - emit activeUASSet(uas->getUASID()); + setActiveUAS(uas); } } @@ -165,6 +163,11 @@ void UASManager::setActiveUAS(UASInterface* uas) if (uas != NULL) { activeUASMutex.lock(); + if (activeUAS != NULL) + { + emit activeUASStatusChanged(activeUAS, false); + emit activeUASStatusChanged(activeUAS->getUASID(), false); + } activeUAS = uas; activeUASMutex.unlock(); @@ -172,6 +175,8 @@ void UASManager::setActiveUAS(UASInterface* uas) emit activeUASSet(uas); emit activeUASSet(uas->getUASID()); + emit activeUASStatusChanged(uas, true); + emit activeUASStatusChanged(uas->getUASID(), true); } } diff --git a/src/uas/UASManager.h b/src/uas/UASManager.h index 669889752..7b8dabfb5 100644 --- a/src/uas/UASManager.h +++ b/src/uas/UASManager.h @@ -1,29 +1,29 @@ /*===================================================================== -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit +QGroundControl Open Source Ground Control Station -(c) 2009 PIXHAWK PROJECT +(c) 2009, 2010 QGROUNDCONTROL PROJECT -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 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, + 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 PIXHAWK. If not, see . + along with QGROUNDCONTROL. If not, see . ======================================================================*/ /** * @file - * @brief Definition of central manager for all connected aerial vehicles + * @brief Definition of class UASManager * @author Lorenz Meier * */ @@ -37,7 +37,7 @@ This file is part of the PIXHAWK project #include /** - * @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 * UAS is currently select with respect to user input or manual controls. @@ -165,8 +165,14 @@ protected: signals: void UASCreated(UASInterface* UAS); + /** @brief The UAS currently under main operator control changed */ void activeUASSet(UASInterface* UAS); + /** @brief The UAS currently under main operator control changed */ 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); }; diff --git a/src/uas/UASWaypointManager.h b/src/uas/UASWaypointManager.h index e9dce5d6d..b0e4e3ee8 100644 --- a/src/uas/UASWaypointManager.h +++ b/src/uas/UASWaypointManager.h @@ -1,23 +1,23 @@ /*===================================================================== -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit +QGroundControl Open Source Ground Control Station -(c) 2009, 2010 PIXHAWK PROJECT +(c) 2009, 2010 QGROUNDCONTROL PROJECT -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 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, + 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 PIXHAWK. If not, see . + along with QGROUNDCONTROL. If not, see . ======================================================================*/ diff --git a/src/ui/HDDisplay.cc b/src/ui/HDDisplay.cc index 68102fd16..5d9a44915 100644 --- a/src/ui/HDDisplay.cc +++ b/src/ui/HDDisplay.cc @@ -32,6 +32,8 @@ This file is part of the PIXHAWK project #include #include #include +#include +#include #include "UASManager.h" #include "HDDisplay.h" #include "ui_HDDisplay.h" @@ -80,11 +82,47 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) : 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->setMinimumWidth(100); // 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(paintGL())); @@ -117,14 +155,12 @@ void HDDisplay::enableGLRendering(bool enable) void HDDisplay::triggerUpdate() { // Only repaint the regions necessary - QRect r = geometry(); - update(r); + update(this->geometry()); } void HDDisplay::paintEvent(QPaintEvent * event) { Q_UNUSED(event); - //paintGL(); static quint64 interval = 0; //qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__; interval = MG::TIME::getGroundTimeNow(); @@ -152,7 +188,7 @@ void HDDisplay::renderOverlay() QPainter painter(viewport()); painter.setRenderHint(QPainter::Antialiasing, 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 float spacing = 0.4f; // 40% of width const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.5f)); @@ -629,3 +665,138 @@ void HDDisplay::changeEvent(QEvent *e) 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); +//} diff --git a/src/ui/HDDisplay.h b/src/ui/HDDisplay.h index 303ac5c83..0461c4cc1 100644 --- a/src/ui/HDDisplay.h +++ b/src/ui/HDDisplay.h @@ -94,6 +94,23 @@ protected: 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); +// //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 QMap values; ///< The variables this HUD displays QMap valuesDot; ///< First derivative of the variable diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index 51761bb80..69bdf1535 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -32,12 +32,16 @@ This file is part of the QGROUNDCONTROL project #include #include #include +#include +#include +#include #include "UASManager.h" #include "HSIDisplay.h" #include "MG.h" #include "QGC.h" #include "Waypoint.h" #include "UASWaypointManager.h" +#include "Waypoint2DIcon.h" #include @@ -98,9 +102,28 @@ HSIDisplay::HSIDisplay(QWidget *parent) : connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); refreshTimer->setInterval(60); + +// this->setScene(new QGraphicsScene(-metricWidth/2.0f, -metricWidth/2.0f, metricWidth, metricWidth, this)); + xCenterPos = vwidth/2.0f; 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); + // Do first update + setMetricWidth(metricWidth); } void HSIDisplay::paintEvent(QPaintEvent * event) @@ -136,7 +159,8 @@ void HSIDisplay::renderOverlay() painter.setRenderHint(QPainter::HighQualityAntialiasing, true); // Draw background - painter.fillRect(QRect(0, 0, width(), height()), backgroundColor); + //painter.fillRect(QRect(0, 0, width(), height()), backgroundColor); + // Draw base instrument // ---------------------- @@ -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 @@ -634,6 +667,18 @@ void HSIDisplay::drawWaypoints(QPainter& painter) if (uas) { const QVector& 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; painter.setBrush(Qt::NoBrush); @@ -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); } -/** - * @param fix 0: lost, 1: 2D local position hold, 2: 2D localization, 3: 3D localization - */ -void localizationChanged(UASInterface* uas, int fix); -/** - * @param fix 0: lost, 1: at least one satellite, but no GPS fix, 2: 2D localization, 3: 3D localization - */ -void gpsLocalizationChanged(UASInterface* uas, int fix); -/** - * @param fix 0: lost, 1: 2D local position hold, 2: 2D localization, 3: 3D localization - */ -void visionLocalizationChanged(UASInterface* uas, int fix); +void HSIDisplay::wheelEvent(QWheelEvent* event) +{ + double zoomScale = 0.005; // Scaling of zoom value + if(event->delta() > 0) + { + // Reduce width -> Zoom in + metricWidth -= event->delta() * zoomScale; + } + else + { + // Increase width -> Zoom out + 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) { diff --git a/src/ui/HSIDisplay.h b/src/ui/HSIDisplay.h index f784338dc..2fb873866 100644 --- a/src/ui/HSIDisplay.h +++ b/src/ui/HSIDisplay.h @@ -51,6 +51,8 @@ public: public slots: 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 updateAttitudeSetpoints(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 usec); void updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 time); @@ -80,6 +82,9 @@ public slots: void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat); void pressKey(int key); +signals: + void metricWidthChanged(double width); + protected slots: void renderOverlay(); void drawGPS(QPainter &painter); @@ -101,6 +106,8 @@ protected slots: void drawSafetyArea(const QPointF &topLeft, const QPointF &bottomRight, const QColor &color, QPainter &painter); /** @brief Receive mouse clicks */ void mouseDoubleClickEvent(QMouseEvent* event); + /** @brief Receive mouse wheel events */ + void wheelEvent(QWheelEvent* event); protected: @@ -202,7 +209,7 @@ protected: float uiYSetCoordinate; ///< Y Setpoint coordinate wanted by the UI float uiZSetCoordinate; ///< Z Setpoint coordinate 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 diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 4ce9725db..781e38fa7 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -391,29 +391,61 @@ void MainWindow::addLink(LinkInterface *link) void MainWindow::UASCreated(UASInterface* uas) { // 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 - connect(uas, SIGNAL(textMessageReceived(int,int,int,QString)), debugConsole, SLOT(receiveTextMessage(int,int,int,QString))); + if (uas != NULL) + { + 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 - info->addUAS(uas); + ui.menuConnected_Systems->addAction(icon, tr("Select %1 for control").arg(uas->getUASName()), uas, SLOT(setSelected())); - // UAS List - list->addUAS(uas); + // FIXME Should be not inside the mainwindow + connect(uas, SIGNAL(textMessageReceived(int,int,int,QString)), debugConsole, SLOT(receiveTextMessage(int,int,int,QString))); - // Camera view - //camera->addUAS(uas); + // Health / System status indicator + info->addUAS(uas); - // Revalidate UI - // TODO Stylesheet reloading should in theory not be necessary - reloadStylesheet(); + // UAS List + list->addUAS(uas); - // Check which type this UAS is of - PxQuadMAV* mav = dynamic_cast(uas); - if (mav) loadPixhawkView(); - SlugsMAV* mav2 = dynamic_cast(uas); - if (mav2) loadSlugsView(); + // 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(uas); + if (mav) loadPixhawkView(); + SlugsMAV* mav2 = dynamic_cast(uas); + if (mav2) loadSlugsView(); + + } } /** diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index 7cf8485ae..79dc075a4 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -89,7 +89,7 @@ - Connected Systems + Select System diff --git a/src/ui/MapWidget.cc b/src/ui/MapWidget.cc index db0d1bb15..a7b8b7930 100644 --- a/src/ui/MapWidget.cc +++ b/src/ui/MapWidget.cc @@ -64,7 +64,10 @@ MapWidget::MapWidget(QWidget *parent) : geomLayer = new Layer("Geom Layer", osmAdapter, Layer::GeometryLayer); // add Layers to the MapControl and set zoom level - mc->addLayer(osmLayer); + //mc->addLayer(osmLayer); + GoogleSatMapAdapter* gsat = new GoogleSatMapAdapter(); + Layer* gsatLayer = new Layer("Google Satellite", gsat, Layer::MapLayer); + mc->addLayer(gsatLayer); mc->addLayer(geomLayer); mc->setZoom(3); diff --git a/src/ui/PFD.cc b/src/ui/PFD.cc deleted file mode 100644 index 1d7536f3f..000000000 --- a/src/ui/PFD.cc +++ /dev/null @@ -1,53 +0,0 @@ -/*===================================================================== - -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit - -(c) 2009 PIXHAWK PROJECT - -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 . - -======================================================================*/ - -/** - * @file - * @brief Head Down Display / Primary Flight Display - * - * @author Lorenz Meier - * - */ - -#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) diff --git a/src/ui/PFD.h b/src/ui/PFD.h deleted file mode 100644 index fa673e2f8..000000000 --- a/src/ui/PFD.h +++ /dev/null @@ -1,43 +0,0 @@ -/*===================================================================== - -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit - -(c) 2009 PIXHAWK PROJECT - -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 . - -======================================================================*/ - -/** - * @file - * @brief Head Down Display / Primary Flight Display - * - * @author Lorenz Meier - * - */ - -#ifndef PFD_H -#define PFD_H - -#include "HUD.h" - -class PFD : public HUD -{ -public: - PFD(int width, int height, QWidget* parent); -}; - -#endif // PFD_H diff --git a/src/ui/UASControl.ui b/src/ui/UASControl.ui index bc34fd146..458df4cbf 100644 --- a/src/ui/UASControl.ui +++ b/src/ui/UASControl.ui @@ -6,20 +6,20 @@ 0 0 - 280 - 164 + 287 + 354 280 - 130 + 170 Form - + 6 @@ -60,7 +60,7 @@ 20 - 0 + 2 diff --git a/src/ui/linechart/IncrementalPlot.cc b/src/ui/linechart/IncrementalPlot.cc index da65cd6d7..9af1f8c15 100644 --- a/src/ui/linechart/IncrementalPlot.cc +++ b/src/ui/linechart/IncrementalPlot.cc @@ -299,14 +299,17 @@ void IncrementalPlot::updateScale() if (xRange > yRange) { double yCenter = yMinRange + yRange/2.0; + double xCenter = xMinRange + xRange/2.0; yMinRange = yCenter - xRange/2.0; yMaxRange = yCenter + xRange/2.0; + xMinRange = xCenter - (xRange*aspectRatio)/2.0; + xMaxRange = xCenter + (xRange*aspectRatio)/2.0; } else { double xCenter = xMinRange + xRange/2.0; - xMinRange = xCenter - yRange/2.0; - xMaxRange = xCenter + yRange/2.0; + xMinRange = xCenter - (yRange*aspectRatio)/2.0; + xMaxRange = xCenter + (yRange*aspectRatio)/2.0; } } setAxisScale(xBottom, xMinRange, xMaxRange); diff --git a/src/ui/linechart/LinechartPlot.h b/src/ui/linechart/LinechartPlot.h index cf733e523..835c8def0 100644 --- a/src/ui/linechart/LinechartPlot.h +++ b/src/ui/linechart/LinechartPlot.h @@ -214,7 +214,7 @@ public: 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_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; public slots: diff --git a/src/ui/map/MAV2DIcon.cc b/src/ui/map/MAV2DIcon.cc new file mode 100644 index 000000000..4b4cd92cb --- /dev/null +++ b/src/ui/map/MAV2DIcon.cc @@ -0,0 +1,27 @@ +#include "MAV2DIcon.h" +#include + +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); +} diff --git a/src/ui/map/MAV2DIcon.h b/src/ui/map/MAV2DIcon.h new file mode 100644 index 000000000..3a82a8eaf --- /dev/null +++ b/src/ui/map/MAV2DIcon.h @@ -0,0 +1,16 @@ +#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 diff --git a/src/ui/map/QGC2DIcon.cc b/src/ui/map/QGC2DIcon.cc new file mode 100644 index 000000000..24a780f10 --- /dev/null +++ b/src/ui/map/QGC2DIcon.cc @@ -0,0 +1,58 @@ +#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; +} diff --git a/src/ui/map/QGC2DIcon.h b/src/ui/map/QGC2DIcon.h new file mode 100644 index 000000000..ddca2787f --- /dev/null +++ b/src/ui/map/QGC2DIcon.h @@ -0,0 +1,38 @@ +#ifndef QGC2DICON_H +#define QGC2DICON_H + +#include +#include + +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 diff --git a/src/ui/map/Waypoint2DIcon.cc b/src/ui/map/Waypoint2DIcon.cc new file mode 100644 index 000000000..a260194ce --- /dev/null +++ b/src/ui/map/Waypoint2DIcon.cc @@ -0,0 +1,31 @@ +#include "Waypoint2DIcon.h" +#include + +#include + +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); +} diff --git a/src/ui/map/Waypoint2DIcon.h b/src/ui/map/Waypoint2DIcon.h new file mode 100644 index 000000000..56b9a151b --- /dev/null +++ b/src/ui/map/Waypoint2DIcon.h @@ -0,0 +1,18 @@ +#ifndef WAYPOINT2DICON_H +#define WAYPOINT2DICON_H + +#include +#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 diff --git a/src/ui/uas/UASControlWidget.cc b/src/ui/uas/UASControlWidget.cc index 700b7a3cc..c01fbedcb 100644 --- a/src/ui/uas/UASControlWidget.cc +++ b/src/ui/uas/UASControlWidget.cc @@ -35,6 +35,7 @@ This file is part of the PIXHAWK project #include #include #include +#include #include #include "UASControlWidget.h" @@ -59,7 +60,7 @@ This file is part of the PIXHAWK project #define CONTROL_MODE_TEST3_INDEX 8 UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent), -uas(NULL), +uas(0), engineOn(false) { ui.setupUi(this); @@ -74,22 +75,21 @@ engineOn(false) 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_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); } void UASControlWidget::setUAS(UASInterface* uas) { - if (this->uas != NULL) + if (this->uas != 0) { - disconnect(ui.controlButton, SIGNAL(clicked()), uas, SLOT(enable_motors())); - disconnect(ui.liftoffButton, SIGNAL(clicked()), uas, SLOT(launch())); - disconnect(ui.landButton, SIGNAL(clicked()), uas, SLOT(home())); - disconnect(ui.shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown())); - disconnect(ui.modeComboBox, SIGNAL(activated(int)), this, SLOT(setMode(int))); - disconnect(ui.setModeButton, SIGNAL(clicked()), this, SLOT(transmitMode())); - ui.modeComboBox->clear(); - + UASInterface* oldUAS = UASManager::instance()->getUASForId(this->uas); + disconnect(ui.controlButton, SIGNAL(clicked()), oldUAS, SLOT(enable_motors())); + disconnect(ui.liftoffButton, SIGNAL(clicked()), oldUAS, SLOT(launch())); + disconnect(ui.landButton, SIGNAL(clicked()), oldUAS, SLOT(home())); + disconnect(ui.shutdownButton, SIGNAL(clicked()), oldUAS, SLOT(shutdown())); disconnect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); disconnect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int))); } @@ -99,22 +99,42 @@ void UASControlWidget::setUAS(UASInterface* uas) 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(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); connect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int))); - this->uas = uas; + ui.controlStatusLabel->setText(tr("Connected to ") + uas->getUASName()); + + 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) { Q_UNUSED(uas); @@ -189,14 +209,14 @@ void UASControlWidget::transmitMode() { if (uasMode != 0) { - this->uas->setMode(uasMode); - ui.lastActionLabel->setText(QString("Set new mode for system %1").arg(uas->getUASName())); + UASManager::instance()->getUASForId(this->uas)->setMode(uasMode); + ui.lastActionLabel->setText(QString("Set new mode for system %1").arg(UASManager::instance()->getUASForId(uas)->getUASName())); } } void UASControlWidget::cycleContextButton() { - UAS* mav = dynamic_cast(this->uas); + UAS* mav = dynamic_cast(UASManager::instance()->getUASForId(this->uas)); if (mav) { @@ -204,13 +224,13 @@ void UASControlWidget::cycleContextButton() { ui.controlButton->setText(tr("Stop Engine")); 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 { ui.controlButton->setText(tr("Activate Engine")); 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("KILL VEHICLE")); diff --git a/src/ui/uas/UASControlWidget.h b/src/ui/uas/UASControlWidget.h index 5f8f23626..d799516d4 100644 --- a/src/ui/uas/UASControlWidget.h +++ b/src/ui/uas/UASControlWidget.h @@ -64,10 +64,14 @@ public slots: /** @brief Update state */ void updateState(int state); +protected slots: + /** @brief Set the background color for the widget */ + void setBackgroundColor(QColor color); + protected: - UASInterface* uas; - unsigned int uasMode; - bool engineOn; + int uas; ///< Reference to the current uas + unsigned int uasMode; ///< Current uas mode + bool engineOn; ///< Engine state private: Ui::uasControl ui; diff --git a/src/ui/uas/UASInfoWidget.h b/src/ui/uas/UASInfoWidget.h index b66998740..89d52a96b 100644 --- a/src/ui/uas/UASInfoWidget.h +++ b/src/ui/uas/UASInfoWidget.h @@ -1,24 +1,24 @@ /*===================================================================== - -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit - -(c) 2009 PIXHAWK PROJECT - -This file is part of the PIXHAWK project - - PIXHAWK is free software: you can redistribute it and/or modify + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2010 QGROUNDCONTROL PROJECT + +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. - - 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 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 . - + along with QGROUNDCONTROL. If not, see . + ======================================================================*/ /** diff --git a/src/ui/uas/UASListWidget.h b/src/ui/uas/UASListWidget.h index 9fc3b8df1..33d0c7b88 100644 --- a/src/ui/uas/UASListWidget.h +++ b/src/ui/uas/UASListWidget.h @@ -1,23 +1,23 @@ /*===================================================================== -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit +QGroundControl Open Source Ground Control Station -(c) 2009, 2010 PIXHAWK PROJECT +(c) 2009, 2010 QGROUNDCONTROL PROJECT -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 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, + 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 PIXHAWK. If not, see . + along with QGROUNDCONTROL. If not, see . ======================================================================*/ diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 18ff0086c..764bcf77b 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -78,6 +78,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : connect(uas, SIGNAL(waypointSelected(int,int)), this, SLOT(selectWaypoint(int,int))); connect(&(uas->getWaypointManager()), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointUpdated(quint16))); 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 connect(m_ui->uasViewFrame, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool))); @@ -108,7 +109,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : // Heartbeat fade refreshTimer = new QTimer(this); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); - refreshTimer->start(100); + refreshTimer->start(180); } UASView::~UASView() @@ -142,9 +143,19 @@ void UASView::setBackgroundColor() void UASView::setUASasActive(bool active) { - UASManager::instance()->setActiveUAS(this->uas); - this->isActive = active; - setBackgroundColor(); + if (active) + { + 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) diff --git a/src/ui/uas/UASView.h b/src/ui/uas/UASView.h index 7f57f8084..ba7ccf494 100644 --- a/src/ui/uas/UASView.h +++ b/src/ui/uas/UASView.h @@ -1,23 +1,23 @@ /*===================================================================== -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit +QGroundControl Open Source Ground Control Station -(c) 2009 PIXHAWK PROJECT +(c) 2009, 2010 QGROUNDCONTROL PROJECT -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 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, + 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 PIXHAWK. If not, see . + along with QGROUNDCONTROL. If not, see . ======================================================================*/ @@ -42,7 +42,8 @@ namespace Ui { class UASView; } -class UASView : public QWidget { +class UASView : public QWidget +{ Q_OBJECT public: UASView(UASInterface* uas, QWidget *parent = 0); @@ -71,6 +72,8 @@ public slots: void setSystemType(UASInterface* uas, unsigned int systemType); /** @brief Set the current UAS as the globally active system */ 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 */ void setBackgroundColor(); -- 2.22.0