源自:https://github.com/ethz-asl/grid_map

Grid Map

Overview

This is a C++ library with ROS interface to manage two-dimensional grid maps with multiple data layers. It is designed for mobile robotic mapping to store data such as elevation, variance, color, friction coefficient, foothold quality, surface normal, traversability etc. It is used in theRobot-Centric Elevation Mapping package designed for rough terrain navigation.

Features:

  • Multi-layered: Developed for universal 2.5-dimensional grid mapping with support for any number of layers.
  • Efficient map re-positioning: Data storage is implemented as two-dimensional circular buffer. This allows for non-destructive shifting of the map's position (e.g. to follow the robot) without copying data in memory.
  • Based on Eigen: Grid map data is stored as Eigen data types. Users can apply available Eigen algorithms directly to the map data for versatile and efficient data manipulation.
  • Convenience functions: Several helper methods allow for convenient and memory safe cell data access. For example, iterator functions for rectangular, circular, polygonal regions and lines are implemented.
  • ROS interface: Grid maps can be directly converted to and from ROS message types such as PointCloud2, OccupancyGrid, GridCells, and our custom GridMap message.
  • OpenCV interface: Grid maps can be seamlessly converted from and toOpenCV image types to make use of the tools provided byOpenCV.
  • Visualizations: The grid_map_rviz_plugin renders grid maps as 3d surface plots (height maps) inRViz. Additionally, the grid_map_visualization package helps to visualize grid maps as point clouds, occupancy grids, grid cells etc.

The grid map package has been tested with ROS Indigo, Jade (under Ubuntu 14.04) and Kinetic (under Ubuntu 16.04). This is research code, expect that it changes often and any fitness for a particular purpose is disclaimed.

The source code is released under a BSD 3-Clause license.

Author: Péter Fankhauser
Maintainer: Péter Fankhauser, pfankhauser@ethz.ch
With contributions by: Martin Wermelinger, Philipp Krüsi, Remo Diethelm, Ralph Kaestner, Elena Stumm, Dominic Jud, Daniel Stonier, Christos Zalidis
Affiliation: Autonomous Systems Lab, ETH Zurich

Publications

