From 1948ddbad63a59cf65c81ce832d2e8b18de15ae4 Mon Sep 17 00:00:00 2001 From: jschall Date: Sun, 25 Dec 2011 02:22:26 -0800 Subject: [PATCH 1/6] Fix build on 64-bit linux target --- src/libs/utils/utils_external.pri | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/utils/utils_external.pri b/src/libs/utils/utils_external.pri index 621e0ca..cf81cc2 100644 --- a/src/libs/utils/utils_external.pri +++ b/src/libs/utils/utils_external.pri @@ -81,6 +81,10 @@ linux-g++ { SOURCES += consoleprocess_unix.cpp } +linux-g++-64 { +SOURCES += consoleprocess_unix.cpp +} + # submiteditorwidget.cpp \ # qtcolorbutton.cpp \ From 2cd005b461a1dbe42a1f18f79a37ea94b2138f05 Mon Sep 17 00:00:00 2001 From: LM Date: Tue, 10 Jan 2012 17:49:25 +0100 Subject: [PATCH 2/6] Fixed Ubuntu 64bit build error --- src/libs/utils/utils_external.pri | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libs/utils/utils_external.pri b/src/libs/utils/utils_external.pri index cf81cc2..dd78de6 100644 --- a/src/libs/utils/utils_external.pri +++ b/src/libs/utils/utils_external.pri @@ -77,11 +77,7 @@ macx { SOURCES += consoleprocess_unix.cpp } -linux-g++ { -SOURCES += consoleprocess_unix.cpp -} - -linux-g++-64 { +linux-g++|linux-g++-64 { SOURCES += consoleprocess_unix.cpp } From 7fe1c809ce2559f1a35f9323f8ae7e0dc633d48f Mon Sep 17 00:00:00 2001 From: LM Date: Tue, 10 Jan 2012 18:28:09 +0100 Subject: [PATCH 3/6] Made Doxygen verbose, made sure the initialization of control widget is correct --- doc/Doxyfile | 11 ++++++----- src/ui/uas/UASControlWidget.cc | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 28d0c33..0d28fe8 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -515,7 +515,7 @@ LAYOUT_FILE = # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. -QUIET = YES +QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank @@ -599,7 +599,8 @@ RECURSIVE = YES # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = ../src/lib/ \ - lib/ + lib/ \ + ../src/libs/ # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded @@ -985,7 +986,7 @@ SEARCHENGINE = YES # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be @@ -1033,13 +1034,13 @@ LATEX_HEADER = # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. -PDF_HYPERLINKS = YES +PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. -USE_PDFLATEX = YES +USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep diff --git a/src/ui/uas/UASControlWidget.cc b/src/ui/uas/UASControlWidget.cc index 5c13e52..06161d2 100644 --- a/src/ui/uas/UASControlWidget.cc +++ b/src/ui/uas/UASControlWidget.cc @@ -44,6 +44,7 @@ This file is part of the PIXHAWK project UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent), uas(0), + uasMode(0), engineOn(false) { ui.setupUi(this); @@ -59,6 +60,8 @@ UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent), connect(ui.modeComboBox, SIGNAL(activated(int)), this, SLOT(setMode(int))); connect(ui.setModeButton, SIGNAL(clicked()), this, SLOT(transmitMode())); + uasMode = ui.modeComboBox->itemData(ui.modeComboBox->currentIndex()).toInt(); + ui.modeComboBox->setCurrentIndex(0); ui.gridLayout->setAlignment(Qt::AlignTop); @@ -67,7 +70,8 @@ UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent), void UASControlWidget::setUAS(UASInterface* uas) { - if (this->uas != 0) { + if (this->uas != 0) + { UASInterface* oldUAS = UASManager::instance()->getUASForId(this->uas); disconnect(ui.controlButton, SIGNAL(clicked()), oldUAS, SLOT(armSystem())); disconnect(ui.liftoffButton, SIGNAL(clicked()), oldUAS, SLOT(launch())); @@ -101,9 +105,12 @@ UASControlWidget::~UASControlWidget() void UASControlWidget::updateStatemachine() { - if (engineOn) { + if (engineOn) + { ui.controlButton->setText(tr("DISARM SYSTEM")); - } else { + } + else + { ui.controlButton->setText(tr("ARM SYSTEM")); } } @@ -139,7 +146,8 @@ void UASControlWidget::updateMode(int uas,QString mode,QString description) void UASControlWidget::updateState(int state) { - switch (state) { + switch (state) + { case (int)MAV_STATE_ACTIVE: engineOn = true; ui.controlButton->setText(tr("DISARM SYSTEM")); From f4504903e688eadae53f1bf2af020b7e05f310d7 Mon Sep 17 00:00:00 2001 From: LM Date: Tue, 10 Jan 2012 18:34:41 +0100 Subject: [PATCH 4/6] Updated to latest MAVLink --- src/uas/UAS.cc | 13 ++++++------- src/uas/UAS.h | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index c0c6e69..7c8aa43 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -767,6 +767,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) imagePayload = p.payload; imageQuality = p.jpg_quality; imageType = p.type; + imageWidth = p.width; + imageHeight = p.height; imageStart = QGC::groundTimeMilliseconds(); } break; @@ -1392,16 +1394,13 @@ QImage UAS::getImage() // RAW greyscale if (imageType == MAVLINK_DATA_STREAM_IMG_RAW8U) { - // TODO FIXME Fabian - // RAW hardcoded to 22x22 - int imgWidth = 22; - int imgHeight = 22; - int imgColors = 255; + // TODO FIXME + int imgColors = 255;//imageSize/(imageWidth*imageHeight); //const int headerSize = 15; // Construct PGM header QString header("P5\n%1 %2\n%3\n"); - header = header.arg(imgWidth).arg(imgHeight).arg(imgColors); + header = header.arg(imageWidth).arg(imageHeight).arg(imgColors); QByteArray tmpImage(header.toStdString().c_str(), header.toStdString().size()); tmpImage.append(imageRecBuffer); @@ -1451,7 +1450,7 @@ void UAS::requestImage() if (imagePacketsArrived == 0) { mavlink_message_t msg; - mavlink_msg_data_transmission_handshake_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, DATA_TYPE_JPEG_IMAGE, 0, 0, 0, 50); + mavlink_msg_data_transmission_handshake_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, DATA_TYPE_JPEG_IMAGE, 0, 0, 0, 0, 0, 50); sendMessage(msg); } #endif diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 1e89ed1..093122d 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -214,6 +214,8 @@ protected: //COMMENTS FOR TEST UNIT int imagePayload; ///< Payload size per transmitted packet (bytes). Standard is 254, and decreases when image resolution increases. int imageQuality; ///< Quality of the transmitted image (percentage) int imageType; ///< Type of the transmitted image (BMP, PNG, JPEG, RAW 8 bit, RAW 32 bit) + int imageWidth; ///< Width of the image stream + int imageHeight; ///< Width of the image stream QByteArray imageRecBuffer; ///< Buffer for the incoming bytestream QImage image; ///< Image data of last completely transmitted image quint64 imageStart; From ce0bd4d2189565e5ef73acb34478cdd263c6876a Mon Sep 17 00:00:00 2001 From: oberion Date: Thu, 5 Jan 2012 08:48:42 +0100 Subject: [PATCH 5/6] Solved Windows threading problem with joystick and signal slot bug in WaypointList.cc --- src/input/JoystickInput.cc | 31 ++++++++++++++++++++++++++----- src/input/JoystickInput.h | 3 +++ src/ui/WaypointList.cc | 8 +++++--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/input/JoystickInput.cc b/src/input/JoystickInput.cc index 805f9a5..01d6e4f 100644 --- a/src/input/JoystickInput.cc +++ b/src/input/JoystickInput.cc @@ -37,6 +37,7 @@ This file is part of the PIXHAWK project #include "UAS.h" #include "UASManager.h" #include "QGC.h" +#include /** * The coordinate frame of the joystick axis is the aeronautical frame like shown on this image: @@ -49,10 +50,10 @@ JoystickInput::JoystickInput() : uas(NULL), uasButtonList(QList()), done(false), - thrustAxis(3), - xAxis(1), - yAxis(0), - yawAxis(2), + thrustAxis(2), + xAxis(0), + yAxis(1), + yawAxis(3), joystickName(tr("Unitinialized")) { for (int i = 0; i < 10; i++) { @@ -66,6 +67,17 @@ JoystickInput::JoystickInput() : //start(); } +JoystickInput::~JoystickInput() +{ + { + QMutexLocker locker(&this->m_doneMutex); + done = true; + } + this->wait(); + this->deleteLater(); +} + + void JoystickInput::setActiveUAS(UASInterface* uas) { // Only connect / disconnect is the UAS is of a controllable UAS class @@ -134,7 +146,16 @@ void JoystickInput::run() init(); - while(!done) { + forever + { + { + QMutexLocker locker(&this->m_doneMutex); + if(done) + { + done = false; + break; + } + } while(SDL_PollEvent(&event)) { SDL_JoystickUpdate(); diff --git a/src/input/JoystickInput.h b/src/input/JoystickInput.h index ad08c12..f8b369e 100644 --- a/src/input/JoystickInput.h +++ b/src/input/JoystickInput.h @@ -35,6 +35,7 @@ This file is part of the PIXHAWK project #include #include +#include #include #include "UASInterface.h" @@ -48,6 +49,7 @@ class JoystickInput : public QThread public: JoystickInput(); + ~JoystickInput(); void run(); const QString& getName(); @@ -63,6 +65,7 @@ protected: UASInterface* uas; QList uasButtonList; bool done; + QMutex m_doneMutex; // Axis 3 is thrust (CALIBRATION!) int thrustAxis; diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 8436230..a4f1cf1 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -154,9 +154,11 @@ void WaypointList::setUAS(UASInterface* uas) if (this->uas == NULL && uas != NULL) { this->uas = uas; - - connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updatePosition(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,double,double,double,quint64))); + if(uas != NULL) + { + connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updatePosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,double,double,double,quint64))); + } connect(WPM, SIGNAL(updateStatusString(const QString &)), this, SLOT(updateStatusLabel(const QString &))); connect(WPM, SIGNAL(waypointEditableListChanged(void)), this, SLOT(waypointEditableListChanged(void))); From 25e35803a3bef8d831e710769b2c1eb3ee2f967e Mon Sep 17 00:00:00 2001 From: oberion Date: Tue, 3 Jan 2012 15:07:24 +0100 Subject: [PATCH 6/6] Fixed windows build bug and div. compile warnings --- src/QGC.cc | 2 +- src/QGC.h | 2 +- src/comm/MAVLinkSimulationMAV.cc | 8 ++++---- src/uas/UASWaypointManager.cc | 4 ++++ src/ui/HSIDisplay.cc | 5 +++++ src/ui/QGCMAVLinkInspector.cc | 3 +++ src/ui/QGCMAVLinkInspector.h | 4 ++-- src/ui/QGCRGBDView.cc | 2 ++ src/ui/map/QGCMapWidget.cc | 2 +- src/ui/uas/UASListWidget.cc | 1 + 10 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/QGC.cc b/src/QGC.cc index 179d54f..c30209f 100644 --- a/src/QGC.cc +++ b/src/QGC.cc @@ -64,7 +64,7 @@ float limitAngleToPMPIf(float angle) else { // Approximate - angle = fmodf(angle, M_PI); + angle = fmodf(angle, (float) M_PI); } return angle; diff --git a/src/QGC.h b/src/QGC.h index 9a1b442..7f17bd1 100644 --- a/src/QGC.h +++ b/src/QGC.h @@ -47,7 +47,7 @@ inline bool isnan(T value) template inline bool isinf(T value) { - return std::numeric_limits::has_infinity && (value == std::numeric_limits::infinity() || (-1*value) == std::numeric_limits::infinity()); + return (value == std::numeric_limits::infinity() || (-1*value) == std::numeric_limits::infinity()) && std::numeric_limits::has_infinity; } #else #include diff --git a/src/comm/MAVLinkSimulationMAV.cc b/src/comm/MAVLinkSimulationMAV.cc index 5199244..948fcec 100644 --- a/src/comm/MAVLinkSimulationMAV.cc +++ b/src/comm/MAVLinkSimulationMAV.cc @@ -221,10 +221,10 @@ void MAVLinkSimulationMAV::mainloop() if (sys_mode & MAV_MODE_FLAG_DECODE_POSITION_HIL) { mavlink_hil_controls_t hil; - hil.roll_ailerons = 0.0; - hil.pitch_elevator = 0.05; - hil.yaw_rudder = 0.05; - hil.throttle = 0.6; + hil.roll_ailerons = 0.0f; + hil.pitch_elevator = 0.05f; + hil.yaw_rudder = 0.05f; + hil.throttle = 0.6f; // Encode the data (adding header and checksums, etc.) mavlink_msg_hil_controls_encode(systemid, MAV_COMP_ID_IMU, &ret, &hil); // And send it diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index e37bd25..4a274b4 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -114,6 +114,9 @@ void UASWaypointManager::handleGlobalPositionChanged(UASInterface* mav, double l { Q_UNUSED(mav); Q_UNUSED(time); + Q_UNUSED(alt); + Q_UNUSED(lon); + Q_UNUSED(lat); if (waypointsEditable.count() > 0 && currentWaypointEditable && (currentWaypointEditable->getFrame() == MAV_FRAME_GLOBAL || currentWaypointEditable->getFrame() == MAV_FRAME_GLOBAL_RELATIVE_ALT)) { // TODO FIXME Calculate distance @@ -239,6 +242,7 @@ void UASWaypointManager::handleWaypointRequest(quint8 systemId, quint8 compId, m void UASWaypointManager::handleWaypointReached(quint8 systemId, quint8 compId, mavlink_mission_item_reached_t *wpr) { + Q_UNUSED(compId); if (!uas) return; if (systemId == uasid) { emit updateStatusString(QString("Reached waypoint %1").arg(wpr->seq)); diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index 296e25d..0e260bf 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -486,6 +486,11 @@ void HSIDisplay::updatePositionZControllerEnabled(bool enabled) void HSIDisplay::updateObjectPosition(unsigned int time, int id, int type, const QString& name, int quality, float bearing, float distance) { + Q_UNUSED(quality); + Q_UNUSED(name); + Q_UNUSED(type); + Q_UNUSED(id); + Q_UNUSED(time); // FIXME add multi-object support QPainter painter(this); QColor color(Qt::yellow); diff --git a/src/ui/QGCMAVLinkInspector.cc b/src/ui/QGCMAVLinkInspector.cc index 691f8bc..d4c353c 100644 --- a/src/ui/QGCMAVLinkInspector.cc +++ b/src/ui/QGCMAVLinkInspector.cc @@ -6,6 +6,9 @@ #include +const float QGCMAVLinkInspector::updateHzLowpass = 0.2f; +const unsigned int QGCMAVLinkInspector::updateInterval = 1000U; + QGCMAVLinkInspector::QGCMAVLinkInspector(MAVLinkProtocol* protocol, QWidget *parent) : QWidget(parent), ui(new Ui::QGCMAVLinkInspector) diff --git a/src/ui/QGCMAVLinkInspector.h b/src/ui/QGCMAVLinkInspector.h index f4751dd..4623b24 100644 --- a/src/ui/QGCMAVLinkInspector.h +++ b/src/ui/QGCMAVLinkInspector.h @@ -37,8 +37,8 @@ protected: // Update one message field void updateField(int msgid, int fieldid, QTreeWidgetItem* item); - static const unsigned int updateInterval = 1000; - static const float updateHzLowpass = 0.2f; + static const unsigned int updateInterval; + static const float updateHzLowpass; private: Ui::QGCMAVLinkInspector *ui; diff --git a/src/ui/QGCRGBDView.cc b/src/ui/QGCRGBDView.cc index de45d80..ded4a4e 100644 --- a/src/ui/QGCRGBDView.cc +++ b/src/ui/QGCRGBDView.cc @@ -265,5 +265,7 @@ void QGCRGBDView::updateData(UASInterface *uas) } glImage = QGLWidget::convertToGLFormat(fill); +#else + Q_UNUSED(uas); #endif } diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index ed1b371..2c5a7aa 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -10,7 +10,7 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) : mapcontrol::OPMapWidget(parent), currWPManager(NULL), firingWaypointChange(NULL), - maxUpdateInterval(2.1), // 2 seconds + maxUpdateInterval(2.1f), // 2 seconds followUAVEnabled(false), trailType(mapcontrol::UAVTrailType::ByTimeElapsed), trailInterval(2.0f), diff --git a/src/ui/uas/UASListWidget.cc b/src/ui/uas/UASListWidget.cc index faa136d..33bac7a 100644 --- a/src/ui/uas/UASListWidget.cc +++ b/src/ui/uas/UASListWidget.cc @@ -114,6 +114,7 @@ void UASListWidget::activeUAS(UASInterface* uas) void UASListWidget::removeUAS(UASInterface* uas) { + Q_UNUSED(uas); // uasViews.remove(uas); // listLayout->removeWidget(uasViews.value(uas)); // uasViews.value(uas)->deleteLater();