1. 安装Kinect驱动
安装openni
sudo apt-get install ros-indigo-openni-camera ros-indigo-openni-launch
安装libopenni-sensor-primesense-dev
sudo apt-get install libopenni-sensor-primesense-dev
安装驱动
mkdir ~/kinectdriver
cd ~/kinectdriver
git clone https://github.com/avin2/SensorKinect
cd SensorKinect/Bin/
tar xvjf SensorKinect093-Bin-Linux-x64-v5.1.2.1.tar.bz2
cd Sensor-Bin-Linux-x64-v5.1.2.1/
sudo ./install.sh
驱动安装成功后,再安装下列包
sudo apt-get install ros-indigo-openni-* ros-indigo-openni2-* ros-indigo-freenect-*
测试Kinect(我使用的是Kinect一代)
roslaunch freenect_launch freenect-registered-xyzrgb.launch
rosrun image_view image_view image:=/camera/rgb/image_raw
rosrun image_view image_view image:=/camera/depth_registered/image
2. 安装rgbdslam功能包
进入工作空间,下载并解压
cd ~/catkin_ws/src
wget -q http://github.com/felixendres/rgbdslam_v2/archive/indigo.zip
unzip -q indigo.zip
安装以来并进行编译
cd ~/catkin_ws
rosdep install rgbdslam
rosdep update
catkin_make
3. 建立三维模型/重建
roslaunch freenect_launch freenect.launch
roslaunch rgbdslam rgbdslam.launch
打开后转动Kinect,即可对周边环境进行建模
建好后,就可以保存你的三维了,在rgbdslam界面,按空格键,暂停后,在电脑最上方选择SAVE,save as point clund,保存到你想要的文件夹中,选择后最好等一会,因为一个三维点云体积都很大!
4. 保存并使用rviz查看三维地图
首先安装PCL,处理点云的必备工具,安装方法为
sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl-all
安装后,使用pcl将点云发布到ros上
rosrun pcl_ros pcd_to_pointcloud quicksave.pcd
这时,运行rviz
rosrun rviz rviz
打开界面后,在最上方的Fixed Frame输入 base_link,在下面的add中添加PointClound2,添加后,打开pointclound2的列表,在topic中选择/cloud_pcd,如图