diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index 6bf00d51aab75de9eb4fe8114c01fe289fc1bd68..121b7bf1893b132768a3a298dd2c399dc2afb0a0 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -448,46 +448,46 @@ DEFINES += QGC_OSG_ENABLED TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\") - exists($$TARGETDIR/debug) { - QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\debug\\files" /E /I $$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\debug\\models" /E /I $$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(xcopy /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\debug" /E /I /EXCLUDE:copydebug.txt $$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\phonond4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtCored4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtGuid4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtMultimediad4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtNetworkd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtOpenGLd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtSqld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtSvgd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtWebKitd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtXmld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtXmlPatternsd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + CONFIG(debug, debug|release) { + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\debug\\files" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\debug\\models" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\debug" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\phonond4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtCored4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtGuid4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtMultimediad4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtNetworkd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtOpenGLd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtSqld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtSvgd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtWebKitd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatternsd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) } - exists($$TARGETDIR/release) { - QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\release\\files" /E /I $$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\release\\models" /E /I $$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\release\\earth.html" $$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(xcopy /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\release" /E /I /EXCLUDE:copyrelease.txt $$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\phonon4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtCore4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtGui4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtMultimedia4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtNetwork4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtOpenGL4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtSql4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtSvg4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtWebKit4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtXml4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtXmlPatterns4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.exp"$$escape_expand(\\n)) - QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.lib"$$escape_expand(\\n)) + CONFIG(release, debug|release) { + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\release\\files" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\release\\models" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\release\\earth.html" $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$BASEDIR_WIN\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\release" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\phonon4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtCore4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtGui4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtMultimedia4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtNetwork4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtOpenGL4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtSql4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtSvg4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtWebKit4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXml4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatterns4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.exp"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.lib"$$escape_expand(\\n)) } } diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index ffb7e9bfdf7e7b14c9c5a4096177f45ea8a0c9a1..1d4641ee5691d4aa46cd168484e8816faaaee194 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -361,14 +361,7 @@ HEADERS += src/MG.h \ src/ui/mavlink/QGCMAVLinkMessageSender.h \ src/ui/firmwareupdate/QGCFirmwareUpdateWidget.h \ src/ui/QGCPluginHost.h \ - src/ui/firmwareupdate/QGCPX4FirmwareUpdate.h \ - src/ui/map3D/gpl.h \ - src/ui/map3D/CameraParams.h \ - src/ui/map3D/ViewParamWidget.h \ - src/ui/map3D/SystemContainer.h \ - src/ui/map3D/SystemViewParams.h \ - src/ui/map3D/GlobalViewParams.h \ - src/ui/map3D/SystemGroupNode.h + src/ui/firmwareupdate/QGCPX4FirmwareUpdate.h # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h @@ -376,7 +369,14 @@ contains(DEPENDENCIES_PRESENT, osg) { message("Including headers for OpenSceneGraph") # Enable only if OpenSceneGraph is available - HEADERS += src/ui/map3D/Q3DWidget.h \ + HEADERS += src/ui/map3D/gpl.h \ + src/ui/map3D/CameraParams.h \ + src/ui/map3D/ViewParamWidget.h \ + src/ui/map3D/SystemContainer.h \ + src/ui/map3D/SystemViewParams.h \ + src/ui/map3D/GlobalViewParams.h \ + src/ui/map3D/SystemGroupNode.h \ + src/ui/map3D/Q3DWidget.h \ src/ui/map3D/GCManipulator.h \ src/ui/map3D/ImageWindowGeode.h \ src/ui/map3D/PixhawkCheetahGeode.h \ @@ -501,14 +501,7 @@ SOURCES += src/main.cc \ src/ui/mavlink/QGCMAVLinkMessageSender.cc \ src/ui/firmwareupdate/QGCFirmwareUpdateWidget.cc \ src/ui/QGCPluginHost.cc \ - src/ui/firmwareupdate/QGCPX4FirmwareUpdate.cc \ - src/ui/map3D/gpl.cc \ - src/ui/map3D/CameraParams.cc \ - src/ui/map3D/ViewParamWidget.cc \ - src/ui/map3D/SystemContainer.cc \ - src/ui/map3D/SystemViewParams.cc \ - src/ui/map3D/GlobalViewParams.cc \ - src/ui/map3D/SystemGroupNode.cc + src/ui/firmwareupdate/QGCPX4FirmwareUpdate.cc # Enable Google Earth only on Mac OS and Windows with Visual Studio compiler macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc @@ -518,7 +511,14 @@ contains(DEPENDENCIES_PRESENT, osg) { message("Including sources for OpenSceneGraph") # Enable only if OpenSceneGraph is available - SOURCES += src/ui/map3D/Q3DWidget.cc \ + SOURCES += src/ui/map3D/gpl.cc \ + src/ui/map3D/CameraParams.cc \ + src/ui/map3D/ViewParamWidget.cc \ + src/ui/map3D/SystemContainer.cc \ + src/ui/map3D/SystemViewParams.cc \ + src/ui/map3D/GlobalViewParams.cc \ + src/ui/map3D/SystemGroupNode.cc \ + src/ui/map3D/Q3DWidget.cc \ src/ui/map3D/ImageWindowGeode.cc \ src/ui/map3D/GCManipulator.cc \ src/ui/map3D/PixhawkCheetahGeode.cc \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 1c7619edab995e054b62a874c3ee88ebf66071d9..42b43b30e03f04feff5d580e99716abe532cefda 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -75,10 +75,10 @@ images/status/audio-volume-medium.svg images/status/audio-volume-low.svg images/status/audio-volume-high.svg - images/status/colorbars.png + images/status/colorbars.png images/style-mission.css images/splash.png - audio/alert.wav + files/audio/alert.wav demo-log.txt images/mapproviders/openstreetmap.png images/mapproviders/google.png diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index f7647499dbabff4602e4550c3d526c7da8642602..77f309f8eb010bfbc8362ba6e08b4e9354348763 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -344,39 +344,42 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) // Only count message if UAS exists for this message if (uas != NULL) { + // Increase receive counter totalReceiveCounter++; currReceiveCounter++; - // Update last packet index - if (lastIndex[message.sysid][message.compid] == -1) + + // Update last message sequence ID + uint8_t expectedIndex; + if (lastIndex[message.sysid][message.compid] == -1) { lastIndex[message.sysid][message.compid] = message.seq; - } + expectedIndex = message.seq; + } else { - uint8_t expectedIndex = lastIndex[message.sysid][message.compid]; - // Now increase to the expected index - expectedIndex++; - - //qDebug() << "SYSID" << message.sysid << "COMPID" << message.compid << "MSGID" << message.msgid << "EXPECTED INDEX:" << expectedIndex << "SEQ" << message.seq; - while(expectedIndex != message.seq) - { - expectedIndex++; - totalLossCounter++; - currLossCounter++; - //qDebug() << "COUNTING ONE DROP!"; - } - - // Set new lastindex - lastIndex[message.sysid][message.compid] = message.seq; - } - // if (lastIndex.contains(message.sysid)) - // { - // QMap* lastCompIndex = lastIndex.value(message.sysid); - // if (lastCompIndex->contains(message.compid)) - // while (lastCompIndex->value(message.compid, 0)+1 ) - // } - //if () + // NOTE: Using uint8_t here auto-wraps the number around to 0. + expectedIndex = lastIndex[message.sysid][message.compid] + 1; + } + + // Make some noise if a message was skipped + //qDebug() << "SYSID" << message.sysid << "COMPID" << message.compid << "MSGID" << message.msgid << "EXPECTED INDEX:" << expectedIndex << "SEQ" << message.seq; + if (message.seq != expectedIndex) + { + // Determine how many messages were skipped accounting for 0-wraparound + int16_t lostMessages = message.seq - expectedIndex; + if (lostMessages < 0) + { + lostMessages += 256; + } + qDebug() << QString("Lost %1 messages: expected sequence ID %2 but received %3.").arg(lostMessages).arg(expectedIndex).arg(message.seq); + + totalLossCounter += lostMessages; + currLossCounter += lostMessages; + } + + // Update the last sequence ID + lastIndex[message.sysid][message.compid] = message.seq; // Update on every 32th packet if (totalReceiveCounter % 32 == 0) @@ -385,11 +388,9 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) // Receive loss float receiveLoss = (double)currLossCounter/(double)(currReceiveCounter+currLossCounter); receiveLoss *= 100.0f; - // qDebug() << "LOSSCHANGED" << receiveLoss; currLossCounter = 0; currReceiveCounter = 0; emit receiveLossChanged(message.sysid, receiveLoss); - //qDebug() << "LOSSCHANGED" << message.sysid<<" "<getUASID(), state.drop_rate_comm/10000.0f); - } + // Trigger drop rate updates as needed. Here we convert the incoming + // drop_rate_comm value from 1/100 of a percent in a uint16 to a true + // percentage as a float. We also cap the incoming value at 100% as defined + // by the MAVLink specifications. + if (state.drop_rate_comm > 10000) { + emit dropRateChanged(this->getUASID(), 100.0f); + } else { + emit dropRateChanged(this->getUASID(), state.drop_rate_comm/100.0f); + } + } break; case MAVLINK_MSG_ID_ATTITUDE: { diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 91c65cd376ca17a7c00ff25bab4e3c70acdee864..7ed06d8839ecab7164b377b4807b5b6a15fcfe03 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -132,7 +132,7 @@ void UASWaypointManager::handleGlobalPositionChanged(UASInterface* mav, double l void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, quint16 count) { - if (current_state == WP_GETLIST && systemId == current_partner_systemid && compId == current_partner_compid) { + if (current_state == WP_GETLIST && systemId == current_partner_systemid && (compId == current_partner_compid || compId == MAV_COMP_ID_ALL)) { protocol_timer.start(PROTOCOL_TIMEOUT_MS); current_retries = PROTOCOL_MAX_RETRIES; @@ -172,7 +172,7 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_mission_item_t *wp) { - if (systemId == current_partner_systemid && compId == current_partner_compid && current_state == WP_GETLIST_GETWPS && wp->seq == current_wp_id) { + if (systemId == current_partner_systemid && (compId == current_partner_compid || compId == MAV_COMP_ID_ALL) && current_state == WP_GETLIST_GETWPS && wp->seq == current_wp_id) { protocol_timer.start(PROTOCOL_TIMEOUT_MS); current_retries = PROTOCOL_MAX_RETRIES; @@ -222,7 +222,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ void UASWaypointManager::handleWaypointAck(quint8 systemId, quint8 compId, mavlink_mission_ack_t *wpa) { - if (systemId == current_partner_systemid && compId == current_partner_compid) { + if (systemId == current_partner_systemid && (compId == current_partner_compid || compId == MAV_COMP_ID_ALL)) { if((current_state == WP_SENDLIST || current_state == WP_SENDLIST_SENDWPS) && (current_wp_id == waypoint_buffer.count()-1 && wpa->type == 0)) { //all waypoints sent and ack received protocol_timer.stop(); @@ -241,7 +241,7 @@ void UASWaypointManager::handleWaypointAck(quint8 systemId, quint8 compId, mavli void UASWaypointManager::handleWaypointRequest(quint8 systemId, quint8 compId, mavlink_mission_request_t *wpr) { - if (systemId == current_partner_systemid && compId == current_partner_compid && ((current_state == WP_SENDLIST && wpr->seq == 0) || (current_state == WP_SENDLIST_SENDWPS && (wpr->seq == current_wp_id || wpr->seq == current_wp_id + 1)))) { + if (systemId == current_partner_systemid && (compId == current_partner_compid || compId == MAV_COMP_ID_ALL) && ((current_state == WP_SENDLIST && wpr->seq == 0) || (current_state == WP_SENDLIST_SENDWPS && (wpr->seq == current_wp_id || wpr->seq == current_wp_id + 1)))) { protocol_timer.start(PROTOCOL_TIMEOUT_MS); current_retries = PROTOCOL_MAX_RETRIES; diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index 5a25f5dc65722b1b13e258796a5dc39bd2ba44ac..c61b2e4dcb819328950d9c7c532ae372794207e1 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -952,6 +952,7 @@ void HSIDisplay::updateAttitude(UASInterface* uas, double roll, double pitch, do void HSIDisplay::updateUserPositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired) { + Q_UNUSED(uasid); uiXSetCoordinate = xDesired; uiYSetCoordinate = yDesired; uiZSetCoordinate = zDesired; @@ -962,8 +963,8 @@ void HSIDisplay::updateUserPositionSetpoints(int uasid, float xDesired, float yD void HSIDisplay::updatePositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired, quint64 usec) { - Q_UNUSED(usec); Q_UNUSED(uasid); + Q_UNUSED(usec); bodyXSetCoordinate = xDesired; bodyYSetCoordinate = yDesired; bodyZSetCoordinate = zDesired; diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index c69a0be3ca2b18d1e888b4421cc19c169c57ae94..106725ec0bae32653113d936f9f83c0adbc93a68 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -55,18 +55,28 @@ QGCToolBar::QGCToolBar(QWidget *parent) : // Add internal actions // Add MAV widget symbolButton = new QToolButton(this); + symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px 0px 0px 20px; background-color: none; }"); + addWidget(symbolButton); + toolBarNameLabel = new QLabel("------", this); + toolBarNameLabel->setToolTip(tr("Currently controlled vehicle")); + addWidget(toolBarNameLabel); + toolBarSafetyLabel = new QLabel("SAFE", this); toolBarSafetyLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #14C814; }"); + toolBarSafetyLabel->setToolTip(tr("Vehicle safety state")); + addWidget(toolBarSafetyLabel); + toolBarModeLabel = new QLabel("------", this); toolBarModeLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #3C7B9E; }"); + toolBarModeLabel->setToolTip(tr("Vehicle mode")); + addWidget(toolBarModeLabel); + toolBarStateLabel = new QLabel("------", this); toolBarStateLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #FEC654; }"); - toolBarWpLabel = new QLabel("WP--", this); - toolBarWpLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 18px; color: #3C7B9E; }"); - toolBarDistLabel = new QLabel("--- ---- m", this); - toolBarMessageLabel = new QLabel("No system messages.", this); - toolBarMessageLabel->setStyleSheet("QLabel { margin: 0px 4px; font: 12px; font-style: italic; color: #3C7B9E; }"); + toolBarStateLabel->setToolTip(tr("Vehicle state")); + addWidget(toolBarStateLabel); + toolBarBatteryBar = new QProgressBar(this); toolBarBatteryBar->setStyleSheet("QProgressBar:horizontal { margin: 0px 4px 0px 0px; border: 1px solid #4A4A4F; border-radius: 4px; text-align: center; padding: 2px; color: #111111; background-color: #111118; height: 10px; } QProgressBar:horizontal QLabel { font-size: 9px; color: #111111; } QProgressBar::chunk { background-color: green; }"); toolBarBatteryBar->setMinimum(0); @@ -74,26 +84,34 @@ QGCToolBar::QGCToolBar(QWidget *parent) : toolBarBatteryBar->setMinimumWidth(20); toolBarBatteryBar->setMaximumWidth(100); toolBarBatteryBar->setToolTip(tr("Battery charge level")); + addWidget(toolBarBatteryBar); + toolBarBatteryVoltageLabel = new QLabel("xx.x V"); toolBarBatteryVoltageLabel->setStyleSheet(QString("QLabel { margin: 0px 0px 0px 4px; font: 14px; color: %1; }").arg(QColor(Qt::green).name())); - symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px 0px 0px 20px; background-color: none; }"); - addWidget(symbolButton); - addWidget(toolBarNameLabel); - addWidget(toolBarSafetyLabel); - addWidget(toolBarModeLabel); - addWidget(toolBarStateLabel); - addWidget(toolBarBatteryBar); + toolBarBatteryVoltageLabel->setToolTip(tr("Battery voltage")); addWidget(toolBarBatteryVoltageLabel); + + toolBarWpLabel = new QLabel("WP--", this); + toolBarWpLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 18px; color: #3C7B9E; }"); + toolBarWpLabel->setToolTip(tr("Current mission")); addWidget(toolBarWpLabel); + + toolBarDistLabel = new QLabel("--- ---- m", this); + toolBarDistLabel->setToolTip(tr("Distance to current mission")); addWidget(toolBarDistLabel); + + toolBarMessageLabel = new QLabel("No system messages.", this); + toolBarMessageLabel->setStyleSheet("QLabel { margin: 0px 4px; font: 12px; font-style: italic; color: #3C7B9E; }"); + toolBarMessageLabel->setToolTip(tr("Most recent system message")); addWidget(toolBarMessageLabel); - //addWidget(new QSpacerItem(20, 0, QSizePolicy::Expanding)); // DONE INITIALIZING BUTTONS + // Configure the toolbar for the current default UAS setActiveUAS(UASManager::instance()->getActiveUAS()); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); + // Set the toolbar to be updated every 2s connect(&updateViewTimer, SIGNAL(timeout()), this, SLOT(updateView())); updateViewTimer.start(2000); } diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 9f29858b484dc78dfa65202ac58169a4dd398d02..1c9bdb4453c744be8e080b031d56a66903514a68 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -197,7 +197,7 @@ void WaypointList::loadWaypoints() msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost."); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); - int ret = msgBox.exec(); + msgBox.exec(); showOfflineWarning = false; } QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)")); @@ -263,7 +263,7 @@ void WaypointList::addEditable() msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost."); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); - int ret = msgBox.exec(); + msgBox.exec(); showOfflineWarning = false; } } diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index d0c95be23ffc6d1a45c14d276383d140d5089bde..67582631c296814ce9466222ab74647055ad6ee2 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -303,9 +303,6 @@ void QGCMapWidget::updateLocalPosition() } // Set new lat/lon position of UAV icon - double latitude = UASManager::instance()->getHomeLatitude(); - double longitude = UASManager::instance()->getHomeLongitude(); - double altitude = UASManager::instance()->getHomeAltitude(); internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude()); uav->SetUAVPos(pos_lat_lon, system->getAltitude()); // Follow status @@ -317,33 +314,7 @@ void QGCMapWidget::updateLocalPosition() void QGCMapWidget::updateLocalPositionEstimates() { - QList systems = UASManager::instance()->getUASList(); - foreach (UASInterface* system, systems) - { - // Get reference to graphic UAV item - mapcontrol::UAVItem* uav = GetUAV(system->getUASID()); - // Check if reference is valid, else create a new one - if (uav == NULL) - { - MAV2DIcon* newUAV = new MAV2DIcon(map, this, system); - AddUAV(system->getUASID(), newUAV); - uav = newUAV; - uav->SetTrailTime(1); - uav->SetTrailDistance(5); - uav->SetTrailType(mapcontrol::UAVTrailType::ByTimeElapsed); - } - - // Set new lat/lon position of UAV icon - double latitude = UASManager::instance()->getHomeLatitude(); - double longitude = UASManager::instance()->getHomeLongitude(); - double altitude = UASManager::instance()->getHomeAltitude(); - internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude()); - uav->SetUAVPos(pos_lat_lon, system->getAltitude()); - // Follow status - if (followUAVEnabled && system->getUASID() == followUAVID) SetCurrentPosition(pos_lat_lon); - // Convert from radians to degrees and apply - uav->SetUAVHeading((system->getYaw()/M_PI)*180.0f); - } + updateLocalPosition(); } diff --git a/src/ui/mavlink/QGCMAVLinkMessageSender.cc b/src/ui/mavlink/QGCMAVLinkMessageSender.cc index 630d79af303054fc33378be473ad84320e570000..227934f72262897296e8ecc66420f63c5a93fd91 100644 --- a/src/ui/mavlink/QGCMAVLinkMessageSender.cc +++ b/src/ui/mavlink/QGCMAVLinkMessageSender.cc @@ -23,7 +23,6 @@ QGCMAVLinkMessageSender::QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidg void QGCMAVLinkMessageSender::refresh() { - unsigned int maxUpdateRate = 0; // Send messages foreach (unsigned int i, managementItems.keys()) { @@ -79,7 +78,7 @@ bool QGCMAVLinkMessageSender::sendMessage(unsigned int msgid) uint8_t* nums = m+messageInfo[msgid].fields[fieldid].wire_offset; for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) { - if (field->data(1, Qt::DisplayRole).toString().split(" ").size() > j) + if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j) { nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toInt(); } diff --git a/src/ui/uas/UASInfoWidget.h b/src/ui/uas/UASInfoWidget.h index 81a8179e66b0630443272f1347c892ffc726a0db..ec977c82dec9f31e362d37d5eda780a417c61cee 100644 --- a/src/ui/uas/UASInfoWidget.h +++ b/src/ui/uas/UASInfoWidget.h @@ -57,10 +57,20 @@ public slots: void updateBattery(UASInterface* uas, double voltage, double percent, int seconds); void updateCPULoad(UASInterface* uas, double load); - /** @brief Set the loss rate of packets received by the MAV */ + /** + * @brief Set the loss rate of packets received by the MAV. + * @param uasId UNUSED + * @param receiveLoss A percentage value (0-100) of how many message the UAS has failed to receive. + */ void updateReceiveLoss(int uasId, float receiveLoss); - /** @brief Set the loss rate of packets sent from the MAV */ + + /** + * @brief Set the loss rate of packets sent from the MAV + * @param uasId UNUSED + * @param sendLoss A percentage value (0-100) of how many message QGC has failed to receive. + */ void updateSendLoss(int uasId, float sendLoss); + /** @brief Update the error count */ void updateErrorCount(int uasid, QString component, QString device, int count);