Commit 27932f5c authored by PIXHAWK Team's avatar PIXHAWK Team

Merge pull request #34 from Susurrus/master

Various changes
parents 864e6ae8 19805a92
...@@ -448,44 +448,44 @@ DEFINES += QGC_OSG_ENABLED ...@@ -448,44 +448,44 @@ DEFINES += QGC_OSG_ENABLED
TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\") TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\")
exists($$TARGETDIR/debug) { CONFIG(debug, debug|release) {
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) 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 /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\debug\\files" /E /I $$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 /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\debug\\models" /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(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\debug"$$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(copy /Y "$$BASEDIR_WIN\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$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 /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\debug" /E /I /EXCLUDE:copydebug.txt $$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\debug" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\phonond4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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)) QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatternsd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
} }
exists($$TARGETDIR/release) { CONFIG(release, debug|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 /D /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 /D /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(xcopy /D /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(xcopy /D /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 /D /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(xcopy /D /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\release" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\phonon4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(xcopy /D /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(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.exp"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.lib"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.lib"$$escape_expand(\\n))
} }
......
...@@ -361,14 +361,7 @@ HEADERS += src/MG.h \ ...@@ -361,14 +361,7 @@ HEADERS += src/MG.h \
src/ui/mavlink/QGCMAVLinkMessageSender.h \ src/ui/mavlink/QGCMAVLinkMessageSender.h \
src/ui/firmwareupdate/QGCFirmwareUpdateWidget.h \ src/ui/firmwareupdate/QGCFirmwareUpdateWidget.h \
src/ui/QGCPluginHost.h \ src/ui/QGCPluginHost.h \
src/ui/firmwareupdate/QGCPX4FirmwareUpdate.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
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler # 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 macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
...@@ -376,7 +369,14 @@ contains(DEPENDENCIES_PRESENT, osg) { ...@@ -376,7 +369,14 @@ contains(DEPENDENCIES_PRESENT, osg) {
message("Including headers for OpenSceneGraph") message("Including headers for OpenSceneGraph")
# Enable only if OpenSceneGraph is available # 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/GCManipulator.h \
src/ui/map3D/ImageWindowGeode.h \ src/ui/map3D/ImageWindowGeode.h \
src/ui/map3D/PixhawkCheetahGeode.h \ src/ui/map3D/PixhawkCheetahGeode.h \
...@@ -501,14 +501,7 @@ SOURCES += src/main.cc \ ...@@ -501,14 +501,7 @@ SOURCES += src/main.cc \
src/ui/mavlink/QGCMAVLinkMessageSender.cc \ src/ui/mavlink/QGCMAVLinkMessageSender.cc \
src/ui/firmwareupdate/QGCFirmwareUpdateWidget.cc \ src/ui/firmwareupdate/QGCFirmwareUpdateWidget.cc \
src/ui/QGCPluginHost.cc \ src/ui/QGCPluginHost.cc \
src/ui/firmwareupdate/QGCPX4FirmwareUpdate.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
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler # 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 macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
...@@ -518,7 +511,14 @@ contains(DEPENDENCIES_PRESENT, osg) { ...@@ -518,7 +511,14 @@ contains(DEPENDENCIES_PRESENT, osg) {
message("Including sources for OpenSceneGraph") message("Including sources for OpenSceneGraph")
# Enable only if OpenSceneGraph is available # 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/ImageWindowGeode.cc \
src/ui/map3D/GCManipulator.cc \ src/ui/map3D/GCManipulator.cc \
src/ui/map3D/PixhawkCheetahGeode.cc \ src/ui/map3D/PixhawkCheetahGeode.cc \
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<file>images/status/colorbars.png</file> <file>images/status/colorbars.png</file>
<file>images/style-mission.css</file> <file>images/style-mission.css</file>
<file>images/splash.png</file> <file>images/splash.png</file>
<file>audio/alert.wav</file> <file>files/audio/alert.wav</file>
<file>demo-log.txt</file> <file>demo-log.txt</file>
<file>images/mapproviders/openstreetmap.png</file> <file>images/mapproviders/openstreetmap.png</file>
<file>images/mapproviders/google.png</file> <file>images/mapproviders/google.png</file>
......
...@@ -344,39 +344,42 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -344,39 +344,42 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// Only count message if UAS exists for this message // Only count message if UAS exists for this message
if (uas != NULL) if (uas != NULL)
{ {
// Increase receive counter // Increase receive counter
totalReceiveCounter++; totalReceiveCounter++;
currReceiveCounter++; currReceiveCounter++;
// Update last packet index
// Update last message sequence ID
uint8_t expectedIndex;
if (lastIndex[message.sysid][message.compid] == -1) if (lastIndex[message.sysid][message.compid] == -1)
{ {
lastIndex[message.sysid][message.compid] = message.seq; lastIndex[message.sysid][message.compid] = message.seq;
expectedIndex = message.seq;
} }
else else
{ {
uint8_t expectedIndex = lastIndex[message.sysid][message.compid]; // NOTE: Using uint8_t here auto-wraps the number around to 0.
// Now increase to the expected index expectedIndex = lastIndex[message.sysid][message.compid] + 1;
expectedIndex++; }
// Make some noise if a message was skipped
//qDebug() << "SYSID" << message.sysid << "COMPID" << message.compid << "MSGID" << message.msgid << "EXPECTED INDEX:" << expectedIndex << "SEQ" << message.seq; //qDebug() << "SYSID" << message.sysid << "COMPID" << message.compid << "MSGID" << message.msgid << "EXPECTED INDEX:" << expectedIndex << "SEQ" << message.seq;
while(expectedIndex != 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)
{ {
expectedIndex++; lostMessages += 256;
totalLossCounter++;
currLossCounter++;
//qDebug() << "COUNTING ONE DROP!";
} }
qDebug() << QString("Lost %1 messages: expected sequence ID %2 but received %3.").arg(lostMessages).arg(expectedIndex).arg(message.seq);
// Set new lastindex totalLossCounter += lostMessages;
lastIndex[message.sysid][message.compid] = message.seq; currLossCounter += lostMessages;
} }
// if (lastIndex.contains(message.sysid))
// { // Update the last sequence ID
// QMap<int, int>* lastCompIndex = lastIndex.value(message.sysid); lastIndex[message.sysid][message.compid] = message.seq;
// if (lastCompIndex->contains(message.compid))
// while (lastCompIndex->value(message.compid, 0)+1 )
// }
//if ()
// Update on every 32th packet // Update on every 32th packet
if (totalReceiveCounter % 32 == 0) if (totalReceiveCounter % 32 == 0)
...@@ -385,11 +388,9 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -385,11 +388,9 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// Receive loss // Receive loss
float receiveLoss = (double)currLossCounter/(double)(currReceiveCounter+currLossCounter); float receiveLoss = (double)currLossCounter/(double)(currReceiveCounter+currLossCounter);
receiveLoss *= 100.0f; receiveLoss *= 100.0f;
// qDebug() << "LOSSCHANGED" << receiveLoss;
currLossCounter = 0; currLossCounter = 0;
currReceiveCounter = 0; currReceiveCounter = 0;
emit receiveLossChanged(message.sysid, receiveLoss); emit receiveLossChanged(message.sysid, receiveLoss);
//qDebug() << "LOSSCHANGED" << message.sysid<<" "<<receiveLoss;
} }
// The packet is emitted as a whole, as it is only 255 - 261 bytes short // The packet is emitted as a whole, as it is only 255 - 261 bytes short
...@@ -414,7 +415,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -414,7 +415,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
} }
} }
} }
// receiveMutex.unlock();
} }
/** /**
......
...@@ -199,7 +199,7 @@ protected: ...@@ -199,7 +199,7 @@ protected:
bool m_actionGuardEnabled; ///< Action request retransmission enabled bool m_actionGuardEnabled; ///< Action request retransmission enabled
int m_actionRetransmissionTimeout; ///< Timeout for parameter retransmission int m_actionRetransmissionTimeout; ///< Timeout for parameter retransmission
QMutex receiveMutex; ///< Mutex to protect receiveBytes function QMutex receiveMutex; ///< Mutex to protect receiveBytes function
int lastIndex[256][256]; int lastIndex[256][256]; ///< Store the last received sequence ID for each system/componenet pair
int totalReceiveCounter; int totalReceiveCounter;
int totalLossCounter; int totalLossCounter;
int currReceiveCounter; int currReceiveCounter;
......
...@@ -432,9 +432,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -432,9 +432,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
stopLowBattAlarm(); stopLowBattAlarm();
} }
// COMMUNICATIONS DROP RATE // Trigger drop rate updates as needed. Here we convert the incoming
// FIXME // drop_rate_comm value from 1/100 of a percent in a uint16 to a true
emit dropRateChanged(this->getUASID(), state.drop_rate_comm/10000.0f); // 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; break;
case MAVLINK_MSG_ID_ATTITUDE: case MAVLINK_MSG_ID_ATTITUDE:
......
...@@ -132,7 +132,7 @@ void UASWaypointManager::handleGlobalPositionChanged(UASInterface* mav, double l ...@@ -132,7 +132,7 @@ void UASWaypointManager::handleGlobalPositionChanged(UASInterface* mav, double l
void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, quint16 count) 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); protocol_timer.start(PROTOCOL_TIMEOUT_MS);
current_retries = PROTOCOL_MAX_RETRIES; current_retries = PROTOCOL_MAX_RETRIES;
...@@ -172,7 +172,7 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui ...@@ -172,7 +172,7 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui
void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_mission_item_t *wp) 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); protocol_timer.start(PROTOCOL_TIMEOUT_MS);
current_retries = PROTOCOL_MAX_RETRIES; current_retries = PROTOCOL_MAX_RETRIES;
...@@ -222,7 +222,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ ...@@ -222,7 +222,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
void UASWaypointManager::handleWaypointAck(quint8 systemId, quint8 compId, mavlink_mission_ack_t *wpa) 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)) { 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 //all waypoints sent and ack received
protocol_timer.stop(); protocol_timer.stop();
...@@ -241,7 +241,7 @@ void UASWaypointManager::handleWaypointAck(quint8 systemId, quint8 compId, mavli ...@@ -241,7 +241,7 @@ void UASWaypointManager::handleWaypointAck(quint8 systemId, quint8 compId, mavli
void UASWaypointManager::handleWaypointRequest(quint8 systemId, quint8 compId, mavlink_mission_request_t *wpr) 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); protocol_timer.start(PROTOCOL_TIMEOUT_MS);
current_retries = PROTOCOL_MAX_RETRIES; current_retries = PROTOCOL_MAX_RETRIES;
......
...@@ -952,6 +952,7 @@ void HSIDisplay::updateAttitude(UASInterface* uas, double roll, double pitch, do ...@@ -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) void HSIDisplay::updateUserPositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired)
{ {
Q_UNUSED(uasid);
uiXSetCoordinate = xDesired; uiXSetCoordinate = xDesired;
uiYSetCoordinate = yDesired; uiYSetCoordinate = yDesired;
uiZSetCoordinate = zDesired; uiZSetCoordinate = zDesired;
...@@ -962,8 +963,8 @@ void HSIDisplay::updateUserPositionSetpoints(int uasid, float xDesired, float yD ...@@ -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) void HSIDisplay::updatePositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired, quint64 usec)
{ {
Q_UNUSED(usec);
Q_UNUSED(uasid); Q_UNUSED(uasid);
Q_UNUSED(usec);
bodyXSetCoordinate = xDesired; bodyXSetCoordinate = xDesired;
bodyYSetCoordinate = yDesired; bodyYSetCoordinate = yDesired;
bodyZSetCoordinate = zDesired; bodyZSetCoordinate = zDesired;
......
...@@ -55,18 +55,28 @@ QGCToolBar::QGCToolBar(QWidget *parent) : ...@@ -55,18 +55,28 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
// Add internal actions // Add internal actions
// Add MAV widget // Add MAV widget
symbolButton = new QToolButton(this); 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 = new QLabel("------", this);
toolBarNameLabel->setToolTip(tr("Currently controlled vehicle"));
addWidget(toolBarNameLabel);
toolBarSafetyLabel = new QLabel("SAFE", this); toolBarSafetyLabel = new QLabel("SAFE", this);
toolBarSafetyLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #14C814; }"); toolBarSafetyLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #14C814; }");
toolBarSafetyLabel->setToolTip(tr("Vehicle safety state"));
addWidget(toolBarSafetyLabel);
toolBarModeLabel = new QLabel("------", this); toolBarModeLabel = new QLabel("------", this);
toolBarModeLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #3C7B9E; }"); toolBarModeLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #3C7B9E; }");
toolBarModeLabel->setToolTip(tr("Vehicle mode"));
addWidget(toolBarModeLabel);
toolBarStateLabel = new QLabel("------", this); toolBarStateLabel = new QLabel("------", this);
toolBarStateLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #FEC654; }"); toolBarStateLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 14px; color: #FEC654; }");
toolBarWpLabel = new QLabel("WP--", this); toolBarStateLabel->setToolTip(tr("Vehicle state"));
toolBarWpLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 18px; color: #3C7B9E; }"); addWidget(toolBarStateLabel);
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; }");
toolBarBatteryBar = new QProgressBar(this); 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->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); toolBarBatteryBar->setMinimum(0);
...@@ -74,26 +84,34 @@ QGCToolBar::QGCToolBar(QWidget *parent) : ...@@ -74,26 +84,34 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
toolBarBatteryBar->setMinimumWidth(20); toolBarBatteryBar->setMinimumWidth(20);
toolBarBatteryBar->setMaximumWidth(100); toolBarBatteryBar->setMaximumWidth(100);
toolBarBatteryBar->setToolTip(tr("Battery charge level")); toolBarBatteryBar->setToolTip(tr("Battery charge level"));
addWidget(toolBarBatteryBar);
toolBarBatteryVoltageLabel = new QLabel("xx.x V"); toolBarBatteryVoltageLabel = new QLabel("xx.x V");
toolBarBatteryVoltageLabel->setStyleSheet(QString("QLabel { margin: 0px 0px 0px 4px; font: 14px; color: %1; }").arg(QColor(Qt::green).name())); 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; }"); toolBarBatteryVoltageLabel->setToolTip(tr("Battery voltage"));
addWidget(symbolButton);
addWidget(toolBarNameLabel);
addWidget(toolBarSafetyLabel);
addWidget(toolBarModeLabel);
addWidget(toolBarStateLabel);
addWidget(toolBarBatteryBar);
addWidget(toolBarBatteryVoltageLabel); addWidget(toolBarBatteryVoltageLabel);
toolBarWpLabel = new QLabel("WP--", this);
toolBarWpLabel->setStyleSheet("QLabel { margin: 0px 2px; font: 18px; color: #3C7B9E; }");
toolBarWpLabel->setToolTip(tr("Current mission"));
addWidget(toolBarWpLabel); addWidget(toolBarWpLabel);
toolBarDistLabel = new QLabel("--- ---- m", this);
toolBarDistLabel->setToolTip(tr("Distance to current mission"));
addWidget(toolBarDistLabel); 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(toolBarMessageLabel);
//addWidget(new QSpacerItem(20, 0, QSizePolicy::Expanding));
// DONE INITIALIZING BUTTONS // DONE INITIALIZING BUTTONS
// Configure the toolbar for the current default UAS
setActiveUAS(UASManager::instance()->getActiveUAS()); setActiveUAS(UASManager::instance()->getActiveUAS());
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); 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())); connect(&updateViewTimer, SIGNAL(timeout()), this, SLOT(updateView()));
updateViewTimer.start(2000); updateViewTimer.start(2000);
} }
......
...@@ -197,7 +197,7 @@ void WaypointList::loadWaypoints() ...@@ -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.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.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec(); msgBox.exec();
showOfflineWarning = false; showOfflineWarning = false;
} }
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)")); QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)"));
...@@ -263,7 +263,7 @@ void WaypointList::addEditable() ...@@ -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.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.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec(); msgBox.exec();
showOfflineWarning = false; showOfflineWarning = false;
} }
} }
......
...@@ -303,9 +303,6 @@ void QGCMapWidget::updateLocalPosition() ...@@ -303,9 +303,6 @@ void QGCMapWidget::updateLocalPosition()
} }
// Set new lat/lon position of UAV icon // 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()); internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude());
uav->SetUAVPos(pos_lat_lon, system->getAltitude()); uav->SetUAVPos(pos_lat_lon, system->getAltitude());
// Follow status // Follow status
...@@ -317,33 +314,7 @@ void QGCMapWidget::updateLocalPosition() ...@@ -317,33 +314,7 @@ void QGCMapWidget::updateLocalPosition()
void QGCMapWidget::updateLocalPositionEstimates() void QGCMapWidget::updateLocalPositionEstimates()
{ {
QList<UASInterface*> systems = UASManager::instance()->getUASList(); updateLocalPosition();
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);
}
} }
......
...@@ -23,7 +23,6 @@ QGCMAVLinkMessageSender::QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidg ...@@ -23,7 +23,6 @@ QGCMAVLinkMessageSender::QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidg
void QGCMAVLinkMessageSender::refresh() void QGCMAVLinkMessageSender::refresh()
{ {
unsigned int maxUpdateRate = 0;
// Send messages // Send messages
foreach (unsigned int i, managementItems.keys()) foreach (unsigned int i, managementItems.keys())
{ {
...@@ -79,7 +78,7 @@ bool QGCMAVLinkMessageSender::sendMessage(unsigned int msgid) ...@@ -79,7 +78,7 @@ bool QGCMAVLinkMessageSender::sendMessage(unsigned int msgid)
uint8_t* nums = m+messageInfo[msgid].fields[fieldid].wire_offset; uint8_t* nums = m+messageInfo[msgid].fields[fieldid].wire_offset;
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) 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(); nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toInt();
} }
......
...@@ -57,10 +57,20 @@ public slots: ...@@ -57,10 +57,20 @@ public slots:
void updateBattery(UASInterface* uas, double voltage, double percent, int seconds); void updateBattery(UASInterface* uas, double voltage, double percent, int seconds);
void updateCPULoad(UASInterface* uas, double load); 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); 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); void updateSendLoss(int uasId, float sendLoss);
/** @brief Update the error count */ /** @brief Update the error count */
void updateErrorCount(int uasid, QString component, QString device, int count); void updateErrorCount(int uasid, QString component, QString device, int count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment