1. 程式人生 > >Ubuntu16.04 ros-kinetic下安裝kinect驅動

Ubuntu16.04 ros-kinetic下安裝kinect驅動

環境:

獨顯gtx1050ti 已安裝Nvidia-390顯示卡驅動

OS: Ubuntu 16.04.5 LTS x64

ROS Distro: Kinetic

Machine: HP-OMEN 暗影精靈4

 

這篇部落格的起因是 roslaunch openni_launch openni.launch 後出現錯誤:

... logging to /home/zhhp/.ros/log/5a3dd04e-e6dc-11e8-9d84-2bd80521b768/roslaunch-PhoNixe-19619.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://PhoNixe:46681/

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: kinetic
 * /rosversion: 1.12.14

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 (tf2_ros/static_transform_publisher)
    camera_base_link1 (tf2_ros/static_transform_publisher)
    camera_base_link2 (tf2_ros/static_transform_publisher)
    camera_base_link3 (tf2_ros/static_transform_publisher)

auto-starting new master
process[master]: started with pid [19630]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 5a3dd04e-e6dc-11e8-9d84-2bd80521b768
process[rosout-1]: started with pid [19643]
started core service [/rosout]
process[camera/camera_nodelet_manager-2]: started with pid [19658]
process[camera/driver-3]: started with pid [19661]
process[camera/rgb_debayer-4]: started with pid [19662]
process[camera/rgb_rectify_mono-5]: started with pid [19664]
process[camera/rgb_rectify_color-6]: started with pid [19682]
[ INFO] [1542069472.212680009]: Initializing nodelet with 4 worker threads.
process[camera/ir_rectify_ir-7]: started with pid [19710]
process[camera/depth_rectify_depth-8]: started with pid [19729]
process[camera/depth_metric_rect-9]: started with pid [19742]
process[camera/depth_metric-10]: started with pid [19757]
process[camera/depth_points-11]: started with pid [19768]
process[camera/register_depth_rgb-12]: started with pid [19781]
process[camera/points_xyzrgb_sw_registered-13]: started with pid [19794]
process[camera/depth_registered_sw_metric_rect-14]: started with pid [19808]
process[camera/depth_registered_rectify_depth-15]: started with pid [19825]
process[camera/points_xyzrgb_hw_registered-16]: started with pid [19840]
process[camera/depth_registered_hw_metric_rect-17]: started with pid [19857]
process[camera/depth_registered_metric-18]: started with pid [19874]
process[camera/disparity_depth-19]: started with pid [19892]
process[camera/disparity_registered_sw-20]: started with pid [19903]
process[camera/disparity_registered_hw-21]: started with pid [19923]
process[camera_base_link-22]: started with pid [19941]
process[camera_base_link1-23]: started with pid [19958]
process[camera_base_link2-24]: started with pid [19968]
process[camera_base_link3-25]: started with pid [19987]
Warning: USB events thread - failed to set priority. This might cause loss of data...
[ INFO] [1542069474.410803256]: Number devices connected: 2
[ INFO] [1542069474.511905071]: 1. device on bus 001:13 is a SensorKinect (2ae) from PrimeSense (45e) with serial id '0'
[ INFO] [1542069474.511993644]: 2. device on bus 001:13 is a SensorV2 (2ae) from PrimeSense (45e) with serial id '0000000000000000'
[ INFO] [1542069474.513561680]: Searching for device with index = 1
[camera/camera_nodelet_manager-2] process has died [pid 19658, exit code -11, cmd /opt/ros/kinetic/lib/nodelet/nodelet manager __name:=camera_nodelet_manager __log:=/home/zhhp/.ros/log/5a3dd04e-e6dc-11e8-9d84-2bd80521b768/camera-camera_nodelet_manager-2.log].

Number devices connected: 2   詳情如下

 

原因總結:終端顯示再bus 001:13上連線了兩個裝置,一個是SensorKinect驅動的 serial id '0' (id 不能是empty或者 0) 、一個是SensorV2驅動的。。。 這時候刪去SensorKinect驅動(教程裡有教怎麼刪,) 再次執行節點 發現錯誤消失~ 

這是之前由於按照教程安裝了SensorKinect驅動出現的錯誤 。。。所以請按我的步驟安裝驅動~

正確安裝操作如下:

0. Pre-requsites

sudo apt-get install git build-essential python libusb-1.0-0-dev freeglut3-dev openjdk-8-jdk
sudo apt-get install doxygen graphviz mono-complete

OpenNI says Doxygen is optional. This is lies. Install it.

I have also kept this seperate from my catkin workspace (which is called catkin_ws), so I created a folder called "kinect" in the home directory.

cd ~/
mkdir kinect

1. Install OpenNI

 

cd ~/kinect
git clone https://github.com/OpenNI/OpenNI.git
cd OpenNI
git checkout Unstable-1.5.4.0
cd Platform/Linux/CreateRedist
chmod +x RedistMaker
./RedistMaker
cd ../Redist/OpenNI-Bin-Dev-Linux-[xxx]  

(where [xxx] is your architecture and this particular OpenNI release. In my case, this is x64)

sudo ./install.sh

 

好了!到此為止! 不要繼續安裝SensorKinect驅動!

2. Install Kinetic OpenNI

sudo apt-get install ros-kinetic-openni*

Done! 

現在開個終端執行

roslaunch openni_launch openni.launch 

沒有紅色錯誤說明成功安裝~

 

如果你要使用骨骼點檢測功能請按教程繼續安裝NITE。。。