octomap_server

octomap_server除了将点云地图转化为基于Octree的OctoMap,还能将点云地图转化为二维地图。可以增量建3D的 OctoMaps,还提供了能保存地图的节点octomap_saver. octomap_server节点很消耗内存,增量建图的过程中内存持续上升,因为当中不存在内存释放,没有静态储存八叉树图信息

1
2
3
4
5
6
7
8
9
10
11
12
<node pkg="octomap_server" type="octomap_server_node" name="octomap_server">
<!-- resolution in meters per pixel -->
<param name="resolution" value="0.05"/>
<!-- name of the fixed frame, needs to be "/map" for SLAM -->
<param name="frame_id" type="string" value="$(arg frame_id)"/>
<param name="sensor_model/max_range" value="150.0"/>
<param name="latch" value="true"/>
<!-- 需要和 publish_pointcloud 的frame_id相同,否则会导致Octomap没有发布数据 -->
<!-- topic from where pointcloud2 messages are subscribed,改为自己的点云话题 -->
<remap from="/cloud_in" to="$(arg cloud_topic)"/>
<remap from="/projected_map" to="$(arg map_topic)"/>
</node>

也就是将点云数据发布到一个指定的 topic 上,然后调用 Octomap 在ROS下的srv组件进行实时转换,并发布到另外一个 Octomap topic 上去,最后通过rviz 进行显示Octomap。注意octomap的输入话题(topic)和数据的坐标系(frame_id)两个参数的设置, 通常octomap 没有数据输出都是由于这两个参数设置错误导致的。

Rviz配置

安装octomap-rviz-plugins后,打开rviz,这时候点开Add选项,会多一个octomap_rviz_plugins模组。 其中的OccupancyGrid是显示三维概率地图,也就是octomap地图。OccupancyMap是显示二维占据栅格地图。

打开rviz,在里面添加OccupancyGrid,OccupancyMap,Map显示选项,显示话题选择octomap_full或者octomap_binary

octomap topics are 3D occupancy maps, which would be used by some other 3D planning approach (e.g., move_it). They are not the same as /grid_map or /proj_map from rtabmap_ros. For 3D trajectories (having to move in Z, e.g., quadcopter), then using OctoMap with OMPL/move_it can be another approach, though not sure if there is one most popular approach for the 3D case.

参考:
Octomap在ROS环境下实时显示,但点云来源是ORB稠密点云