mrpt_localization_core.h
Go to the documentation of this file.
1 /***********************************************************************************
2  * Revised BSD License *
3  * Copyright (c) 2014, Markus Bader <markus.bader@tuwien.ac.at> *
4  * All rights reserved. *
5  * *
6  * Redistribution and use in source and binary forms, with or without *
7  * modification, are permitted provided that the following conditions are met: *
8  * * Redistributions of source code must retain the above copyright *
9  * notice, this list of conditions and the following disclaimer. *
10  * * Redistributions in binary form must reproduce the above copyright *
11  * notice, this list of conditions and the following disclaimer in the *
12  * documentation and/or other materials provided with the distribution. *
13  * * Neither the name of the Vienna University of Technology nor the *
14  * names of its contributors may be used to endorse or promote products *
15  * derived from this software without specific prior written permission. *
16  * *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  *AND *
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  **
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
22  * DISCLAIMED. IN NO EVENT SHALL Markus Bader BE LIABLE FOR ANY *
23  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  **
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
27  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  **
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  ** *
32  ***********************************************************************************/
33 
34 #ifndef MRPT_LOCALIZATION_CORE_H
35 #define MRPT_LOCALIZATION_CORE_H
36 
37 #include <iostream>
38 #include <stdint.h>
39 
40 #include <mrpt/bayes/CParticleFilter.h>
41 #include <mrpt/poses/CPose2D.h>
42 #include <mrpt/poses/CPosePDFGaussian.h>
43 #include <mrpt/utils/CTicTac.h>
44 #include <mrpt/slam/CMonteCarloLocalization2D.h>
45 #include <mrpt_bridge/mrpt_log_macros.h>
46 
47 #include <mrpt/version.h>
48 #include <mrpt/obs/CActionRobotMovement2D.h>
49 #include <mrpt/obs/CActionCollection.h>
50 #include <mrpt/obs/CObservationOdometry.h>
51 #include <mrpt/obs/CSensoryFrame.h>
52 #include <mrpt/maps/CMultiMetricMap.h>
53 using namespace mrpt::maps;
54 using namespace mrpt::obs;
55 
57 {
58  MRPT_VIRTUAL_LOG_MACROS
59 
60  public:
61  enum PFStates
62  {
63  NA,
65  RUN,
66  IDLE
67  };
68 
71 
76  void init();
85  void observation(
86  CSensoryFrame::Ptr _sf, CObservationOdometry::Ptr _odometry);
87 
88  protected:
90  CActionRobotMovement2D::TMotionModelOptions
92  CActionRobotMovement2D::TMotionModelOptions
94  CMultiMetricMap metric_map_;
95  mrpt::bayes::CParticleFilter
96  pf_;
97  mrpt::bayes::CParticleFilter::TParticleFilterStats
99  mrpt::slam::CMonteCarloLocalization2D pdf_;
100  mrpt::poses::CPosePDFGaussian
103  mrpt::system::TTimeStamp time_last_update_;
104  mrpt::utils::CTicTac tictac_;
106  PFStates state_;
108  mrpt::poses::CPose2D
112  float init_PDF_min_x;
117 
118  private:
125  void initializeFilter();
126 
127  void updateFilter(CActionCollection::Ptr _action, CSensoryFrame::Ptr _sf);
128 };
129 
130 #endif // MRPT_LOCALIZATION_CORE_H
CMultiMetricMap metric_map_
map
mrpt::utils::CTicTac tictac_
timer to measure performance
mrpt::bayes::CParticleFilter::TParticleFilterStats pf_stats_
filter statistics
int initial_particle_count_
number of particles for initialization
mrpt::poses::CPose2D odom_last_observation_
correct time
mrpt::slam::CMonteCarloLocalization2D pdf_
the filter
mrpt::poses::CPosePDFGaussian initial_pose_
initial posed used in initializeFilter()
CActionRobotMovement2D::TMotionModelOptions motion_model_options_
used with odom value motion noise
mrpt::bayes::CParticleFilter pf_
common interface for particle filters
mrpt::system::TTimeStamp time_last_update_
time of the last update
bool use_motion_model_default_options_
used default odom_params
CActionRobotMovement2D::TMotionModelOptions motion_model_default_options_
used if there are is not odom


mrpt_localization
Author(s): Markus Bader, Raphael Zack
autogenerated on Thu Jun 6 2019 19:44:49