Commit 44dc6619 authored by dongfang's avatar dongfang Committed by Michael Carpenter

Undone the HUD_old renaming and fixed public slots in PrimaryFlightDisply that were not.

parent c6ab1f05
This diff is collapsed.
...@@ -29,8 +29,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -29,8 +29,8 @@ This file is part of the QGROUNDCONTROL project
* *
*/ */
#ifndef HUD_old_H #ifndef HUD_H
#define HUD_old_H #define HUD_H
#include <QImage> #include <QImage>
#include <QGLWidget> #include <QGLWidget>
...@@ -41,18 +41,18 @@ This file is part of the QGROUNDCONTROL project ...@@ -41,18 +41,18 @@ This file is part of the QGROUNDCONTROL project
#include "UASInterface.h" #include "UASInterface.h"
/** /**
* @brief Displays a Head Up Display (HUD_old) * @brief Displays a Head Up Display (HUD)
* *
* This class represents a head up display (HUD_old) and draws this HUD_old in an OpenGL widget (QGLWidget). * This class represents a head up display (HUD) and draws this HUD in an OpenGL widget (QGLWidget).
* It can superimpose the HUD_old over the current live image stream (any arriving image stream will be auto- * It can superimpose the HUD over the current live image stream (any arriving image stream will be auto-
* matically used as background), or it draws the classic blue-brown background known from instruments. * matically used as background), or it draws the classic blue-brown background known from instruments.
*/ */
class HUD_old : public QGLWidget class HUD : public QGLWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
HUD_old(int width = 640, int height = 480, QWidget* parent = NULL); HUD(int width = 640, int height = 480, QWidget* parent = NULL);
~HUD_old(); ~HUD();
void setImageSize(int width, int height, int depth, int channels); void setImageSize(int width, int height, int depth, int channels);
void resizeGL(int w, int h); void resizeGL(int w, int h);
...@@ -90,7 +90,7 @@ public slots: ...@@ -90,7 +90,7 @@ public slots:
/** @brief Select directory where to load the offline files from */ /** @brief Select directory where to load the offline files from */
void selectOfflineDirectory(); void selectOfflineDirectory();
/** @brief Enable the HUD instruments */ /** @brief Enable the HUD instruments */
void enableHUD_oldInstruments(bool enabled); void enableHUDInstruments(bool enabled);
/** @brief Enable Video */ /** @brief Enable Video */
void enableVideo(bool enabled); void enableVideo(bool enabled);
/** @brief Copy an image from the current active UAS */ /** @brief Copy an image from the current active UAS */
...@@ -103,9 +103,9 @@ protected slots: ...@@ -103,9 +103,9 @@ protected slots:
void paintPitchLines(float pitch, QPainter* painter); void paintPitchLines(float pitch, QPainter* painter);
/** @brief Paint text on top of the image and OpenGL drawings */ /** @brief Paint text on top of the image and OpenGL drawings */
void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter); void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter);
/** @brief Setup the OpenGL view for drawing a sub-component of the HUD_old */ /** @brief Setup the OpenGL view for drawing a sub-component of the HUD */
void setupGLView(float referencePositionX, float referencePositionY, float referenceWidth, float referenceHeight); void setupGLView(float referencePositionX, float referencePositionY, float referenceWidth, float referenceHeight);
void paintHUD_old(); void paintHUD();
void paintPitchLinePos(QString text, float refPosX, float refPosY, QPainter* painter); void paintPitchLinePos(QString text, float refPosX, float refPosY, QPainter* painter);
void paintPitchLineNeg(QString text, float refPosX, float refPosY, QPainter* painter); void paintPitchLineNeg(QString text, float refPosX, float refPosY, QPainter* painter);
...@@ -156,8 +156,8 @@ protected: ...@@ -156,8 +156,8 @@ protected:
float vGaugeSpacing; ///< Virtual spacing of the gauges from the center, 50 mm per default float vGaugeSpacing; ///< Virtual spacing of the gauges from the center, 50 mm per default
float vPitchPerDeg; ///< Virtual pitch to mm conversion. Currently one degree is 3 mm up/down in the pitch markings float vPitchPerDeg; ///< Virtual pitch to mm conversion. Currently one degree is 3 mm up/down in the pitch markings
int xCenter; ///< Center of the HUD_old instrument in pixel coordinates. Allows to off-center the whole instrument in its OpenGL window, e.g. to fit another instrument int xCenter; ///< Center of the HUD instrument in pixel coordinates. Allows to off-center the whole instrument in its OpenGL window, e.g. to fit another instrument
int yCenter; ///< Center of the HUD_old instrument in pixel coordinates. Allows to off-center the whole instrument in its OpenGL window, e.g. to fit another instrument int yCenter; ///< Center of the HUD instrument in pixel coordinates. Allows to off-center the whole instrument in its OpenGL window, e.g. to fit another instrument
// Image buffers // Image buffers
unsigned char* rawBuffer1; ///< Double buffer 1 for the image unsigned char* rawBuffer1; ///< Double buffer 1 for the image
...@@ -172,8 +172,8 @@ protected: ...@@ -172,8 +172,8 @@ protected:
int receivedWidth; ///< Width in pixels of the current image int receivedWidth; ///< Width in pixels of the current image
int receivedHeight; ///< Height in pixels of the current image int receivedHeight; ///< Height in pixels of the current image
// HUD_old colors // HUD colors
QColor defaultColor; ///< Color for most HUD_old elements, e.g. pitch lines, center cross, change rate gauges QColor defaultColor; ///< Color for most HUD elements, e.g. pitch lines, center cross, change rate gauges
QColor setPointColor; ///< Color for the current control set point, e.g. yaw desired QColor setPointColor; ///< Color for the current control set point, e.g. yaw desired
QColor warningColor; ///< Color for warning messages QColor warningColor; ///< Color for warning messages
QColor criticalColor; ///< Color for caution messages QColor criticalColor; ///< Color for caution messages
...@@ -184,17 +184,17 @@ protected: ...@@ -184,17 +184,17 @@ protected:
int warningBlinkRate; ///< Blink rate of warning messages, will be rounded to the refresh rate int warningBlinkRate; ///< Blink rate of warning messages, will be rounded to the refresh rate
QTimer* refreshTimer; ///< The main timer, controls the update rate QTimer* refreshTimer; ///< The main timer, controls the update rate
QPainter* HUD_oldPainter; QPainter* HUDPainter;
QFont font; ///< The HUD_old font, per default the free Bitstream Vera SANS, which is very close to actual HUD_old fonts QFont font; ///< The HUD font, per default the free Bitstream Vera SANS, which is very close to actual HUD fonts
QFontDatabase fontDatabase;///< Font database, only used to load the TrueType font file (the HUD_old font is directly loaded from file rather than from the system) QFontDatabase fontDatabase;///< Font database, only used to load the TrueType font file (the HUD font is directly loaded from file rather than from the system)
bool noCamera; ///< No camera images available, draw the ground/sky box to indicate the horizon bool noCamera; ///< No camera images available, draw the ground/sky box to indicate the horizon
bool hardwareAcceleration; ///< Enable hardware acceleration bool hardwareAcceleration; ///< Enable hardware acceleration
float strongStrokeWidth; ///< Strong line stroke width, used throughout the HUD_old float strongStrokeWidth; ///< Strong line stroke width, used throughout the HUD
float normalStrokeWidth; ///< Normal line stroke width, used throughout the HUD_old float normalStrokeWidth; ///< Normal line stroke width, used throughout the HUD
float fineStrokeWidth; ///< Fine line stroke width, used throughout the HUD_old float fineStrokeWidth; ///< Fine line stroke width, used throughout the HUD
QString waypointName; ///< Waypoint name displayed in HUD_old QString waypointName; ///< Waypoint name displayed in HUD
float roll; float roll;
float pitch; float pitch;
float yaw; float yaw;
...@@ -235,4 +235,4 @@ protected: ...@@ -235,4 +235,4 @@ protected:
unsigned int imageLogCounter; unsigned int imageLogCounter;
}; };
#endif // HUD_old_H #endif // HUD_H
...@@ -170,6 +170,8 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, double roll, double ...@@ -170,6 +170,8 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, double roll, double
this->heading = yaw; this->heading = yaw;
} }
// TODO: Else-part. We really should have an "attitude bad or unknown" indication instead of just freezing. // TODO: Else-part. We really should have an "attitude bad or unknown" indication instead of just freezing.
qDebug("r,p,y: %f,%f,%f", roll, pitch, yaw);
} }
/* /*
...@@ -184,6 +186,8 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, int component, doub ...@@ -184,6 +186,8 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, int component, doub
Q_UNUSED(pitch); Q_UNUSED(pitch);
Q_UNUSED(yaw); Q_UNUSED(yaw);
Q_UNUSED(timestamp); Q_UNUSED(timestamp);
qDebug("ignore (!!!) r,p,y: %f,%f,%f", roll, pitch, yaw);
} }
void PrimaryFlightDisplay::updateBattery(UASInterface* uas, double voltage, double percent, int seconds) void PrimaryFlightDisplay::updateBattery(UASInterface* uas, double voltage, double percent, int seconds)
...@@ -1122,3 +1126,5 @@ void PrimaryFlightDisplay::doPaint() { ...@@ -1122,3 +1126,5 @@ void PrimaryFlightDisplay::doPaint() {
paintAllInOne(); paintAllInOne();
#endif #endif
} }
void PrimaryFlightDisplay:: createActions() {}
...@@ -84,6 +84,7 @@ public: ...@@ -84,6 +84,7 @@ public:
PrimaryFlightDisplay(int width = 640, int height = 480, QWidget* parent = NULL); PrimaryFlightDisplay(int width = 640, int height = 480, QWidget* parent = NULL);
~PrimaryFlightDisplay(); ~PrimaryFlightDisplay();
public slots:
/** @brief Attitude from main autopilot / system state */ /** @brief Attitude from main autopilot / system state */
void updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 timestamp); void updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 timestamp);
/** @brief Attitude from one specific component / redundant autopilot */ /** @brief Attitude from one specific component / redundant autopilot */
...@@ -100,6 +101,7 @@ public: ...@@ -100,6 +101,7 @@ public:
void updateLoad(UASInterface*, double); void updateLoad(UASInterface*, double);
void selectWaypoint(int uasId, int id); void selectWaypoint(int uasId, int id);
protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
...@@ -115,11 +117,10 @@ public: ...@@ -115,11 +117,10 @@ public:
// dongfang: We have no context menu. Viewonly. // dongfang: We have no context menu. Viewonly.
// void contextMenuEvent (QContextMenuEvent* event); // void contextMenuEvent (QContextMenuEvent* event);
protected:
// dongfang: What is that? // dongfang: What is that?
void createActions(); void createActions();
static const int updateInterval = 40;
public slots: public slots:
/** @brief Set the currently monitored UAS */ /** @brief Set the currently monitored UAS */
virtual void setActiveUAS(UASInterface* uas); virtual void setActiveUAS(UASInterface* uas);
...@@ -208,6 +209,9 @@ private: ...@@ -208,6 +209,9 @@ private:
static const int tickValues[]; static const int tickValues[];
static const QString compassWindNames[]; static const QString compassWindNames[];
static const int updateInterval = 40;
signals: signals:
public slots: public slots:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "UASManager.h" #include "UASManager.h"
QGCRGBDView::QGCRGBDView(int width, int height, QWidget *parent) : QGCRGBDView::QGCRGBDView(int width, int height, QWidget *parent) :
HUD_old(width, height, parent), HUD(width, height, parent),
rgbEnabled(false), rgbEnabled(false),
depthEnabled(false) depthEnabled(false)
{ {
...@@ -70,7 +70,7 @@ void QGCRGBDView::setActiveUAS(UASInterface* uas) ...@@ -70,7 +70,7 @@ void QGCRGBDView::setActiveUAS(UASInterface* uas)
connect(uas, SIGNAL(rgbdImageChanged(UASInterface*)), this, SLOT(updateData(UASInterface*))); connect(uas, SIGNAL(rgbdImageChanged(UASInterface*)), this, SLOT(updateData(UASInterface*)));
} }
HUD_old::setActiveUAS(uas); HUD::setActiveUAS(uas);
} }
void QGCRGBDView::clearData(void) void QGCRGBDView::clearData(void)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "HUD.h" #include "HUD.h"
class QGCRGBDView : public HUD_old class QGCRGBDView : public HUD
{ {
Q_OBJECT Q_OBJECT
public: public:
......
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