Commit 39fc764a authored by Lorenz Meier's avatar Lorenz Meier

Many minor improvements

parent c5599aa1
......@@ -235,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 \
......@@ -353,7 +357,11 @@ 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|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
......@@ -481,7 +489,11 @@ 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|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
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>
......
......@@ -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/>
......
#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>
#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>
......@@ -35,8 +35,8 @@ LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): Qwt
minTime(0),
lastTime(0),
maxTime(100),
plotPosition(0),
maxInterval(MAX_STORAGE_INTERVAL),
plotPosition(0),
timeScaleStep(DEFAULT_SCALE_INTERVAL), // 10 seconds
automaticScrollActive(false),
m_active(false),
......
......@@ -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;
......
......@@ -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