Browse Source

Disable references to pixhawk protoc files if pixhawk is not included in MAVLINK_CONF.

QGC4.4
hengli 13 years ago
parent
commit
c7deeaa88b
  1. 4
      qgroundcontrol.pro
  2. 5
      src/comm/MAVLinkProtocol.cc
  3. 10
      src/comm/MAVLinkProtocol.h
  4. 2
      src/uas/PxQuadMAV.cc
  5. 2
      src/uas/PxQuadMAV.h
  6. 6
      src/uas/UAS.cc
  7. 6
      src/uas/UAS.h
  8. 4
      src/uas/UASInterface.h
  9. 2
      src/ui/QGCRGBDView.cc
  10. 10
      src/ui/map3D/Pixhawk3DWidget.cc
  11. 6
      src/ui/map3D/Pixhawk3DWidget.h

4
qgroundcontrol.pro

@ -388,7 +388,7 @@ contains(DEPENDENCIES_PRESENT, protobuf):contains(MAVLINK_CONF, pixhawk) {
message("Including headers for Protocol Buffers") message("Including headers for Protocol Buffers")
# Enable only if protobuf is available # Enable only if protobuf is available
HEADERS += ../mavlink/include/pixhawk/pixhawk.pb.h \ HEADERS += thirdParty/mavlink/include/pixhawk/pixhawk.pb.h \
src/ui/map3D/ObstacleGroupNode.h src/ui/map3D/ObstacleGroupNode.h
} }
contains(DEPENDENCIES_PRESENT, libfreenect) { contains(DEPENDENCIES_PRESENT, libfreenect) {
@ -530,7 +530,7 @@ contains(DEPENDENCIES_PRESENT, protobuf):contains(MAVLINK_CONF, pixhawk) {
message("Including sources for Protocol Buffers") message("Including sources for Protocol Buffers")
# Enable only if protobuf is available # Enable only if protobuf is available
SOURCES += ../mavlink/src/pixhawk/pixhawk.pb.cc \ SOURCES += thirdParty/mavlink/src/pixhawk/pixhawk.pb.cc \
src/ui/map3D/ObstacleGroupNode.cc src/ui/map3D/ObstacleGroupNode.cc
} }
contains(DEPENDENCIES_PRESENT, libfreenect) { contains(DEPENDENCIES_PRESENT, libfreenect) {

5
src/comm/MAVLinkProtocol.cc

@ -201,7 +201,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// continue; // continue;
// } // }
//#endif //#endif
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED)
if (message.msgid == MAVLINK_MSG_ID_EXTENDED_MESSAGE) if (message.msgid == MAVLINK_MSG_ID_EXTENDED_MESSAGE)
{ {
@ -218,6 +218,8 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// copy extended payload data // copy extended payload data
memcpy(extended_message.extended_payload, extended_payload, extended_message.extended_payload_len); memcpy(extended_message.extended_payload, extended_payload, extended_message.extended_payload_len);
#if defined(QGC_USE_PIXHAWK_MESSAGES)
if (protobufManager.cacheFragment(extended_message)) if (protobufManager.cacheFragment(extended_message))
{ {
std::tr1::shared_ptr<google::protobuf::Message> protobuf_msg; std::tr1::shared_ptr<google::protobuf::Message> protobuf_msg;
@ -262,6 +264,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
} }
} }
} }
#endif
position += extended_message.extended_payload_len; position += extended_message.extended_payload_len;

10
src/comm/MAVLinkProtocol.h

@ -42,9 +42,13 @@ This file is part of the QGROUNDCONTROL project
#include "QGCMAVLink.h" #include "QGCMAVLink.h"
#include "QGC.h" #include "QGC.h"
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED)
#include <tr1/memory>
#include <google/protobuf/message.h>
#if defined(QGC_USE_PIXHAWK_MESSAGES)
#include <mavlink_protobuf_manager.hpp> #include <mavlink_protobuf_manager.hpp>
#endif #endif
#endif
/** /**
@ -202,14 +206,14 @@ protected:
int currLossCounter; int currLossCounter;
bool versionMismatchIgnore; bool versionMismatchIgnore;
int systemId; int systemId;
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
mavlink::ProtobufManager protobufManager; mavlink::ProtobufManager protobufManager;
#endif #endif
signals: signals:
/** @brief Message received and directly copied via signal */ /** @brief Message received and directly copied via signal */
void messageReceived(LinkInterface* link, mavlink_message_t message); void messageReceived(LinkInterface* link, mavlink_message_t message);
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED)
/** @brief Message received via signal */ /** @brief Message received via signal */
void extendedMessageReceived(LinkInterface *link, std::tr1::shared_ptr<google::protobuf::Message> message); void extendedMessageReceived(LinkInterface *link, std::tr1::shared_ptr<google::protobuf::Message> message);
#endif #endif

2
src/uas/PxQuadMAV.cc

