zoukankan      html  css  js  c++  java
  • ROS naviagtion analysis: costmap_2d--Layer

    博客转载自:https://blog.csdn.net/u013158492/article/details/50493113

    这个类中有一个LayeredCostmap* layered_costmap_数据成员,这个数据成员很重要,因为这个类就是通过这个指针获取到的对master map的操作。没有这个指针,所有基于Layer继承下去的地图的类,都无法操作master map。 这个类基本上没有什么实质性的操作,主要是提供了统一的接口,要求子类必须实现这些方法。这样plugin使用的时候,就可以不用管具体是什么类型的map,反正都有同样的方法名。 
    以下是这个类实现的两个方法,其他的方法基本上都是virtual ,要求子类实现。

    void Layer::initialize(LayeredCostmap* parent, std::string name, tf::TransformListener *tf)
    {
      layered_costmap_ = parent;
      name_ = name;
      tf_ = tf;
      onInitialize();
    }
    
    const std::vector<geometry_msgs::Point>& Layer::getFootprint() const
    {
      return layered_costmap_->getFootprint();
    }
    

    重要的几个virtual方法:

     virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y,
                                double* max_x, double* max_y) {}
    
      /**
       * @brief Actually update the underlying costmap, only within the bounds
       *        calculated during UpdateBounds().
       */
      virtual void updateCosts(Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j) {}
    
      /** @brief Stop publishers. */
      virtual void deactivate() {}
    
      /** @brief Restart publishers if they've been stopped. */
      virtual void activate() {}
    
      virtual void reset() {}
    

    这个类就这么多内容,接下来进入真正干活的几个类分析:

    ObstacleLayer
    InflationLayer
    StaticLayer
    VoxelLayer
    

      

  • 相关阅读:
    迷宫最短路问题
    回溯算法
    解题报告:poj1321 棋盘问题
    矩阵、分数、点、线类
    判断图像中有多少行文本(开发中)
    图形-回行扫描函数
    贝叶斯分类器
    js解析数学运算公式
    用postcss给less加上webkit前缀
    node创建文件夹
  • 原文地址:https://www.cnblogs.com/flyinggod/p/9083338.html
Copyright © 2011-2022 走看看