一、编译安装
系统ubuntu16.04、ros-kinetic、gird_map 1.6.0-1.6.2。
1.1 官方github
ros-kinetic适用grid_map版本:1.6.0--1.6.2
https://github.com/ANYbotics/grid_map/issues/279https://github.com/ANYbotics/grid_map/issues/279
1.2 安装编译
sudo apt-get install ros-kinetic-grid-map
##安装依赖
sudo apt-get install libeigen3-dev
##创建工作空间编译
mkdir -p xxx/grid_map_ws/src
cd grid_map_ws/src
git clone -b 1.6.0 https://github.com/anybotics/grid_map.git
cd ..
catkin_make -DCMAKE_BUILD_TYPE=Release
#catkin_make
#或以Release模式编译(建议以Release模式编译,下面2.7会说明原因)
#catkin_make -DCMAKE_BUILD_TYPE=Release
使用1.6.0版本的grid_map编译,不会报错。
下面是按照官方github的readme.md进行编译的一些报错
1.3 编译踩坑
##git clone默认版本,会报错
git clone https://github.com/anybotics/grid_map.git
1.3.1 编译报错----fatal error: filters/filter_base.hpp: 没有那个文件或目录
相应修改:
grid_map_ws/src/grid_map/grid_map_cv/include/grid_map_cv/InpaintFilter.hpp 的第十行
#include <filters/filter_base.hpp> 为 #include <filters/filter_base.h>
此外,结合上次经验,还需要修改:
文件夹grid_map_ws/src/grid_map/grid_map_filters/include/grid_map_filters下几乎所有文件
#include <filters/filter_base.hpp> 或 #include <filters/filter_base.h>
文件grid_map_ws/src/grid_map/grid_map_demos/include/grid_map_demos/FiltersDemo.hpp
#include <filters/filter_chain.hpp> 为#include <filters/filter_chain.h>
文件grid_map_ws/src/grid_map/grid_map_demos/src/normal_filter_comparison_node.cpp
#include <filters/filter_chain.hpp> 为 #include <filters/filter_chain.h>
1.3.2 编译报错----error: ‘class rviz::DisplayContext’ has no member named ‘getTF2BufferPtr’
https://github.com/ANYbotics/grid_map/issues/279https://github.com/ANYbotics/grid_map/issues/279 参考上面的链接,说的是grid_map github仓的默认版本为ubuntu18.04的melodic,上面直接git clone 的版本不适用ubuntu16.04的ros-kinetic。参考链接,将原来git clone的删掉,git clone 1.6.0-1.6.2版本的.
git clone -b 1.6.0 https://github.com/anybotics/grid_map.git
1.4 安装测试
适用catkin_make编译的(我用的)
source devel/setup.bash
catkin_make run_tests_grid_map_core run_tests_grid_map_ros
测试成功:
适用catkin tools的
catkin build grid_map --no-deps --verbose --catkin-make-args run_tests
二、应用demo
##进入工作空间,并source一下
cd grid_map_ws/
source devel/setup.bash
2.1 simple demo
roslaunch grid_map_demos simple_demo.launch
2.2 tutorial demo
roslaunch grid_map_demos tutorial_demo.launch
2.3 iterators_demo
roslaunch grid_map_demos iterators_demo.launch
2.4 image to gridmap demo
roslaunch grid_map_demos image_to_gridmap_demo.launch
2.5 opencv demo
roslaunch grid_map_demos opencv_demo.launch
视频链接:https://www.bilibili.com/video/BV1gF411J78D/https://www.bilibili.com/video/BV1gF411J78D/
2.6 resolution change demo
roslaunch grid_map_demos resolution_change_demo.launch
视频链接:
https://www.bilibili.com/video/BV1oL4y1W7rc/https://www.bilibili.com/video/BV1oL4y1W7rc/
2.7 filter demo
roslaunch grid_map_demos filters_demo.launch
filters_demo uses a chain of ROS Filters to process a grid map. Starting from the elevation of a terrain map, the demo uses several filters to show how to compute surface normals, use inpainting to fill holes, smoothen/blur the map, and use math expressions to detect edges, compute roughness and traversability. The filter chain setup is configured in the filters_demo_filter_chain.yaml file。
filters_demo使用一系列的ros过滤器来处理栅格地图。
这个演示从地形图的高程图开始,使用一些列的过滤器来展示,如何计算曲面法线、修补填充孔洞、平滑/模糊地图、使用数学表达式来检测边缘、计算粗糙度和可通行度。
过滤器链设置配置在filters_demo_filter_chain.yaml文件中
第一次直接正在终端roslaunch,rviz中会显示空白,如下;大概是需要在
查看readme.md的grid_map_filters篇幅,好像是需要在filters_demo_filter_chain.yaml里面配置不同的过滤器,所以这里显示空白。
查看系统情况,如下图:8核cpu只有两个满了,16GB运存用了20%多一些,应该不是cpu和内存的问题。
查看话题:
[meng@meng ~/my_learning/grid_map_ws]$ rostopic list
/clicked_point
/grid_map_filter_demo/filtered_map
/grid_map_visualization/surface_normals
/grid_map_visualization/traversability_grid
/image_publisher/image
/image_to_gridmap_demo/grid_map
/initialpose
/move_base_simple/goal
/rosout
/rosout_agg
/tf
/tf_static
其中图像话题可以用:rqt_image_view直接查看:
唉,可能就是下面链接说的rviz 插件可视化的问题、没有用RELEASE MODE编译问题等等。
https://github.com/ANYbotics/grid_map/issues/167https://github.com/ANYbotics/grid_map/issues/167https://github.com/ANYbotics/grid_map/issues/184
https://github.com/ANYbotics/grid_map/issues/184
这里先尝试最简单的方法,删除原来使用catkin_make编译的文件夹,使用RELEASE MODE编译,就通过了~
catkin_make -DCMAKE_BUILD_TYPE=Release
normal mapping:正常建图
Elevation:高程图,立视图
Edge:边缘
roughness:粗糙度
traversability:可通行度
surface normal:表面法向量