Baxter學習筆記2-Kinect攝像頭驅動安裝篇

1: Install ROS

參考ROS官網

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 0xB01FA116
sudo apt-get update
sudo apt-get install ros-indigo-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install python-rosinstall

然後創建工作空間:

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ..
catkin_make 

2: Install OpenKinect/libfreenect2

2.1 Prerequisite

git clone https://github.com/OpenKinect/libfreenect2.git
cd libfreenect2
cd depends; ./download_debs_trusty.sh
sudo apt-get install build-essential cmake pkg-config

2.2 Install libusb must be >= 1.0.20

sudo dpkg -i debs/libusb*deb

Install TurboJPEG

sudo apt-get install libturbojpeg libjpeg-turbo8-dev

2.3 Install OpenGL

sudo dpkg -i debs/libglfw3*deb
sudo apt-get install -f
sudo apt-get install libgl1-mesa-dri-lts-vivid

The thrid command would be not right:

1: If the last command conflicts with other packages, don’t do it
2: If get the error info: ‘No rule to make target /usr/lib/x86_64-linux-gnu/libGL.so’

we should build the link to the libGL.so:
locate the libGL.so we know 'libGL.so' is in the '/usr/lib/x86_64-linux-gnu'
sudo ln -s libGL.so.1.0.0 libGL.so (which libGL.so.1.0.0 is not the link)

sudo apt-add-repository ppa:floe/beignet
sudo apt-get update
sudo apt-get install beignet-dev
sudo dpkg -i debs/ocl-icd*deb

2.4 Install Nvidia driver

1: Download the Nvidia driver in right version (NVIDIA GeForce GTX1080)
從這裏下載
2: Edit the blacklist.conf:

    sudo gedit /etc/modprobe.d/blacklist.conf
    add :
    blacklist vga16fb
    blacklist nouveau
    blacklist rivafb
    blacklist nvidiafb
    blacklist rivatv
    __block_line__

3: sudo apt-get remove –purge nvidia-*
sudo apt-get remove –purge xserver-xorg-video-nouveau
4: reboot and into computer using ‘Ctrl+ALT+F1’ using the ‘Ctrl+ALT+F7’ return xservers
5: sudo /etc/init.d/gdm stop or sudo /etc/init.d/lightdm stop
6: in the driver file,which downloaded in step 1
sudo sh __NVIDIA.run__
7: sudo /etc/init.d/gdm restart or sudo /etc/init.d/lightdm restart
8: sudo reboot
9: maybe we should sudo apt-get install mesa-utils
http://blog.163.com/zhao_en_peng/blog/static/12740422420131202110539/

2.5 Install CUDA (optional)

1: Download the cuda 7.5 from the cuda_driver
IMPORTANCE:download .runfile
2: reboot and ctrl+alt+F1
sudo /etc/init.d/lightdm stop
3: sudo sh cuda.run
IMPORTANCE:ALL SHOULD INSTALL EXCEPT:DRIVER(because we have installed the nvidia driver and the cuda.runfile don’t include the nvidia driver)
4: sudo /etc/init.d/lightdm restart and reboot
http://www.cnblogs.com/GingerZeng/p/5709032.htm

2.6 Install VAAPI (optional)

sudo dpkg -i debs/{libva,i965}*deb
sudo apt-get install -f

2.7 Install OpenNI2 (optional)

sudo apt-add-repository ppa:deb-rob/ros-trusty && sudo apt-get update(You don't need this if you have ROS repos)
sudo apt-get install libopenni2-dev

2.8 Build the libfreenect2

cd ..
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2 -DENABLE_CXX11=ON
make
make install
NOTE:CMAKE_INSTALL_PREFIX=’$HOME/freenect2’ the install position will be used later

3: Using the kinect2

1 : sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/
2 : run the demo :
./bin/Protonect( in the build folder )

4: Using the kinect in ros

accoding this link
accoding this link

4.1 install the iai-kinect2

cd ~/catkin_ws/src/
git clone https://github.com/code-iai/iai_kinect2.git
cd iai_kinect2
rosdep install -r --from-paths .
cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release" -Dfreenect2_DIR=path_to_freenect2/lib/cmake/freenect2
__NOTE:the <path_to_freenect2>is the '$HOME/freenect2' just setting before building the libfreenect2__

4.2 get the image in the ros topic

roslaunch kinect2_bridge kinect2_bridge.launch
rosrun kinect2_viewer kinect2_viewer sd cloud
(we can use 'rostopic list' to get the note publish topic about the kinect )
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章