35 #include <OGRE/OgreVector3.h> 36 #include <OGRE/OgreSceneNode.h> 38 #define SHAPE_WIDTH_MIN 0.005f // Avoid a complete flat sphere/cylinder 43 :
Marker(scene_manager, parent_node, id) {
51 for (
int i = 0; i < 3; i++) {
63 for (
int i = 0; i < 3; i++)
68 Ogre::Matrix3 cov_xyz = Ogre::Matrix3(
69 m[6 * 0 + 0], m[6 * 0 + 1], m[6 * 0 + 2],
70 m[6 * 1 + 0], m[6 * 1 + 1], m[6 * 1 + 2],
71 m[6 * 2 + 0], m[6 * 2 + 1], m[6 * 2 + 2]
74 Ogre::Real eigenvalues[3];
75 Ogre::Vector3 eigenvectors[3];
76 cov_xyz.EigenSolveSymmetric(eigenvalues, eigenvectors);
78 if (eigenvalues[0] < 0)
81 if (eigenvalues[1] < 0)
84 if (eigenvalues[2] < 0)
100 Ogre::Matrix3 cov_roll = Ogre::Matrix3(
101 m[6 * 4 + 4], m[6 * 4 + 5], 0,
102 m[6 * 5 + 5], m[6 * 5 + 5], 0,
105 cov_roll.EigenSolveSymmetric(eigenvalues, eigenvectors);
107 Ogre::Quaternion o = Ogre::Quaternion::IDENTITY;
108 o = o * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Z);
109 o = o * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Y);
110 o = o * (Ogre::Quaternion(Ogre::Matrix3(1, 0, 0,
111 0, eigenvectors[0][0], eigenvectors[0][1],
112 0, eigenvectors[1][0], eigenvectors[1][1])));
125 Ogre::Matrix3 cov_pitch = Ogre::Matrix3(
126 m[6 * 3 + 3], m[6 * 3 + 5], 0,
127 m[6 * 5 + 3], m[6 * 5 + 5], 0,
130 cov_pitch.EigenSolveSymmetric(eigenvalues, eigenvectors);
132 o = Ogre::Quaternion::IDENTITY;
133 o = o * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Y);
134 o = o * (Ogre::Quaternion(Ogre::Matrix3(eigenvectors[0][0], 0, eigenvectors[0][1],
136 0, eigenvectors[1][0], eigenvectors[1][1])));
149 Ogre::Matrix3 cov_yaw = Ogre::Matrix3(
150 m[6 * 3 + 3], m[6 * 3 + 4], 0,
151 m[6 * 4 + 3], m[6 * 4 + 4], 0,
154 cov_yaw.EigenSolveSymmetric(eigenvalues, eigenvectors);
156 o = Ogre::Quaternion::IDENTITY;
157 o = o * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_X);
158 o = o * (Ogre::Quaternion(Ogre::Matrix3(eigenvectors[0][0], eigenvectors[0][1], 0,
159 eigenvectors[1][0], eigenvectors[1][1], 0,
virtual void setOrientation(const Ogre::Quaternion &orientation)
MarkerWithCovariance(Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node=0, int id=-1)
virtual void setScale(const Ogre::Vector3 &scale)
rviz::Shape * variance_rpy_[3]
virtual void setColor(float r, float g, float b, float a)
virtual void setCovarianceMatrix(boost::array< double, 36 > m)
virtual void setPosition(const Ogre::Vector3 &position)
Ogre::MaterialPtr getMaterial()
Ogre::SceneNode * variance_pos_parent
rviz::Shape * variance_pos_
Ogre::SceneManager * scene_manager_
virtual ~MarkerWithCovariance()
virtual void setScale(const Ogre::Vector3 &scale)
virtual void setScale(const Ogre::Vector3 &scale)
Ogre::SceneNode * scene_node_