Ubuntu ROS Kinect2安装

Posted BkbK-

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu ROS Kinect2安装相关的知识,希望对你有一定的参考价值。

Ubuntu ROS Kinect2安装

1.安装libfreenect

1.1 相关依赖

sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libturbojpeg libjpeg-turbo8-dev
sudo apt-get install libglfw3-dev

1.2 下载编译

下载代码

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


进入文件夹新建build文件并进入

cd libfreenect2
mkdir build && cd build

cmake:

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_WORKS)
CMake Error at /usr/share/cmake-3.10/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.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake_modules/FindTurboJPEG.cmake:66 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:243 (FIND_PACKAGE)

– Configuring incomplete, errors occurred!
See also “/home/srobot/libfreenect2/build/CMakeFiles/CMakeOutput.log”.


解决办法:

sudo apt-get install libturbojpeg0-dev


make:

make -j`nproc`

安装

make install
cd ..
cmake -Dfreenect2_DIR=$HOME/freenect2/lib/cmake/freenect2

1.3 配置路径

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

2.安装iai_kinect包

2.1 下载kinect包

cd ~/catkin_ws/src/
git clone https://github.com/code-iai/iai_kinect2.git

1.2 配置

cd iai_kinect2
rosdep install -r --from-paths .

以下错误不影响,可以忽略:

WARNING: Package name “KinectTest” does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
kinect2_viewer: Cannot locate rosdep definition for [kinect2_bridge]
iai_kinect2: Cannot locate rosdep definition for [kinect2_registration]
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.3 编译

cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release"

3.启动测试

roslaunch kinect2_bridge kinect2_bridge.launch

rostopic list

/kinect2/bond
/kinect2/hd/camera_info
/kinect2/hd/image_color
/kinect2/hd/image_color/compressed
/kinect2/hd/image_color_rect
/kinect2/hd/image_color_rect/compressed
/kinect2/hd/image_depth_rect
/kinect2/hd/image_depth_rect/compressed
/kinect2/hd/image_mono
/kinect2/hd/image_mono/compressed
/kinect2/hd/image_mono_rect
/kinect2/hd/image_mono_rect/compressed
/kinect2/hd/points
/kinect2/qhd/camera_info
/kinect2/qhd/image_color
/kinect2/qhd/image_color/compressed
/kinect2/qhd/image_color_rect
/kinect2/qhd/image_color_rect/compressed
/kinect2/qhd/image_depth_rect
/kinect2/qhd/image_depth_rect/compressed
/kinect2/qhd/image_mono
/kinect2/qhd/image_mono/compressed
/kinect2/qhd/image_mono_rect
/kinect2/qhd/image_mono_rect/compressed
/kinect2/qhd/points
/kinect2/sd/camera_info
/kinect2/sd/image_color_rect
/kinect2/sd/image_color_rect/compressed
/kinect2/sd/image_depth
/kinect2/sd/image_depth/compressed
/kinect2/sd/image_depth_rect
/kinect2/sd/image_depth_rect/compressed
/kinect2/sd/image_ir
/kinect2/sd/image_ir/compressed
/kinect2/sd/image_ir_rect
/kinect2/sd/image_ir_rect/compressed
/kinect2/sd/points
/rosout
/rosout_agg

以上是关于Ubuntu ROS Kinect2安装的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu ROS Kinect2安装

ubuntu16.04 kinect2 驱动和ROS驱动

ubuntu16.04 kinect2 驱动和ROS驱动

kinect2的矫正

ROS下Kinect2的驱动安装及简单应用

ROS下Kinect2的驱动安装及简单应用