8 : CollisionCheckGridMapPlugin(name)
14 if (!CollisionCheckGridMapPlugin::loadParams(params))
23 CollisionCheckGridMapPlugin::mapCallback(occupancy_grid_map);
25 boost::unique_lock<boost::shared_mutex> lock(grid_map_shared_mutex_);
33 bool out_of_bounds = d < 0.0;
40 double r_o = width*width + height*height;
44 if (d*d >= 0.25 * r_o)
50 double h_half = 0.5 * height;
51 double w_half = 0.5 * width;
52 double r_i = std::min(w_half, h_half);
72 double h_clear = out_of_bounds ? 0.0 : sqrt(d*d - w_half*w_half);
73 h_new = h_half - h_clear;
75 delta_x = h_clear + 0.5 * h_new;
80 double w_clear = out_of_bounds ? 0.0 : sqrt(d*d - h_half*h_half);
82 w_new = w_half - w_clear;
84 delta_y = w_clear + 0.5 * w_new;
86 double x_shift = cos_theta*delta_x - sin_theta*delta_y;
87 double y_shift = sin_theta*delta_x + cos_theta*delta_y;
89 return (
collision_check(x+x_shift, y+y_shift, cos_theta, sin_theta, h_new, w_new) ||
90 collision_check(x-x_shift, y-y_shift, cos_theta, sin_theta, h_new, w_new));
void setMap(const nav_msgs::OccupancyGridConstPtr &gridMap)
Initialize map from a ROS OccupancyGrid message.
float distanceMapAt(double wx, double wy) const
Returns distance (in m) at world coordinates <wx,wy> in m; -1 if out of bounds!
float getResolution() const