您当前的位置:首页 > 计算机 > 系统应用 > Linux

Ubuntu18.04+ROS安装Kinect V2步骤及问题解决

时间:01-29来源:作者:点击数:

安装Kinect V2在ROS上运行。

需要libfreenect2 和 iai_kinect2

首先安装libfreenect2

step1.

git下载代码

git clone https://github.com/OpenKinect/libfreenect2.git

2.之前最好先安装好opencv 然后安装依赖如下(如下是我参考上面两个博客的依赖安装的,他们有不同之处,但是我都安装了,最后没问题)

其一:

sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev 

其二:

sudo apt-get install libglfw3-dev
sudo apt-get install libopenni2-dev
sudo apt-get install libusb-1.0-0-dev

有博客说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

step2

开始安装

cd libfreenect2
mkdir build 
cd build
cmake ..
make
sudo make install

默认安装在/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"

但是我看了这些包我都安装了,于是

解决方案:

sudo apt-get install libturbojpeg0-dev

来自github解答

然后删掉build,重新建build然后cmake . .

接着设定udev rules:(填好自己libfreenect2的路径,以下是例子)

sudo cp libfreenect2/platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/

然后重新插拔Kinect2。在刚才build目录下运行

./bin/Protonect

下面是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 .

在这一步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

解决方案是忽略它,来源https://github.com/code-iai/iai_kinect2/issues/297

接着

cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release"

如果你出错,参考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

这个学ROS都懂,或者重新打开一个终端

roslaunch kinect2_bridge kinect2_bridge.launch

另一个终端

rosrun kinect2_viewer kinect2_viewer

你应该看到画面了。成功!!!

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门