在使用gmapping时,如果是用kinetic作为获取数据sensor,那么就需要将kinect获取的depth data转换成fake laser scan。
使用步骤如下:
1.将depthimage_to_laserscan包下载到工作空间中:
cd ~/catkin_ws/src
git clone --branch indigo-devel https://github.com/ros-perception/depthimage_to_laserscan.git
cd ..
catkin_make
2.
roslaunch openni_launch openni.launch
3.
rosrun depthimage_to_laserscan depthimage_to_laserscan image:=/camera/depth/image_raw
4.
rosrun rviz rviz
在rviz中Fixed Frame选择camera_depth_optical_frame,Add选择By topic,选择LaserScan,在LaserScan中的Color Transformer中选择AxisColor。
会看到距离近的物体的点是红色,距离远的是紫色。
enjoy!