Commit ba82c210 authored by LM's avatar LM
Browse files

Merge branch 'master' of github.com:mavlink/qgroundcontrol

parents c8d6ba30 27932f5c
......@@ -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))
}
}
......
......@@ -361,8 +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/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
......@@ -370,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 \
......@@ -495,8 +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/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
......@@ -506,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 \
......
......@@ -75,10 +75,10 @@
<file>images/status/audio-volume-medium.svg</file>
<file>images/status/audio-volume-low.svg</file>
<file>images/status/audio-volume-high.svg</file>
<file>images/status/colorbars.png</file>
<file>images/status/colorbars.png</file>
<file>images/style-mission.css</file>
<file>images/splash.png</file>
<file>audio/alert.wav</file>
<file>files/audio/alert.wav</file>
<file>demo-log.txt</file>
<file>images/mapproviders/openstreetmap.png</file>
<file>images/mapproviders/google.png</file>
......
......@@ -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<int, int>* 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<<" "<<receiveLoss;
}
// 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)
}
}
}
// receiveMutex.unlock();
}
/**
......
......@@ -199,7 +199,7 @@ protected:
bool m_actionGuardEnabled; ///< Action request retransmission enabled
int m_actionRetransmissionTimeout; ///< Timeout for parameter retransmission
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 totalLossCounter;
int currReceiveCounter;
......
......@@ -432,10 +432,16 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
stopLowBattAlarm();
}
// COMMUNICATIONS DROP RATE
// FIXME
emit dropRateChanged(this->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:
{
......
......@@ -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;
......
......@@ -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;
......
......@@ -553,7 +553,7 @@ void MainWindow::buildCommonWidgets()
#ifdef QGC_OSG_ENABLED
if (!_3DWidget) {
_3DWidget = Q3DWidgetFactory::get("PIXHAWK");
_3DWidget = Q3DWidgetFactory::get("PIXHAWK", this);
addCentralWidget(_3DWidget, tr("Local 3D"));
}
#endif
......
......@@ -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);
}
......
......@@ -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;
}
}
......
......@@ -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<UASInterface*> 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();
}
......
#include "CameraParams.h"
CameraParams::CameraParams()
: mMinZoomRange(2.0f)
, mFov(30.0f)
, mMinClipRange(1.0f)
, mMaxClipRange(10000.0f)
{
}
float&
CameraParams::minZoomRange(void)
{
return mMinZoomRange;
}
float
CameraParams::minZoomRange(void) const
{
return mMinZoomRange;
}
float&
CameraParams::fov(void)
{
return mFov;
}
float
CameraParams::fov(void) const
{
return mFov;
}
float&
CameraParams::minClipRange(void)
{
return mMinClipRange;
}
float
CameraParams::minClipRange(void) const
{
return mMinClipRange;
}
float&
CameraParams::maxClipRange(void)
{
return mMaxClipRange;
}
float
CameraParams::maxClipRange(void) const
{
return mMaxClipRange;
}
#ifndef CAMERAPARAMS_H
#define CAMERAPARAMS_H
class CameraParams
{
public:
CameraParams();
float& minZoomRange(void);
float minZoomRange(void) const;
float& fov(void);
float fov(void) const;
float& minClipRange(void);
float minClipRange(void) const;
float& maxClipRange(void);
float maxClipRange(void) const;
private:
float mMinZoomRange;
float mFov;
float mMinClipRange;
float mMaxClipRange;
};
#endif // CAMERAPARAMS_H
#include "GlobalViewParams.h"
#include <QStringList>
GlobalViewParams::GlobalViewParams()
: mDisplayWorldGrid(true)
, mImageryType(Imagery::BLANK_MAP)
, mFollowCameraId(-1)
, mFrame(MAV_FRAME_LOCAL_NED)
{
}
bool&
GlobalViewParams::displayWorldGrid(void)
{
return mDisplayWorldGrid;
}
bool
GlobalViewParams::displayWorldGrid(void) const
{
return mDisplayWorldGrid;
}
Imagery::Type&
GlobalViewParams::imageryType(void)
{
return mImageryType;
}
Imagery::Type
GlobalViewParams::imageryType(void) const
{
return mImageryType;
}
int&
GlobalViewParams::followCameraId(void)
{
return mFollowCameraId;
}
int
GlobalViewParams::followCameraId(void) const
{
return mFollowCameraId;
}
MAV_FRAME&
GlobalViewParams::frame(void)
{
return mFrame;
}
MAV_FRAME
GlobalViewParams::frame(void) const
{
return mFrame;
}
void
GlobalViewParams::followCameraChanged(const QString& text)
{
int followCameraId = -1;
if (text.compare("None") == 0)
{
followCameraId = -1;
}
else
{
QStringList list = text.split(" ", QString::SkipEmptyParts);
followCameraId = list.back().toInt();
}
if (followCameraId != mFollowCameraId)
{
mFollowCameraId = followCameraId;
emit followCameraChanged(mFollowCameraId);
}
}
void
GlobalViewParams::frameChanged(const QString& text)
{
if (text.compare("Global") == 0)
{
mFrame = MAV_FRAME_GLOBAL;
}
else if (text.compare("Local") == 0)
{
mFrame = MAV_FRAME_LOCAL_NED;
}
}
void
GlobalViewParams::imageryTypeChanged(int index)
{
mImageryType = static_cast<Imagery::Type>(index);
}
void
GlobalViewParams::toggleWorldGrid(int state)
{
if (state == Qt::Checked)
{
mDisplayWorldGrid = true;
}
else
{
mDisplayWorldGrid = false;
}
}
#ifndef GLOBALVIEWPARAMS_H
#define GLOBALVIEWPARAMS_H
#include <QObject>
#include <QString>
#include <QVector>
#include "QGCMAVLink.h"
#include "Imagery.h"
class GlobalViewParams : public QObject
{
Q_OBJECT
public:
GlobalViewParams();
bool& displayWorldGrid(void);
bool displayWorldGrid(void) const;
Imagery::Type& imageryType(void);
Imagery::Type imageryType(void) const;
int& followCameraId(void);
int followCameraId(void) const;
MAV_FRAME& frame(void);
MAV_FRAME frame(void) const;
public slots:
void followCameraChanged(const QString& text);
void frameChanged(const QString &text);
void imageryTypeChanged(int index);
void toggleWorldGrid(int state);
signals:
void followCameraChanged(int systemId);
private:
bool mDisplayWorldGrid;
Imagery::Type mImageryType;
int mFollowCameraId;
MAV_FRAME mFrame;
};
typedef QSharedPointer<GlobalViewParams> GlobalViewParamsPtr;
#endif // GLOBALVIEWPARAMS_H
......@@ -32,19 +32,19 @@
#include "ImageWindowGeode.h"
ImageWindowGeode::ImageWindowGeode()
: border(5)
: mBorder(5)
, mImage(new osg::Image)
{
}
void
ImageWindowGeode::init(const QString& caption, const osg::Vec4& backgroundColor,
osg::ref_ptr<osg::Image>& image,
osg::ref_ptr<osgText::Font>& font)
{
// image
osg::ref_ptr<osg::Geometry> imageGeometry = new osg::Geometry;
imageVertices = new osg::Vec3Array(4);
mImageVertices = new osg::Vec3Array(4);
osg::ref_ptr<osg::Vec2Array> textureCoords = new osg::Vec2Array;
textureCoords->push_back(osg::Vec2(0.0f, 1.0f));
......@@ -57,15 +57,15 @@ ImageWindowGeode::init(const QString& caption, const osg::Vec4& backgroundColor,
imageGeometry->setColorArray(imageColors);
imageGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
imageGeometry->setVertexArray(imageVertices);
imageGeometry->setVertexArray(mImageVertices);
imageGeometry->setTexCoordArray(0, textureCoords);
imageGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,
0, imageVertices->size()));
0, mImageVertices->size()));
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
texture->setDataVariance(osg::Object::DYNAMIC);
texture->setImage(image);
texture->setImage(mImage);
texture->setResizeNonPowerOfTwoHint(false);
imageGeometry->getOrCreateStateSet()->
......@@ -74,10 +74,10 @@ ImageWindowGeode::init(const QString& caption, const osg::Vec4& backgroundColor,
// background
osg::ref_ptr<osg::Geometry> backgroundGeometry = new osg::Geometry;
backgroundVertices = new osg::Vec3Array(4);
backgroundGeometry->setVertexArray(backgroundVertices);
mBackgroundVertices = new osg::Vec3Array(4);
backgroundGeometry->setVertexArray(mBackgroundVertices);
backgroundGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,
0, backgroundVertices->size()));
0, mBackgroundVertices->size()));
osg::ref_ptr<osg::Vec4Array> backgroundColors(new osg::Vec4Array);
backgroundColors->push_back(backgroundColor);
backgroundGeometry->setColorArray(backgroundColors);
......@@ -85,16 +85,16 @@ ImageWindowGeode::init(const QString& caption, const osg::Vec4& backgroundColor,
backgroundGeometry->setUseDisplayList(false);
// caption
text = new osgText::Text;
text->setText(caption.toStdString().c_str());
text->setCharacterSize(11);
text->setFont(font);
text->setAxisAlignment(osgText::Text::SCREEN);
text->setColor(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
mText = new osgText::Text;
mText->setText(caption.toStdString().c_str());
mText->setCharacterSize(11);
mText->setFont(font);
mText->setAxisAlignment(osgText::Text::SCREEN);
mText->setColor(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
addDrawable(imageGeometry);
addDrawable(backgroundGeometry);
addDrawable(text);
addDrawable(mText);
setAttributes(0, 0, 0, 0);
}
......@@ -102,20 +102,26 @@ ImageWindowGeode::init(const QString& caption, const osg::Vec4& backgroundColor,
void
ImageWindowGeode::setAttributes(int x, int y, int width, int height)
{
int imageWidth = width - border * 2;
int imageHeight = height - border * 2 - 15;
int imageXPosition = x + border;
int imageYPosition = y + border;
imageVertices->at(0) = osg::Vec3(imageXPosition, imageYPosition, 0);
imageVertices->at(1) = osg::Vec3(imageXPosition + imageWidth, imageYPosition, 0);
imageVertices->at(2) = osg::Vec3(imageXPosition + imageWidth, imageYPosition + imageHeight, 0);
imageVertices->at(3) = osg::Vec3(imageXPosition, imageYPosition + imageHeight, 0);
text->setPosition(osg::Vec3(imageXPosition, imageYPosition + imageHeight + 5, 0));
backgroundVertices->at(0) = osg::Vec3(x, y, -1);
backgroundVertices->at(1) = osg::Vec3(x + width, y, -1);
backgroundVertices->at(2) = osg::Vec3(x + width, y + height, -1);
backgroundVertices->at(3) = osg::Vec3(x, y + height, -1);
int imageWidth = width - mBorder * 2;
int imageHeight = height - mBorder * 2 - 15;
int imageXPosition = x + mBorder;
int imageYPosition = y + mBorder;
mImageVertices->at(0) = osg::Vec3(imageXPosition, imageYPosition, 0);
mImageVertices->at(1) = osg::Vec3(imageXPosition + imageWidth, imageYPosition, 0);
mImageVertices->at(2) = osg::Vec3(imageXPosition + imageWidth, imageYPosition + imageHeight, 0);
mImageVertices->at(3) = osg::Vec3(imageXPosition, imageYPosition + imageHeight, 0);
mText->setPosition(osg::Vec3(imageXPosition, imageYPosition + imageHeight + 5, 0));
mBackgroundVertices->at(0) = osg::Vec3(x, y, -1);
mBackgroundVertices->at(1) = osg::Vec3(x + width, y, -1);
mBackgroundVertices->at(2) = osg::Vec3(x + width, y + height, -1);
mBackgroundVertices->at(3) = osg::Vec3(x, y + height, -1);
}
osg::ref_ptr<osg::Image>&
ImageWindowGeode::image(void)
{
return mImage;
}
......@@ -42,17 +42,18 @@ class ImageWindowGeode : public osg::Geode
public:
ImageWindowGeode();
void init(const QString& caption, const osg::Vec4& backgroundColor,
osg::ref_ptr<osg::Image>& image,
osg::ref_ptr<osgText::Font>& font);
void setAttributes(int x, int y, int width, int height);
osg::ref_ptr<osg::Image>& image(void);
private:
int border;
int mBorder;
osg::ref_ptr<osg::Vec3Array> imageVertices;
osg::ref_ptr<osg::Vec3Array> backgroundVertices;
osg::ref_ptr<osgText::Text> text;
osg::ref_ptr<osg::Image> mImage;
osg::ref_ptr<osg::Vec3Array> mImageVertices;
osg::ref_ptr<osg::Vec3Array> mBackgroundVertices;
osg::ref_ptr<osgText::Text> mText;
};
#endif // IMAGEWINDOWGEODE_H
......@@ -46,14 +46,14 @@ Imagery::Imagery()
}
Imagery::ImageryType
Imagery::Type
Imagery::getImageryType(void) const
{
return currentImageryType;
}
void
Imagery::setImageryType(ImageryType type)
Imagery::setImageryType(Imagery::Type type)
{
currentImageryType = type;
}
......
......@@ -41,7 +41,7 @@ This file is part of the QGROUNDCONTROL project
class Imagery : public osg::Geode
{
public:
enum ImageryType {
enum Type {
BLANK_MAP = 0,
GOOGLE_MAP = 1,
GOOGLE_SATELLITE = 2,
......@@ -50,8 +50,8 @@ public:
Imagery();
ImageryType getImageryType(void) const;
void setImageryType(ImageryType type);
Type getImageryType(void) const;
void setImageryType(Type type);
void setOffset(double xOffset, double yOffset);
void prefetch2D(double windowWidth, double windowHeight,
......@@ -104,7 +104,7 @@ private:
QScopedPointer<TextureCache> textureCache;
ImageryType currentImageryType;
Type currentImageryType;
double xOffset;
double yOffset;
......
Supports Markdown
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