Commit 61f66c9d authored by pixhawk's avatar pixhawk

Fixed scaling factor of Pixhawk Cheetah model.

parent 8507c30b
......@@ -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
......
......@@ -41,7 +41,7 @@
#include <osgText/Text>
#include "../MainWindow.h"
#include "PixhawkCheetahGeode.h"
#include "PixhawkCheetahNode.h"
#include "TerrainParamDialog.h"
#include "UASManager.h"
......@@ -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);
......
......@@ -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