Playing Kinect 2 with ROS in Ubuntu 16.04: Hello World

OS: Ubuntu 16.04.02 x64
ROS: Kinetic
Device: Kinect 2
OpenCV: 2.4.13.3
USB 3.0 Controller is essential

Now we begin to talk about how to play kinect2 with ROS. Note that OpenCV 2.4.X is essential and OpenCV 3 will not work. You can check the verison of your OpenCV by type in:

pkg-config --modversion opencv 

Install libfreenect2

There are some ways to drive kinect 2 in linux. Here we only talk about libfreenect2, which is very convenient. You can follow this instruction to install it if you want more details. However, if you would like to play with kinect 2 as soon as possible, just go ahead.

Download libfreenect2:

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

Install build tools:

sudo apt-get install build-essential cmake pkg-config

Install libusb: (version >= 1.0.20), TurboJPEG and OpenGL

sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libturbojpeg libjpeg-turbo8-dev
sudo apt-get install libglfw3-dev

Build

mkdir build && cd build
cmake .. -DENABLE_CXX11=ON -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
make
make install

A Test

Run a program: (Never forget to plug your Kinect 2)

./bin/Protonect

Then you will see the following window if nothing goes wrong.
Protonect

Install IAI Kinect2

Now go to your catkin workspace. Let’s try to get the iai_kinect2 package and make it.
Follow this instruction if you want more details.

cd $YOUR_CATKIN_WORKSPACE_PATH/src
git clone https://github.com/code-iai/iai_kinect2.git
cd iai_kinect2
rosdep install -r --from-paths .

rosdep will output errors on not being able to locate [kinect2_bridge] and [depth_registration]. Never mind, that is fine because they are all part of the iai_kinect2 package and rosdep does not know these packages.

cd ~/YOUR_CATKIN_WORKSPACE_PATH
catkin_make -DCMAKE_BUILD_TYPE="Release"

Run kinect2_bridge :

roslaunch kinect2_bridge kinect2_bridge.launch

Then you can see that some nodes are running:

/kinect2
/kinect2_bridge
/kinect2_points_xyzrgb_hd
/kinect2_points_xyzrgb_qhd
/kinect2_points_xyzrgb_sd
/rosout

Go Ahead

Now you can use your kinect 2 in your ROS system to do some robotics research. Here are some references you may need:

  1. Calibrate your sensor using the kinect2_calibration.
  2. Add the calibration files to the kinect2_bridge/data.
  3. Restart kinect2_bridge and view the results using rosrun kinect2_viewer kinect2_viewer kinect2 sd cloud.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值