Browse Source

Small compile fixes, fixed image copy calls for non-visible Huds

QGC4.4
LM 13 years ago
parent
commit
c2f4dc0dee
  1. 2
      qgroundcontrol.pri
  2. 11
      src/ui/HUD.cc
  3. 3
      src/ui/MAVLinkDecoder.cc
  4. 14
      src/ui/QGCFirmwareUpdate.h
  5. 4
      src/ui/QGCToolBar.cc
  6. 62
      src/ui/map/QGCMapWidget.cc
  7. 4
      src/ui/map/QGCMapWidget.h
  8. 14
      src/ui/map3D/Pixhawk3DWidget.h
  9. 8
      src/ui/map3D/Q3DWidget.cc

2
qgroundcontrol.pri

@ -250,6 +250,7 @@ message("Compiling for linux 32") @@ -250,6 +250,7 @@ message("Compiling for linux 32")
-lOpenThreads
DEFINES += QGC_OSG_ENABLED
DEFINES += QGC_OSG_QT_ENABLED
}
exists(/usr/local/include/google/protobuf) {
@ -333,6 +334,7 @@ linux-g++-64 { @@ -333,6 +334,7 @@ linux-g++-64 {
-lOpenThreads
DEFINES += QGC_OSG_ENABLED
DEFINES += QGC_OSG_QT_ENABLED
}
exists(/usr/local/include/google/protobuf) {

11
src/ui/HUD.cc

@ -1431,10 +1431,13 @@ void HUD::setPixels(int imgid, const unsigned char* imageData, int length, int s @@ -1431,10 +1431,13 @@ void HUD::setPixels(int imgid, const unsigned char* imageData, int length, int s
void HUD::copyImage()
{
qDebug() << "HUD::copyImage()";
UAS* u = dynamic_cast<UAS*>(this->uas);
if (u)
if (isVisible())
{
this->glImage = QGLWidget::convertToGLFormat(u->getImage());
qDebug() << "HUD::copyImage()";
UAS* u = dynamic_cast<UAS*>(this->uas);
if (u)
{
this->glImage = QGLWidget::convertToGLFormat(u->getImage());
}
}
}

3
src/ui/MAVLinkDecoder.cc

@ -27,8 +27,9 @@ MAVLinkDecoder::MAVLinkDecoder(MAVLinkProtocol* protocol, QObject *parent) : @@ -27,8 +27,9 @@ 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);
#ifdef MAVLINK_ENABLED_PIXHAWK
messageFilter.insert(MAVLINK_MSG_ID_DATA_STREAM, false);
#ifdef MAVLINK_ENABLED_PIXHAWK
messageFilter.insert(MAVLINK_MSG_ID_ENCAPSULATED_DATA, false);
messageFilter.insert(MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, false);
#endif
messageFilter.insert(MAVLINK_MSG_ID_EXTENDED_MESSAGE, false);

14
src/ui/QGCFirmwareUpdate.h

@ -17,9 +17,23 @@ public: @@ -17,9 +17,23 @@ public:
protected:
void changeEvent(QEvent *e);
void showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
emit visibilityChanged(true);
}
void hideEvent(QHideEvent* event)
{
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
private:
Ui::QGCFirmwareUpdate *ui;
signals:
void visibilityChanged(bool visible);
};
#endif // QGCFIRMWAREUPDATE_H

4
src/ui/QGCToolBar.cc

@ -374,6 +374,6 @@ void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QS @@ -374,6 +374,6 @@ void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QS
QGCToolBar::~QGCToolBar()
{
delete toggleLoggingAction;
delete logReplayAction;
if (toggleLoggingAction) toggleLoggingAction->deleteLater();
if (logReplayAction) logReplayAction->deleteLater();
}

62
src/ui/map/QGCMapWidget.cc

@ -284,6 +284,68 @@ void QGCMapWidget::updateGlobalPosition() @@ -284,6 +284,68 @@ void QGCMapWidget::updateGlobalPosition()
}
}
void QGCMapWidget::updateLocalPosition()
{
QList<UASInterface*> systems = UASManager::instance()->getUASList();
foreach (UASInterface* system, systems)
{
// Get reference to graphic UAV item
mapcontrol::UAVItem* uav = GetUAV(system->getUASID());
// Check if reference is valid, else create a new one
if (uav == NULL)
{
MAV2DIcon* newUAV = new MAV2DIcon(map, this, system);
AddUAV(system->getUASID(), newUAV);
uav = newUAV;
uav->SetTrailTime(1);
uav->SetTrailDistance(5);
uav->SetTrailType(mapcontrol::UAVTrailType::ByTimeElapsed);
}
// Set new lat/lon position of UAV icon
double latitude = UASManager::instance()->getHomeLatitude();
double longitude = UASManager::instance()->getHomeLongitude();
double altitude = UASManager::instance()->getHomeAltitude();
internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude());
uav->SetUAVPos(pos_lat_lon, system->getAltitude());
// Follow status
if (followUAVEnabled && system->getUASID() == followUAVID) SetCurrentPosition(pos_lat_lon);
// Convert from radians to degrees and apply
uav->SetUAVHeading((system->getYaw()/M_PI)*180.0f);
}
}
void QGCMapWidget::updateLocalPositionEstimates()
{
QList<UASInterface*> systems = UASManager::instance()->getUASList();
foreach (UASInterface* system, systems)
{
// Get reference to graphic UAV item
mapcontrol::UAVItem* uav = GetUAV(system->getUASID());
// Check if reference is valid, else create a new one
if (uav == NULL)
{
MAV2DIcon* newUAV = new MAV2DIcon(map, this, system);
AddUAV(system->getUASID(), newUAV);
uav = newUAV;
uav->SetTrailTime(1);
uav->SetTrailDistance(5);
uav->SetTrailType(mapcontrol::UAVTrailType::ByTimeElapsed);
}
// Set new lat/lon position of UAV icon
double latitude = UASManager::instance()->getHomeLatitude();
double longitude = UASManager::instance()->getHomeLongitude();
double altitude = UASManager::instance()->getHomeAltitude();
internals::PointLatLng pos_lat_lon = internals::PointLatLng(system->getLatitude(), system->getLongitude());
uav->SetUAVPos(pos_lat_lon, system->getAltitude());
// Follow status
if (followUAVEnabled && system->getUASID() == followUAVID) SetCurrentPosition(pos_lat_lon);
// Convert from radians to degrees and apply
uav->SetUAVHeading((system->getYaw()/M_PI)*180.0f);
}
}
void QGCMapWidget::updateSystemSpecs(int uas)
{

4
src/ui/map/QGCMapWidget.h

@ -46,6 +46,10 @@ public slots: @@ -46,6 +46,10 @@ public slots:
void updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec);
/** @brief Update the global position of all systems */
void updateGlobalPosition();
/** @brief Update the local position and draw it converted to GPS reference */
void updateLocalPosition();
/** @brief Update the local position estimates (individual sensors) and draw it converted to GPS reference */
void updateLocalPositionEstimates();
/** @brief Update the type, size, etc. of this system */
void updateSystemSpecs(int uas);
/** @brief Change current system in focus / editing */

