CovarianceVisual.h
Go to the documentation of this file.
1 /*
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2013-2015, Timm Linder, Social Robotics Lab, University of Freiburg
5 * Copyright (c) 2006, Kai O. Arras, Autonomous Intelligent Systems Lab, University of Freiburg
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * * Redistributions of source code must retain the above copyright notice, this
12 * list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 * * Neither the name of the copyright holder nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31 
32 #ifndef COVARIANCE_VISUAL_H
33 #define COVARIANCE_VISUAL_H
34 
37 #include <OGRE/OgreSceneManager.h>
38 #include <cmath>
39 
40 
41 namespace tuw_object_rviz {
42  // Visualization of a covariance matrix
44  public:
45  CovarianceVisual(Ogre::SceneManager* sceneManager, Ogre::SceneNode* parentNode);
46 
47  virtual ~CovarianceVisual();
48 
49  void setPosition(const Ogre::Vector3& position);
50 
51  void setOrientation(const Ogre::Quaternion& orientation);
52 
53  void setVisible(bool visible);
54 
55  virtual void setColor(const Ogre::ColourValue& c) = 0;
56 
57  virtual void setLineWidth(float lineWidth) = 0;
58 
60  virtual void setMeanCovariance(const Ogre::Vector3& mean, const Ogre::Matrix3& cov) = 0;
61 
62  protected:
63  Ogre::SceneManager* m_sceneManager;
64  Ogre::SceneNode* m_sceneNode;
65  };
66 
67 
68  // 2D ellipse visualization of a covariance matrix
70  public:
71  ProbabilityEllipseCovarianceVisual(Ogre::SceneManager* sceneManager, Ogre::SceneNode* parentNode);
72 
74 
75  virtual void setLineWidth(float lineWidth);
76 
77  virtual void setColor(const Ogre::ColourValue& c);
78 
79  virtual void setMeanCovariance(const Ogre::Vector3& mean, const Ogre::Matrix3& cov);
80 
81  private:
83 
84  // Puts angle alpha into the interval [min..min+2*pi[
85  double set_angle_to_range(double alpha, double min);
86 
87  // Calculates the points on a rotated ellipse given by center xc, yc, half axes a, b and angle phi.
88  // Returns number of points np and points in Cart. coordinates
89  void calc_ellipse(double xc, double yc, double a, double b, double phi, int& np, double*& xvec, double*& yvec);
90 
91  // Calculates the points on a 95%-iso-probability ellipse given by the bivarate RV with mean xc, yc
92  // and covariance matrix sxx, syy, sxy. Returns number of points np and points in Cart. coordinates
93  void calc_prob_elli_95(double xc, double yc, double sxx, double syy, double sxy, int& np, double*& x, double*& y);
94 
95  // Calculates the points on a 99%-iso-probability ellipse given by the bivarate RV with mean xc, yc
96  // and covariance matrix sxx, syy, sxy. Returns number of points np and points in Cart. coordinates
97  void calc_prob_elli_99(double xc, double yc, double sxx, double syy, double sxy, int& np, double*& x, double*& y);
98  };
99 
100 }
101 
102 #endif // COVARIANCE_VISUAL_H
103 
virtual void setLineWidth(float lineWidth)=0
void setPosition(const Ogre::Vector3 &position)
CovarianceVisual(Ogre::SceneManager *sceneManager, Ogre::SceneNode *parentNode)
void setOrientation(const Ogre::Quaternion &orientation)
Ogre::SceneManager * m_sceneManager
virtual void setColor(const Ogre::ColourValue &c)=0
virtual void setMeanCovariance(const Ogre::Vector3 &mean, const Ogre::Matrix3 &cov)=0
NOTE: It is assumed that the covariance matrix is already rotated into the target frame of the sceneN...


tuw_object_rviz
Author(s): Florian Beck
autogenerated on Mon Jun 10 2019 15:40:17