1 #ifndef SLAM_CTOR_CORE_HCSM_FIXED_H_INCLUDED 2 #define SLAM_CTOR_CORE_HCSM_FIXED_H_INCLUDED 8 #include "../maps/grid_map.h" 14 int max_shrinks_nm = 5,
15 double lin_delta = 0.1,
double ang_delta = 0.1)
25 const double d_t = 0.01;
26 const double d_o =
deg2rad(0.5);
32 _max_step_shrinks++) {
36 size_t next_action = 0;
42 double prob_diff = best_pose_prob - shifted_pose_prob;
44 if (prob_diff < best_diff) {
45 best_diff = prob_diff;
47 d_d =
action % DimNm ==
Th ? d_o : d_t;
54 auto r_pose =
shift(current_pose, r, r, next_action);
56 if (best_pose_prob < r_prob) {
57 best_pose_prob = std::move(r_prob);
65 if (0 <= best_diff) {
break; }
66 best_pose =
shift(current_pose, r, r, next_action);
67 best_pose_prob -= best_diff;
70 pose_delta = best_pose - init_pose;
71 return best_pose_prob;
77 static_assert(DimNm % 2 != DirNm % 2,
"");
84 double shift_value = action % DirNm ? -1 : 1;
85 switch (action % DimNm) {
86 case X: shifted.
x += shift_value * l_step;
break;
87 case Y: shifted.
y += shift_value * l_step;
break;
88 case Th: shifted.
theta += shift_value * a_step;
break;
89 default: assert(0 &&
"Missed shift destination");
HillClimbingSMFixed(SPE est, int max_shrinks_nm=5, double lin_delta=0.1, double ang_delta=0.1)
std::shared_ptr< ScanProbabilityEstimator > SPE
double process_scan(const TransformedLaserScan &raw_scan, const RobotPose &init_pose, const GridMap &map, RobotPoseDelta &pose_delta) override
RobotPose shift(const RobotPose ¤t_pose, double a_step, double l_step, size_t action)
unsigned _max_step_shrinks
LaserScan2D filter_scan(const LaserScan2D &scan, const RobotPose &pose, const GridMap &map)
double scan_probability(const LaserScan2D &scan, const RobotPose &pose, const GridMap &map) const
constexpr double deg2rad(double angle_deg)