# Cost Map
This is a C++ library directly analogous to ETHZ ASL's [GridMap] library,
but designed for use with costs where the data element is an unsigned char (as opposed to grid_map's doubles).
## Table of Contents
1. [Packages Overview](#packages-overview)
2. [CostMap](#costmap)
3. [Publishing and Subscribing](#publishing-and-subscribing)
4. [Visualisations](#visualisations)
5. [Saving and Loading](#saving-and-loading)
6. [Costmap2DROS Conversions](#costmap2dros-conversions)
7. [Other Conversions](#other-conversions)
8. [Inflation Computers](#inflation-computers)
## Packages Overview
* ***cost_map*** : meta-package for the grid map library.
* ***cost_map_core*** : core interfaces and algorithms of the cost map library, this package has no [ROS] dependencies.
* ***cost_map_ros*** : converters and utilities for cost maps in a [ROS] ecosystem - Image Bundles, CostMap2DROS, OccupancyGrid, CostMap messsages.
* ***cost_map_cv*** : conversions from and to [OpenCV] image types.
* ***cost_map_msgs*** : [ROS] message definitions related to the [cost_map_msgs/CostMap] type.
* ***cost_map_visualisations*** : helper nodes that bridge cost maps to [RViz].
* ***cost_map_demos*** : several nodes for demonstration purposes and a test suite.
The source code is released under a [BSD 3-Clause license](LICENSE).
## CostMap
The core `cost_map::CostMap` class is designed to maintain as close a compatibility
to grid maps as possible. This compatibility extends to conventions, definitions and API.
For convenience, an illustrative reference of a few of the conventions that hold for both
cost maps and grid maps is provided below.
[![Layers](cost_map_core/doc/grid_map_layers.png)](cost_map_core/doc/grid_map_layers.pdf)
[![Conventions](cost_map_core/doc/grid_map_conventions.png)](cost_map_core/doc/grid_map_conventions.pdf)
Please refer to the [GridMap README](https://github.com/ethz-asl/grid_map/blob/master/README.md) for a
more comprehensive outline of what is possible with cost maps and grid maps.
Doxygen documentation for the cost map API's is served via the *Code API* links on the
[ROS wiki](http://wiki.ros.org/cost_map) for each respective release/package. In addition
the latest doxygen documentation can always be found for each package at:
* [cost_map_core](http://docs.ros.org/api/cost_map_core/html/annotated.html)
* [cost_map_ros](http://docs.ros.org/api/cost_map_ros/html/annotated.html)
* [cost_map_visualisations](http://docs.ros.org/api/cost_map_visualisations/html/annotated.html)
## Publishing and Subscribing
Use the `cost_map::toMessage()/fromMessage(...)` methods.
```cpp
// Publishing
#include <cost_map_ros/converter.hpp>
void publishCostMap(const cost_map::CostMap& cost_map) {
cost_map_msgs::CostMap msg;
toMessage(cost_map, msg);
publisher.publish(msg);
}
```
```cpp
// Subscribing
#include <cost_map_ros/converter.hpp>
void costMapCallback(const cost_map_msgs::CostMap::ConstPtr& msg) {
cost_map::CostMap cost_map;
cost_map::fromMessage(*msg, cost_map);
}
```
## Visualisations
As with grid maps, the method employed to visualise is to drop in a relay node between
the cost map publisher and rviz to convert it to the appropriate type for visualisation.
This spares you from having to write any gui-related code in the cost maps or the
planners/controllers that use the cost maps.
`cost_map_visualisations` has a relay node that converts each layer of a subscribed
cost map topic to a `nav_msgs/OccupancyGrid` topic for rviz. Simply include and
remap the input cost map topic in your launcher, for example:
```xml
<launch>
<!-- node that publishes cost maps -->
<node pkg="cost_map_visualisations" type="node" name="cost_map_visualisation">
<remap from="cost_map_visualisation/cost_map" to="funky_cost_maps/cost_map"/>
</node>
<!-- rviz, with a pre-loaded configuration that loads the resulting occupancy grid maps -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find funky_demos)/rviz/funky_cost_maps.rviz" />
</launch>
```
An example of a relay in action is in the image bundle demo below.
## Saving and Loading
### Image Bundles
Image bundles provide an easy way to load and save cost maps to and from files on disk.
An image bundle consists of data stored in two parts - 1) meta-information about a costmap in
a yaml file and 2) layer data that is stored alongside in grayscale images.
A typical meta yaml for an image bundle:
```yaml
# frame in the world that this map is attached to
frame_id: map
# co-ordinates of the centre of the map relative to the frame_id
centre_x: 0
centre_y: 0
# dimensional properties of the map
resolution: 0.05
number_of_cells_x: 200
number_of_cells_y: 200
# data layers
layers:
- layer_name: obstacle_costs
layer_data: obstacle_costs.png
- layer_name: static_costs
layer_data: can_be_some_other_name.png
```
See [cost_map_ros/image_bundles/example.yaml](cost_map_ros/image_bundles/example.yaml) for a real example.
### ImageBundle Demo
```bash
# load an image bundle and visualise the cost map
roslaunch cost_map_demos load_image_bundle.launch --screen
```
### ImageBundle Command Line Utilities
There exist two command line utilities for loading and saving to and from a cost map topic:
```bash
# load and publish to '/foo/cost_map'
rosrun cost_map_ros load_image_bundle -t /foo/cost_map example.yaml
# subscribe and save from '/foo/cost_map' to foo.yaml
mkdir foo
cd foo
rosrun cost_map_ros save_image_bundle /foo/cost_map foo.yaml
```
### ImageBundle Methods
* `cost_map::toImageBundle(...)` : save a cost map to an image bundle
* `cost_map::fromImageBundle(...)` : load an image bundle into a cost map object
See the [LoadImageBundle](cost_map_ros/src/lib/image_bundles.cpp#L203)/[SaveImageBundle](cost_map_ros/src/lib/image_bundles.cpp#L235)
classes which illustrate how the command line utilities use these api.
## Costmap2DROS Conversions
The ROS Navistack uses `costmap_2d::Costmap2DROS` objects and it is sometimes necessary
to make conversions from these to provide new style cost maps to other libraries. Methods are
available for both full map conversion as well as subwindows centred on the pose of the robot itself.
### Costmap2DROS vs CostMap
[![CostMap](cost_map_ros/doc/image_loading_coordinates_preview.png)](cost_map_ros/doc/image_loading_coordinates.png)
### Costmap2DROS Demo
Costmap2DROS | Full/Partial Copies
:---: | :---: | :---:
[![Costmap2DROS](cost_map_demos/doc/images/from_ros_costmaps/from_ros_costmaps_preview.png)](cost_map_demos/doc/images/from_ros_costmaps/from_ros_costmaps.png) | [![CostMap](cost_map_demos/doc/images/from_ros_costmaps/from_ros_costmaps_copied_preview.png)](cost_map_demos/doc/images/from_ros_costmaps/from_ros_costmaps_copied.png)
```bash
# load several ros costmaps and copy full/sub windows to new style costmaps
roslaunch cost_map_demos from_ros_costmaps.launch --screen
```
### Costmap2DROS Methods
* `cost_map::fromCostmap2DROS(...)` : create a cost map from a Costmap2DROS
* `cost_map::fromCostmap2DROSAtRobotPose(...)` : create a cost map from a subwindow around the robot pose in a Costmap2DROS
See the [from_ros_costmaps demo program](cost_map_demos/src/applications/from_ros_costmaps.cpp)
which illustrates how to use these api. Additionally you can directly use the `grid_map::Costmap2DConverter` template class for more atomic operations.
## Other Conversions
* `cost_map::toGridMap(...)` : convert to a float based grid map by normalising values between 0.0 and 100.0
* `cost_map::addLayerFromROSImage(...)` : add a layer from ros immage message type (sensor_msgs::Image)
## Inflation Computers
### Inflation Demo
```bash
# load an image bundle and visualise the cost map
roslaunch cost_map_demos inflations.launch --screen
```
Obstacle Layer | Inflated
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ROS机器人turtlebot路径规划 (1287个子文件)
008d33f58dce7fd22f81d41201306259508f91 2KB
053f816070bbccea3c3a49bbc0cd68ddd370b8 170B
090250626175d92ea37a74e68c3a2a1863126b 273B
0984ec743e4c4cacabe8b42cc8ffe5138b2a32 65B
126ecad96f89e1bd6dcf28881d5cd79f635c0a 240B
156fe1db9c5cd21ca1c68b7025bae40d0c5764 14KB
15c726a936fb0d1cb51eb83c71b174ceedd567 55B
1683406722c1c1096b8ee2f49b1ef08767cf83 273B
177f55be8e036ff5dd469fd6658bbb54ebd538 135B
1780ad8d51bfb96a3ba3ee35cb589a6a996e5d 176B
181d864004c53ef29d0901eb7061f816ebaaa7 165B
1a2615a929d35b6b32dda8e61406bc5c2c9a15 4KB
1d037b8723e8b3f45812b7c7d52c8c998d6574 68B
1e68bdd7019b5ea7d6171696182cb5c6e951d1 273B
211b32d031426748a582af02d329bbe134f8f9 160B
2148dac4a942ba1b847f6685fd94f3b149a285 583B
23027aa1298bab851223c1a0ac7ae75e7eaae5 173B
2341d8cb8705d46851e4fa5a8db8db5090c1c6 273B
248adf8541d25b98d15a0b40153848b26acbc2 163B
24dd6dd0554f5dfeb183da6694c8ec82642366 57B
27f404a15dc1f20ada63a423b6e0e95d1b7ef4 2KB
2c087cf932e4118316872358896d7be7a35bc9 93B
2c9cdf926129173ca639263837436f175162e8 56B
2cf4e7684d09528a3e4a375b194e8c7a21f9f4 273B
2f573f5fd535c62ba3ed0f4ef4773d0dfc7d36 324B
30b04e315ee7c9fa34fce3b97bae107231e5bc 274B
31187b8ceeb7bb0a8014ce790e73692f49e128 4KB
31fa9ce9065e88f47a7a0653facd8bbea25f0a 451B
338a62cfc79d30bf1c4a5e755f7f61a701d485 236B
358e6e505619992d9619fe024bcfa9a07461f6 465B
3732bd968d52fb5e9abb3b9077a0bc5fd35ebd 2KB
379b5278538a86fbcde90375dcdf4ae822fb4c 162B
386e6b675bf4a81fc68139255f90e4ecafafd6 455B
3a21527cd09e24feca1c8c14b0693e73d56563 168B
3ada69d60f01ed9bb6ec9f07245a1246ab60fb 493B
3c1b1f79ce4715499a93ef437d81d73a04dc97 85B
3e383cf619942e5c2da0fc61e600129d90e018 68B
40563d24c5a6152466cc429a786e792459543e 482B
4108024fda0686cefbc82f83ac15745622bc93 179B
43b6848355d4058db65ecc1200d1af9ad7cef4 129B
449b9aabd26b7c7e7df9db06518cfa08a1c425 361B
45ed9718ef17dfc1df470257d40b54779292c2 2KB
49feb31578de18e01d73614d4e61cb15e0962e 239B
4a4277ed82ce40dd7eea1efdab488c6b502e30 273B
4d27c01f748ef92354aa34dd3c1343d0ca7988 6KB
4d2ac01b58ba481e9cb90eb361b41d1a15af1d 243B
4d2b0d903b2a8158e2badf0f28a0035416a251 171B
4fe0a748559fc730fd8d0b61d494f84f681228 2KB
51663977aae55a3b86b9ebdeaf27d7f2669b73 7KB
5391dd7003c61168706b1e2fbd0198e6ea3304 2KB
5bc80e581504874859a678a8c32b400484f0b6 72B
5c8dbd0940dd6101f80ed4fc822f51c981d360 2KB
5dc2d4bc65483a797474544463500842260acd 171B
5edaac440f37e94643c68c91349173d1e030f6 773B
5ee2e38ce2dbb09a8975116f410d8da75a37d8 345B
617d1c38e3c3683f615fa42a11e790be1dc7a0 68B
62b7259c97424d81adf307cd8354588a1c0c7e 908B
6399ad59573c932d5b5a8fddb0fd63d2fa7937 321B
662179e3df795c4a633b23cde899b595d5027a 2KB
66e0f7d5cb1c66a25c18c3294d97c0c92e01d0 5KB
6bb91fbb7677bb60578686dfb6fdbc26449849 239B
6cde442a37d30b7fb01f9d6ffe67c70ca7ccaa 462B
6d0011d5310ba82f98fcddc63f9130dfaf72b2 89B
6d8930fa57f1e5480d7ae7ddab41d69823f780 819B
6d8daa8d3ca26bacc4d6385213c0e1fbd56c1a 1KB
6ea8d3345b1a9d0b2c79c9b791f89594138a0a 2KB
7106147effae166ccc42460448359a1bc99e99 117B
731e157b8a474e64cf502dd46f40430c8c696c 176B
763d11c8f18ca7495e4dd1a244da743c4335eb 3KB
780e27b4147e3e0ce6ca6ece44d901b3cac0b1 67B
7844a1622f68cf4b6674d1877c87dbbf3f32a7 54B
785166be569cf08192f7a7d6f642fbc0722fd6 2KB
78e123e614640d6c1cf66127a4507c2f600dff 353B
7b5de7195fb1830e0e84dffe57117314cc5dc9 164B
7dbbe75274d8dddb2cc980e516f009f6a1efa0 239B
7e46604598eda3f51eee74e5583c4d2940d7ce 2KB
7f509fd789deb8c29f401621b3ba6b3fd1b621 68B
81136655fe3e5e30d53c921c6a15f05e260b65 167B
81c79171408e93597f9a2ed6c12d2f7e1a09c5 1KB
829ee43300bc4bb2e4946abcba70bf82345c4f 718B
837425e666423711cb718767954503a80cb821 210B
8380dc888a0443220b675f637fee300af50313 2KB
8418e9620c449cca315c1d4375c7afbbec2fb2 498B
85e88649f35c4b70a8b345bea18398f83f0d8c 361B
86a2158fe2479fa1e366e06d32ed2417178966 511B
8749fe8121797e35162357f975330badbffa17 2KB
88a66c575d32db60d869141e15ebc7a29c0f47 3KB
88b28fa85f4851644f294100c7b6188014282a 239B
8b07620f294fe20642a42941fd40d82521a543 6KB
8d09b009dd353048fce58f296da9305149b1b9 240B
8e76afb85778935ea3931397553ac86ecb03de 325B
90bd8ab55b5a205d1eb07b91efa1ef217c7177 127B
9217c135cb1bdee1672365f257563256307ca5 64B
92774cc850874a8025779415e3d18e4c3ba5fc 5KB
9389035e1933091fe6a56c3a119d7b406f2535 177B
95559a10e646e989ae064aa0bcf204154fa9d7 593B
959a7eb71fa3492cd96ce3b60203811ee5aa24 90B
95c60b0315efa0bb7da6c9d4c12d4fb4c311af 77B
95f1dbcb1673cdeff93f0497369284d97ee7ab 195B
96fe0a4915d19107ae8b0f69e75f0b5c5bc8e6 6KB
共 1287 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
- 向阳花33992018-05-23挺好。。。。。。
- mhrobot2019-02-18还不错。。。
机器的创造者
- 粉丝: 13
- 资源: 34
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功