Skip to content

A ROS package to process PointCloud2 and build OctoMap

License

Notifications You must be signed in to change notification settings

HuaYuXiao/easondrone_mapping

Repository files navigation

easondrone_mapping

HitCount Static Badge Static Badge Static Badge Static Badge

A ROS package to process PointCloud2 and build OctoMap

  • merge or concatinate multiple PointCloud2s, with optional ICP algorithm, and publish PointCloud2 in another frame
  • build OctoMap from PointCloud2

Installation

sudo apt install libpcl-dev
cd ~/easondrone_ws/reconstruct
git clone https://github.com/HuaYuXiao/easondrone_mapping.git
cd ~/easondrone_ws
catkin_make --source reconstruct/easondrone_mapping --build reconstruct/easondrone_mapping/build

Merge Multiple sensor_msgs::PointCloud2

Config Parameters

pc2_topics_in: 
    - /livox/lidar
    - /realsense/depth_camera/depth/points
timeout: 0.5

tf_duration: 0.05

# The Iterative Closest Point algorithm
icp_enable: true
icp_max_iter: 1
icp_tf_epsilon: 1e-8
icp_euclidean_fitness_epsilon: 1e-5
icp_max_corr_d: 0.05

pc2_topic_out: /sensor/pc2_out
pc2_frame_out: base_link

Launch ROS Node

<launch>
    <node pkg="easondrone_mapping" type="merge_pc2" name="merge_pc2">
        <rosparam command="load" file="$(find easondrone_mapping)/config/merge_pc2.yaml" />
    </node>
</launch>

Build OctoMap

Launch ROS Node

roslaunch easondrone_mapping octomap_server.launch

Save Map

You are trying to invoke octomap_saver as an argument to the octomap_server node. However, octomap_saver is a node of its own, so you only have to start it from a separate terminal while octomap_server is running. Check the documentation at http://wiki.ros.org/octomap_server#octomap_saver

控制无人机完成建图后,用以下指令保存.ot(或者.bt,相较于.ot体积更小)格式的地图文件

rosrun octomap_server octomap_saver -f ~/easondrone_ws/reconstruct/easondrone_mapping/map.ot

image

参考:

查看地图

方法1:octovis

也可以借助octovis工具查看

octovis ~/easondrone_ws/reconstruct/easondrone_mapping/map.bt

方法2:rviz

一种方法是在rviz中查看

rviz
rosrun octomap_server octomap_server_node ~/easondrone_ws/reconstruct/easondrone_mapping/map.bt

添加OccupancyGrid,话题选择/octomap_binary

image

参考:

加载地图

参考:

LaserScan to PointCloud2

rosrun easondrone_mapping laser_to_pointcloud.py

(deprecated) 转发点云

EGO-Planner等规划器要求点云发布在world坐标系下,因此需要将原本发布在lidar_frame的点云转发到world下

rosrun easondrone_mapping pub_pcl_world.py