45 CostmapModel::CostmapModel(
const Costmap2D& ma) : costmap_(ma) {}
48 double inscribed_radius,
double circumscribed_radius){
56 unsigned int cell_x, cell_y;
63 if(footprint.size() < 3){
65 if(cost == NO_INFORMATION)
67 if(cost == LETHAL_OBSTACLE || cost == INSCRIBED_INFLATED_OBSTACLE)
73 unsigned int x0, x1, y0, y1;
74 double line_cost = 0.0;
75 double footprint_cost = 0.0;
78 for(
unsigned int i = 0; i < footprint.size() - 1; ++i){
87 line_cost =
lineCost(x0, x1, y0, y1);
88 footprint_cost = std::max(line_cost, footprint_cost);
104 line_cost =
lineCost(x0, x1, y0, y1);
105 footprint_cost = std::max(line_cost, footprint_cost);
111 return footprint_cost;
117 double line_cost = 0.0;
118 double point_cost = -1.0;
122 point_cost =
pointCost( line.getX(), line.getY() );
127 if(line_cost < point_cost)
128 line_cost = point_cost;
137 if(cost == NO_INFORMATION)
139 if(cost == LETHAL_OBSTACLE)
const costmap_2d::Costmap2D & costmap_
Allows access of costmap obstacle information.
double pointCost(int x, int y) const
Checks the cost of a point in the costmap.
unsigned char getCost(unsigned int mx, unsigned int my) const
double lineCost(int x0, int x1, int y0, int y1) const
Rasterizes a line in the costmap grid and checks for collisions.
virtual double footprintCost(const geometry_msgs::Point &position, const std::vector< geometry_msgs::Point > &footprint, double inscribed_radius, double circumscribed_radius)
Checks if any obstacles in the costmap lie inside a convex footprint that is rasterized into the grid...
bool worldToMap(double wx, double wy, unsigned int &mx, unsigned int &my) const