38 #ifndef COSTMAP_2D_INFLATION_LAYER_H_ 39 #define COSTMAP_2D_INFLATION_LAYER_H_ 44 #include <costmap_2d/InflationPluginConfig.h> 45 #include <dynamic_reconfigure/server.h> 46 #include <boost/thread.hpp> 66 CellData(
double i,
unsigned int x,
unsigned int y,
unsigned int sx,
unsigned int sy) :
89 virtual void onInitialize();
90 virtual void updateBounds(
double robot_x,
double robot_y,
double robot_yaw,
double* min_x,
double* min_y,
91 double* max_x,
double* max_y);
92 virtual void updateCosts(
costmap_2d::Costmap2D& master_grid,
int min_i,
int min_j,
int max_i,
int max_j);
97 virtual void matchSize();
99 virtual void reset() { onInitialize(); }
106 unsigned char cost = 0;
109 else if (distance * resolution_ <= inscribed_radius_)
114 double euclidean_distance = distance * resolution_;
115 double factor =
exp(-1.0 * weight_ * (euclidean_distance - inscribed_radius_));
126 void setInflationParameters(
double inflation_radius,
double cost_scaling_factor);
129 virtual void onFootprintChanged();
149 unsigned int dx =
abs(mx - src_x);
150 unsigned int dy =
abs(my - src_y);
151 return cached_distances_[dx][dy];
162 inline unsigned char costLookup(
int mx,
int my,
int src_x,
int src_y)
164 unsigned int dx =
abs(mx - src_x);
165 unsigned int dy =
abs(my - src_y);
166 return cached_costs_[dx][dy];
169 void computeCaches();
170 void deleteKernels();
171 void inflate_area(
int min_i,
int min_j,
int max_i,
int max_j,
unsigned char* master_grid);
175 return layered_costmap_->getCostmap()->cellDistance(world_dist);
178 inline void enqueue(
unsigned int index,
unsigned int mx,
unsigned int my,
179 unsigned int src_x,
unsigned int src_y);
192 dynamic_reconfigure::Server<costmap_2d::InflationPluginConfig> *
dsrv_;
193 void reconfigureCB(costmap_2d::InflationPluginConfig &config, uint32_t level);
200 #endif // COSTMAP_2D_INFLATION_LAYER_H_
double ** cached_distances_
std::map< double, std::vector< CellData > > inflation_cells_
boost::recursive_mutex * inflation_access_
virtual unsigned char computeCost(double distance) const
Given a distance, compute a cost.
double distance(double x0, double y0, double x1, double y1)
static const unsigned char INSCRIBED_INFLATED_OBSTACLE
CellData(double i, unsigned int x, unsigned int y, unsigned int sx, unsigned int sy)
Constructor for a CellData objects.
virtual bool isDiscretized()
INLINE Rall1d< T, V, S > exp(const Rall1d< T, V, S > &arg)
Storage for cell information used during obstacle inflation.
unsigned char ** cached_costs_
static const unsigned char LETHAL_OBSTACLE
INLINE Rall1d< T, V, S > abs(const Rall1d< T, V, S > &x)
unsigned int cached_cell_inflation_radius_
unsigned char costLookup(int mx, int my, int src_x, int src_y)
Lookup pre-computed costs.
double distanceLookup(int mx, int my, int src_x, int src_y)
Lookup pre-computed distances.
unsigned int cellDistance(double world_dist)
bool need_reinflation_
Indicates that the entire costmap should be reinflated next time around.
A 2D costmap provides a mapping between points in the world and their associated "costs".
dynamic_reconfigure::Server< costmap_2d::InflationPluginConfig > * dsrv_
unsigned int cell_inflation_radius_
virtual ~InflationLayer()