Browse Source

Working on horizontal situation indicator

QGC4.4
pixhawk 15 years ago
parent
commit
ef8326f0c3
  1. 6
      qgroundcontrol.pro
  2. 8
      src/ui/HDDisplay.cc
  3. 28
      src/ui/HSIDisplay.cc
  4. 4
      src/ui/HSIDisplay.h
  5. 2
      src/ui/MainWindow.cc
  6. 2
      src/ui/MainWindow.h

6
qgroundcontrol.pro

@ -140,7 +140,8 @@ HEADERS += src/MG.h \ @@ -140,7 +140,8 @@ HEADERS += src/MG.h \
src/comm/MAVLinkSyntaxHighlighter.h \
src/ui/watchdog/WatchdogControl.h \
src/ui/watchdog/WatchdogProcessView.h \
src/ui/watchdog/WatchdogView.h
src/ui/watchdog/WatchdogView.h \
src/ui/HSIDisplay.h
SOURCES += src/main.cc \
src/Core.cc \
src/uas/UASManager.cc \
@ -193,5 +194,6 @@ SOURCES += src/main.cc \ @@ -193,5 +194,6 @@ SOURCES += src/main.cc \
src/comm/MAVLinkSyntaxHighlighter.cc \
src/ui/watchdog/WatchdogControl.cc \
src/ui/watchdog/WatchdogProcessView.cc \
src/ui/watchdog/WatchdogView.cc
src/ui/watchdog/WatchdogView.cc \
src/ui/HSIDisplay.cc
RESOURCES = mavground.qrc

8
src/ui/HDDisplay.cc

@ -74,6 +74,12 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) : @@ -74,6 +74,12 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) :
{
//m_ui->setupUi(this);
// Check if acceptlist exists
if (!acceptList)
{
acceptList = new QStringList();
}
this->setMinimumHeight(125);
this->setMinimumWidth(100);
@ -146,7 +152,7 @@ void HDDisplay::paintDisplay() @@ -146,7 +152,7 @@ void HDDisplay::paintDisplay()
painter.fillRect(QRect(0, 0, width(), height()), backgroundColor);
const int columns = 3;
const float spacing = 0.4f; // 40% of width
const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.1f));
const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.5f));
const QColor gaugeColor = QColor(200, 200, 200);
//drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter);
//drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true);

28
src/ui/HSIDisplay.cc

@ -31,14 +31,15 @@ This file is part of the PIXHAWK project @@ -31,14 +31,15 @@ This file is part of the PIXHAWK project
#include <QFile>
#include <QStringList>
#include <QPainter>
#include "UASManager.h"
#include "HSIDisplay.h"
#include "MG.h"
#include <QDebug>
HSIDisplay::HSIDisplay(QStringList* plotList, QWidget *parent) :
HDDisplay(plotList, parent),
HSIDisplay::HSIDisplay(QWidget *parent) :
HDDisplay(NULL, parent)
{
}
@ -68,7 +69,7 @@ void HSIDisplay::paintDisplay() @@ -68,7 +69,7 @@ void HSIDisplay::paintDisplay()
const int columns = 3;
const float spacing = 0.4f; // 40% of width
const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.1f));
const QColor gaugeColor = QColor(200, 200, 200);
const QColor ringColor = QColor(200, 200, 200);
//drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter);
//drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true);
//drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true);
@ -140,11 +141,10 @@ void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw, @@ -140,11 +141,10 @@ void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw,
drawCircle(xRef, yRef, radius, 200.0f, color, painter);
//drawCircle(xRef, yRef, radius, 200.0f, 170.0f, 1.0f, color, painter);
QString label;
label.sprintf("%05.1f", value);
// Draw the value
paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter);
// // Draw the value
// QString label;
// label.sprintf("%05.1f", value);
// paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter);
// Draw the needle
// Scale the rotation so that the gauge does one revolution
@ -172,15 +172,3 @@ void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw, @@ -172,15 +172,3 @@ void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw,
painter->setBrush(indexBrush);
drawPolygon(p, painter);
}
void HDDisplay::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
m_ui->retranslateUi(this);
break;
default:
break;
}
}

4
src/ui/HSIDisplay.h

@ -44,8 +44,8 @@ This file is part of the PIXHAWK project @@ -44,8 +44,8 @@ This file is part of the PIXHAWK project
class HSIDisplay : public HDDisplay {
Q_OBJECT
public:
HSIDisplay(QStringList* plotList, QWidget *parent = 0);
~HSIDisplay();
HSIDisplay(QWidget *parent = 0);
// ~HSIDisplay();
public slots:
void setActiveUAS(UASInterface* uas);

2
src/ui/MainWindow.cc

@ -100,6 +100,8 @@ settings() @@ -100,6 +100,8 @@ settings()
parameters->setVisible(false);
watchdogControl = new WatchdogControl(this);
watchdogControl->setVisible(false);
hsi = new HSIDisplay(this);
hsi->setVisible(false);
QStringList* acceptList = new QStringList();
acceptList->append("roll IMU");

2
src/ui/MainWindow.h

@ -61,6 +61,7 @@ This file is part of the PIXHAWK project @@ -61,6 +61,7 @@ This file is part of the PIXHAWK project
#include "XMLCommProtocolWidget.h"
#include "HDDisplay.h"
#include "WatchdogControl.h"
#include "HSIDisplay.h"
#include "LogCompressor.h"
@ -148,6 +149,7 @@ protected: @@ -148,6 +149,7 @@ protected:
HDDisplay* headDown1;
HDDisplay* headDown2;
WatchdogControl* watchdogControl;
HSIDisplay* hsi;
// Popup widgets
JoystickWidget* joystickWidget;

Loading…
Cancel
Save