How to connect Kinect to Raspberry Pi 2 or 3 with ROS


Today's episode is about using Kinect with ROS on Raspberry Pi 2 or 3.
Kinect is one of the most popular source of PointClouds - array of points with 3D coordinates information. It has proprietary connector - actually it's USB+12V bus, and needs adapter for PC connection Despite that Kinect is bigger than ASUS Xtion, it has also tilt motor, microphone array, accelerometer and better support from ROS community
PointClouds can be converted to LaserScan - array of range sensor data withing some angle range. It looks like lidar data, but not in 360 degrees.


 Video transcript:

0) We will connect Kinect to RPi. For this purpose freenect driver should be installed on RPi

1) On RPi install freenect nodes and dependencies:
    $ sudo apt install ros-kinetic-freenect-launch 

2) Also install ros-kinetic-depthimage-to-laserscan node:
    $ sudo apt install ros-kinetic-depthimage-to-laserscan

3) Run roscore on master:
    $ roscore 

4) And run example freenect launch file:
    $ roslaunch freenect_launch freenect.launch

5) Run rviz on master and use kinect_view.rviz:
    $ rviz

6) You can use rviz views from gist https://gist.github.com/WinKILLER/df1...

7) We can see pointcloud data.

8) Low PointCloud framerate caused by RPi's poor ethernet and CPU performance

9) We also can view pointcloud data even with RGB information

10) To add depthimage-to-laserscan node let's create new launch file

11) I will use workspace from previous tutorial

12) Create file and paste node description from gist:
    $ vim ~/rosvid_ws/src/vidsrv/launch/laserscan.launch  
     https://gist.github.com/WinKILLER/7a8...

13) Run roscore, freenect node and new created one

14) Run rviz and use kinect_view-2.rviz

15) White stripe is laserscan visualization

16) Laserscan information can be used for map building, obstacle avoidance, etc...

Links:

3 комментария:

  1. Thans for the tutorial . I was always wonering on how to connect a kinect v2 to a microcomputer, but it needs a 3.0 port. recently i've spotted this one --> https://www.loverpi.com/collections/libre-computer-project/products/libre-computer-board-roc-rk3328-cc which has usb 3.1 port and even 4GB ram, , how do you think would it be possible to try and make it work?

    ОтветитьУдалить
    Ответы
    1. Hi. I haven't worked with Kinect2, but can say that there is an appropriate library for it - libfreenect2. Please refer to its page to find more info. The board you've posted looks good from hardware perspective, but check if it has kernel drivers to support USB 3.0. Cheers!

      Удалить
  2. "sudo apt install ros-kinetic-freenect-launch "shows the below error
    "E: Unable to locate package ros-kinetic-freenect-launch"

    ОтветитьУдалить