* @brief Given an index of a cell in the costmap, place it into a list pending for obstacle inflation * @param grid The costmap * @param index The index of the cell * @param mx The x coordinate of the cell (can be computed from the index, but saves time to store it) * @param my The y coordinate of the cell (can be computed from the index, but saves time to store it) * @param src_x The x
| 248 | * @param src_y The y index of the obstacle point inflation started at |
| 249 | */ |
| 250 | inline void InflationLayer::Enqueue(unsigned int index, unsigned int mx, unsigned int my, |
| 251 | unsigned int src_x, unsigned int src_y) { |
| 252 | if (!seen_[index]) { |
| 253 | // we compute our distance table one cell further than the inflation radius dictates so we can make the check below |
| 254 | double distance = DistanceLookup(mx, my, src_x, src_y); |
| 255 | |
| 256 | // we only want to put the cell in the list if it is within the inflation radius of the obstacle point |
| 257 | if (distance > cell_inflation_radius_) |
| 258 | return; |
| 259 | |
| 260 | // push the cell data onto the inflation list and mark |
| 261 | inflation_cells_[distance].push_back(CellData(index, mx, my, src_x, src_y)); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | void InflationLayer::ComputeCaches() { |
| 266 | if (cell_inflation_radius_ == 0) |