@ -206,7 +206,7 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
#endif #endif
} }
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED)
void PxQuadMAV::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<google::protobuf::Message> message) void PxQuadMAV::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<google::protobuf::Message> message)
{ {
UAS::receiveExtendedMessage(link, message); UAS::receiveExtendedMessage(link, message);

2
src/uas/PxQuadMAV.h

@ -35,7 +35,7 @@ public:
public slots: public slots:
/** @brief Receive a MAVLink message from this MAV */ /** @brief Receive a MAVLink message from this MAV */
void receiveMessage(LinkInterface* link, mavlink_message_t message); void receiveMessage(LinkInterface* link, mavlink_message_t message);
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED)
/** @brief Receive a Protobuf message from this MAV */ /** @brief Receive a Protobuf message from this MAV */
void receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<google::protobuf::Message> message); void receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<google::protobuf::Message> message);
#endif #endif

6
src/uas/UAS.cc

@ -75,7 +75,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
pitch(0.0), pitch(0.0),
yaw(0.0), yaw(0.0),
statusTimeout(new QTimer(this)), statusTimeout(new QTimer(this)),
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
receivedPointCloudTimestamp(0.0), receivedPointCloudTimestamp(0.0),
receivedRGBDImageTimestamp(0.0), receivedRGBDImageTimestamp(0.0),
receivedObstacleListTimestamp(0.0), receivedObstacleListTimestamp(0.0),
@ -1022,7 +1022,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
} }
} }
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED)
void UAS::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<google::protobuf::Message> message) void UAS::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<google::protobuf::Message> message)
{ {
if (!link) if (!link)
@ -1069,6 +1069,7 @@ void UAS::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<googl
return; return;
} }
#ifdef QGC_USE_PIXHAWK_MESSAGES
if (message->GetTypeName() == pointCloud.GetTypeName()) if (message->GetTypeName() == pointCloud.GetTypeName())
{ {
receivedPointCloudTimestamp = QGC::groundTimeSeconds(); receivedPointCloudTimestamp = QGC::groundTimeSeconds();
@ -1101,6 +1102,7 @@ void UAS::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<googl
pathMutex.unlock(); pathMutex.unlock();
emit pathChanged(this); emit pathChanged(this);
} }
#endif
} }
#endif #endif

6
src/uas/UAS.h

