参考鸣谢:
http://www.cnblogs.com/hitcm/p/5118196.html
https://blog.csdn.net/wuguangbin1230/article/details/77184032
安装Kinect V2在ROS上运行。
需要libfreenect2 和 iai_kinect2
首先安装libfreenect2
step1.
git下载代码
git clone https://github.com/OpenKinect/libfreenect2.git
- 1
2.之前最好先安装好opencv 然后安装依赖如下(如下是我参考上面两个博客的依赖安装的,他们有不同之处,但是我都安装了,最后没问题)
其一:
sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev
- 1
其二:
sudo apt-get install libglfw3-dev
sudo apt-get install libopenni2-dev
sudo apt-get install libusb-1.0-0-dev
- 1
- 2
- 3
有博客说sudo apt-get install libusb-1.0-0-dev安装不上,可能你需要梯子,或者试试
sudo apt-add-repository ppa:floe/libusb
sudo apt-get update
sudo apt-get install libusb-1.0-0-dev
- 1
- 2
- 3
step2
开始安装
cd libfreenect2
mkdir build
cd build
cmake ..
make
sudo make install
- 1
- 2
- 3
- 4
- 5
- 6
默认安装在/usr/local
以下是我出现问题
ubuntu@ubuntu:~/Desktop/libfree/libfreenect2/build$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
-- using tinythread as threading library
-- Checking for modules 'libva;libva-drm'
-- No package 'libva' found
-- No package 'libva-drm' found
-- Could NOT find TegraJPEG (missing: TegraJPEG_LIBRARIES TegraJPEG_INCLUDE_DIRS TegraJPEG_L4T_OK TegraJPEG_DRIVER_OK TegraJPEG_WORKS)
CMake Error at /usr/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find TurboJPEG (missing: TurboJPEG_INCLUDE_DIRS TURBOJPEG_WORKS)
Call Stack (most recent call first):
/usr/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
cmake_modules/FindTurboJPEG.cmake:66 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:237 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/Desktop/libfree/libfreenect2/build/CMakeFiles/CMakeOutput.log"
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
但是我看了这些包我都安装了,于是
解决方案:
sudo apt-get install libturbojpeg0-dev
- 1
来自github解答
然后删掉build,重新建build然后cmake . .
接着设定udev rules:(填好自己libfreenect2的路径,以下是例子)
sudo cp libfreenect2/platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/
- 1
然后重新插拔Kinect2。在刚才build目录下运行
./bin/Protonect
- 1
下面是ROS上使用Kinect v2
需要安装iai_kinect2这个metapackage
cd ~/catkin_ws/src/
git clone https://github.com/code-iai/iai_kinect2.git
cd iai_kinect2
rosdep install -r --from-paths .
- 1
- 2
- 3
- 4
在这一步rosdep install -r --from-paths .
会报错
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
kinect2_viewer: Cannot locate rosdep definition for [kinect2_bridge]
kinect2_calibration: Cannot locate rosdep definition for [kinect2_bridge]
kinect2_bridge: Cannot locate rosdep definition for [kinect2_registration]
Continuing to install resolvable dependencies...
All required rosdeps installed successfully
- 1
- 2
- 3
- 4
- 5
- 6
- 7
解决方案是忽略它,来源https://github.com/code-iai/iai_kinect2/issues/297
接着
cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release"
- 1
- 2
- 3
如果你出错,参考https://github.com/code-iai/iai_kinect2/issues/297
我因为安装了Eigen3,但OpenCL没安装成功,有Eigen3就够了
有求老哥们告诉我OpenCL的.tgz的文件在哪里?我是intel SDK,但最后我怎么找不到 installGUI.sh 等我有空再搞OpenCL
安装已经完成,但想运行测试还得
source ~/catkin_ws/devel/setup.bash
- 1
这个学ROS都懂,或者重新打开一个终端
roslaunch kinect2_bridge kinect2_bridge.launch
- 1
另一个终端
rosrun kinect2_viewer kinect2_viewer
- 1
你应该看到画面了。成功!!!
</div>
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-e44c3c0e64.css" rel="stylesheet">
</div>