diff --git a/lib/QMapControl/src/layer.cpp b/lib/QMapControl/src/layer.cpp index 65d0f3e21af3e3a14e936cac084f3ccb053a936e..6083b3bec99201b9d321d472ba3f3193f93e9e2a 100644 --- a/lib/QMapControl/src/layer.cpp +++ b/lib/QMapControl/src/layer.cpp @@ -110,28 +110,45 @@ namespace qmapcontrol } void Layer::mouseEvent(const QMouseEvent* evnt, const QPoint mapmiddle_px) - { - if (takesMouseEvents()) { - if (evnt->button() == Qt::LeftButton && evnt->type() == QEvent::MouseButtonPress) + if (takesMouseEvents()) { - // check for collision - QPointF c = mapAdapter->displayToCoordinate(QPoint(evnt->x()-screenmiddle.x()+mapmiddle_px.x(), - evnt->y()-screenmiddle.y()+mapmiddle_px.y())); - Point* tmppoint = new Point(c.x(), c.y()); - for (int i=0; ibutton() == Qt::LeftButton && evnt->type() == QEvent::MouseButtonPress) { - if (geometries.at(i)->isVisible() && geometries.at(i)->Touches(tmppoint, mapAdapter)) - - //if (geometries.at(i)->Touches(c, mapAdapter)) + // check for collision + QPointF c = mapAdapter->displayToCoordinate(QPoint(evnt->x()-screenmiddle.x()+mapmiddle_px.x(), + evnt->y()-screenmiddle.y()+mapmiddle_px.y())); + Point* tmppoint = new Point(c.x(), c.y()); + for (int i=0; ix(), evnt->y()))); + if (geometries.at(i)->isVisible() && geometries.at(i)->Touches(tmppoint, mapAdapter)) + + //if (geometries.at(i)->Touches(c, mapAdapter)) + { + + emit(geometryClicked(geometries.at(i), QPoint(evnt->x(), evnt->y()))); + draggingGeometry = true; + geometrySelected = geometries.at(i); + } } + delete tmppoint; + } + + if (evnt->type() == QEvent::MouseButtonRelease){ + QPointF c = mapAdapter->displayToCoordinate(QPoint(evnt->x()-screenmiddle.x()+mapmiddle_px.x(), + evnt->y()-screenmiddle.y()+mapmiddle_px.y())); + draggingGeometry = false; + emit (geometryEndDrag(geometrySelected, c)); + geometrySelected = 0; + } + + if ( evnt->type() == QEvent::MouseMove && draggingGeometry){ + QPointF c = mapAdapter->displayToCoordinate(QPoint(evnt->x()-screenmiddle.x()+mapmiddle_px.x(), + evnt->y()-screenmiddle.y()+mapmiddle_px.y())); + emit(geometryDragged(geometrySelected, c)); } - delete tmppoint; } } - } bool Layer::takesMouseEvents() const { diff --git a/lib/QMapControl/src/layer.h b/lib/QMapControl/src/layer.h index 14debeaac23dd460f430733c0dd27a492bf3fe8c..9d677916b3341701a62e0f6b6d779121552799d3 100644 --- a/lib/QMapControl/src/layer.h +++ b/lib/QMapControl/src/layer.h @@ -63,6 +63,7 @@ namespace qmapcontrol public: friend class LayerManager; + //! sets the type of a layer, see Layer class doc for further information enum LayerType { @@ -157,6 +158,9 @@ namespace qmapcontrol bool takeevents; mutable QRect myoffscreenViewport; + Geometry* geometrySelected; + bool draggingGeometry; + signals: //! This signal is emitted when a Geometry is clicked /*! @@ -167,6 +171,25 @@ namespace qmapcontrol */ void geometryClicked(Geometry* geometry, QPoint point); + //! This signal is emitted while a Geometry is being dragged + /*! + * A Geometry is clickable, if the containing layer is clickable. + * The layer emits a signal as it is dragged + * @param geometry The selected Geometry + * @param coordinate The new coordinate (in world coordinates) + */ + void geometryDragged(Geometry* geometrySelected, QPointF coordinate); + + + //! This signal is emitted when a User releases the button after selecting a Geometry + /*! + * A Geometry is clickable, if the containing layer is clickable. + * The layer emits a signal when it is released + * @param geometry The selected Geometry + * @param coordinate The new coordinate (in world coordinates) + */ + void geometryEndDrag(Geometry* geometrySelected, QPointF coordinate); + void updateRequest(QRectF rect); void updateRequest(); diff --git a/lib/QMapControl/src/mapcontrol.cpp b/lib/QMapControl/src/mapcontrol.cpp index 57df98b7d7dee8d76cec73190b4fb34544e36696..7d53b7fc5d9d8ceba533e83d3965e3b83c818d22 100644 --- a/lib/QMapControl/src/mapcontrol.cpp +++ b/lib/QMapControl/src/mapcontrol.cpp @@ -255,6 +255,7 @@ namespace qmapcontrol void MapControl::mouseReleaseEvent(QMouseEvent* evnt) { + layermanager->mouseEvent(evnt); mousepressed = false; if (mymousemode == Dragging) { @@ -271,6 +272,7 @@ namespace qmapcontrol void MapControl::mouseMoveEvent(QMouseEvent* evnt) { + layermanager->mouseEvent(evnt); emit(mouseEvent(evnt)); diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 8b9f3c4ab42479b19276cf4874d9c1c8254342ac..0960acb490c8ea582892658723c6060c906131b0 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -74,7 +74,8 @@ FORMS += src/ui/MainWindow.ui \ src/ui/watchdog/WatchdogView.ui \ src/ui/QGCFirmwareUpdate.ui \ src/ui/QGCPxImuFirmwareUpdate.ui \ - src/ui/QGCDataPlot2D.ui + src/ui/QGCDataPlot2D.ui \ + src/ui/QGCRemoteControlView.ui INCLUDEPATH += src \ src/ui \ src/ui/linechart \ @@ -155,7 +156,8 @@ HEADERS += src/MG.h \ src/ui/linechart/IncrementalPlot.h \ src/ui/map/Waypoint2DIcon.h \ src/ui/map/MAV2DIcon.h \ - src/ui/map/QGC2DIcon.h + src/ui/map/QGC2DIcon.h \ + src/ui/QGCRemoteControlView.h SOURCES += src/main.cc \ src/Core.cc \ src/uas/UASManager.cc \ @@ -218,7 +220,8 @@ SOURCES += src/main.cc \ src/ui/linechart/IncrementalPlot.cc \ src/ui/map/Waypoint2DIcon.cc \ src/ui/map/MAV2DIcon.cc \ - src/ui/map/QGC2DIcon.cc + src/ui/map/QGC2DIcon.cc \ + src/ui/QGCRemoteControlView.cc RESOURCES = mavground.qrc # Include RT-LAB Library diff --git a/src/comm/AS4Protocol.cc b/src/comm/AS4Protocol.cc index 8b522bb4084d3f3c4e125d722991350918ede025..47e4ac2d9f7fa1a9ff8381a8ed17e0efc3c75d2b 100644 --- a/src/comm/AS4Protocol.cc +++ b/src/comm/AS4Protocol.cc @@ -1,24 +1,24 @@ /*===================================================================== - -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit - -(c) 2009, 2010 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/comm/LinkManager.cc b/src/comm/LinkManager.cc index 4c1e11d55114607a3f71115502691d7f02447d4a..76c4fde4c142de7e24b6655c863b4fd70b5106f2 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -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/comm/MAVLinkSimulationLink.cc b/src/comm/MAVLinkSimulationLink.cc index 7f253e6b4737104a0bc7e7142c89cd72ad68a167..a20877d7e864d96069c28c067cb184dc7d2c79a0 100644 --- a/src/comm/MAVLinkSimulationLink.cc +++ b/src/comm/MAVLinkSimulationLink.cc @@ -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/comm/MAVLinkSyntaxHighlighter.cc b/src/comm/MAVLinkSyntaxHighlighter.cc index 170ac2cd2e954db0d6a511fdfa7a716073b177c4..ad3cbf3e12a185d9b0759aba2ba5eda865e6aaf1 100644 --- a/src/comm/MAVLinkSyntaxHighlighter.cc +++ b/src/comm/MAVLinkSyntaxHighlighter.cc @@ -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 . + +======================================================================*/ + #include "MAVLinkSyntaxHighlighter.h" MAVLinkSyntaxHighlighter::MAVLinkSyntaxHighlighter(QObject *parent) : diff --git a/src/comm/MAVLinkXMLParser.cc b/src/comm/MAVLinkXMLParser.cc index 1a44b405d9c2ac5341b68b7e752814c66bcbdd6f..312737a8da1bca36873eb46a10d1d5e5717d3ab5 100644 --- a/src/comm/MAVLinkXMLParser.cc +++ b/src/comm/MAVLinkXMLParser.cc @@ -258,7 +258,7 @@ bool MAVLinkXMLParser::generate() packLines += QString("\ti += put_%1_by_index(%2, %3, i, msg->payload); //%4\n").arg(arrayType, fieldName, QString::number(arrayLength), e2.text()); // Add decode function for this type decodeLines += QString("\tmavlink_msg_%1_get_%2(msg, %1->%2);\n").arg(messageName, fieldName); - arrayDefines += QString("#define MAVLINK_MSG_%1_FIELD_%2_LEN %3").arg(messageName.toUpper(), fieldName.toUpper(), QString::number(arrayLength)); + arrayDefines += QString("#define MAVLINK_MSG_%1_FIELD_%2_LEN %3\n").arg(messageName.toUpper(), fieldName.toUpper(), QString::number(arrayLength)); } else if (fieldType.startsWith("string")) { @@ -273,7 +273,7 @@ bool MAVLinkXMLParser::generate() packLines += QString("\ti += put_%1_by_index(%2, %3, i, msg->payload); //%4\n").arg(arrayType, fieldName, QString::number(arrayLength), e2.text()); // Add decode function for this type decodeLines += QString("\tmavlink_msg_%1_get_%2(msg, %1->%2);\n").arg(messageName, fieldName); - arrayDefines += QString("#define MAVLINK_MSG_%1_FIELD_%2_LEN %3").arg(messageName.toUpper(), fieldName.toUpper(), QString::number(arrayLength)); + arrayDefines += QString("#define MAVLINK_MSG_%1_FIELD_%2_LEN %3\n").arg(messageName.toUpper(), fieldName.toUpper(), QString::number(arrayLength)); } else // Handle simple types like integers and floats diff --git a/src/comm/SerialLink.cc b/src/comm/SerialLink.cc index 5e949212e70594194119520c3706fe257fa05e2a..09d6fa96e433c92f897eb3217a73dc7da13a142f 100644 --- a/src/comm/SerialLink.cc +++ b/src/comm/SerialLink.cc @@ -1,26 +1,25 @@ /*===================================================================== -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 . ======================================================================*/ - /** * @file * @brief Cross-platform support for serial ports diff --git a/src/comm/SerialSimulationLink.cc b/src/comm/SerialSimulationLink.cc index 7a9a929a3477e0549b05ebd737ba65b62478335b..e2e2e927b83dd47421b7ea57d6c6a27557d2f539 100644 --- a/src/comm/SerialSimulationLink.cc +++ b/src/comm/SerialSimulationLink.cc @@ -1,26 +1,25 @@ /*===================================================================== -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 Brief Description diff --git a/src/comm/UDPLink.cc b/src/comm/UDPLink.cc index 048bacdf5e4f51af9beeac9f2d6a944d01eb0370..ebd768ec87059ab6d1389ec3d8f16f8cc69b341b 100644 --- a/src/comm/UDPLink.cc +++ b/src/comm/UDPLink.cc @@ -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/uas/PxQuadMAV.cc b/src/uas/PxQuadMAV.cc index bd83d2a249a452a7ea3d41d1bd08f0f150ce534d..422244c65fad2ef446711605eb2fc72e5f7c3e87 100644 --- a/src/uas/PxQuadMAV.cc +++ b/src/uas/PxQuadMAV.cc @@ -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 . + +======================================================================*/ + #include "PxQuadMAV.h" #include "GAudioOutput.h" diff --git a/src/uas/SlugsMAV.cc b/src/uas/SlugsMAV.cc index f053345f2e77a6a0bad1abd83c4131119bc00ad6..9a8c2da732f083485dd6109b68c64b780ee9bf1f 100644 --- a/src/uas/SlugsMAV.cc +++ b/src/uas/SlugsMAV.cc @@ -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 . + +======================================================================*/ + #include "SlugsMAV.h" #include diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 60287c5337fb738725e22cec4f83f88637f50c53..1fe756b82a5bd657d42c9e04c5a40f1263f379a3 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -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 . ======================================================================*/ @@ -387,6 +387,42 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) } } break; + case MAVLINK_MSG_ID_RC_CHANNELS: + { + mavlink_rc_channels_t channels; + mavlink_msg_rc_channels_decode(&message, &channels); + for (int i = 0; i < 8; i++) + { + switch (i) + { + case 0: + emit remoteControlChannelChanged(i, channels.chan1_raw, channels.chan1_255/255.0f); + break; + case 1: + emit remoteControlChannelChanged(i, channels.chan2_raw, channels.chan2_255/255.0f); + break; + case 2: + emit remoteControlChannelChanged(i, channels.chan3_raw, channels.chan3_255/255.0f); + break; + case 3: + emit remoteControlChannelChanged(i, channels.chan4_raw, channels.chan4_255/255.0f); + break; + case 4: + emit remoteControlChannelChanged(i, channels.chan5_raw, channels.chan5_255/255.0f); + break; + case 5: + emit remoteControlChannelChanged(i, channels.chan6_raw, channels.chan6_255/255.0f); + break; + case 6: + emit remoteControlChannelChanged(i, channels.chan7_raw, channels.chan7_255/255.0f); + break; + case 7: + emit remoteControlChannelChanged(i, channels.chan8_raw, channels.chan8_255/255.0f); + break; + } + } + } + break; case MAVLINK_MSG_ID_PARAM_VALUE: { mavlink_param_value_t value; @@ -954,6 +990,13 @@ void UAS::enableExtra3Transmission(bool enabled) #endif } +/** + * Set a parameter value onboard + * + * @param component The component to set the parameter + * @param id Name of the parameter + * @param value Parameter value + */ void UAS::setParameter(int component, QString id, float value) { mavlink_message_t msg; @@ -986,7 +1029,7 @@ void UAS::setParameter(int component, QString id, float value) } /** - * @brief Launches the system + * Launches the system * **/ void UAS::launch() diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index a0ad5ad18b131f566dfd397e3f035281ff2e50c9..41931ad18f13089439ddca74718732f8967c45db 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -329,6 +329,8 @@ signals: void positionZControlEnabled(bool enabled); /** @brief Heading control enabled/disabled */ void positionYawControlEnabled(bool enabled); + /** @brief Value of a remote control channel */ + void remoteControlChannelChanged(int channelId, float raw, float normalized); /** * @brief Localization quality changed diff --git a/src/uas/UASManager.cc b/src/uas/UASManager.cc index c974dc84b40139cab0cebe0ed732c624d711383f..bba66dda702204e6c166734d75a54b22bd9cc618 100644 --- a/src/uas/UASManager.cc +++ b/src/uas/UASManager.cc @@ -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 . ======================================================================*/ diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index e7ccdee42972add49067608adec90ae2fe2ff3b2..02ef012214870789727e654e9a6e058e99b430b6 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -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/AudioOutputWidget.cc b/src/ui/AudioOutputWidget.cc index 392daec57171dbc129877aee9df6981061fa9905..bf157eb96d4272b89a4b2e49a0f958749756b11b 100644 --- a/src/ui/AudioOutputWidget.cc +++ b/src/ui/AudioOutputWidget.cc @@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project /** * @file - * @brief Implementation of class AudioOutputWidget + * @brief Implementation of AudioOutputWidget * @author Lorenz Meier * */ diff --git a/src/ui/CameraView.cc b/src/ui/CameraView.cc index c19f514bb4dcd12b1ef863f06c527e307578e4fc..ec25ce07ac1ae486c6ff80f83f02da83e3625fc6 100644 --- a/src/ui/CameraView.cc +++ b/src/ui/CameraView.cc @@ -1,30 +1,29 @@ /*===================================================================== - -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 . + ======================================================================*/ - + /** * @file - * @brief Brief Description - * + * @brief Implementation of CameraView * @author Lorenz Meier * */ diff --git a/src/ui/CommConfigurationWindow.cc b/src/ui/CommConfigurationWindow.cc index b48fe7262cd5dcf68d7ab306652ffc6e54e17cd2..a51303e885c4926de4372ae72ed3d7e02c208730 100644 --- a/src/ui/CommConfigurationWindow.cc +++ b/src/ui/CommConfigurationWindow.cc @@ -1,30 +1,29 @@ /*===================================================================== -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit -Please see our website at +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 . ======================================================================*/ /** * @file - * @brief Implementation of configuration window for serial links + * @brief Implementation of CommConfigurationWindow * * @author Lorenz Meier * diff --git a/src/ui/DebugConsole.cc b/src/ui/DebugConsole.cc index 4bf1ce965b077a5adf632b28fa7050a65c48b569..d91de4a9ecf47762afaa758e9d5fb84ea0cde28d 100644 --- a/src/ui/DebugConsole.cc +++ b/src/ui/DebugConsole.cc @@ -1,29 +1,29 @@ /*===================================================================== -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 . ======================================================================*/ /** * @file - * @brief Debug console + * @brief Implementation of DebugConsole * * @author Lorenz Meier * diff --git a/src/ui/MAVLinkSettingsWidget.cc b/src/ui/MAVLinkSettingsWidget.cc index a64fbaa410e60c46fe142df966fb894054bba8da..d4198389125e5ab9ebb165bafa19bb3b3b662ade 100644 --- a/src/ui/MAVLinkSettingsWidget.cc +++ b/src/ui/MAVLinkSettingsWidget.cc @@ -1,3 +1,32 @@ +/*===================================================================== + +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 . + +======================================================================*/ + +/** + * @file + * @brief Implementation of MAVLinkSettingsWidget + * @author Lorenz Meier + */ + #include "MAVLinkSettingsWidget.h" #include "ui_MAVLinkSettingsWidget.h" diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 781e38fa7c78e264914681b56830566982c51ee3..c7101a5b24c2b5610af0593e169a7f5566c0681e 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -138,7 +138,8 @@ void MainWindow::buildWidgets() headDown1 = new HDDisplay(acceptList, this); headDown2 = new HDDisplay(acceptList2, this); joystick = new JoystickInput(); - dataplot = new QGCDataPlot2D(); + dataplot = new QGCDataPlot2D(this); + rcView = new QGCRemoteControlView(this); } void MainWindow::connectWidgets() @@ -562,6 +563,11 @@ void MainWindow::loadPixhawkView() container7->setWidget(debugConsole); addDockWidget(Qt::BottomDockWidgetArea, container7); + // DEBUG CONSOLE + QDockWidget* rcContainer = new QDockWidget(tr("Radio Control"), this); + rcContainer->setWidget(rcView); + addDockWidget(Qt::BottomDockWidgetArea, rcContainer); + // ONBOARD PARAMETERS QDockWidget* containerParams = new QDockWidget(tr("Onboard Parameters"), this); containerParams->setWidget(parameters); diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 1ef6f38f9a20f4849e05a7b413d76463d5dce4db..cd1b85fe8942136c26eb595effde0ce03c86b212 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -62,6 +62,7 @@ This file is part of the QGROUNDCONTROL project #include "WatchdogControl.h" #include "HSIDisplay.h" #include "QGCDataPlot2D.h" +#include "QGCRemoteControlView.h" #include "LogCompressor.h" @@ -170,6 +171,7 @@ protected: WatchdogControl* watchdogControl; HSIDisplay* hsi; QGCDataPlot2D* dataplot; + QGCRemoteControlView* rcView; // Popup widgets JoystickWidget* joystickWidget; diff --git a/src/ui/MapWidget.cc b/src/ui/MapWidget.cc index c97ba954fe1a38f9e47436f33846bd12a15d9a36..4811d955746e7aa9e3a1ad73d48b0a959a4fe813 100644 --- a/src/ui/MapWidget.cc +++ b/src/ui/MapWidget.cc @@ -190,11 +190,16 @@ MapWidget::MapWidget(QWidget *parent) : this, SLOT(captureMapClick(const QMouseEvent*, const QPointF))); connect(createPath, SIGNAL(clicked(bool)), - this, SLOT(createPathButtonClicked())); + this, SLOT(createPathButtonClicked(bool))); connect(geomLayer, SIGNAL(geometryClicked(Geometry*,QPoint)), this, SLOT(captureGeometryClick(Geometry*, QPoint))); + connect(geomLayer, SIGNAL(geometryDragged(Geometry*, QPointF)), + this, SLOT(captureGeometryDrag(Geometry*, QPointF))); + + connect(geomLayer, SIGNAL(geometryEndDrag(Geometry*, QPointF)), + this, SLOT(captureGeometryEndDrag(Geometry*, QPointF))); // Configure the WP Path's pen pointPen = new QPen(QColor(0, 255,0)); @@ -290,12 +295,15 @@ void MapWidget::mapproviderSelected(QAction* action) } -void MapWidget::createPathButtonClicked() +void MapWidget::createPathButtonClicked(bool checked) { + Q_UNUSED(checked); + if (createPath->isChecked()) { // change the cursor shape this->setCursor(Qt::PointingHandCursor); + mc->setMouseMode(qmapcontrol::MapControl::None); // Clear the previous WP track // TODO: Move this to an actual clear track button and add a warning dialog @@ -303,8 +311,12 @@ void MapWidget::createPathButtonClicked() wps.clear(); path->setPoints(wps); mc->layer("Waypoints")->addGeometry(path); + wpIndex.clear(); + + } else { this->setCursor(Qt::ArrowCursor); + mc->setMouseMode(qmapcontrol::MapControl::Panning); } } @@ -313,30 +325,55 @@ void MapWidget::createPathButtonClicked() void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordinate){ if (QEvent::MouseButtonRelease == event->type() && createPath->isChecked()){ - // Create waypoint name QString str; - str = QString("WP%1").arg(path->numberOfPoints()+1); - - qDebug()<< "Waypoint " << str; - qDebug()<< "Lat: " << coordinate.y(); - qDebug()<< "Lon: " << coordinate.x(); + str = QString("WP%1").arg(path->numberOfPoints()); // create the WP and set everything in the LineString to display the path - mc->layer("Waypoints")->addGeometry(new CirclePoint(coordinate.x(), coordinate.y(), 10, str)); - wps.append(new Point(coordinate.x(), coordinate.y(),str)); - path->addPoint(new Point(coordinate.x(), coordinate.y(),str)); + CirclePoint* tempCirclePoint = new CirclePoint(coordinate.x(), coordinate.y(), 10, str); + mc->layer("Waypoints")->addGeometry(tempCirclePoint); + + Point* tempPoint = new Point(coordinate.x(), coordinate.y(),str); + wps.append(tempPoint); + path->addPoint(tempPoint); + wpIndex.insert(str,tempPoint); + + // Refresh the screen mc->updateRequestNew(); } } void MapWidget::captureGeometryClick(Geometry* geom, QPoint point){ + Q_UNUSED(geom); Q_UNUSED(point); - qDebug ()<< geom->name(); - qDebug() << geom->GeometryType; + mc->setMouseMode(qmapcontrol::MapControl::None); + + +} + +void MapWidget::captureGeometryDrag(Geometry* geom, QPointF coordinate){ + Q_UNUSED(coordinate); + + Point* point2Find; + point2Find = wpIndex[geom->name()]; + point2Find->setCoordinate(coordinate); + + point2Find = dynamic_cast (geom); + point2Find->setCoordinate(coordinate); + + // Refresh the screen + mc->updateRequestNew(); +} + +void MapWidget::captureGeometryEndDrag(Geometry* geom, QPointF coordinate){ + mc->setMouseMode(qmapcontrol::MapControl::Panning); + +// qDebug() << geom->name(); +// qDebug() << geom->GeometryType; +// qDebug() << point; } MapWidget::~MapWidget() diff --git a/src/ui/MapWidget.h b/src/ui/MapWidget.h index fdb09cd675f1d0b15709a8931980648c45f61424..17929329c47bbd9a372d4dd5589b450ce968b732 100644 --- a/src/ui/MapWidget.h +++ b/src/ui/MapWidget.h @@ -89,7 +89,7 @@ protected: qmapcontrol::Layer* overlay; ///< Street overlay (foreground) qmapcontrol::GeometryLayer* geomLayer; ///< Layer for waypoints 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 maxZoom = 50; ///< Maximum zoom level @@ -102,12 +102,19 @@ protected: protected slots: void captureMapClick (const QMouseEvent* event, const QPointF coordinate); - void createPathButtonClicked(); + void createPathButtonClicked(bool checked); void captureGeometryClick(Geometry*, QPoint); void mapproviderSelected(QAction* action); + void captureGeometryDrag(Geometry* geom, QPointF coordinate); + void captureGeometryEndDrag(Geometry* geom, QPointF coordinate); + + signals: + void movePoint(QPointF newCoord); + private: Ui::MapWidget *m_ui; QList wps; + QHash wpIndex; LineString* path; QPen* pointPen; }; diff --git a/src/ui/QGCDataPlot2D.cc b/src/ui/QGCDataPlot2D.cc index a4160caaebc8a7e209f98f5f6790560001c7f29d..afaf40dae0f1dd67b489f584861e5bfb0775116c 100644 --- a/src/ui/QGCDataPlot2D.cc +++ b/src/ui/QGCDataPlot2D.cc @@ -1,3 +1,32 @@ +/*===================================================================== + +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 . + +======================================================================*/ + +/** + * @file + * @brief Implementation of QGCDataPlot2D + * @author Lorenz Meier + * + */ #include #include diff --git a/src/ui/QGCFirmwareUpdate.cc b/src/ui/QGCFirmwareUpdate.cc index 7e943d71738a3b880b2afe782dcc5a391d35f377..99c870f11fd128ff26281908e4bfb349d7557b89 100644 --- a/src/ui/QGCFirmwareUpdate.cc +++ b/src/ui/QGCFirmwareUpdate.cc @@ -1,3 +1,33 @@ +/*===================================================================== + +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 . + +======================================================================*/ + +/** + * @file + * @brief Implementation of QGCFirmwareUpdate + * @author Lorenz Meier + * + */ + #include "QGCFirmwareUpdate.h" #include "ui_QGCFirmwareUpdate.h" diff --git a/src/ui/QGCPxImuFirmwareUpdate.cc b/src/ui/QGCPxImuFirmwareUpdate.cc index eed713e754b25ac5f13841656d3a796e7fda0ddb..330d6b996fd503dfd98801c7605b78efb5d3cfa6 100644 --- a/src/ui/QGCPxImuFirmwareUpdate.cc +++ b/src/ui/QGCPxImuFirmwareUpdate.cc @@ -21,6 +21,13 @@ This file is part of the QGROUNDCONTROL project ======================================================================*/ +/** + * @file + * @brief Implementation of QGCPxImuFirmwareUpdate + * @author Lorenz Meier + * + */ + #include "QGCPxImuFirmwareUpdate.h" #include "ui_QGCPxImuFirmwareUpdate.h" diff --git a/src/ui/QGCRemoteControlView.cc b/src/ui/QGCRemoteControlView.cc new file mode 100644 index 0000000000000000000000000000000000000000..78c5416bbefb218c8c6b6e2c753fd56651291f34 --- /dev/null +++ b/src/ui/QGCRemoteControlView.cc @@ -0,0 +1,180 @@ +/*===================================================================== + +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 . + +======================================================================*/ + +/** + * @file + * @brief Implementation of QGCRemoteControlView + * @author Lorenz Meier + */ + +#include +#include +#include +#include +#include +#include +#include "QGCRemoteControlView.h" +#include "ui_QGCRemoteControlView.h" +#include "UASManager.h" + +QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) : + QWidget(parent), + uasId(-1), + rssi(0.0f), + updated(false), + channelLayout(new QVBoxLayout()), + ui(new Ui::QGCRemoteControlView) +{ + //ui->setupUi(this); + QGridLayout* layout = new QGridLayout(this); + layout->addLayout(channelLayout, 1, 0, 1, 2); + // Name label + nameLabel = new QLabel(this); + nameLabel->setText("No MAV selected yet.."); + layout->addWidget(nameLabel, 0, 0, 1, 2); + // Add spacer left of button + layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding), 2, 0); + // Set stretch to maximize spacer, not button + layout->setColumnStretch(0, 100); + layout->setColumnStretch(1, 1); + // Calibrate button + QPushButton* calibrateButton = new QPushButton(this); + calibrateButton->setText(tr("Calibrate")); + // Connect to calibration slot + connect(calibrateButton, SIGNAL(clicked()), this, SLOT(calibrate())); + // Add button + layout->addWidget(calibrateButton, 2, 1); + setVisible(false); + + connect(UASManager::instance(), SIGNAL(activeUASSet(int)), this, SLOT(setUASId(int))); +} + +QGCRemoteControlView::~QGCRemoteControlView() +{ + delete ui; + delete channelLayout; +} + +void QGCRemoteControlView::calibrate() +{ + // Run auto-calibration +} + +void QGCRemoteControlView::setUASId(int id) +{ + if (uasId != -1) + { + UASInterface* uas = UASManager::instance()->getUASForId(id); + if (uas) + { + // The UAS exists, disconnect any existing connections + disconnect(uas, SIGNAL(remoteControlChannelChanged(int,float,float)), this, SLOT(setChannel(int,float,float))); + } + } + + // Connect the new UAS + UASInterface* newUAS = UASManager::instance()->getUASForId(id); + if (newUAS) + { + // New UAS exists, connect + nameLabel->setText(QString("RC Input of %1").arg(newUAS->getUASName())); + connect(newUAS, SIGNAL(remoteControlChannelChanged(int,float,float)), this, SLOT(setChannel(int,float,float))); + } +} + +void QGCRemoteControlView::setChannel(int channelId, float raw, float normalized) +{ + if (this->raw.size() <= channelId) + { + // This is a new channel, append it + this->raw.append(raw); + this->normalized.append(normalized); + appendChannelWidget(channelId); + } + else + { + // This is an existing channel, update it + this->raw[channelId] = raw; + this->normalized[channelId] = normalized; + } + updated = true; + + // FIXME Will be timer based in the future + redraw(); +} + +void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized) +{ + rssi = rssiNormalized; + updated = true; +} + +void QGCRemoteControlView::appendChannelWidget(int channelId) +{ + // Create new layout + QHBoxLayout* layout = new QHBoxLayout(this); + // Add content + layout->addWidget(new QLabel(QString("Channel %1").arg(channelId + 1), this)); + QLabel* raw = new QLabel(this); + // Append raw label + rawLabels.append(raw); + layout->addWidget(raw); + // Append progress bar + QProgressBar* normalized = new QProgressBar(this); + normalized->setMinimum(0); + normalized->setMaximum(100); + progressBars.append(normalized); + layout->addWidget(normalized); + channelLayout->addLayout(layout); +} + +void QGCRemoteControlView::redraw() +{ + if(isVisible() && updated) + { + // Update raw values + for(int i = 0; i < rawLabels.count(); i++) + { + rawLabels.at(i)->setText(QString("%1 us").arg(raw.at(i))); + } + + // Update percent bars + for(int i = 0; i < progressBars.count(); i++) + { + progressBars.at(i)->setValue(normalized.at(i)*100.0f); + } + updated = false; + } +} + +void QGCRemoteControlView::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/ui/QGCRemoteControlView.h b/src/ui/QGCRemoteControlView.h new file mode 100644 index 0000000000000000000000000000000000000000..a3f82a1ede7952a71f7a2fb808d07f575ea0dabe --- /dev/null +++ b/src/ui/QGCRemoteControlView.h @@ -0,0 +1,76 @@ +/*===================================================================== + +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 . + +======================================================================*/ + +/** + * @file + * @brief Declaration of QGCRemoteControlView + * @author Lorenz Meier + */ + +#ifndef QGCREMOTECONTROLVIEW_H +#define QGCREMOTECONTROLVIEW_H + +#include +#include + +namespace Ui { + class QGCRemoteControlView; +} + +class QVBoxLayout; +class QLabel; +class QProgressBar; + +class QGCRemoteControlView : public QWidget { + Q_OBJECT +public: + QGCRemoteControlView(QWidget *parent = 0); + ~QGCRemoteControlView(); + +public slots: + void setUASId(int id); + void setChannel(int channelId, float raw, float normalized); + void setRemoteRSSI(float rssiNormalized); + void calibrate(); + void redraw(); + +protected slots: + void appendChannelWidget(int channelId); + +protected: + void changeEvent(QEvent *e); + int uasId; + float rssi; + bool updated; + QVBoxLayout* channelLayout; + QVector raw; + QVector normalized; + QVector rawLabels; + QVector progressBars; + QLabel* nameLabel; + +private: + Ui::QGCRemoteControlView *ui; +}; + +#endif // QGCREMOTECONTROLVIEW_H diff --git a/src/ui/QGCRemoteControlView.ui b/src/ui/QGCRemoteControlView.ui new file mode 100644 index 0000000000000000000000000000000000000000..94076ebb494368943a40cd57dff6f2550892c826 --- /dev/null +++ b/src/ui/QGCRemoteControlView.ui @@ -0,0 +1,279 @@ + + + QGCRemoteControlView + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 300 + 260 + 93 + 27 + + + + Calibrate + + + + + + 10 + 270 + 171 + 17 + + + + Remote Control detected + + + + + + 10 + 10 + 71 + 17 + + + + Channel 1 + + + + + + 10 + 30 + 71 + 17 + + + + Channel 2 + + + + + + 10 + 50 + 71 + 17 + + + + Channel 3 + + + + + + 10 + 70 + 71 + 17 + + + + Channel 4 + + + + + + 10 + 90 + 71 + 17 + + + + Channel 5 + + + + + + 10 + 110 + 71 + 17 + + + + Channel 6 + + + + + + 10 + 130 + 71 + 17 + + + + Channel 7 + + + + + + 10 + 150 + 71 + 17 + + + + Channel 8 + + + + + + 10 + 170 + 62 + 17 + + + + RSSI + + + + + + 200 + 10 + 118 + 16 + + + + 24 + + + + + + 200 + 30 + 118 + 16 + + + + 24 + + + + + + 200 + 50 + 118 + 16 + + + + 24 + + + + + + 200 + 70 + 118 + 16 + + + + 24 + + + + + + 200 + 90 + 118 + 16 + + + + 24 + + + + + + 200 + 110 + 118 + 16 + + + + 24 + + + + + + 200 + 130 + 118 + 16 + + + + 24 + + + + + + 200 + 150 + 118 + 16 + + + + 24 + + + + + + 90 + 10 + 41 + 17 + + + + 1120 + + + + + + diff --git a/src/ui/QGCSensorSettingsWidget.cc b/src/ui/QGCSensorSettingsWidget.cc index f00bb98cda14b046d34ca19915a5e32ab8c86f83..f91defe50cd02d2932ed28a7d617e64b95f0a5a4 100644 --- a/src/ui/QGCSensorSettingsWidget.cc +++ b/src/ui/QGCSensorSettingsWidget.cc @@ -21,6 +21,13 @@ This file is part of the QGROUNDCONTROL project ======================================================================*/ +/** + * @file + * @brief Implementation of QGCSensorSettingsWidget + * @author Lorenz Meier + * + */ + #include "QGCSensorSettingsWidget.h" #include "ui_QGCSensorSettingsWidget.h" diff --git a/src/ui/SerialConfigurationWindow.cc b/src/ui/SerialConfigurationWindow.cc index d3bd9310cd4c73d5cea9ad328157ab36672d6571..5542bc93bd382ec0971c464a00c644c7e3303c9b 100644 --- a/src/ui/SerialConfigurationWindow.cc +++ b/src/ui/SerialConfigurationWindow.cc @@ -23,8 +23,7 @@ This file is part of the QGROUNDCONTROL project /** * @file - * @brief Implementation of configuration window for serial links - * + * @brief Implementation of SerialConfigurationWindow * @author Lorenz Meier * */