ROS indigo下Kinect v1的驱动安装与调试
ROS indigo下Kinect v1的驱动安装与调试
本文简要叙述了在ROS indigo版本下Kinect v1的驱动安装与调试过程。
1. 实验环境
(1)硬件: 台式机和Kinect v1。
台式机配置:
Intel(R)Core(TM)i5-6500 CPU @ 3.20GHz 3.20GHz;
RAM: 16.0GB;
GPU: NVIDIA GeForce GTX 1060 6GB。
(2)软件:Ubuntu 14.04 + ROS indigo。
2. 安装ROS软件包
以下2种方式,任选一种安装,或者全部安装,选择一种运行也可。
(1)openni_launch
sudo apt-get install ros-indigo-openni-camera sudo apt-get install ros-indigo-openni-launch rosstack profile rospack profile
(2)freenect_launch
sudo apt-get install ros-indigo-freenect-camera ros-indigo-freenect-stack ros-indigo-freenect-launch
或者直接一条命令将两种方式同时安装:
sudo apt-get install ros-indigo-openni-* ros-indigo-openni2-* ros-indigo-freenect-*
3. 测试Kinect v1设备
方式1:
终端1:
roslaunch openni_launch openni.launch
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
yuanlibin@yuanlibin:~$ roslaunch openni_launch openni.launch ... logging to /home/yuanlibin/.ros/log/7e08363e-2be5-11e8-b5a2-1c1b0d61bf22/roslaunch-yuanlibin-9290.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://yuanlibin:37483/ SUMMARY ======== PARAMETERS * /camera/camera_nodelet_manager/num_worker_threads: 4 * /camera/depth_rectify_depth/interpolation: 0 * /camera/depth_registered_rectify_depth/interpolation: 0 * /camera/disparity_depth/max_range: 4.0 * /camera/disparity_depth/min_range: 0.5 * /camera/disparity_registered_hw/max_range: 4.0 * /camera/disparity_registered_hw/min_range: 0.5 * /camera/disparity_registered_sw/max_range: 4.0 * /camera/disparity_registered_sw/min_range: 0.5 * /camera/driver/depth_camera_info_url: * /camera/driver/depth_frame_id: camera_depth_opti... * /camera/driver/depth_registration: False * /camera/driver/device_id: #1 * /camera/driver/rgb_camera_info_url: * /camera/driver/rgb_frame_id: camera_rgb_optica... * /rosdistro: indigo * /rosversion: 1.11.21 NODES /camera/ camera_nodelet_manager (nodelet/nodelet) depth_metric (nodelet/nodelet) depth_metric_rect (nodelet/nodelet) depth_points (nodelet/nodelet) depth_rectify_depth (nodelet/nodelet) depth_registered_hw_metric_rect (nodelet/nodelet) depth_registered_metric (nodelet/nodelet) depth_registered_rectify_depth (nodelet/nodelet) depth_registered_sw_metric_rect (nodelet/nodelet) disparity_depth (nodelet/nodelet) disparity_registered_hw (nodelet/nodelet) disparity_registered_sw (nodelet/nodelet) driver (nodelet/nodelet) ir_rectify_ir (nodelet/nodelet) points_xyzrgb_hw_registered (nodelet/nodelet) points_xyzrgb_sw_registered (nodelet/nodelet) register_depth_rgb (nodelet/nodelet) rgb_debayer (nodelet/nodelet) rgb_rectify_color (nodelet/nodelet) rgb_rectify_mono (nodelet/nodelet) / camera_base_link (tf/static_transform_publisher) camera_base_link1 (tf/static_transform_publisher) camera_base_link2 (tf/static_transform_publisher) camera_base_link3 (tf/static_transform_publisher) auto-starting new master process[master]: started with pid [9302] ROS_MASTER_URI=http://localhost:11311 setting /run_id to 7e08363e-2be5-11e8-b5a2-1c1b0d61bf22 process[rosout-1]: started with pid [9315] started core service [/rosout] process[camera/camera_nodelet_manager-2]: started with pid [9325] process[camera/driver-3]: started with pid [9333] process[camera/rgb_debayer-4]: started with pid [9334] process[camera/rgb_rectify_mono-5]: started with pid [9335] process[camera/rgb_rectify_color-6]: started with pid [9337] process[camera/ir_rectify_ir-7]: started with pid [9338] process[camera/depth_rectify_depth-8]: started with pid [9339] process[camera/depth_metric_rect-9]: started with pid [9355] process[camera/depth_metric-10]: started with pid [9362] process[camera/depth_points-11]: started with pid [9364] process[camera/register_depth_rgb-12]: started with pid [9375] process[camera/points_xyzrgb_sw_registered-13]: started with pid [9397] process[camera/depth_registered_sw_metric_rect-14]: started with pid [9414] process[camera/depth_registered_rectify_depth-15]: started with pid [9424] [ INFO] [1521512530.084412228]: Initializing nodelet with 4 worker threads. process[camera/points_xyzrgb_hw_registered-16]: started with pid [9444] process[camera/depth_registered_hw_metric_rect-17]: started with pid [9449] process[camera/depth_registered_metric-18]: started with pid [9470] process[camera/disparity_depth-19]: started with pid [9488] process[camera/disparity_registered_sw-20]: started with pid [9498] process[camera/disparity_registered_hw-21]: started with pid [9520] process[camera_base_link-22]: started with pid [9524] process[camera_base_link1-23]: started with pid [9539] process[camera_base_link2-24]: started with pid [9556] process[camera_base_link3-25]: started with pid [9563] Warning: USB events thread - failed to set priority. This might cause loss of data... Warning: USB events thread - failed to set priority. This might cause loss of data... [ INFO] [1521512530.991225346]: Number devices connected: 1 [ INFO] [1521512530.991443026]: 1. device on bus 001:08 is a SensorKinect (2ae) from PrimeSense (45e) with serial id '0000000000000000' [ INFO] [1521512530.993391990]: Searching for device with index = 1 [ INFO] [1521512532.075612809]: Opened 'SensorKinect' on bus 1:8 with serial number '0000000000000000' [ INFO] [1521512532.160335981]: rgb_frame_id = 'camera_rgb_optical_frame' [ INFO] [1521512532.160547264]: depth_frame_id = 'camera_depth_optical_frame' [ WARN] [1521512532.167038548]: Camera calibration file /home/yuanlibin/.ros/camera_info/rgb_0000000000000000.yaml not found. [ WARN] [1521512532.167074136]: Using default parameters for RGB camera calibration. [ WARN] [1521512532.167101562]: Camera calibration file /home/yuanlibin/.ros/camera_info/depth_0000000000000000.yaml not found. [ WARN] [1521512532.167119680]: Using default parameters for IR camera calibration.
终端2:
rosrun rqt_image_view rqt_image_view
如下图所示:
方式2:
终端1:
roslaunch freenect_launch freenect-registered-xyzrgb.launch
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
yuanlibin@yuanlibin:~$ roslaunch freenect_launch freenect-registered-xyzrgb.launch ... logging to /home/yuanlibin/.ros/log/4f23a262-2be6-11e8-90ab-1c1b0d61bf22/roslaunch-yuanlibin-12979.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://yuanlibin:38951/ SUMMARY ======== PARAMETERS * /camera/camera_nodelet_manager/num_worker_threads: 4 * /camera/depth_registered_rectify_depth/interpolation: 0 * /camera/driver/data_skip: 0 * /camera/driver/debug: False * /camera/driver/depth_camera_info_url: * /camera/driver/depth_frame_id: camera_depth_opti... * /camera/driver/depth_registration: True * /camera/driver/device_id: #1 * /camera/driver/diagnostics_max_frequency: 30.0 * /camera/driver/diagnostics_min_frequency: 30.0 * /camera/driver/diagnostics_tolerance: 0.05 * /camera/driver/diagnostics_window_time: 5.0 * /camera/driver/enable_depth_diagnostics: False * /camera/driver/enable_ir_diagnostics: False * /camera/driver/enable_rgb_diagnostics: False * /camera/driver/rgb_camera_info_url: * /camera/driver/rgb_frame_id: camera_rgb_optica... * /rosdistro: indigo * /rosversion: 1.11.21 NODES /camera/ camera_nodelet_manager (nodelet/nodelet) depth_registered_hw_metric_rect (nodelet/nodelet) depth_registered_metric (nodelet/nodelet) depth_registered_rectify_depth (nodelet/nodelet) driver (nodelet/nodelet) points_xyzrgb_hw_registered (nodelet/nodelet) rgb_debayer (nodelet/nodelet) rgb_rectify_color (nodelet/nodelet) rgb_rectify_mono (nodelet/nodelet) / camera_base_link (tf/static_transform_publisher) camera_base_link1 (tf/static_transform_publisher) camera_base_link2 (tf/static_transform_publisher) camera_base_link3 (tf/static_transform_publisher) auto-starting new master process[master]: started with pid [12992] ROS_MASTER_URI=http://localhost:11311 setting /run_id to 4f23a262-2be6-11e8-90ab-1c1b0d61bf22 process[rosout-1]: started with pid [13005] started core service [/rosout] process[camera/camera_nodelet_manager-2]: started with pid [13016] process[camera/driver-3]: started with pid [13022] process[camera/rgb_debayer-4]: started with pid [13024] process[camera/rgb_rectify_mono-5]: started with pid [13025] process[camera/rgb_rectify_color-6]: started with pid [13026] process[camera/depth_registered_rectify_depth-7]: started with pid [13037] process[camera/points_xyzrgb_hw_registered-8]: started with pid [13042] process[camera/depth_registered_hw_metric_rect-9]: started with pid [13043] process[camera/depth_registered_metric-10]: started with pid [13046] process[camera_base_link-11]: started with pid [13047] process[camera_base_link1-12]: started with pid [13048] process[camera_base_link2-13]: started with pid [13053] process[camera_base_link3-14]: started with pid [13055] [ INFO] [1521512880.894225759]: Initializing nodelet with 4 worker threads. [ INFO] [1521512881.035164983]: Number devices connected: 1 [ INFO] [1521512881.035200471]: 1. device on bus 000:00 is a Xbox NUI Camera (2ae) from Microsoft (45e) with serial id 'B70773103929441B' [ INFO] [1521512881.035586547]: Searching for device with index = 1 [ INFO] [1521512886.486004198]: Starting a 3s RGB and Depth stream flush. [ INFO] [1521512886.486190837]: Opened 'Xbox NUI Camera' on bus 0:0 with serial number 'B70773103929441B' [ WARN] [1521512886.495869607]: Could not find any compatible image output mode for 1. Falling back to default image output mode 1. [ WARN] [1521512886.495915261]: Could not find any compatible depth output mode for 1. Falling back to default depth output mode 1. [ INFO] [1521512886.503091540]: rgb_frame_id = 'camera_rgb_optical_frame' [ INFO] [1521512886.503133073]: depth_frame_id = 'camera_depth_optical_frame' [ WARN] [1521512886.516610578]: Camera calibration file /home/yuanlibin/.ros/camera_info/rgb_B70773103929441B.yaml not found. [ WARN] [1521512886.516673295]: Using default parameters for RGB camera calibration. [ WARN] [1521512886.516711780]: Camera calibration file /home/yuanlibin/.ros/camera_info/depth_B70773103929441B.yaml not found. [ WARN] [1521512886.516746978]: Using default parameters for IR camera calibration. [ INFO] [1521512889.945930001]: Stopping device RGB and Depth stream flush.
终端2:
rosrun rqt_image_view rqt_image_view
如下图所示:
终端2或者用命令(=后面是发布的主题,可以用rostopic list命令查看)
rosrun image_view image_view image:=/camera/rgb/image_color
查看彩色图像如下图所示:
rosrun image_view image_view image:=/camera/depth_regisred/image
查看深度图像如下图所示:
终端2或者用命令
rosrun rviz rviz
点击add,选择类型camera。添加成功后选择camera菜单下的Iamge Topic选项,选择主题/camera/rgb/image_color或者/camera/depth_registered/image查看彩色图像和深度图像。
彩色图像如下图所示:
还可以查看点云:点击add添加PointCloud2类型,修改“topic”,如下图所示:
ubuntu系统下虽然都可以查看彩色图像和深度图像,但是无法保存其成对的原始数据,关于Kinect v1彩色和深度图像对的采集步骤详见:
Kinect v1 (Microsoft Kinect for Windows v1 )彩色和深度图像对的采集步骤
参考文献:http://blog.csdn.net/x_r_su/article/details/52904113