8 #include "../core/state_data.h" 9 #include "../core/sensor_data.h" 10 #include "../core/laser_scan_grid_world.h" 11 #include "../core/maps/grid_cell_strategy.h" 29 unsigned lim_totl,
double hole_width) :
30 SIG_XY(sig_XY), SIG_TH(sig_T), BAD_LMT(lim_bad), TOT_LMT(lim_totl),
31 HOLE_WIDTH(hole_width) {}
66 _scan_matcher->reset_state();
67 _scan_matcher->process_scan(pose(), scan, map(), pose_delta);
68 update_robot_pose(pose_delta.
x, pose_delta.
y, pose_delta.
theta);
70 bool pose_was_fixed = pose_delta.
x || pose_delta.
y || pose_delta.
theta;
71 auto factory = _gcs->cell_factory();
72 scan.
quality = pose_was_fixed ? _params.localized_scan_quality :
73 _params.raw_scan_quality;
89 double laser_x,
double laser_y,
90 double beam_end_x,
double beam_end_y,
91 bool is_occ,
double quality)
override {
92 Beam beam{laser_x, laser_y, beam_end_x, beam_end_y};
96 double obst_dist_sq = robot_pt.
dist_sq(obst_pt);
98 double hole_dist_sq = std::pow(_params.HOLE_WIDTH / map.
cell_scale(), 2);
100 auto occ_est = _gcs->occupancy_est();
101 Occupancy beam_end_occ = occ_est->estimate_occupancy(beam,
103 map.
update_cell(pts.back(), beam_end_occ, quality);
106 for (
const auto &pt : pts) {
107 Occupancy empty_cell_value = occ_est->estimate_occupancy(beam,
110 double dist_sq = pt.dist_sq(obst_pt);
111 if (dist_sq < hole_dist_sq && hole_dist_sq < obst_dist_sq && is_occ) {
113 (1.0 - dist_sq / hole_dist_sq) * beam_end_occ.
prob_occ;
124 return _scan_matcher;
127 std::shared_ptr<GridCellStrategy>
_gcs;
Tracks a robots perception of an environment. The environment is represented by a GridMap; A laser sc...
std::shared_ptr< GridCellStrategy > _gcs
Definition of classes file: BaseTinyCell, AvgTinyCell (are inherited from GidCell), TinyBaseCellFactory, TinyAvgCellFactory (from GridCellFactory)
Rectangle world_cell_bounds(const DiscretePoint2D &cell_coord)
double localized_scan_quality
An occupancy grid implementation.
virtual void handle_scan_point(GridMap &map, double laser_x, double laser_y, double beam_end_x, double beam_end_y, bool is_occ, double quality) override
void update_cell(const DiscretePoint2D &cell_coord, const Occupancy &new_value, double quality=1.0)
const TinyWorldParams _params
double dist_sq(const DiscretePoint2D &pt) const
A container for the following tinySLAM parameters: TODO: params description.
double theta
The position of robot.
virtual void handle_observation(TransformedLaserScan &scan) override
double cell_scale() const
Returnes the scale.
Defines a robot position in cartesian coordinates and an angle of rotation.
TinyWorld(std::shared_ptr< GridCellStrategy > gcs, const TinyWorldParams ¶ms, const GridMapParams &init_map_params)
const std::vector< Point > & points() const
Returns the line's component points.
The class implements the tinySLAM-specific map update logic.
The scan matcher based on the Monte Carlo simulation.
DiscretePoint2D world_to_cell(double x, double y) const
TinyWorldParams(double sig_XY, double sig_T, unsigned lim_bad, unsigned lim_totl, double hole_width)
Defines a line segment on a plane.
Defines a point with integer coordinates on a plane.
std::shared_ptr< TinyScanMatcher > _scan_matcher
virtual void handle_observation(TransformedLaserScan &scan)
std::shared_ptr< GridScanMatcher > scan_matcher()