ROS naviagtion analysis: costmap_2d--InflationLayer

UML
Call cluster
这是costmap_2d的最后一个重要的类了。InflationLayer 本身不存储map数据,所以所谓的地图层的概念,仅仅指的是一种对地图的操作,并不是数据层面的地图。
首先来看一个数据结构,知道有这个东西就行了:

class CellData
{
public:
   CellData(double d, double i, unsigned int x, unsigned int y, unsigned int sx, unsigned int sy) :
      distance_(d), index_(i), x_(x), y_(y), src_x_(sx), src_y_(sy)
  {
  }
  double distance_;//
  unsigned int index_;//this cell在map的一维索引
  unsigned int x_, y_;//this cell在map的x,y二维索引
  unsigned int src_x_, src_y_;//this cell距离最近的障碍物点,这个障碍物cell的x,y二维索引
};
//对应的class CellData的比较操作,用于priority queue操作
inline bool operator<(const CellData &a, const CellData &b)
{
  return a.distance_ > b.distance_;
}

函数onInitialize 配置了动态参数服务的回调函数,然后在最后一行调用了matchSize

void InflationLayer::matchSize()
{
  boost::unique_lock < boost::recursive_mutex > lock(*inflation_access_);
  costmap_2d::Costmap2D* costmap = layered_costmap_->getCostmap();
  resolution_ = costmap->getResolution();
  cell_inflation_radius_ = cellDistance(inflation_radius_);
  computeCaches();//这个函数通过cell_inflation_radius_计算了两个buffer,这两个二维buffer直接存储了[i,j]的distance 和cost

  unsigned int size_x = costmap->getSizeInCellsX(), size_y = costmap->getSizeInCellsY();
  if (seen_)
    delete
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值