ObservationModel.h
Go to the documentation of this file.
1 // SVN $HeadURL$
2 // SVN $Id$
3 
4 /*
5  * 6D localization for humanoid robots
6  *
7  * Copyright 2009-2012 Armin Hornung, University of Freiburg
8  * http://www.ros.org/wiki/humanoid_localization
9  *
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, version 3.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef HUMANOID_LOCALIZATION_OBSERVATIONMODEL_H_
25 #define HUMANOID_LOCALIZATION_OBSERVATIONMODEL_H_
26 
27 #include <limits>
28 #include <cmath>
29 
30 #include <omp.h>
31 
32 #include <ros/ros.h>
33 #include <tf/transform_datatypes.h>
34 #include <pcl_ros/transforms.h>
35 
38 #include <octomap/octomap.h>
39 
40 #include <sensor_msgs/PointCloud2.h>
41 
42 
43 namespace humanoid_localization{
44 
46 const static double SQRT_2_PI = 2.506628274;
47 
49 const static double LOG_SQRT_2_PI = 0.91893853320467274178;
50 
52 public:
54  virtual ~ObservationModel();
55 
57  static inline double logLikelihood(double x, double sigma){
58  assert(!isnan(x));
59  return -1.0*( LOG_SQRT_2_PI) - log(sigma) - ((x * x) / (2* sigma * sigma));
60  }
61 
63  static inline double logLikelihoodSq(double x_sq, double sigma){
64  assert(!isnan(x_sq));
65  return -1.0*( LOG_SQRT_2_PI) - log(sigma) - ((x_sq) / (2* sigma * sigma));
66  }
67 
68 
69  //static double logLikelihoodSimple(double x, double sigma){
70  // return -((x * x) / (2* sigma * sigma));
71  //}
72 
77  virtual void integrateMeasurement(Particles& particles, const PointCloud& pc, const std::vector<float>& ranges, float max_range, const tf::Transform& baseToSensor) = 0;
78 
79  virtual void integratePoseMeasurement(Particles& particles, double roll, double pitch, const tf::StampedTransform& footprintToTorso);
80 
82 protected:
83  virtual bool getHeightError(const Particle& p, const tf::StampedTransform& footprintToBase, double& heightError) const = 0;
90 
91  double m_weightRoll;
92  double m_weightPitch;
93  double m_weightZ;
94 
95  double m_sigmaZ;
96  double m_sigmaRoll;
97  double m_sigmaPitch;
98 
100 
101 };
102 }
103 
104 #endif /* OBSERVATIONMODEL_H_ */
static double logLikelihoodSq(double x_sq, double sigma)
Helper function to compute the log likelihood based on sqared distances.
ObservationModel(ros::NodeHandle *nh, boost::shared_ptr< MapModel > mapModel, EngineT *rngEngine)
virtual void setMap(boost::shared_ptr< octomap::OcTree > map)
boost::shared_ptr< octomap::OcTree > m_map
boost::variate_generator< EngineT &, NormalDistributionT > NormalGeneratorT
standard normal-distributed noise
boost::mt19937 EngineT
Boost RNG engine:
Particle consists of a pose and a weight.
static double logLikelihood(double x, double sigma)
Helper function to compute the log likelihood.
boost::shared_ptr< MapModel > m_mapModel
virtual void integrateMeasurement(Particles &particles, const PointCloud &pc, const std::vector< float > &ranges, float max_range, const tf::Transform &baseToSensor)=0
static const double SQRT_2_PI
sqrt(2*pi)
static const double LOG_SQRT_2_PI
log(sqrt(2*pi))
boost::variate_generator< EngineT &, UniformDistributionT > UniformGeneratorT
uniform noise in range [0,1)
virtual void integratePoseMeasurement(Particles &particles, double roll, double pitch, const tf::StampedTransform &footprintToTorso)
virtual bool getHeightError(const Particle &p, const tf::StampedTransform &footprintToBase, double &heightError) const =0
std::vector< Particle > Particles
pcl::PointCloud< pcl::PointXYZ > PointCloud


humanoid_localization
Author(s): Armin Hornung, Stefan Osswald, Daniel Maier
autogenerated on Mon Jun 10 2019 13:38:31