Search This Blog

Wednesday, March 25, 2015

ROS freenect_stack with Kinect Model 1473

This post is in reply to answers.ros.org user Nimisha who asked:
"...I am trying to interface kinect to ROS indigo and am facing similar problems. Could you please tell me the entire procedure all over[sic] so that i could know where i am going wrong."
So here is the way I did it:
  1. I uninstalled all copies of openni/openni2 from my computer with this command         sudo apt-get remove ros-indigo-openni*
  2. Then I installed the all of the freenect tools that are on ROS with this command:         sudo apt-get install ros-indigo-freenect*
  3. Now I was ready to install the Avin2/SensorKinect drivers from github. Note: these are made to work with openni which I just removed, but they seem to work for freenect also.
  4. I went to the Avin2/SensorKinect github repository and followed the install instructions. Since I was using linux I used these instructions:
    Linux:
     Requirements:
      1) GCC 4.x
         From: http://gcc.gnu.org/releases.html
         Or via apt:
         sudo apt-get install g++
      2) Python 2.6+/3.x
         From: http://www.python.org/download/
         Or via apt:
         sudo apt-get install python
      3) OpenNI 1.5.x.x
         From: http://www.openni.org/Downloads/OpenNIModules.aspx
         
     Building Sensor:
      1) Go into the directory: "Platform/Linux/CreateRedist".
         Run the script: "./RedistMaker".
         This will compile everything and create a redist package in the "Platform/Linux/Redist" directory.
         It will also create a distribution in the "Platform/Linux/CreateRedist/Final" directory.
      2) Go into the directory: "Platform/Linux/Redist".
         Run the script: "sudo ./install.sh" (needs to run as root)
    
           The install script copies key files to the following location:
             Libs into: /usr/lib
             Bins into: /usr/bin
             Config files into: /usr/etc/primesense
             USB rules into: /etc/udev/rules.d 
             Logs will be created in: /var/log/primesense
       
      To build the package manually, you can run "make" in the "Platform\Linux\Build" directory.
      
      Important: Please note that even though the directory is called Linux, you can also use it to compile it for 64-bit targets and pretty much any other linux based environment. 
    
     Building Sensor using a cross-compiler:
      1) Make sure to define two environment variables:
         - _CXX - the name of the cross g++ for platform 
         - _STAGING - a path to the staging dir (a directory which simulates the target root filesystem).
         Note that  should be upper cased.
         For example, if wanting to compile for ARM from a x86 machine, ARM_CXX and ARM_STAGING should be defined.
      2) Go into the directory: "Platform/Linux/CreateRedist".
         Run: "./RedistMaker " (for example: "./RedistMake Arm").
         This will compile everything and create a redist package in the "Platform/Linux/Redist" directory.
         It will also create a distribution in the "Platform/Linux/CreateRedist/Final" directory.
      3) To install OpenNI files on the target file system:
         Go into the directory: "Platform/Linux/Redist".
         Run the script: "./install.sh -c $_STAGING" (for example: "./install.sh -c $ARM_STAGING").
    
           The install script copies key files to the following location:
             Libs into: STAGING/usr/lib
             Bins into: STAGING/usr/bin
             Config files into: STAGING/usr/etc/primesense
             USB rules into: STAGING/etc/udev/rules.d 
             Logs will be created in: STAGING/var/log/primesense
       
      To build the package manually, you can run "make PLATFORM=" in the "Platform\Linux\Build" directory.
      If you wish to build the Mono wrappers, also run "make PLATFORM= mono_wrapper" and "make PLATFORM= mono_samples".
      
      Excerpted from README.md from https://github.com/avin2/SensorKinect.
    That was all I had to do to get it to work. Now I ran roslaunch freenect_launch freenect.launch and it connected to my Kinect. I hope that answers your question, Namish! Good luck with your Kinect!

2 comments:

  1. Is freenect available for skeleton_tracker too? AFAIK, openni support for skeleton_tracker. After i search on google 'libfreenect vs openni' they said that libfreenect doesn't support for skeleton tracking. So i got confused, if indigo can't used openni_launch, and openni2_launch either, freenect can't get the skeletob tracking. What should i do then?

    ReplyDelete
  2. +Adhelia Irawan I am not sure about which skeleton traker package you are talking about, but on the Freenect FAQ's[], it says this:

    "Does libfreenect have any skeleton tracking feature?

    Skeleton tracking is higher-level than drivers and libfreenect is basically a low-level driver within OpenKinect. The raw data is made available and a skeleton-tracking solution that takes data from libfreenect can be built. The project Roadmap calls for further developments as the focus should change at some point from low-level driver and API to higher level abstractions"

    Freenect and LibFreenect only provide a driver to the Kinect. Openni, which has since been dissolved, provided the basic drivers and a few algorithms. So it is possible to do a skeleton tracker with Freenect but you will need to either implement an existing tracker, or write your own. I hope that answers your question and thanks for reading!

    ReplyDelete