1.这两天看了一些关于move_base的栅格地图相关的一些东西
2.在move_base的costmap中提供了三个话题,其中括号中的是数据类型,通过话题订阅可以获取像素点的代价值及局部地图不断更新的代价值。只能获取并不能更改其代价值。
wiki网页链接:http://wiki.ros.org/costmap_2d
~<name>/costmap (nav_msgs/OccupancyGrid)
The values in the costmap
~<name>/costmap_updates (map_msgs/OccupancyGridUpdate)
The value of the updated area of the costmap
~<name>/voxel_grid (costmap_2d/VoxelGrid)
Optionally advertised when the underlying occupancy grid uses voxels and the user requests the voxel grid be published.
3.在costmap上创建一层新的地图层
wiki链接:http://wiki.ros.org/costmap_2d/Tutorials/Creating%20a%20New%20Layer
步骤1:创建一个package
cd ~/catkin_ws/src
catkin_create_pkg simple_layers roscpp costmap_2d dynamic_reconfigure std_msgs rospy
在这里插入图片描述
步骤2:
分别在
1.在simple_layers/include/simple_layers文件夹中建立simple_layer.h文件
2.在simple_layers/isrc/simple_layers文件夹中建立simple_layer.c文件
.h文档与.c文档内容全部复制wiki官网
步骤3:
修改Cmakerlists.txt文件(与src在同一个文件夹的)
add_library(simple_layer src/simple_layer.cpp)
include_directories(include ${catkin_INCLUDE_DIRS})
编译这个package的时候,能够找到之前simple_layers/include/simple_layers这个文件下的头文件
步骤4:创建costmap_plugins.xml
这个文件是插件的描述文件,它的目的是让ROS系统发现这个插件和load这个插件到系统里去
内容:
<library path="lib/libsimple_layer">
<class type="simple_layer_namespace::SimpleLayer" base_class_type="costmap_2d::Layer">
<description>Demo Layer that adds a point 1 meter in front of the robot</description>
</class>
</library>
步骤5:修改package.xml文件,注册刚刚的插件。
<costmap_2d plugin="${prefix}/costmap_plugins.xml" />
步骤6:
cd ~/catkin_ws
catkin_make
source devel/setup.bash
rospack plugins --attrib=plugin costmap_2d
获得
zhy@zhy-Inspiron-7460:~/nav_test$ rospack plugins --attrib=plugin costmap_2d
pedestrian_layer-master /home/zhy/nav_test/src/pedestrian_layer-master/costmap_plugins.xml
simple_layers /home/zhy/nav_test/src/simple_layers/costmap_plugins.xml
costmap_2d /opt/ros/kinetic/share/costmap_2d/costmap_plugins.xml
zhy@zhy-Inspiron-7460:~/nav_test$
说明插件已经可以使用
参考博客1
看了一个大一的小朋友做的ros,自闭了