monte_carlo_scan_matcher.h
Go to the documentation of this file.
1 #ifndef SLAM_CTOR_CORE_MONTE_CARLO_SCAN_MATCHER_H
2 #define SLAM_CTOR_CORE_MONTE_CARLO_SCAN_MATCHER_H
3 
4 #include <random>
5 #include <memory>
6 
7 #include "../random_utils.h"
9 
11 protected:
12  using Engine = std::mt19937;
13 public:
14  GaussianPoseEnumerator(unsigned seed,
15  double translation_dispersion,
16  double rotation_dispersion,
17  unsigned max_dispersion_failed_attempts,
18  unsigned max_poses_nm)
19  : _max_failed_attempts_per_shift{max_dispersion_failed_attempts}
20  , _max_poses_nm{max_poses_nm}
21  , _base_translation_dispersion{translation_dispersion}
22  , _base_rotation_dispersion{rotation_dispersion}
26  , _pr_generator{seed} {
27  reset();
28  }
29 
30  bool has_next() const override {
33  }
34 
35  RobotPose next(const RobotPose &prev_pose) override {
36  return prev_pose + _pose_shift_rv.sample(_pr_generator);
37  }
38 
39  void reset() override {
40  _poses_nm = 0;
42  }
43 
44  void feedback(bool pose_is_acceptable) override {
45  ++_poses_nm;
46  if (!pose_is_acceptable) {
48  } else {
50  // we haven't failed enough times to shrink the lookup area
51  return;
52  }
53  reset_shift(0.5);
54  }
55  }
56 
57 private:
58  void reset_shift(double new_translation_dispersion,
59  double new_rotation_dispersion) {
61  _translation_dispersion = new_translation_dispersion;
62  _rotation_dispersion = new_rotation_dispersion;
66  }
67 
68  void reset_shift(double dispersion_scale_factor) {
70  }
71 
72 private:
73  // number of poses
76  // sampling params
79 
82 };
83 
85 public:
86  // FIXME: update enumerator on set_lookup_ranges update
87  MonteCarloScanMatcher(std::shared_ptr<ScanProbabilityEstimator> estimator,
88  unsigned seed,
89  double translation_dispersion,
90  double rotation_dispersion,
91  unsigned failed_attempts_per_dispersion,
92  unsigned total_attempts)
94  estimator,
95  std::make_shared<GaussianPoseEnumerator>(
96  seed, translation_dispersion, rotation_dispersion,
97  failed_attempts_per_dispersion, total_attempts
98  )
99  } {}
100 };
101 
102 #endif
RobotPose next(const RobotPose &prev_pose) override
MonteCarloScanMatcher(std::shared_ptr< ScanProbabilityEstimator > estimator, unsigned seed, double translation_dispersion, double rotation_dispersion, unsigned failed_attempts_per_dispersion, unsigned total_attempts)
bool has_next() const override
GaussianPoseEnumerator(unsigned seed, double translation_dispersion, double rotation_dispersion, unsigned max_dispersion_failed_attempts, unsigned max_poses_nm)
RobotPoseDelta sample(RandomEngineT &re)
Definition: robot_pose.h:83
void reset_shift(double dispersion_scale_factor)
RobotPoseDeltaRV< Engine > _pose_shift_rv
void feedback(bool pose_is_acceptable) override
void reset_shift(double new_translation_dispersion, double new_rotation_dispersion)


slam_constructor
Author(s): JetBrains Research, OSLL team
autogenerated on Mon Jun 10 2019 15:08:25