Commit cffcb346 authored by Lorenz Meier's avatar Lorenz Meier

Merge branch 'master' of github.com:mavlink/qgroundcontrol

parents 9aab0f81 784e8144
......@@ -347,7 +347,7 @@ contains(DEPENDENCIES_PRESENT, osg) {
src/ui/map3D/Q3DWidget.h \
src/ui/map3D/GCManipulator.h \
src/ui/map3D/ImageWindowGeode.h \
src/ui/map3D/PixhawkCheetahGeode.h \
src/ui/map3D/PixhawkCheetahNode.h \
src/ui/map3D/Pixhawk3DWidget.h \
src/ui/map3D/Q3DWidgetFactory.h \
src/ui/map3D/WebImageCache.h \
......@@ -492,7 +492,7 @@ contains(DEPENDENCIES_PRESENT, osg) {
src/ui/map3D/Q3DWidget.cc \
src/ui/map3D/ImageWindowGeode.cc \
src/ui/map3D/GCManipulator.cc \
src/ui/map3D/PixhawkCheetahGeode.cc \
src/ui/map3D/PixhawkCheetahNode.cc \
src/ui/map3D/Pixhawk3DWidget.cc \
src/ui/map3D/Q3DWidgetFactory.cc \
src/ui/map3D/WebImageCache.cc \
......
......@@ -249,9 +249,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
switch (message.compid)
{
case MAV_COMP_ID_IMU:
case MAV_COMP_ID_IMU_2:
// Prefer IMU 2 over IMU 1 (FIXME)
componentID[message.msgid] = MAV_COMP_ID_IMU;
componentID[message.msgid] = MAV_COMP_ID_IMU_2;
break;
default:
// Do nothing
......
......@@ -132,7 +132,7 @@ void UASWaypointManager::handleGlobalPositionChanged(UASInterface* mav, double l
void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, quint16 count)
{
if (current_state == WP_GETLIST && systemId == current_partner_systemid && (compId == current_partner_compid || compId == MAV_COMP_ID_ALL)) {
if (current_state == WP_GETLIST && systemId == current_partner_systemid) {
protocol_timer.start(PROTOCOL_TIMEOUT_MS);
current_retries = PROTOCOL_MAX_RETRIES;
......@@ -172,7 +172,7 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui
void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_mission_item_t *wp)
{
if (systemId == current_partner_systemid && (compId == current_partner_compid || compId == MAV_COMP_ID_ALL) && current_state == WP_GETLIST_GETWPS && wp->seq == current_wp_id) {
if (systemId == current_partner_systemid && current_state == WP_GETLIST_GETWPS && wp->seq == current_wp_id) {
protocol_timer.start(PROTOCOL_TIMEOUT_MS);
current_retries = PROTOCOL_MAX_RETRIES;
......@@ -241,7 +241,7 @@ void UASWaypointManager::handleWaypointAck(quint8 systemId, quint8 compId, mavli
void UASWaypointManager::handleWaypointRequest(quint8 systemId, quint8 compId, mavlink_mission_request_t *wpr)
{
if (systemId == current_partner_systemid && (compId == current_partner_compid || compId == MAV_COMP_ID_ALL) && ((current_state == WP_SENDLIST && wpr->seq == 0) || (current_state == WP_SENDLIST_SENDWPS && (wpr->seq == current_wp_id || wpr->seq == current_wp_id + 1)))) {
if (systemId == current_partner_systemid && ((current_state == WP_SENDLIST && wpr->seq == 0) || (current_state == WP_SENDLIST_SENDWPS && (wpr->seq == current_wp_id || wpr->seq == current_wp_id + 1)))) {
protocol_timer.start(PROTOCOL_TIMEOUT_MS);
current_retries = PROTOCOL_MAX_RETRIES;
......
......@@ -41,7 +41,7 @@
#include <osgText/Text>
#include "../MainWindow.h"
#include "PixhawkCheetahGeode.h"
#include "PixhawkCheetahNode.h"
#include "TerrainParamDialog.h"
#include "UASManager.h"
......@@ -150,7 +150,7 @@ Pixhawk3DWidget::systemCreated(UASInterface *uas)
this, SLOT(addOverlay(UASInterface*)));
#endif
// mSystemContainerMap[systemId].gpsLocalOrigin() = QVector3D(47.419182, 8.566980, 428);
// mSystemContainerMap[systemId].gpsLocalOrigin() = QVector3D(47.397786, 8.544476, 428);
initializeSystem(systemId, uas->getColor());
emit systemCreatedSignal(uas);
......@@ -1304,7 +1304,7 @@ Pixhawk3DWidget::addModels(QVector< osg::ref_ptr<osg::Node> >& models,
QStringList files = directory.entryList(QStringList("*.osg"), QDir::Files);
// add Pixhawk Bravo model
models.push_back(PixhawkCheetahGeode::create(systemColor));
models.push_back(PixhawkCheetahNode::create(systemColor));
// add sphere of 0.05m radius
osg::ref_ptr<osg::Sphere> sphere = new osg::Sphere(osg::Vec3f(0.0f, 0.0f, 0.0f), 0.05f);
......@@ -2301,8 +2301,8 @@ Pixhawk3DWidget::updateImagery(double originX, double originY,
minResolution = 0.5;
break;
case Imagery::OFFLINE_SATELLITE:
minResolution = 0.25;
maxResolution = 0.25;
minResolution = 0.5;
maxResolution = 0.5;
break;
default:
{}
......
......@@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project
/**
* @file
* @brief Generates a OpenSceneGraph geode which renders a
* @brief Generates a OpenSceneGraph node which renders a
* Pixhawk Cheetah MAV.
*
* @author Lionel Heng <hengli@student.ethz.ch>
......@@ -31,7 +31,9 @@ This file is part of the QGROUNDCONTROL project
*/
#include <osg/Geometry>
#include "PixhawkCheetahGeode.h"
#include <osg/PositionAttitudeTransform>
#include "PixhawkCheetahNode.h"
struct sample_MATERIAL {
GLfloat ambient[3];
......@@ -59335,15 +59337,15 @@ void SelectMaterial(int i)
};
osg::ref_ptr<osg::Geode> PixhawkCheetahGeode::mInstance;
osg::ref_ptr<osg::Node> PixhawkCheetahNode::mInstance;
PixhawkCheetahGeode::PixhawkCheetahGeode()
PixhawkCheetahNode::PixhawkCheetahNode()
{
}
osg::ref_ptr<osg::Geode>
PixhawkCheetahGeode::instance(void)
osg::ref_ptr<osg::Node>
PixhawkCheetahNode::instance(void)
{
if (!mInstance.valid())
{
......@@ -59354,13 +59356,18 @@ PixhawkCheetahGeode::instance(void)
return mInstance;
}
osg::ref_ptr<osg::Geode>
PixhawkCheetahGeode::create(const QColor& color)
osg::ref_ptr<osg::Node>
PixhawkCheetahNode::create(const QColor& color)
{
osg::ref_ptr<osg::PositionAttitudeTransform> pat(new osg::PositionAttitudeTransform);
pat->setScale(osg::Vec3(0.5f, 0.5f, 0.5f));
osg::ref_ptr<osg::Geode> geode(new osg::Geode());
geode->setName("Pixhawk Bravo");
osg::ref_ptr<osg::Geometry> geometry(new osg::Geometry());
geode->addDrawable(geometry.get());
geode->addDrawable(geometry);
pat->addChild(geode);
osg::ref_ptr<osg::Vec3Array> osgVertices(new osg::Vec3Array);
osg::ref_ptr<osg::Vec3Array> osgNormals(new osg::Vec3Array);
......@@ -59392,18 +59399,18 @@ PixhawkCheetahGeode::create(const QColor& color)
face->push_back(i * 3 + j);
}
geometry->addPrimitiveSet(face.get());
geometry->addPrimitiveSet(face);
}
geometry->setVertexArray(osgVertices.get());
geometry->setNormalArray(osgNormals.get());
geometry->setTexCoordArray(0, osgTextures.get());
geometry->setVertexArray(osgVertices);
geometry->setNormalArray(osgNormals);
geometry->setTexCoordArray(0, osgTextures);
osg::ref_ptr<osg::Vec4Array> colors(new osg::Vec4Array);
colors->push_back(osg::Vec4(color.redF(), color.greenF(), color.blueF(), 1.0f));
geometry->setColorArray(colors.get());
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
return geode;
return pat;
};
......@@ -23,48 +23,48 @@ This file is part of the QGROUNDCONTROL project
/**
* @file
* @brief Definition of the class PixhawkCheetahGeode.
* @brief Definition of the class PixhawkCheetahNode.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#ifndef PIXHAWKCHEETAHGEODE_H_
#define PIXHAWKCHEETAHGEODE_H_
#ifndef PIXHAWKCHEETAHNODE_H_
#define PIXHAWKCHEETAHNODE_H_
#include <osg/Geode>
#include <QColor>
/**
* @brief The PixhawkCheetahGeode class.
* Generates an OpenSceneGraph geode which renders a Pixhawk Cheetah MAV.
* @brief The PixhawkCheetahNode class.
* Generates an OpenSceneGraph node which renders a Pixhawk Cheetah MAV.
**/
class PixhawkCheetahGeode
class PixhawkCheetahNode
{
public:
/**
* Constructor.
*/
PixhawkCheetahGeode();
PixhawkCheetahNode();
/**
* Get a single instance of the geode.
* Get a single instance of the node.
*/
static osg::ref_ptr<osg::Geode> instance(void);
static osg::ref_ptr<osg::Node> instance(void);
/**
* @brief Creates an OpenSceneGraph geode which renders a Pixhawk Cheetah MAV.
* @brief Creates an OpenSceneGraph node which renders a Pixhawk Cheetah MAV.
* @param red Red intensity of the MAV model.
* @param green Green intensity of the MAV model.
* @param blue Blue intensity of the MAV model.
*
* @return A smart pointer to the geode.
* @return A smart pointer to the node.
**/
static osg::ref_ptr<osg::Geode> create(const QColor& color);
static osg::ref_ptr<osg::Node> create(const QColor& color);
private:
static osg::ref_ptr<osg::Geode> mInstance;
static osg::ref_ptr<osg::Node> mInstance;
};
#endif
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