... source : https://github.com/OctoMap/octomap_mapping
Go trough this pdf once to get an understanding of octomap with ros octomap_ros tutorial
If you have a pcd file
1.you need to remap the output topic cloud_pcd to cloud_in because octomap package subscribes to cloud_in <BR/> 2.create a launch folder in pcl_ros and create a file named pcd_to_pcl.launch, copy the following code to your launch file.
<launch> <node pkg="pcl_ros" type="pcd_to_pointcloud" name="spawn_pcd_to_pcl" output="screen" args ="path-to-you-pcd-file/cloud_in.pcd 0.1" > <param name="frame_id" value="/map" /> <remap from="cloud_pcd" to="cloud_in" /> </node> </launch>
2.Run the launch file
roslaunch pcl_ros pcd_to_pcl.launch
3.start your octomap node as below
rosrun octomap_server octomap_tracking_server_node
4.start rviz and add the topic: /occupied_cells_vis_array to visualize octomap cells
rosrun rviz rviz
5.save octotree
rosrun octomap_server octomap_saver -f mapfile.ot
6.Install octovis to visualize the ot or bt file
sudo apt-get install ros-indigo-octovis
7. to visualize your saved ot or bt file
octovis yourfilename
8.for distance transform in 3D with octomap need to install dynamic-edt-3d, a seperate package
sudo apt-get install ros-indigo-dynamic-edt-3d
9.Worst part is in my version it doesnot have config file to link the libraries and it is only there as debian, so i only can install with apt-get. Package is not available for build from source issue link
set(DYNAMICEDT3D_LIBRARIES "/opt/ros/indigo/lib/libdynamicedt3d.so") include_directories( include ${catkin_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS} ${OCTOMAP_INCLUDE_DIRS} ${DYNAMICEDT3D_LIBRARIES} )
if you check the above box, i have added DYNAMICEDT3D_LIBRARIES variable to the path of the library in the CMakeLists.txt 10. for changing the resolution, change the octo_mapping.launch file
<launch> <node pkg="octomap_server" type="octomap_server_node" name="octomap_server"> <param name="resolution" value="0.5" /> <!--common frame id fixed map frame (set to 'map' if SLAM or localization running!) --> <param name="frame_id" type="string" value="map" /> <!-- maximum range to integrate (speedup!) --> <param name="sensor_model/max_range" value="5.0" /> <!-- data source to integrate (PointCloud2) --> <!--remap from="cloud_in" to="/narrow_stereo/points_filtered2" /--> </node> </launch>
roslaunch octomap_server octomap_mapping.launch