@ -134,7 +134,7 @@ public:
} }
bool getSelected() const; bool getSelected() const;
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
px::PointCloudXYZRGB getPointCloud() { px::PointCloudXYZRGB getPointCloud() {
QMutexLocker locker(&pointCloudMutex); QMutexLocker locker(&pointCloudMutex);
return pointCloud; return pointCloud;
@ -263,7 +263,7 @@ protected: //COMMENTS FOR TEST UNIT
QImage image; ///< Image data of last completely transmitted image QImage image; ///< Image data of last completely transmitted image
quint64 imageStart; quint64 imageStart;
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
px::PointCloudXYZRGB pointCloud; px::PointCloudXYZRGB pointCloud;
QMutex pointCloudMutex; QMutex pointCloudMutex;
qreal receivedPointCloudTimestamp; qreal receivedPointCloudTimestamp;
@ -610,7 +610,7 @@ signals:
void imageStarted(quint64 timestamp); void imageStarted(quint64 timestamp);
/** @brief A new camera image has arrived */ /** @brief A new camera image has arrived */
void imageReady(UASInterface* uas); void imageReady(UASInterface* uas);
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
/** @brief Point cloud data has been changed */ /** @brief Point cloud data has been changed */
void pointCloudChanged(UASInterface* uas); void pointCloudChanged(UASInterface* uas);
/** @brief RGBD image data has been changed */ /** @brief RGBD image data has been changed */

4
src/uas/UASInterface.h

@ -46,8 +46,10 @@ This file is part of the QGROUNDCONTROL project
#ifdef QGC_PROTOBUF_ENABLED #ifdef QGC_PROTOBUF_ENABLED
#include <tr1/memory> #include <tr1/memory>
#ifdef QGC_USE_PIXHAWK_MESSAGES
#include <pixhawk/pixhawk.pb.h> #include <pixhawk/pixhawk.pb.h>
#endif #endif
#endif
/** /**
* @brief Interface for all robots. * @brief Interface for all robots.
@ -94,7 +96,7 @@ public:
virtual bool getSelected() const = 0; virtual bool getSelected() const = 0;
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
virtual px::PointCloudXYZRGB getPointCloud() = 0; virtual px::PointCloudXYZRGB getPointCloud() = 0;
virtual px::PointCloudXYZRGB getPointCloud(qreal& receivedTimestamp) = 0; virtual px::PointCloudXYZRGB getPointCloud(qreal& receivedTimestamp) = 0;
virtual px::RGBDImage getRGBDImage() = 0; virtual px::RGBDImage getRGBDImage() = 0;

2
src/ui/QGCRGBDView.cc

@ -220,7 +220,7 @@ float colormapJet[128][3] = {
void QGCRGBDView::updateData(UASInterface *uas) void QGCRGBDView::updateData(UASInterface *uas)
{ {
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
px::RGBDImage rgbdImage = uas->getRGBDImage(); px::RGBDImage rgbdImage = uas->getRGBDImage();
if (rgbdImage.rows() == 0 || rgbdImage.cols() == 0 || (!rgbEnabled && !depthEnabled)) if (rgbdImage.rows() == 0 || rgbdImage.cols() == 0 || (!rgbEnabled && !depthEnabled))

10
src/ui/map3D/Pixhawk3DWidget.cc

@ -45,7 +45,7 @@
#include "QGC.h" #include "QGC.h"
#include "gpl.h" #include "gpl.h"
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
#include <tr1/memory> #include <tr1/memory>
#include <pixhawk/pixhawk.pb.h> #include <pixhawk/pixhawk.pb.h>
#endif #endif
@ -111,7 +111,7 @@ Pixhawk3DWidget::Pixhawk3DWidget(QWidget* parent)
rgbd3DNode = createRGBD3D(); rgbd3DNode = createRGBD3D();
rollingMap->addChild(rgbd3DNode); rollingMap->addChild(rgbd3DNode);
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
obstacleGroupNode = new ObstacleGroupNode; obstacleGroupNode = new ObstacleGroupNode;
obstacleGroupNode->init(); obstacleGroupNode->init();
rollingMap->addChild(obstacleGroupNode); rollingMap->addChild(obstacleGroupNode);
@ -861,7 +861,7 @@ Pixhawk3DWidget::display(void)
rollingMap->setChildValue(mapNode, displayImagery); rollingMap->setChildValue(mapNode, displayImagery);
rollingMap->setChildValue(waypointGroupNode, displayWaypoints); rollingMap->setChildValue(waypointGroupNode, displayWaypoints);
rollingMap->setChildValue(targetNode, enableTarget); rollingMap->setChildValue(targetNode, enableTarget);
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
rollingMap->setChildValue(obstacleGroupNode, displayObstacleList); rollingMap->setChildValue(obstacleGroupNode, displayObstacleList);
rollingMap->setChildValue(pathNode, displayPath); rollingMap->setChildValue(pathNode, displayPath);
#endif #endif
@ -921,7 +921,7 @@ Pixhawk3DWidget::display(void)
updateTarget(robotX, robotY, robotZ); updateTarget(robotX, robotY, robotZ);
} }
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
if (displayRGBD2D || displayRGBD3D) if (displayRGBD2D || displayRGBD3D)
{ {
updateRGBD(robotX, robotY, robotZ); updateRGBD(robotX, robotY, robotZ);
@ -1647,7 +1647,7 @@ Pixhawk3DWidget::updateTarget(double robotX, double robotY, double robotZ)
sd->setColor(osg::Vec4f(1.0f, 0.8f, 0.0f, 1.0f)); sd->setColor(osg::Vec4f(1.0f, 0.8f, 0.0f, 1.0f));
} }
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
void void
Pixhawk3DWidget::updateRGBD(double robotX, double robotY, double robotZ) Pixhawk3DWidget::updateRGBD(double robotX, double robotY, double robotZ)
{ {

6
src/ui/map3D/Pixhawk3DWidget.h

@ -38,7 +38,7 @@
#include "Imagery.h" #include "Imagery.h"
#include "ImageWindowGeode.h" #include "ImageWindowGeode.h"
#include "WaypointGroupNode.h" #include "WaypointGroupNode.h"
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
#include "ObstacleGroupNode.h" #include "ObstacleGroupNode.h"
#endif #endif
@ -127,7 +127,7 @@ private:
const QString& zone); const QString& zone);
void updateWaypoints(void); void updateWaypoints(void);
void updateTarget(double robotX, double robotY, double robotZ); void updateTarget(double robotX, double robotY, double robotZ);
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
void updateRGBD(double robotX, double robotY, double robotZ); void updateRGBD(double robotX, double robotY, double robotZ);
void updateObstacles(double robotX, double robotY, double robotZ); void updateObstacles(double robotX, double robotY, double robotZ);
void updatePath(double robotX, double robotY, double robotZ); void updatePath(double robotX, double robotY, double robotZ);
@ -182,7 +182,7 @@ private:
osg::ref_ptr<WaypointGroupNode> waypointGroupNode; osg::ref_ptr<WaypointGroupNode> waypointGroupNode;
osg::ref_ptr<osg::Node> targetNode; osg::ref_ptr<osg::Node> targetNode;
osg::ref_ptr<osg::Geode> rgbd3DNode; osg::ref_ptr<osg::Geode> rgbd3DNode;
#ifdef QGC_PROTOBUF_ENABLED #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES)
osg::ref_ptr<ObstacleGroupNode> obstacleGroupNode; osg::ref_ptr<ObstacleGroupNode> obstacleGroupNode;
osg::ref_ptr<osg::Geode> pathNode; osg::ref_ptr<osg::Geode> pathNode;
#endif #endif

Loading…
Cancel
Save