Commit 763ec366 authored by pixhawk's avatar pixhawk

Merge branch 'v10release' of git://github.com/pixhawk/qgroundcontrol into offline-wplist

parents 746fa180 efb95d00
......@@ -37,7 +37,7 @@ win32-msvc2008|win32-msvc2010 {
DEFINES += _TTY_NOWARN_
# MAC OS X
macx-g++42 {
macx|macx-g++42|macx-g++: {
# COMPILER_VERSION = $$system(gcc -v)
#message(Using compiler $$COMPILER_VERSION)
......@@ -93,7 +93,66 @@ macx-g++42 {
# Copy parameter tooltip files
QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$TARGETDIR/qgroundcontrol.app/Contents/MacOS
# Copy libraries
QMAKE_POST_LINK += && cp -rf $$BASEDIR/lib/mac64/lib/* $$TARGETDIR/qgroundcontrol.app/Contents/MacOS
QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/qgroundcontrol.app/Contents/libs
QMAKE_POST_LINK += && cp -rf $$BASEDIR/lib/mac64/lib/* $$TARGETDIR/qgroundcontrol.app/Contents/libs
# Fix library paths inside executable
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
QMAKE_POST_LINK += && install_name_tool -change libosgViewer.dylib "@executable_path/../libs/libosgViewer.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
QMAKE_POST_LINK += && install_name_tool -change libosgWidget.dylib "@executable_path/../libs/libosgWidget.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol
# Fix library paths within libraries (inter-library dependencies)
# OSG GA LIBRARY
QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib
QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib
# OSG DB LIBRARY
QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgDB.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgDB.dylib
QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgDB.dylib
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgDB.dylib
# OSG TEXT LIBRARY
QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib
QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib
# OSG UTIL LIBRARY
QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgUtil.dylib
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgUtil.dylib
# OSG VIEWER LIBRARY
QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib
QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib
# OSG WIDGET LIBRARY
QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib
QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib
QMAKE_POST_LINK += && install_name_tool -change libosgViewer.dylib "@executable_path/../libs/libosgViewer.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib
# CORE OSG LIBRARY
QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosg.dylib
# Copy model files
#QMAKE_POST_LINK += && cp -f $$BASEDIR/models/*.dae $$TARGETDIR/qgroundcontrol.app/Contents/MacOs
......@@ -131,6 +190,8 @@ macx-g++42 {
# GNU/Linux
linux-g++ {
CONFIG -= console
debug {
#DESTDIR = $$TARGETDIR/debug
#CONFIG += debug console
......@@ -215,6 +276,8 @@ message("Compiling for linux 32")
linux-g++-64 {
CONFIG -= console
debug {
#DESTDIR = $$TARGETDIR/debug
#CONFIG += debug console
......
......@@ -180,9 +180,11 @@ INCLUDEPATH += . \
include(thirdParty/qserialport/qgroundcontrol-qserialport.pri)
# Serial port detection (ripped-off from qextserialport library)
macx::SOURCES += src/libs/qextserialport/qextserialenumerator_osx.cpp
macx|macx-g++|macx-g++42::SOURCES += src/libs/qextserialport/qextserialenumerator_osx.cpp
linux-g++::SOURCES += src/libs/qextserialport/qextserialenumerator_unix.cpp
linux-g++-64::SOURCES += src/libs/qextserialport/qextserialenumerator_unix.cpp
win32::SOURCES += src/libs/qextserialport/qextserialenumerator_win.cpp
win32-msvc2008|win32-msvc2010::SOURCES += src/libs/qextserialport/qextserialenumerator_win.cpp
# Input
FORMS += src/ui/MainWindow.ui \
......@@ -233,7 +235,11 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QGCMAVLinkInspector.ui \
src/ui/WaypointViewOnlyView.ui \
src/ui/WaypointEditableView.ui \
src/ui/UnconnectedUASInfoWidget.ui
src/ui/UnconnectedUASInfoWidget.ui \
src/ui/mavlink/QGCMAVLinkMessageSender.ui \
src/ui/firmwareupdate/QGCFirmwareUpdateWidget.ui \
src/ui/QGCPluginHost.ui \
src/ui/firmwareupdate/QGCPX4FirmwareUpdate.ui
INCLUDEPATH += src \
src/ui \
src/ui/linechart \
......@@ -351,10 +357,14 @@ HEADERS += src/MG.h \
src/ui/WaypointViewOnlyView.h \
src/ui/WaypointEditableView.h \
src/ui/UnconnectedUASInfoWidget.h \
src/ui/QGCRGBDView.h
src/ui/QGCRGBDView.h \
src/ui/mavlink/QGCMAVLinkMessageSender.h \
src/ui/firmwareupdate/QGCFirmwareUpdateWidget.h \
src/ui/QGCPluginHost.h \
src/ui/firmwareupdate/QGCPX4FirmwareUpdate.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|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
contains(DEPENDENCIES_PRESENT, osg) {
message("Including headers for OpenSceneGraph")
......@@ -479,10 +489,14 @@ SOURCES += src/main.cc \
src/ui/WaypointViewOnlyView.cc \
src/ui/WaypointEditableView.cc \
src/ui/UnconnectedUASInfoWidget.cc \
src/ui/QGCRGBDView.cc
src/ui/QGCRGBDView.cc \
src/ui/mavlink/QGCMAVLinkMessageSender.cc \
src/ui/firmwareupdate/QGCFirmwareUpdateWidget.cc \
src/ui/QGCPluginHost.cc \
src/ui/firmwareupdate/QGCPX4FirmwareUpdate.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|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
# Enable OSG only if it has been found
contains(DEPENDENCIES_PRESENT, osg) {
......
This diff is collapsed.
......@@ -50,7 +50,8 @@ void ArduPilotMegaMAV::receiveMessage(LinkInterface* link, mavlink_message_t mes
if (message.sysid == uasId) {
// Handle your special messages
switch (message.msgid) {
case MAVLINK_MSG_ID_HEARTBEAT: {
case MAVLINK_MSG_ID_HEARTBEAT:
{
//qDebug() << "ARDUPILOT RECEIVED HEARTBEAT";
break;
}
......
......@@ -100,19 +100,19 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit processChanged(this->uasId, payload.watchdog_id, payload.process_id, payload.state, (payload.muted == 1) ? true : false, payload.crashes, payload.pid);
}
break;
case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE: {
mavlink_vision_position_estimate_t pos;
mavlink_msg_vision_position_estimate_decode(&message, &pos);
quint64 time = getUnixTime(pos.usec);
//emit valueChanged(uasId, "vis. time", pos.usec, time);
emit valueChanged(uasId, "vis. roll", "rad", pos.roll, time);
emit valueChanged(uasId, "vis. pitch", "rad", pos.pitch, time);
emit valueChanged(uasId, "vis. yaw", "rad", pos.yaw, time);
emit valueChanged(uasId, "vis. x", "m", pos.x, time);
emit valueChanged(uasId, "vis. y", "m", pos.y, time);
emit valueChanged(uasId, "vis. z", "m", pos.z, time);
}
break;
// case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE: {
// mavlink_vision_position_estimate_t pos;
// mavlink_msg_vision_position_estimate_decode(&message, &pos);
// quint64 time = getUnixTime(pos.usec);
// //emit valueChanged(uasId, "vis. time", pos.usec, time);
// emit valueChanged(uasId, "vis. roll", "rad", pos.roll, time);
// emit valueChanged(uasId, "vis. pitch", "rad", pos.pitch, time);
// emit valueChanged(uasId, "vis. yaw", "rad", pos.yaw, time);
// emit valueChanged(uasId, "vis. x", "m", pos.x, time);
// emit valueChanged(uasId, "vis. y", "m", pos.y, time);
// emit valueChanged(uasId, "vis. z", "m", pos.z, time);
// }
// break;
// case MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE: {
// mavlink_global_vision_position_estimate_t pos;
// mavlink_msg_global_vision_position_estimate_decode(&message, &pos);
......@@ -126,29 +126,29 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
// emit valueChanged(uasId, "glob. vis. z", "m", pos.z, time);
// }
// break;
case MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE: {
mavlink_vicon_position_estimate_t pos;
mavlink_msg_vicon_position_estimate_decode(&message, &pos);
quint64 time = getUnixTime(pos.usec);
//emit valueChanged(uasId, "vis. time", pos.usec, time);
emit valueChanged(uasId, "vicon roll", "rad", pos.roll, time);
emit valueChanged(uasId, "vicon pitch", "rad", pos.pitch, time);
emit valueChanged(uasId, "vicon yaw", "rad", pos.yaw, time);
emit valueChanged(uasId, "vicon x", "m", pos.x, time);
emit valueChanged(uasId, "vicon y", "m", pos.y, time);
emit valueChanged(uasId, "vicon z", "m", pos.z, time);
//emit localPositionChanged(this, pos.x, pos.y, pos.z, time);
}
break;
case MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE: {
mavlink_vision_speed_estimate_t speed;
mavlink_msg_vision_speed_estimate_decode(&message, &speed);
quint64 time = getUnixTime(speed.usec);
emit valueChanged(uasId, "vis. speed x", "m/s", speed.x, time);
emit valueChanged(uasId, "vis. speed y", "m/s", speed.y, time);
emit valueChanged(uasId, "vis. speed z", "m/s", speed.z, time);
}
break;
// case MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE: {
// mavlink_vicon_position_estimate_t pos;
// mavlink_msg_vicon_position_estimate_decode(&message, &pos);
// quint64 time = getUnixTime(pos.usec);
// //emit valueChanged(uasId, "vis. time", pos.usec, time);
// emit valueChanged(uasId, "vicon roll", "rad", pos.roll, time);
// emit valueChanged(uasId, "vicon pitch", "rad", pos.pitch, time);
// emit valueChanged(uasId, "vicon yaw", "rad", pos.yaw, time);
// emit valueChanged(uasId, "vicon x", "m", pos.x, time);
// emit valueChanged(uasId, "vicon y", "m", pos.y, time);
// emit valueChanged(uasId, "vicon z", "m", pos.z, time);
// //emit localPositionChanged(this, pos.x, pos.y, pos.z, time);
// }
// break;
// case MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE: {
// mavlink_vision_speed_estimate_t speed;
// mavlink_msg_vision_speed_estimate_decode(&message, &speed);
// quint64 time = getUnixTime(speed.usec);
// emit valueChanged(uasId, "vis. speed x", "m/s", speed.x, time);
// emit valueChanged(uasId, "vis. speed y", "m/s", speed.y, time);
// emit valueChanged(uasId, "vis. speed z", "m/s", speed.z, time);
// }
// break;
// case MAVLINK_MSG_ID_CONTROL_STATUS:
// {
// mavlink_control_status_t status;
......
......@@ -164,7 +164,8 @@ void UAS::updateState()
void UAS::setSelected()
{
if (UASManager::instance()->getActiveUAS() != this) {
if (UASManager::instance()->getActiveUAS() != this)
{
UASManager::instance()->setActiveUAS(this);
emit systemSelected(true);
}
......@@ -175,24 +176,6 @@ bool UAS::getSelected() const
return (UASManager::instance()->getActiveUAS() == this);
}
void UAS::receiveMessageNamedValue(const mavlink_message_t& message)
{
if (message.msgid == MAVLINK_MSG_ID_NAMED_VALUE_FLOAT)
{
mavlink_named_value_float_t val;
mavlink_msg_named_value_float_decode(&message, &val);
QByteArray bytes(val.name, MAVLINK_MSG_NAMED_VALUE_FLOAT_FIELD_NAME_LEN);
emit valueChanged(this->getUASID(), QString(bytes), tr("raw"), val.value, getUnixTime());
}
else if (message.msgid == MAVLINK_MSG_ID_NAMED_VALUE_INT)
{
mavlink_named_value_int_t val;
mavlink_msg_named_value_int_decode(&message, &val);
QByteArray bytes(val.name, MAVLINK_MSG_NAMED_VALUE_INT_FIELD_NAME_LEN);
emit valueChanged(this->getUASID(), QString(bytes), tr("raw"), val.value, getUnixTime());
}
}
void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
if (!link) return;
......@@ -201,10 +184,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
addLink(link);
// qDebug() << __FILE__ << __LINE__ << "ADDED LINK!" << link->getName();
}
// else
// {
// qDebug() << __FILE__ << __LINE__ << "DID NOT ADD LINK" << link->getName() << "ALREADY IN LIST";
// }
// qDebug() << "UAS RECEIVED from" << message.sysid << "component" << message.compid << "msg id" << message.msgid << "seq no" << message.seq;
......@@ -356,11 +335,11 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
}
break;
case MAVLINK_MSG_ID_NAMED_VALUE_FLOAT:
case MAVLINK_MSG_ID_NAMED_VALUE_INT:
// Receive named value message
receiveMessageNamedValue(message);
break;
// case MAVLINK_MSG_ID_NAMED_VALUE_FLOAT:
// case MAVLINK_MSG_ID_NAMED_VALUE_INT:
// // Receive named value message
// receiveMessageNamedValue(message);
// break;
case MAVLINK_MSG_ID_SYS_STATUS:
{
if (multiComponentSourceDetected && message.compid != MAV_COMP_ID_IMU_2)
......@@ -429,6 +408,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
// compass = 0.0f;
// }
attitudeKnown = true;
emit attitudeChanged(this, roll, pitch, yaw, time);
emit attitudeSpeedChanged(uasId, attitude.rollspeed, attitude.pitchspeed, attitude.yawspeed, time);
......@@ -938,20 +918,10 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
case MAVLINK_MSG_ID_SCALED_PRESSURE:
case MAVLINK_MSG_ID_SERVO_OUTPUT_RAW:
case MAVLINK_MSG_ID_OPTICAL_FLOW:
break;
case MAVLINK_MSG_ID_DEBUG_VECT:
{
mavlink_debug_vect_t debug;
mavlink_msg_debug_vect_decode(&message, &debug);
debug.name[MAVLINK_MSG_DEBUG_VECT_FIELD_NAME_LEN-1] = '\0';
QString name(debug.name);
quint64 time = getUnixTime(debug.time_usec);
emit valueChanged(uasId, name+".x", "raw", debug.x, time);
emit valueChanged(uasId, name+".y", "raw", debug.y, time);
emit valueChanged(uasId, name+".z", "raw", debug.z, time);
}
break;
case MAVLINK_MSG_ID_DEBUG:
case MAVLINK_MSG_ID_NAMED_VALUE_FLOAT:
case MAVLINK_MSG_ID_NAMED_VALUE_INT:
break;
default:
{
......
......@@ -577,9 +577,9 @@ protected slots:
/** @brief Read settings from disk */
void readSettings();
// MESSAGE RECEPTION
/** @brief Receive a named value message */
void receiveMessageNamedValue(const mavlink_message_t& message);
// // MESSAGE RECEPTION
// /** @brief Receive a named value message */
// void receiveMessageNamedValue(const mavlink_message_t& message);
private:
// unsigned int mode; ///< The current mode of the MAV
......
......@@ -11,8 +11,11 @@ MAVLinkDecoder::MAVLinkDecoder(MAVLinkProtocol* protocol, QObject *parent) :
{
componentID[i] = -1;
componentMulti[i] = false;
onboardTimeOffset[i] = 0;
}
// Fill filter
messageFilter.insert(MAVLINK_MSG_ID_HEARTBEAT, false);
messageFilter.insert(MAVLINK_MSG_ID_SYS_STATUS, false);
......@@ -24,8 +27,6 @@ MAVLinkDecoder::MAVLinkDecoder(MAVLinkProtocol* protocol, QObject *parent) :
messageFilter.insert(MAVLINK_MSG_ID_MISSION_ITEM, false);
messageFilter.insert(MAVLINK_MSG_ID_MISSION_COUNT, false);
messageFilter.insert(MAVLINK_MSG_ID_MISSION_ACK, false);
messageFilter.insert(MAVLINK_MSG_ID_NAMED_VALUE_FLOAT, false);
messageFilter.insert(MAVLINK_MSG_ID_NAMED_VALUE_INT, false);
textMessageFilter.insert(MAVLINK_MSG_ID_DEBUG, false);
textMessageFilter.insert(MAVLINK_MSG_ID_DEBUG_VECT, false);
......@@ -41,37 +42,100 @@ void MAVLinkDecoder::receiveMessage(LinkInterface* link,mavlink_message_t messag
memcpy(receivedMessages+message.msgid, &message, sizeof(mavlink_message_t));
uint8_t msgid = message.msgid;
QString messageName("%1 (#%2)");
messageName = messageName.arg(messageInfo[msgid].name).arg(msgid);
// See if first value is a time value
quint64 time = 0;
uint8_t fieldid = 0;
uint8_t* m = ((uint8_t*)(receivedMessages+msgid))+8;
if (QString(messageInfo[msgid].fields[fieldid].name) == QString("time_boot_ms") && messageInfo[msgid].fields[fieldid].type == MAVLINK_TYPE_UINT32_T)
// Handle time sync message
if (message.msgid == MAVLINK_MSG_ID_SYSTEM_TIME && message.compid == 200)
{
time = *((quint32*)(m+messageInfo[msgid].fields[fieldid].wire_offset));
}
else if (QString(messageInfo[msgid].fields[fieldid].name) == QString("time_usec") && messageInfo[msgid].fields[fieldid].type == MAVLINK_TYPE_UINT64_T)
{
time = *((quint64*)(m+messageInfo[msgid].fields[fieldid].wire_offset));
mavlink_system_time_t timebase;
mavlink_msg_system_time_decode(&message, &timebase);
onboardTimeOffset[message.sysid] = timebase.time_unix_usec/1000 - timebase.time_boot_ms;
onboardToGCSUnixTimeOffsetAndDelay[message.sysid] = static_cast<qint64>(QGC::groundTimeMilliseconds() - timebase.time_unix_usec/1000);
}
else
{
// First value is not time, send out value 0
emitFieldValue(&message, fieldid, time);
}
// Send out field values from 1..n
for (unsigned int i = 1; i < messageInfo[msgid].num_fields; ++i)
{
emitFieldValue(&message, i, time);
QString messageName("%1 (#%2)");
messageName = messageName.arg(messageInfo[msgid].name).arg(msgid);
// See if first value is a time value
quint64 time = 0;
uint8_t fieldid = 0;
uint8_t* m = ((uint8_t*)(receivedMessages+msgid))+8;
if (QString(messageInfo[msgid].fields[fieldid].name) == QString("time_boot_ms") && messageInfo[msgid].fields[fieldid].type == MAVLINK_TYPE_UINT32_T)
{
time = *((quint32*)(m+messageInfo[msgid].fields[fieldid].wire_offset));
}
else if (QString(messageInfo[msgid].fields[fieldid].name).contains("usec") && messageInfo[msgid].fields[fieldid].type == MAVLINK_TYPE_UINT64_T)
{
time = *((quint64*)(m+messageInfo[msgid].fields[fieldid].wire_offset));
time = time/1000; // Scale to milliseconds
}
else
{
// First value is not time, send out value 0
emitFieldValue(&message, fieldid, getUnixTimeFromMs(message.sysid, 0));
}
// Align time to global time
time = getUnixTimeFromMs(message.sysid, time);
// Send out field values from 1..n
for (unsigned int i = 1; i < messageInfo[msgid].num_fields; ++i)
{
emitFieldValue(&message, i, time);
}
}
// Send out combined math expressions
// FIXME XXX TODO
}
quint64 MAVLinkDecoder::getUnixTimeFromMs(int systemID, quint64 time)
{
quint64 ret = 0;
if (time == 0)
{
ret = QGC::groundTimeMilliseconds() - onboardToGCSUnixTimeOffsetAndDelay[systemID];
}
// Check if time is smaller than 40 years,
// assuming no system without Unix timestamp
// runs longer than 40 years continuously without
// reboot. In worst case this will add/subtract the
// communication delay between GCS and MAV,
// it will never alter the timestamp in a safety
// critical way.
//
// Calculation:
// 40 years
// 365 days
// 24 hours
// 60 minutes
// 60 seconds
// 1000 milliseconds
// 1000 microseconds
#ifndef _MSC_VER
else if (time < 1261440000000LLU)
#else
else if (time < 1261440000000)
#endif
{
if (onboardTimeOffset[systemID] == 0 || time < (firstOnboardTime[systemID]-2000))
{
firstOnboardTime[systemID] = time;
onboardTimeOffset[systemID] = QGC::groundTimeMilliseconds() - time;
}
ret = time + onboardTimeOffset[systemID];
}
else
{
// Time is not zero and larger than 40 years -> has to be
// a Unix epoch timestamp. Do nothing.
ret = time;
}
return ret;
}
void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64 time)
{
bool multiComponentSourceDetected = false;
......@@ -102,7 +166,41 @@ void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64
uint8_t* m = ((uint8_t*)(receivedMessages+msgid))+8;
QString name("%1.%2");
QString unit("");
name = name.arg(messageInfo[msgid].name, fieldName);
// Debug vector messages
if (msgid == MAVLINK_MSG_ID_DEBUG_VECT)
{
mavlink_debug_vect_t debug;
mavlink_msg_debug_vect_decode(msg, &debug);
name = name.arg(QString(debug.name), fieldName);
time = debug.time_usec / 1000;
}
else if (msgid == MAVLINK_MSG_ID_DEBUG)
{
mavlink_debug_t debug;
mavlink_msg_debug_decode(msg, &debug);
name = name.arg(QString("debug")).arg(debug.ind);
time = debug.time_boot_ms;
}
else if (msgid == MAVLINK_MSG_ID_NAMED_VALUE_FLOAT)
{
mavlink_named_value_float_t debug;
mavlink_msg_named_value_float_decode(msg, &debug);
name = name.arg(debug.name).arg(fieldName);
time = debug.time_boot_ms;
}
else if (msgid == MAVLINK_MSG_ID_NAMED_VALUE_INT)
{
mavlink_named_value_int_t debug;
mavlink_msg_named_value_int_decode(msg, &debug);
name = name.arg(debug.name).arg(fieldName);
time = debug.time_boot_ms;
}
else
{
name = name.arg(messageInfo[msgid].name, fieldName);
}
if (multiComponentSourceDetected) name.prepend(QString("C%1:").arg(msg->compid));
name.prepend(QString("M%1:").arg(msg->sysid));
switch (messageInfo[msgid].fields[fieldid].type)
......
......@@ -25,6 +25,8 @@ public slots:
protected:
/** @brief Emit the value of one message field */
void emitFieldValue(mavlink_message_t* msg, int fieldid, quint64 time);
/** @brief Shift a timestamp in Unix time if necessary */
quint64 getUnixTimeFromMs(int systemID, quint64 time);
mavlink_message_t receivedMessages[256]; ///< Available / known messages
mavlink_message_info_t messageInfo[256]; ///< Message information
......@@ -32,6 +34,9 @@ protected:
QMap<uint16_t, bool> textMessageFilter; ///< Message/field names not to emit in text mode
int componentID[256]; ///< Multi component detection
bool componentMulti[256]; ///< Multi components detected
quint64 onboardTimeOffset[256]; ///< Offset of onboard time from Unix epoch (of the receiving GCS)
qint64 onboardToGCSUnixTimeOffsetAndDelay[256]; ///< Offset of onboard time and GCS Unix time
quint64 firstOnboardTime[256]; ///< First seen onboard time
};
......
......@@ -161,12 +161,14 @@ void MAVLinkSettingsWidget::chooseLogfileName()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Specify MAVLink log file name"), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), tr("MAVLink Logfile (*.mavlink);;"));
if (!fileName.endsWith(".mavlink")) {
if (!fileName.endsWith(".mavlink"))
{
fileName.append(".mavlink");
}
QFileInfo file(fileName);
if (file.exists() && !file.isWritable()) {
if (file.exists() && !file.isWritable())
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(tr("The selected logfile is not writable"));
......@@ -174,7 +176,9 @@ void MAVLinkSettingsWidget::chooseLogfileName()
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
} else {
}
else
{
updateLogfileName(fileName);
protocol->setLogfileName(fileName);
}
......@@ -189,12 +193,15 @@ void MAVLinkSettingsWidget::enableDroneOS(bool enable)
// Delete from all lists first
UDPLink* firstUdp = NULL;
QList<LinkInterface*> links = LinkManager::instance()->getLinksForProtocol(protocol);
foreach (LinkInterface* link, links) {
foreach (LinkInterface* link, links)
{
UDPLink* udp = dynamic_cast<UDPLink*>(link);
if (udp) {
if (udp)
{
if (!firstUdp) firstUdp = udp;
// Remove current hosts
for (int i = 0; i < m_ui->droneOSComboBox->count(); ++i) {
for (int i = 0; i < m_ui->droneOSComboBox->count(); ++i)
{
QString oldHostString = m_ui->droneOSComboBox->itemText(i);
oldHostString = hostString.split(":").first();
udp->removeHost(oldHostString);
......@@ -203,8 +210,10 @@ void MAVLinkSettingsWidget::enableDroneOS(bool enable)
}
// Re-add if enabled
if (enable) {
if (firstUdp) {
if (enable)
{
if (firstUdp)
{
firstUdp->addHost(hostString);
}
// Set key
......
This diff is collapsed.
......@@ -55,7 +55,6 @@ This file is part of the QGROUNDCONTROL project
#include "JoystickWidget.h"
#include "input/JoystickInput.h"
#include "DebugConsole.h"
//#include "MapWidget.h"
#include "ParameterInterface.h"
#include "XMLCommProtocolWidget.h"
#include "HDDisplay.h"
......@@ -80,6 +79,8 @@ This file is part of the QGROUNDCONTROL project
#include "MAVLinkDecoder.h"
class QGCMapTool;
class QGCMAVLinkMessageSender;
class QGCFirmwareUpdate;
class QSplashScreen;
/**
......@@ -154,6 +155,8 @@ public slots:
void loadOperatorView();
/** @brief Load MAVLink XML generator view */
void loadMAVLinkView();
/** @brief Load firmware update view */
void loadFirmwareUpdateView();
/** @brief Show the online help for users */
void showHelp();
......@@ -241,13 +244,11 @@ protected:
VIEW_OPERATOR,
VIEW_PILOT,
VIEW_MAVLINK,
VIEW_FIRMWAREUPDATE,
VIEW_UNCONNECTED, ///< View in unconnected mode, when no UAS is available
VIEW_FULL ///< All widgets shown at once
} VIEW_SECTIONS;
// QHash<int, QAction*> toolsMenuActions; // Holds ptr to the Menu Actions
// QHash<int, QWidget*> dockWidgets; // Holds ptr to the Actual Dock widget
/**
* @brief Adds an already instantiated QDockedWidget to the Tools Menu
*
......@@ -314,12 +315,10 @@ protected:
#ifdef QGC_OSG_ENABLED
QPointer<QWidget> _3DWidget;
#endif
#ifdef QGC_OSGEARTH_ENABLED
QPointer<QWidget> _3DMapWidget;
#endif
#if (defined _MSC_VER) || (defined Q_OS_MAC)
QPointer<QGCGoogleEarthView> gEarthWidget;
#endif
QPointer<QGCFirmwareUpdate> firmwareUpdateWidget;
// Dock widgets
QPointer<QDockWidget> controlDockWidget;
......@@ -353,6 +352,7 @@ protected:
QPointer<QDockWidget> mavlinkInspectorWidget;
QPointer<MAVLinkDecoder> mavlinkDecoder;
QPointer<QDockWidget> mavlinkSenderWidget;
QGCMAVLinkLogPlayer* logPlayer;
// Popup widgets
......
......@@ -51,7 +51,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>25</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
......@@ -108,7 +108,7 @@
</widget>
<widget class="QMenu" name="menuTools">
<property name="title">
<string>Widgets</string>
<string>Tool Widgets</string>
</property>
<addaction name="actionNewCustomWidget"/>
<addaction name="actionLoadCustomWidgetFile"/>
......@@ -129,6 +129,7 @@
<addaction name="actionEngineersView"/>
<addaction name="actionPilotsView"/>
<addaction name="separator"/>
<addaction name="actionFirmwareUpdateView"/>
<addaction name="actionMavlinkView"/>
<addaction name="actionUnconnectedView"/>
<addaction name="separator"/>
......@@ -137,16 +138,22 @@
</widget>
<widget class="QMenu" name="menuMain">
<property name="title">
<string>Main</string>
<string>Main Widget</string>
</property>
</widget>
<widget class="QMenu" name="menuPlugins">
<property name="title">
<string>Plugins</string>
</property>
</widget>
<addaction name="menuMGround"/>
<addaction name="menuNetwork"/>
<addaction name="menuConnected_Systems"/>
<addaction name="menuUnmanned_System"/>
<addaction name="menuPerspectives"/>
<addaction name="menuMain"/>
<addaction name="menuTools"/>
<addaction name="menuPerspectives"/>
<addaction name="menuPlugins"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
......@@ -466,6 +473,18 @@
<string>Load Custom Widget File</string>
</property>
</action>
<action name="actionFirmwareUpdateView">
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/status/software-update-available.svg</normaloff>:/images/status/software-update-available.svg</iconset>
</property>
<property name="text">
<string>Firmware Update</string>
</property>
<property name="toolTip">
<string>Update the firmware of one of the connected autopilots</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
......
......@@ -470,7 +470,8 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
// Read data
double x,y;
double x = 0;
double y = 0;
while (!in.atEnd())
{
......
......@@ -6,13 +6,21 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>596</width>
<height>343</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QComboBox" name="autopilotComboBox"/>
</item>
<item row="1" column="0">
<widget class="QWidget" name="widget" native="true"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
......
......@@ -21,6 +21,7 @@ QGCMAVLinkLogPlayer::QGCMAVLinkLogPlayer(MAVLinkProtocol* mavlink, QWidget *pare
mavlinkLogFormat(true),
binaryBaudRate(57600),
isPlaying(false),
currPacketCount(0),
ui(new Ui::QGCMAVLinkLogPlayer)
{
ui->setupUi(this);
......@@ -102,6 +103,7 @@ void QGCMAVLinkLogPlayer::play()
loopTimer.start(interval*accelerationFactor);
}
isPlaying = true;
ui->logStatsLabel->setText(tr("Started playing.."));
ui->playButton->setIcon(QIcon(":images/actions/media-playback-pause.svg"));
}
else
......@@ -272,7 +274,8 @@ bool QGCMAVLinkLogPlayer::loadLogFile(const QString& file)
minutes -= 60*hours;
QString timelabel = tr("%1h:%2m:%3s").arg(hours, 2).arg(minutes, 2).arg(seconds, 2);
ui->logStatsLabel->setText(tr("%2 MB, %3 packets, %4").arg(logFileInfo.size()/1000000.0f, 0, 'f', 2).arg(logFileInfo.size()/(MAVLINK_MAX_PACKET_LEN+sizeof(quint64))).arg(timelabel));
currPacketCount = logFileInfo.size()/(MAVLINK_MAX_PACKET_LEN+sizeof(quint64));
ui->logStatsLabel->setText(tr("%2 MB, %3 packets, %4").arg(logFileInfo.size()/1000000.0f, 0, 'f', 2).arg(currPacketCount).arg(timelabel));
}
else
{
......@@ -302,6 +305,10 @@ bool QGCMAVLinkLogPlayer::loadLogFile(const QString& file)
QString timelabel = tr("%1h:%2m:%3s").arg(hours, 2).arg(minutes, 2).arg(seconds, 2);
ui->logStatsLabel->setText(tr("%2 MB, %4 at %5 KB/s").arg(logFileInfo.size()/1000000.0f, 0, 'f', 2).arg(timelabel).arg(binaryBaudRate/10.0f/1024.0f, 0, 'f', 2));
}
// Reset current state
reset(0);
return true;
}
}
......@@ -458,7 +465,7 @@ void QGCMAVLinkLogPlayer::logLoop()
// Update status label
// Update progress bar
if (loopCounter % 40 == 0)
if (loopCounter % 40 == 0 || currPacketCount < 500)
{
QFileInfo logFileInfo(logFile);
int progress = (ui->positionSlider->maximum()-ui->positionSlider->minimum())*(logFile.pos()/static_cast<float>(logFileInfo.size()));
......
......@@ -78,6 +78,7 @@ protected:
bool mavlinkLogFormat;
int binaryBaudRate;
bool isPlaying;
unsigned int currPacketCount;
static const int packetLen = MAVLINK_MAX_PACKET_LEN;
static const int timeLen = sizeof(quint64);
void changeEvent(QEvent *e);
......
#include "QGCPluginHost.h"
#include "ui_QGCPluginHost.h"
QGCPluginHost::QGCPluginHost(QWidget *parent) :
QWidget(parent),
ui(new Ui::QGCPluginHost)
{
ui->setupUi(this);
}
QGCPluginHost::~QGCPluginHost()
{
delete ui;
}
#ifndef QGCPLUGINHOST_H
#define QGCPLUGINHOST_H
#include <QWidget>
namespace Ui {
class QGCPluginHost;
}
class QGCPluginHost : public QWidget
{
Q_OBJECT
public:
explicit QGCPluginHost(QWidget *parent = 0);
~QGCPluginHost();
private:
Ui::QGCPluginHost *ui;
};
#endif // QGCPLUGINHOST_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCPluginHost</class>
<widget class="QWidget" name="QGCPluginHost">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>633</width>
<height>329</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QListWidget" name="pluginListWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>256</width>
<height>271</height>
</rect>
</property>
</widget>
<widget class="QTextEdit" name="pluginLog">
<property name="geometry">
<rect>
<x>280</x>
<y>30</y>
<width>341</width>
<height>271</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Loaded Plugins</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>280</x>
<y>10</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Plugin Log</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
......@@ -45,7 +45,7 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
toggleLoggingAction = new QAction(QIcon(":"), "Logging", this);
toggleLoggingAction->setCheckable(true);
logReplayAction = new QAction(QIcon(":"), "Replay", this);
logReplayAction->setCheckable(true);
logReplayAction->setCheckable(false);
addAction(toggleLoggingAction);
addAction(logReplayAction);
......@@ -101,8 +101,8 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
void QGCToolBar::setLogPlayer(QGCMAVLinkLogPlayer* player)
{
this->player = player;
connect(toggleLoggingAction, SIGNAL(triggered(bool)), this, SLOT(playLogFile(bool)));
connect(logReplayAction, SIGNAL(triggered(bool)), this, SLOT(logging(bool)));
connect(toggleLoggingAction, SIGNAL(triggered(bool)), this, SLOT(logging(bool)));
connect(logReplayAction, SIGNAL(triggered(bool)), this, SLOT(playLogFile(bool)));
}
void QGCToolBar::playLogFile(bool enabled)
......@@ -143,7 +143,7 @@ void QGCToolBar::logging(bool enabled)
}
QFileInfo file(fileName);
if (file.exists() && !file.isWritable())
if ((file.exists() && !file.isWritable()))
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
......
#include "QGCFirmwareUpdateWidget.h"
#include "ui_QGCFirmwareUpdateWidget.h"
QGCFirmwareUpdateWidget::QGCFirmwareUpdateWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::QGCFirmwareUpdateWidget)
{
ui->setupUi(this);
}
QGCFirmwareUpdateWidget::~QGCFirmwareUpdateWidget()
{
delete ui;
}
#ifndef QGCFIRMWAREUPDATEWIDGET_H
#define QGCFIRMWAREUPDATEWIDGET_H
#include <QWidget>
namespace Ui {
class QGCFirmwareUpdateWidget;
}
class QGCFirmwareUpdateWidget : public QWidget
{
Q_OBJECT
public:
explicit QGCFirmwareUpdateWidget(QWidget *parent = 0);
~QGCFirmwareUpdateWidget();
private:
Ui::QGCFirmwareUpdateWidget *ui;
};
#endif // QGCFIRMWAREUPDATEWIDGET_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCFirmwareUpdateWidget</class>
<widget class="QWidget" name="QGCFirmwareUpdateWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>638</width>
<height>412</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>1) Select Autopilot</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QListWidget" name="autopilotListWidget"/>
</item>
<item row="1" column="2">
<widget class="QTextEdit" name="textEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:large; font-weight:600;&quot;&gt;Autopilot Selection&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Select one of the connected autopilots from the list on the left.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="3" rowspan="4" colspan="2">
<widget class="QTextEdit" name="firmwareInfo">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:large; font-weight:600;&quot;&gt;AP Firmware v0.9.1&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;This software update...&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;FIXES:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;- Fix1&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;FEATURES:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;- New feature 1&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>2) Select Software Version</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QListWidget" name="firmwareListWidget"/>
</item>
<item row="3" column="2" rowspan="2">
<widget class="QTextEdit" name="textEdit_2">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:large; font-weight:600;&quot;&gt;Software Version Selection&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Select the software version from the online repository on the left or choose the select file button to load a file from the harddisk. Detail information is shown on the right.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="selectFileButton">
<property name="text">
<string>Select File..</string>
</property>
</widget>
</item>
<item row="5" column="0" rowspan="2" colspan="5">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="6" column="4" rowspan="2">
<widget class="QPushButton" name="flashFirmwareButton">
<property name="text">
<string>Flash Firmware</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
#include "QGCPX4FirmwareUpdate.h"
#include "ui_QGCPX4FirmwareUpdate.h"
QGCPX4FirmwareUpdate::QGCPX4FirmwareUpdate(QWidget *parent) :
QWidget(parent),
ui(new Ui::QGCPX4FirmwareUpdate)
{
ui->setupUi(this);
}
QGCPX4FirmwareUpdate::~QGCPX4FirmwareUpdate()
{
delete ui;
}
#ifndef QGCPX4FIRMWAREUPDATE_H
#define QGCPX4FIRMWAREUPDATE_H
#include <QWidget>
namespace Ui {
class QGCPX4FirmwareUpdate;
}
class QGCPX4FirmwareUpdate : public QWidget
{
Q_OBJECT
public:
explicit QGCPX4FirmwareUpdate(QWidget *parent = 0);
~QGCPX4FirmwareUpdate();
private:
Ui::QGCPX4FirmwareUpdate *ui;
};
#endif // QGCPX4FIRMWAREUPDATE_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCPX4FirmwareUpdate</class>
<widget class="QWidget" name="QGCPX4FirmwareUpdate">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="4">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="firmwareSelectTab">
<attribute name="title">
<string>Firmware</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QListWidget" name="fileList"/>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="fileLineEdit"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="selectFileButton">
<property name="text">
<string>Select File</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="settingsBackupTab">
<attribute name="title">
<string>Settings</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="settingsStoreButton">
<property name="text">
<string>Select File</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="flashTab">
<attribute name="title">
<string>Flash Firmware</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="fileLabel">
<property name="text">
<string>Filename</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="statusLabel">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="flashButton">
<property name="text">
<string>Flash Firmware</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Prev</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>Flash</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -32,9 +32,11 @@
* @param interval The maximum interval for which data is stored (default: 30 minutes) in milliseconds
**/
LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): QwtPlot(parent),
minTime(QUINT64_MAX),
maxTime(QUINT64_MIN),
minTime(0),
lastTime(0),
maxTime(100),
maxInterval(MAX_STORAGE_INTERVAL),
plotPosition(0),
timeScaleStep(DEFAULT_SCALE_INTERVAL), // 10 seconds
automaticScrollActive(false),
m_active(false),
......@@ -84,8 +86,6 @@ LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): Qwt
colors.append(QColor(87,231,246));
colors.append(QColor(230,126,23));
plotPosition = 0;
setAutoReplot(false);
// Set grid
......@@ -132,7 +132,29 @@ LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): Qwt
LinechartPlot::~LinechartPlot()
{
removeAllData();
// datalock.lock();
// // Delete curves
// QMap<QString, QwtPlotCurve*>::iterator i;
// for(i = curves.begin(); i != curves.end(); ++i) {
// // Remove from curve list
// QwtPlotCurve* curve = curves.take(i.key());
// // Delete the object
// delete curve;
// // Set the pointer null
// curve = NULL;
// }
// // Delete data
// QMap<QString, TimeSeriesData*>::iterator j;
// for(j = data.begin(); j != data.end(); ++j) {
// // Remove from data list
// TimeSeriesData* d = data.take(j.key());
// // Delete the object
// delete d;
// // Set the pointer null
// d = NULL;
// }
// datalock.unlock();
}
void LinechartPlot::showEvent(QShowEvent* event)
......@@ -257,12 +279,16 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value)
/* Check if dataset identifier already exists */
if(!data.contains(dataname)) {
addCurve(dataname);
enforceGroundTime(m_groundTime);
qDebug() << "ADDING CURVE WITH" << dataname << ms << value;
qDebug() << "MINTIME:" << minTime << "MAXTIME:" << maxTime;
qDebug() << "LASTTIME:" << lastTime;
}
// Add new value
TimeSeriesData* dataset = data.value(dataname);
quint64 time = QGC::groundTimeMilliseconds();
quint64 time;
// Append data
if (!m_groundTime)
......@@ -270,6 +296,10 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value)
// Use timestamp from dataset
time = ms;
}
else
{
time = QGC::groundTimeMilliseconds();
}
dataset->append(time, value);
lastUpdate.insert(dataname, time);
......@@ -279,7 +309,11 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value)
if(ms > maxTime) maxTime = ms;
storageInterval = maxTime - minTime;
if(time > lastTime) lastTime = time;
if(time > lastTime)
{
//qDebug() << "UPDATED LAST TIME!" << dataname << time << lastTime;
lastTime = time;
}
//
if (value < minValue) minValue = value;
......@@ -302,7 +336,19 @@ void LinechartPlot::enforceGroundTime(bool enforce)
{
m_groundTime = enforce;
lastTime = QGC::groundTimeUsecs()/1000;
if (enforce)
{
lastTime = QGC::groundTimeMilliseconds();
plotPosition = lastTime;
maxTime = lastTime;
}
else
{
lastTime = 0;
plotPosition = 0;
minTime = 0;
maxTime = 100;
}
}
/**
......@@ -504,8 +550,10 @@ bool LinechartPlot::isVisible(QString id)
bool LinechartPlot::anyCurveVisible()
{
bool visible = false;
foreach (QString key, curves.keys()) {
if (curves.value(key)->isVisible()) {
foreach (QString key, curves.keys())
{
if (curves.value(key)->isVisible())
{
visible = true;
}
}
......@@ -579,7 +627,8 @@ void LinechartPlot::setPlotInterval(int interval)
{
plotInterval = interval;
QMap<QString, TimeSeriesData*>::iterator j;
for(j = data.begin(); j != data.end(); ++j) {
for(j = data.begin(); j != data.end(); ++j)
{
TimeSeriesData* d = data.value(j.key());
d->setInterval(interval);
}
......@@ -624,7 +673,8 @@ void LinechartPlot::setLinearScaling()
void LinechartPlot::setAverageWindow(int windowSize)
{
this->averageWindowSize = windowSize;
foreach(TimeSeriesData* series, data) {
foreach(TimeSeriesData* series, data)
{
series->setAverageWindowSize(windowSize);
}
}
......@@ -644,7 +694,8 @@ void LinechartPlot::paintRealtime()
#endif
// Update plot window value to new max time if the last time was also the max time
windowLock.lock();
if (automaticScrollActive) {
if (automaticScrollActive)
{
// FIXME Check, but commenting this out should have been
// beneficial (does only add complexity)
......@@ -721,7 +772,8 @@ void LinechartPlot::removeAllData()
datalock.lock();
// Delete curves
QMap<QString, QwtPlotCurve*>::iterator i;
for(i = curves.begin(); i != curves.end(); ++i) {
for(i = curves.begin(); i != curves.end(); ++i)
{
// Remove from curve list
QwtPlotCurve* curve = curves.take(i.key());
// Delete the object
......@@ -735,7 +787,8 @@ void LinechartPlot::removeAllData()
// Delete data
QMap<QString, TimeSeriesData*>::iterator j;
for(j = data.begin(); j != data.end(); ++j) {
for(j = data.begin(); j != data.end(); ++j)
{
// Remove from data list
TimeSeriesData* d = data.take(j.key());
// Delete the object
......
......@@ -298,8 +298,8 @@ protected:
// TODO CHECK THIS!!!
int scaling;
QwtScaleEngine* yScaleEngine;
quint64 lastTime; ///< Last added timestamp
quint64 minTime; ///< The smallest timestamp occured so far
quint64 lastTime; ///< Last added timestamp
quint64 maxTime; ///< The biggest timestamp occured so far
quint64 maxInterval;
quint64 storageInterval;
......
......@@ -153,6 +153,8 @@ LinechartWidget::~LinechartWidget()
{
writeSettings();
stopLogging();
if (activePlot) delete activePlot;
activePlot = NULL;
delete listedCurves;
listedCurves = NULL;
}
......@@ -184,6 +186,7 @@ void LinechartWidget::readSettings()
if (activePlot) {
timeButton->setChecked(settings.value("ENFORCE_GROUNDTIME", timeButton->isChecked()).toBool());
activePlot->enforceGroundTime(settings.value("ENFORCE_GROUNDTIME", timeButton->isChecked()).toBool());
timeButton->setChecked(settings.value("ENFORCE_GROUNDTIME", timeButton->isChecked()).toBool());
}
if (unitsCheckBox) unitsCheckBox->setChecked(settings.value("SHOW_UNITS", unitsCheckBox->isChecked()).toBool());
if (ui.shortNameCheckBox) ui.shortNameCheckBox->setChecked(settings.value("SHORT_NAMES", ui.shortNameCheckBox->isChecked()).toBool());
......@@ -258,9 +261,6 @@ void LinechartWidget::createLayout()
timeButton->setText(tr("Ground Time"));
timeButton->setToolTip(tr("Overwrite timestamp of data from vehicle with ground receive time. Helps if the plots are not visible because of missing or invalid onboard time."));
timeButton->setWhatsThis(tr("Overwrite timestamp of data from vehicle with ground receive time. Helps if the plots are not visible because of missing or invalid onboard time."));
bool gTimeDefault = true;
if (activePlot) activePlot->enforceGroundTime(gTimeDefault);
timeButton->setChecked(gTimeDefault);
layout->addWidget(timeButton, 1, 4);
layout->setColumnStretch(4, 0);
connect(timeButton, SIGNAL(clicked(bool)), activePlot, SLOT(enforceGroundTime(bool)));
......
......@@ -663,15 +663,19 @@ void
Pixhawk3DWidget::getPosition(double& x, double& y, double& z,
QString& utmZone)
{
if (uas) {
if (frame == MAV_FRAME_GLOBAL) {
if (uas)
{
if (frame == MAV_FRAME_GLOBAL)
{
double latitude = uas->getLatitude();
double longitude = uas->getLongitude();
double altitude = uas->getAltitude();
Imagery::LLtoUTM(latitude, longitude, x, y, utmZone);
z = -altitude;
} else if (frame == MAV_FRAME_LOCAL_NED) {
}
else if (frame == MAV_FRAME_LOCAL_NED)
{
x = uas->getLocalX();
y = uas->getLocalY();
z = uas->getLocalZ();
......@@ -881,7 +885,8 @@ Pixhawk3DWidget::resizeHUD(void)
int bottomHUDHeight = 25;
osg::Vec3Array* vertices = static_cast<osg::Vec3Array*>(hudBackgroundGeometry->getVertexArray());
if (vertices == NULL || vertices->size() != 8) {
if (vertices == NULL || vertices->size() != 8)
{
osg::ref_ptr<osg::Vec3Array> newVertices = new osg::Vec3Array(8);
hudBackgroundGeometry->setVertexArray(newVertices);
......@@ -899,7 +904,8 @@ Pixhawk3DWidget::resizeHUD(void)
statusText->setPosition(osg::Vec3(10, height() - 15, -1.5));
if (rgb2DGeode.valid() && depth2DGeode.valid()) {
if (rgb2DGeode.valid() && depth2DGeode.valid())
{
int windowWidth = (width() - 20) / 2;
int windowHeight = 3 * windowWidth / 4;
rgb2DGeode->setAttributes(10, (height() - windowHeight) / 2,
......@@ -922,7 +928,8 @@ Pixhawk3DWidget::updateHUD(double robotX, double robotY, double robotZ,
std::ostringstream oss;
oss.setf(std::ios::fixed, std::ios::floatfield);
oss.precision(2);
if (frame == MAV_FRAME_GLOBAL) {
if (frame == MAV_FRAME_GLOBAL)
{
double latitude, longitude;
Imagery::UTMtoLL(robotX, robotY, utmZone, latitude, longitude);
......@@ -943,7 +950,9 @@ Pixhawk3DWidget::updateHUD(double robotX, double robotY, double robotZ,
oss.precision(6);
oss << " Cursor [" << cursorLatitude <<
" " << cursorLongitude << "]";
} else if (frame == MAV_FRAME_LOCAL_NED) {
}
else if (frame == MAV_FRAME_LOCAL_NED)
{
oss << " x = " << robotX <<
" y = " << robotY <<
" z = " << robotZ <<
......@@ -957,7 +966,8 @@ Pixhawk3DWidget::updateHUD(double robotX, double robotY, double robotZ,
statusText->setText(oss.str());
bool darkBackground = true;
if (mapNode->getImageryType() == Imagery::GOOGLE_MAP) {
if (mapNode->getImageryType() == Imagery::GOOGLE_MAP)
{
darkBackground = false;
}
......@@ -968,34 +978,44 @@ Pixhawk3DWidget::updateHUD(double robotX, double robotY, double robotZ,
void
Pixhawk3DWidget::updateTrail(double robotX, double robotY, double robotZ)
{
if (robotX == 0.0f || robotY == 0.0f || robotZ == 0.0f) {
if (robotX == 0.0f || robotY == 0.0f || robotZ == 0.0f)
{
return;
}
bool addToTrail = false;
if (trail.size() > 0) {
if (trail.size() > 0)
{
if (fabs(robotX - trail[trail.size() - 1].x()) > 0.01f ||
fabs(robotY - trail[trail.size() - 1].y()) > 0.01f ||
fabs(robotZ - trail[trail.size() - 1].z()) > 0.01f) {
fabs(robotZ - trail[trail.size() - 1].z()) > 0.01f)
{
addToTrail = true;
}
} else {
}
else
{
addToTrail = true;
}
if (addToTrail) {
if (addToTrail)
{
osg::Vec3d p(robotX, robotY, robotZ);
if (trail.size() == trail.capacity()) {
if (trail.size() == trail.capacity())
{
memcpy(trail.data(), trail.data() + 1,
(trail.size() - 1) * sizeof(osg::Vec3d));
trail[trail.size() - 1] = p;
} else {
}
else
{
trail.append(p);
}
}
trailVertices->clear();
for (int i = 0; i < trail.size(); ++i) {
for (int i = 0; i < trail.size(); ++i)
{
trailVertices->push_back(osg::Vec3d(trail[i].y() - robotY,
trail[i].x() - robotX,
-(trail[i].z() - robotZ)));
......@@ -1010,12 +1030,14 @@ void
Pixhawk3DWidget::updateImagery(double originX, double originY, double originZ,
const QString& zone)
{
if (mapNode->getImageryType() == Imagery::BLANK_MAP) {
if (mapNode->getImageryType() == Imagery::BLANK_MAP)
{
return;
}
double viewingRadius = cameraManipulator->getDistance() * 10.0;
if (viewingRadius < 100.0) {
if (viewingRadius < 100.0)
{
viewingRadius = 100.0;
}
......@@ -1024,7 +1046,8 @@ Pixhawk3DWidget::updateImagery(double originX, double originY, double originZ,
double maxResolution = 1048576.0;
Imagery::ImageryType imageryType = mapNode->getImageryType();
switch (imageryType) {
switch (imageryType)
{
case Imagery::GOOGLE_MAP:
minResolution = 0.25;
break;
......@@ -1040,10 +1063,13 @@ Pixhawk3DWidget::updateImagery(double originX, double originY, double originZ,
}
double resolution = minResolution;
while (resolution * 2.0 < centerResolution) {
while (resolution * 2.0 < centerResolution)
{
resolution *= 2.0;
}
if (resolution > maxResolution) {
if (resolution > maxResolution)
{
resolution = maxResolution;
}
......@@ -1057,14 +1083,16 @@ Pixhawk3DWidget::updateImagery(double originX, double originY, double originZ,
zone);
// prefetch map tiles
if (resolution / 2.0 >= minResolution) {
if (resolution / 2.0 >= minResolution)
{
mapNode->prefetch3D(viewingRadius / 2.0,
resolution / 2.0,
cameraManipulator->getCenter().y(),
cameraManipulator->getCenter().x(),
zone);
}
if (resolution * 2.0 <= maxResolution) {
if (resolution * 2.0 <= maxResolution)
{
mapNode->prefetch3D(viewingRadius * 2.0,
resolution * 2.0,
cameraManipulator->getCenter().y(),
......
This diff is collapsed.
#ifndef QGCMAVLINKMESSAGESENDER_H
#define QGCMAVLINKMESSAGESENDER_H
#include <QWidget>
#include <QTreeWidgetItem>
#include <QMap>
#include <QTimer>
#include "MAVLinkProtocol.h"
namespace Ui {
class QGCMAVLinkMessageSender;
}
class QGCMAVLinkMessageSender : public QWidget
{
Q_OBJECT
friend class QTimer;
public:
explicit QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidget *parent = 0);
~QGCMAVLinkMessageSender();
protected:
mavlink_message_info_t messageInfo[256]; ///< Meta information about all messages
MAVLinkProtocol* protocol; ///< MAVLink protocol
QMap<int, float> messagesHz; ///< Used to store update rate in Hz
QTimer refreshTimer;
QMap<unsigned int, QTimer*> sendTimers;
QMap<unsigned int, QTreeWidgetItem*> managementItems;
QMap<unsigned int, QTreeWidgetItem*> treeWidgetItems; ///< Messages
/** @brief Create the tree view of all messages */
void createTreeView();
/** @brief Create one field of one message in the tree view of all messages */
void createField(int msgid, int fieldid, QTreeWidgetItem* item);
/** @brief Send message with values taken from tree view */
bool sendMessage(unsigned int id);
protected slots:
/** @brief Read / display values in UI */
void refresh();
private:
Ui::QGCMAVLinkMessageSender *ui;
};
#endif // QGCMAVLINKMESSAGESENDER_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCMAVLinkMessageSender</class>
<widget class="QWidget" name="QGCMAVLinkMessageSender">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="treeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
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