tiny_scan_cost_estimator.h
Go to the documentation of this file.
1 #ifndef __TINY_SCAN_COST_ESTIMATOR
2 #define __TINY_SCAN_COST_ESTIMATOR
3 
4 #include "../core/grid_scan_matcher.h"
5 
14 public:
15 
25  virtual double estimate_scan_cost(const RobotState &pose,
26  const TransformedLaserScan &scan,
27  const GridMap &map,
28  double min_cost) override {
29  double cost = 0;
30  for (const auto &sp : scan.points) {
31  if (!sp.is_occupied) {
32  continue;
33  }
34  // move to world frame assume sensor coords (0,0)
35  double x_world = pose.x + sp.range * std::cos(sp.angle+pose.theta);
36  double y_world = pose.y + sp.range * std::sin(sp.angle+pose.theta);
37 
38  DiscretePoint2D cell_coord = map.world_to_cell(x_world, y_world);
39  double cell_value = map.cell_value(cell_coord);
40  cost += 1.0 - cell_value;
41  if (min_cost < cost) {
42  break;
43  }
44  }
45  return cost;
46  }
47 
48 };
49 
50 #endif
double cell_value(const DiscretePoint2D &cell_coord) const
Definition: grid_map.h:90
double x
Definition: state_data.h:38
An implementation of the scan cost function described in the original tinySLAM paper.
An occupancy grid implementation.
Definition: grid_map.h:22
virtual double estimate_scan_cost(const RobotState &pose, const TransformedLaserScan &scan, const GridMap &map, double min_cost) override
double theta
The position of robot.
Definition: state_data.h:38
double y
Definition: state_data.h:38
Defines a robot position in cartesian coordinates and an angle of rotation.
Definition: state_data.h:14
DiscretePoint2D world_to_cell(double x, double y) const
Definition: grid_map.h:101
std::vector< ScanPoint > points
The vector of points on scan.
Definition: sensor_data.h:36
Defines a point with integer coordinates on a plane.
Framework internal representation of a laser scan.
Definition: sensor_data.h:33
Interface of Estimator of Scan Cost. Cost - is a number that complies to a scan; the lower cost the b...


tiny_slam
Author(s):
autogenerated on Mon Jun 10 2019 15:30:57