14
src/ui/map3D/Pixhawk3DWidget.h

@ -85,9 +85,23 @@ protected: @@ -85,9 +85,23 @@ protected:
virtual void display(void);
virtual void keyPressEvent(QKeyEvent* event);
virtual void mousePressEvent(QMouseEvent* event);
void showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
emit visibilityChanged(true);
}
void hideEvent(QHideEvent* event)
{
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
UASInterface* uas;
signals:
void visibilityChanged(bool visible);
private:
void getPose(double& x, double& y, double& z,
double& roll, double& pitch, double& yaw,

8
src/ui/map3D/Q3DWidget.cc

@ -35,7 +35,9 @@ This file is part of the QGROUNDCONTROL project @@ -35,7 +35,9 @@ This file is part of the QGROUNDCONTROL project
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/MatrixTransform>
#ifdef QGC_OSG_QT_ENABLED
#include <osgQt/QFontImplementation>
#endif
#ifdef Q_OS_MACX
#include <Carbon/Carbon.h>
#endif
@ -57,9 +59,13 @@ Q3DWidget::Q3DWidget(QWidget* parent) @@ -57,9 +59,13 @@ Q3DWidget::Q3DWidget(QWidget* parent)
cameraParams.cameraFov = 30.0f;
cameraParams.minClipRange = 1.0f;
cameraParams.maxClipRange = 10000.0f;
#ifdef QGC_OSG_QT_ENABLED
osg::ref_ptr<osgText::Font::FontImplementation> fontImpl;
fontImpl = new osgQt::QFontImplementation(QFont(":/general/vera.ttf"));
#else
osg::ref_ptr<osgText::Font::FontImplementation> fontImpl;
fontImpl = 0;//new osgText::Font::Font("images/Vera.ttf");
#endif
font = new osgText::Font(fontImpl);
osgGW = new osgViewer::GraphicsWindowEmbedded(0, 0, width(), height());

Loading…
Cancel
Save