Go to the documentation of this file.
47 double obstacle_threshold,
double occupied_threshold)
48 : boundary_radius_(boundary_radius)
49 , search_radius_(search_radius)
50 , obstacle_threshold_(obstacle_threshold)
51 , occupied_threshold_(occupied_threshold)
55 throw std::invalid_argument(
56 "Search radius must be at least the same size as the boundary radius");
61 throw std::invalid_argument(
"Occupied threshold must be between 0 and 100");
66 const vec& pose)
const
68 const auto psg = grid.
world2Grid(pose(0), pose(1));
96 const vec& pose)
const
98 const auto psg = grid.
world2Grid(pose(0), pose(1));
109 const vec disp(2, arma::fill::zeros);
116 const vec disp = { grid.
resolution() *
static_cast<double>(cfg.
dx),
121 const vec disp = { std::numeric_limits<double>::max(),
122 std::numeric_limits<double>::max() };
128 const auto psg = grid.
world2Grid(pose(0), pose(1));
151 const auto rmax = cfg.
r_max;
206 if (r > x || err > y)
217 unsigned int ci)
const
223 const auto sqrd_obs =
224 static_cast<int>((cfg.
cx - cj) * (cfg.
cx - cj) + (cfg.
cy - ci) * (cfg.
cy - ci));
230 cfg.
dx = cj - cfg.
cx;
231 cfg.
dy = ci - cfg.
cy;
bool gridBounds(unsigned int i, unsigned int j) const
Test if coordinates are within the grid.
double occupied_threshold_
double resolution() const
Return grid resolution.
Collision checking in 2D.
double totalPadding() const
Return the distance from robot center to collision boundary.
Collision detection parameters.
tuple< CollisionMsg, vec > minDirection(const GridMap &grid, const vec &pose) const
Compose displacement vector from closest obstacle to robot.
bool bresenhamCircle(CollisionConfig &cfg, const GridMap &grid, int r) const
Bresenham's circle algorithm.
Collision(double boundary_radius, double search_radius, double obstacle_threshold, double occupied_threshold)
Constructor.
std::vector< unsigned int > world2Grid(double x, double y) const
Convert world coordinates to row and column index in grid.
double obstacle_threshold_
bool checkCell(CollisionConfig &cfg, const GridMap &grid, unsigned int cj, unsigned int ci) const
Check if cell is an obstacle.
bool collisionCheck(const GridMap &grid, const vec &pose) const
Check if the given state is a collision.
tuple< CollisionMsg, double > minDistance(const GridMap &grid, const vec &pose) const
Compose distance to closest obstacle.
double getCell(double x, double y) const
Get the value of the cell at a specified position.
bool search(CollisionConfig &cfg, const GridMap &grid) const
Find occupied cells between collision boundary and max search radius.