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

这个类是为ObstacleLayer StaticLayer voxelLayer 这种维护了自己所在层的地图数据的类,提供了一些公共的操作方法。

从UML中可以看到,这个类提供了以下方法,这些方法的参数列表均为(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j)

updateWithTrueOverwrite
updateWithOverwrite
updateWithMax
updateWithAddition

这些成员函数都是为本层的地图,如何更新数据到master map上的一些更新方法。这里调一个例子说明:

void CostmapLayer::updateWithOverwrite(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j)
{
if (!enabled_)
return;
unsigned char* master = master_grid.getCharMap();
unsigned int span = master_grid.getSizeInCellsX(); for (int j = min_j; j < max_j; j++)
{
unsigned int it = span*j+min_i;
for (int i = min_i; i < max_i; i++)
{
if (costmap_[it] != NO_INFORMATION)
master[it] = costmap_[it];//这里就是overwrite的涵义,costmap_是本层的地图数据。直接将本层的数据赋值给master map的对应索引就行了
it++;
}
}
}

另外还有两个函数成员:

void CostmapLayer::touch(double x, double y, double* min_x, double* min_y, double* max_x, double* max_y)
{
*min_x = std::min(x, *min_x);
*min_y = std::min(y, *min_y);
*max_x = std::max(x, *max_x);
*max_y = std::max(y, *max_y);
} void CostmapLayer::matchSize()
{
Costmap2D* master = layered_costmap_->getCostmap();//这是由Layer 继承过来的,Layer的指针LayeredCostmap* layered_costmap_
resizeMap(master->getSizeInCellsX(), master->getSizeInCellsY(), master->getResolution(),master->getOriginX(), master->getOriginY());//这里调整的对象是继承的Costmap2D的数据成员char* costmap_, 也就是这里的调整是针对各层的地图,不是关于master map的。
}

  

ROS naviagtion analysis: costmap_2d--CostmapLayer的更多相关文章

  1. ROS naviagtion analysis: costmap_2d--Costmap2DROS

    博客转载自:https://blog.csdn.net/u013158492/article/details/50485418 在上一篇文章中moveBase就有关于costmap_2d的使用: pl ...

  2. ROS naviagtion analysis: move_base

    博客转载自:https://blog.csdn.net/u013158492/article/details/50483123 这是navigation的第一篇文章,主要通过分析ROS代码级实现,了解 ...

  3. ROS naviagtion analysis: costmap_2d--ObstacleLayer

    博客转载自:https://blog.csdn.net/u013158492/article/details/50493676 构造函数 ObstacleLayer() { costmap_ = NU ...

  4. ROS naviagtion analysis: costmap_2d--LayeredCostmap

    博客转自:https://blog.csdn.net/u013158492/article/details/50490490 在数据成员中,有两个重要的变量:Costmap2D costmap_和 s ...

  5. ROS naviagtion analysis: costmap_2d--StaticLayer

    博客转载自:https://blog.csdn.net/u013158492/article/details/50493246 从UML中能够看到,StaticLayer主要是在实现Layer层要求实 ...

  6. ROS naviagtion analysis: costmap_2d--Layer

    博客转载自:https://blog.csdn.net/u013158492/article/details/50493113 这个类中有一个LayeredCostmap* layered_costm ...

  7. ROS naviagtion analysis: costmap_2d--Costmap2D

    博客转载自:https://blog.csdn.net/u013158492/article/details/50492506 Costmap2D是存储地图数据的父类.真正的地图数据就存储在数据成员u ...

  8. ROS探索总结(十三)——导航与定位框架

    导航与定位是机器人研究中的重要部分.         一般机器人在陌生的环境下需要使用激光传感器(或者深度传感器转换成激光数据),先进行地图建模,然后在根据建立的地图进行导航.定位.在ROS中也有很多 ...

  9. ROS 教程之 navigation :在 catkin 环境下创建costmap layer plugin

    在做机器人导航的时候,肯定见到过global_costmap和local_costmap.global_costmap是为了全局路径规划服务的,如从这个房间到那个房间该怎么走.local_costma ...

随机推荐

  1. leetcode_sql_3,181,182,183

    181. Employees Earning More Than Their Managers The Employee table holds all employees including the ...

  2. vue前端开发那些事——vue组件开发

    vue的学习曲线不是很陡(相比其它框架,如anglarjs),官方文档比较全面,分为基础篇和高级篇.我们刚开始学习的时候,肯定像引用jquery那样,先把vue的js引进来,然后学习基础内容.如果仅仅 ...

  3. 复制的web工程为什么不能部署到tomcat

    An existing resource has been found at location D:\apache-tomcat-6.0.18\apache-tomcat-6.0.18\webapps ...

  4. Weex 解析(二)—— NativeBridge

    (本篇幅主要讲解Weex 中iOS native与js交互实现) 大纲: weex 总框架预览 iOS NativeBridge总设计原理 一.weex 总框架预览 在写NativeBridge 总设 ...

  5. fft蝶形算法的特点

  6. json数据格式字符串在java中的转移

    说明:项目中遇到请求的json数据字符串,打印出来没有问题,但是想加入到代码中,就需要进行转移 原数据为(用src代替)(没有写完): {"adjust_fee":"0. ...

  7. (转)Android 使用com.j256.ormlite

    在web开发中经常采用的hibernate,在android也提供了一个ormlite 导入所需jar包后 摘自:http://blog.csdn.net/cuiran/article/details ...

  8. 创建工程常量 (OC中的宏定义)

    1.oc创建宏 文件 2.swift创建 常量文件 在swift中, 并非是预编译代码替换, 而是设置全局常量, 简单宏, 直接let 加常量名即可

  9. spring mvc 返回字符串带双引号及StringHttpMessageConverter乱码处理

    本文转载自:http://blog.csdn.net/wangyangbto/article/details/48804155 很多人都碰到过,SpringMVC使用 @ResponseBody 注解 ...

  10. expected_conditions 库的使用方法

    from selenium.webdriver.support import expected_conditions as EC 例子一: 例子二:(判断元素存在文本"糯米")