If you use this work in an academic context, please cite the following publication(s):

  • P. Fankhauser and M. Hutter,"A Universal Grid Map Library: Implementation and Use Case for Rough Terrain Navigation",in Robot Operating System (ROS) – The Complete Reference (Volume 1), A. Koubaa (Ed.), Springer, 2016. (PDF)

    @incollection{Fankhauser2016GridMapLibrary,
    author = {Fankhauser, Péter and Hutter, Marco},
    booktitle = {Robot Operating System (ROS) – The Complete Reference (Volume 1)},
    title = {{A Universal Grid Map Library: Implementation and Use Case for Rough Terrain Navigation}},
    chapter = {5},
    editor = {Koubaa, Anis},
    publisher = {Springer},
    year = {2016},
    isbn = {978-3-319-26052-5},
    doi = {10.1007/978-3-319-26054-9{\_}5},
    url = {http://www.springer.com/de/book/9783319260525}
    }

Documentation

An introduction to the grid map library including a tutorial is given in this book chapter.

The C++ API is documented here:

Installation

Installation from Packages

To install all packages from the grid map library as Debian packages use

sudo apt-get install ros-indigo-grid-map

Building from Source

Dependencies

The grid_map_core package depends only on the linear algebra library Eigen.

sudo apt-get install libeigen3-dev

The grid_map_cv package depends additionally on OpenCV.

The other packages depend additionally on the ROS standard installation (roscpp, tf, filters, sensor_msgs, nav_msgs, and cv_bridge).

Building

To build from source, clone the latest version from this repository into your catkin workspace and compile the package using

cd catkin_ws/src
git clone https://github.com/ethz-asl/grid_map.git
cd ../
catkin_make

To maximize performance, make sure to build in Release mode. You can specify the build type by setting

catkin_make -DCMAKE_BUILD_TYPE=Release

Packages Overview

This repository consists of following packages:

  • grid_map is the meta-package for the grid map library.
  • grid_map_core implements the algorithms of the grid map library. It provides theGridMap class and several helper classes such as the iterators. This package is implemented withoutROS dependencies.
  • grid_map_ros is the main package for ROS dependent projects using the grid map library. It provides the interfaces to convert grid maps from and to severalROS message types.
  • grid_map_cv provides conversions of grid maps from and toOpenCV image types.
  • grid_map_msgs holds the ROS message and service definitions around the [grid_map_msg/GridMap] message type.
  • grid_map_rviz_plugin is an RViz plugin to visualize grid maps as 3d surface plots (height maps).
  • grid_map_visualization contains a node written to convert GridMap messages to otherROS message types for example for visualization inRViz.
  • grid_map_filters builds on the ROS filters package to process grid maps as a sequence of filters.
  • grid_map_demos contains several nodes for demonstration purposes.

Unit Tests

Run the unit tests with

catkin_make run_tests_grid_map_core run_tests_grid_map_ros

or

catkin build grid_map --no-deps --verbose --catkin-make-args run_tests

if you are using catkin tools.

Usage

Demonstrations

The grid_map_demos package contains several demonstration nodes. Use this code to verify your installation of the grid map packages and to get you started with your own usage of the library.

  • simple_demo demonstrates a simple example for using the grid map library. This ROS node creates a grid map, adds data to it, and publishes it. To see the result in RViz, execute the command

    roslaunch grid_map_demos simple_demo.launch
  • tutorial_demo is an extended demonstration of the library's functionalities. Launch thetutorial_demo with

    roslaunch grid_map_demos tutorial_demo.launch
  • iterators_demo showcases the usage of the grid map iterators. Launch it with

    roslaunch grid_map_demos iterators_demo.launch
  • image_to_gridmap_demo demonstrates how to convert data from animage to a grid map. Start the demonstration with

    roslaunch grid_map_demos image_to_gridmap_demo.launch

  • opencv_demo demonstrates map manipulations with help ofOpenCV functions. Start the demonstration with

    roslaunch grid_map_demos opencv_demo.launch

  • resolution_change_demo shows how the resolution of a grid map can be changed with help of theOpenCV image scaling methods. The see the results, use

    roslaunch grid_map_demos resolution_change_demo.launch

Conventions & Definitions

Iterators

The grid map library contains various iterators for convenience.

Grid map Submap Circle Line Polygon
Ellipse Spiral      
     

Using the iterator in a for loop is common. For example, iterate over the entire grid map with theGridMapIterator with

for (grid_map::GridMapIterator iterator(map); !iterator.isPastEnd(); ++iterator) {
cout << "The value at index " << (*iterator).transpose() << " is " << map.at("layer", *iterator) << endl;
}

The other grid map iterators follow the same form. You can find more examples on how to use the different iterators in theiterators_demo node.

Note: For maximum efficiency when using iterators, it is recommended to locally store direct access to the data layers of the grid map withgrid_map::Matrix& data = map["layer"] outside the for loop:

grid_map::Matrix& data = map["layer"];
for (GridMapIterator iterator(map); !iterator.isPastEnd(); ++iterator) {
const Index index(*iterator);
cout << "The value at index " << index.transpose() << " is " << data(index(0), index(1)) << endl;
}

You can find a benchmarking of the performance of the iterators in the iterator_benchmark node of thegrid_map_demos package which can be run with

rosrun grid_map_demos iterator_benchmark

Beware that while iterators are convenient, it is often the cleanest and most efficient to make use of the built-inEigen methods. Here are some examples:

  • Setting a constant value to all cells of a layer:

    map["layer"].setConstant(3.0);
  • Adding two layers:

    map["sum"] = map["layer_1"] + map["layer_2"];
  • Scaling a layer:

    map["layer"] = 2.0 * map["layer"];
  • Max. values between two layers:

    map["max"] = map["layer_1"].cwiseMax(map["layer_2"]);
  • Compute the root mean squared error:

    map.add("error", (map.get("layer_1") - map.get("layer_2")).cwiseAbs());
    unsigned int nCells = map.getSize().prod();
    double rootMeanSquaredError = sqrt((map["error"].array().pow(2).sum()) / nCells);

Changing the Position of the Map

There are two different methods to change the position of the map:

  • setPosition(...): Changes the position of the map without changing data stored in the map. This changes the corresponce between the data and the map frame.
  • move(...): Relocates the grid map such that the corresponce between data and the map frame does not change. Data in the overlapping region before and after the position change remains stored. Data that falls outside of the map at its new position is discarded. Cells that cover previously unknown regions are emptied (set to nan). The data storage is implemented as two-dimensional circular buffer to minimize computational effort.
setPosition(...) move(...)

Packages

grid_map_rviz_plugin

This RViz plugin visualizes a grid map layer as 3d surface plot (height map). A separate layer can be chosen as layer for the color information.

grid_map_visualization

This node subscribes to a topic of type grid_map_msgs/GridMap and publishes messages that can be visualized in RViz. The published topics of the visualizer can be fully configure with a YAML parameter file. Any number of visualizations with different parameters can be added. An example ishere for the configuration file of the tutorial_demo.

Point cloud Vectors Occupancy grid Grid cells

Parameters

  • grid_map_topic (string, default: "/grid_map")

    The name of the grid map topic to be visualized. See below for the description of the visualizers.

Subscribed Topics

Published Topics

The published topics are configured with the YAML parameter file. Possible topics are:

  • point_cloud (sensor_msgs/PointCloud2)

    Shows the grid map as a point cloud. Select which layer to transform as points with thelayer parameter.

    name: elevation
    type: point_cloud
    params:
    layer: elevation
    flat: false # optional
  • flat_point_cloud (sensor_msgs/PointCloud2)

    Shows the grid map as a "flat" point cloud, i.e. with all points at the same heightz. This is convenient to visualize 2d maps or images (or even video streams) inRViz with help of its Color Transformer. The parameter height determines the desiredz-position of the flat point cloud.

    name: flat_grid
    type: flat_point_cloud
    params:
    height: 0.0

    Note: In order to omit points in the flat point cloud from empty/invalid cells, specify the layers which should be checked for validity withsetBasicLayers(...).

  • vectors (visualization_msgs/Marker)

    Visualizes vector data of the grid map as visual markers. Specify the layers which hold thex-, y-, and z-components of the vectors with the layer_prefix parameter. The parameter position_layer defines the layer to be used as start point of the vectors.

    name: surface_normals
    type: vectors
    params:
    layer_prefix: normal_
    position_layer: elevation
    scale: 0.06
    line_width: 0.005
    color: 15600153 # red
  • occupancy_grid (nav_msgs/OccupancyGrid)

    Visualizes a layer of the grid map as occupancy grid. Specify the layer to be visualized with thelayer parameter, and the upper and lower bound with data_min anddata_max.

    name: traversability_grid
    type: occupancy_grid
    params:
    layer: traversability
    data_min: -0.15
    data_max: 0.15
  • grid_cells (nav_msgs/GridCells)

    Visualizes a layer of the grid map as grid cells. Specify the layer to be visualized with thelayer parameter, and the upper and lower bounds with lower_threshold andupper_threshold.

    name: elevation_cells
    type: grid_cells
    params:
    layer: elevation
    lower_threshold: -0.08 # optional, default: -inf
    upper_threshold: 0.08 # optional, default: inf
  • region (visualization_msgs/Marker)

    Shows the boundary of the grid map.

    name: map_region
    type: map_region
    params:
    color: 3289650
    line_width: 0.003

Note: Color values are in RGB form as concatenated integers (for each channel value 0-255). The values can be generated likethis as an example for the color green (red: 0, green: 255, blue: 0).

Build Status

Devel Job Status

  Indigo Jade Kinetic
grid_map
doc

Release Job Status

  Indigo Jade Kinetic
grid_map
grid_map_core
grid_map_ros
grid_map_msgs
grid_map_rviz_plugin
grid_map_visualization
grid_map_filters
grid_map_loader
grid_map_demos

Bugs & Feature Requests

Please report bugs and request features using the Issue Tracker.

ROS_Kinetic_x ROS栅格地图庫 Grid Map Library的更多相关文章

  1. [python] A*算法基于栅格地图的全局路径规划

    # 所有节点的g值并没有初始化为无穷大 # 当两个子节点的f值一样时,程序选择最先搜索到的一个作为父节点加入closed # 对相同数值的不同对待,导致不同版本的A*算法找到等长的不同路径 # 最后c ...

  2. 小豆包的学习之旅:占用概率栅格地图和cost-map

    接下来将制图和定位问题分别进行介绍.这两个问题可以视为SLAM过程中两个相互联系的子问题,但是也可以视为两个单独的问题.虽然说SLAM问题是鸡和蛋的问题,但是在实际处理过程中总是有先后的.为了简化问题 ...

  3. 利用Matlab快速绘制栅格地图

    代码演示 % 基于栅格地图的机器人路径规划算法 % 第1节:利用Matlab快速绘制栅格地图 clc clear close all %% 构建颜色MAP图 cmap = [1 1 1; ... % ...

  4. matlab构建栅格地图绘图思路

    matlab构建栅格地图绘图思路 近来因研究需要,调研并思考了栅格地图的生成方法,暂时总结以备不时之需. 栅格的建立最需要注意栅格粒度的问题,即根据需要调整栅格的边长,目前有两种思路一种是固定栅格边长 ...

  5. Map-making Robots: A Review of the Occupancy Grid Map Algorithm

    栅格地图算法:http://www.ikaros-project.org/articles/2008/gridmaps/

  6. uni-app 地图初用 map

    一.uni-app 地图初用 map 代码如下: <template> <view> <!-- <page-head :title="title" ...

  7. ROS 八叉树地图构建 - 安装 octomap 和 octomap_server 建图包!

    项目要用到八叉树库 Octomap 来构建地图,这里记录下安装.可视化,并启用带颜色的 Octomap 的过程. 一.Apt 安装 Octomap 库 如果你不需要修改源码,可以直接安装编译好的 oc ...

  8. ROS 八叉树地图构建 - 使用 octomap_server 建图过程总结!

    构建语义地图时,最开始用的是 octomap_server,后面换成了 semantic_slam: octomap_generator,不过还是整理下之前的学习笔记. 一.增量构建八叉树地图步骤 为 ...

  9. IOS 使用程序外地图(IOS Map and google Map)

    1.调用IOS6苹果地图 IOS6中实现这个功能需要使用Map Kit中的MKPlaceMark和MKMapItem两个类,因此我们需要在工程中添加MapKit.framework主要代码如下: - ...

随机推荐

  1. bzoj 5287: [Hnoi2018]毒瘤

    Description Solution \(dfs\) 出一棵生成树之后,多出来的边就都是反祖边了 把反祖边两个端点都拿出来,就会得到最多 \(k=2*(m-n+1)\) 个关键点 除了关键点以外的 ...

  2. slab机制

    1.内部碎片和外部碎片 外部碎片 什么是外部碎片呢?我们通过一个图来解释: 假设这是一段连续的页框,阴影部分表示已经被使用的页框,现在需要申请一个连续的5个页框.这个时候,在这段内存上不能找到连续的5 ...

  3. 习题9-3 UVA1629(dp)

    Cake Slicing 题意:有一个n行m列的网格上有一些黑点,要求进行切割,使最后每块上只有一个黑点,求最少的刀数 思路:记忆化搜索,枚举每一条边来切,每一次搜索自己所能切割的所有情况取最小值 但 ...

  4. UVA 3713 Astronauts

    The Bandulu Space Agency (BSA) has plans for the following three space missions: • Mission A: Landin ...

  5. Python paramik

    本节内容 paramiko模块 1.paramiko模块 Python的paramiko模块,该模块机遇SSH用于连接远程服务器并执行相关操作 Python的paramiko模块,该模块机遇SSH用于 ...

  6. Thinkphp中的 I 函数(Thinkphp3.2.3版本)

    I 函数的作用是获取系统变量,必要时还可以对变量值进行过滤及强制转化,I 函数的语法格式: I('变量类型.变量名/修饰符',['默认值'],['过滤方法或正则'],['额外数据源']) 一.获取变量 ...

  7. 从Openvswitch代码看网络包的旅程

    我们知道,Openvwitch可以创建虚拟交换机,而网络包可以通过虚拟交换机进行转发,并通过流表进行处理,具体的过程如何呢? 一.内核模块Openvswitch.ko的加载 OVS是内核态和用户态配合 ...

  8. 一个页面从输入url到页面加载显示完成,中间都经历了什么

    第一种解释: 一般会经历以下几个过程: 1.首先,在浏览器地址栏中输入url 2.浏览器先查看浏览器缓存-系统缓存-路由器缓存,如果缓存中有,会直接在屏幕中显示页面内容.若没有,则跳到第三步操作. 3 ...

  9. Ubuntu 16.04+.Net Core+Docker+Uginx安装部署

    前言 最近公司的项目打算移植到.Net Core平台,所以调研了一下.Net Core在Linux下的安装部署.本篇文章会一步步的描述从安装到配置到部署的全部过程.在文章的结构和内容里,笔者借鉴了很多 ...

  10. 读书学习-Python--描述符(python3)

    转自我的知乎文章(https://zhuanlan.zhihu.com/p/32487852) 何为描述符?描述符就是实现了__get__.__set__和__delete__三者中任意一个的类.是用 ...