Installing Kinect drivers on Ubuntu 14.04 and ROS Indigo

The XBox Kinect is a surprisingly great sensor that is also really cheap. The combination of the two factors makes it a great sensor to use in Robotics research as an interface for human robot interaction. However, it’s a bit difficult to interface with due to the complicated install process, so this post will walk through the steps of installing OpenNI dependencies for use on ROS Indigo and Ubuntu 14.04.

Unfortunately, NiTE is now proprietary software, so I hope you’ve either found a cached version of it elsewhere, or have found a replacement gesture recognition suite. If so, let me know too please! πŸ˜€


 

Here are the steps:

1. Open terminal and do an apt-cache search of libopenni and install both the -dev and 0 libraries.

sudo apt-get install libopenni0 libopenni-dev

2. Clone openni_camera and openni_launch from Github into your catkin_ws/src and catkin_make in the workspace folder.

cd ~/catkin_ws/src
git clone https://github.com/ros-drivers/openni_launch
git clone https://github.com/ros-drivers/openni_camera
cd ..
catkin_make
catkin_make install

3. Connect the Kinect, and run the openni_launch file

roscore
roslaunch openni_launch openni.launch

If the above steps fail, go to this repo and cd into the Bin folder and extract the relevant file

git clone https://github.com/avin2/SensorKinect
cd Bin
tar xjf SensorKinect093-Bin-Linux-x64-v5.1.2.1.tar.bz2
cd Sensor-Bin-Linux-x64-v5.1.2.1
./install.sh

4. Test out your build by running

roslaunch openni_launch openni.launch

Now you should be able to successfully launch openni and listen to all the outputs of the Kinect! You may need to run camera calibration scripts to get ride of edge distortions and the like, but the camera should be all set to go.

Edit 6/24/16
Comments are now closed to prevent spam. Please email me directly at hello@justsophie.com if you’d like help. Thanks!

55 Comments

  1. Adil

    Hello. I followed your entire tutorial and installed the drivers. But im still getting errors, such as ,” process[camera_base_link3-24]: started with pid [15197]
    [ INFO] [1485334983.161246088]: No devices connected…. waiting for devices to be connected”
    Im using ROS indigo ubuntu 14.04.
    I installed libfreenect2 and ran the test and kinect was working (https://github.com/wiedemeyer/libfreenect2). Kindly advise on this matter.

    • kiumars

      hi , I’m kind of new to linux, I have the same error that you had, you putet libfreenect2 link on github, I dont know how to install it, anyone can help me please

      • Sophie

        Oh, I had no idea that happened. One could checkout an older commit to the openni2 repo and still retain that compatibility if necessary.

  2. Jon

    Hi. I have a one question.
    I want to open two kinects.
    but, don’t know how to do it.
    If you know how to do it, please help me.

  3. rida

    hy thanks for such a helping blog πŸ™‚ i run all the commands correctly but it give error message at last command of launching openni .kindly suggest me solution

    • Sophie

      Hey Rida,

      Glad I could help! But I’ll need more info to give you debug info. Can you paste the important parts of the error message here?

  4. anand g

    while i am cloning github files i get the following error
    unable to access ‘https://github.com/ros-drivers/openni_launch/’: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

    what is this problem

    • Sophie

      That would be something internal to your system. Git clone shouldn’t mess up like that. What commands are you using? Try:
      git clone https://github.com/ros-drivers/openni_launch

  5. erxiao

    hello sophie,

    first thank you very much . your blog is very helpful thanks a lot . but when roslaunch openni_launch openni.launch . the error happens .

    .. logging to /home/erxiao/.ros/log/746b76e6-1863-11e6-bbef-c018853a43cd/roslaunch-erxiao-ZBOXNANO-ID62-6586.log
    Checking log directory for disk usage. This may take awhile.
    Press Ctrl-C to interrupt
    Done checking log file disk usage. Usage is <1GB.

    unused args [depth_registered_filtered] for include of [/opt/ros/indigo/share/rgbd_launch/launch/includes/processing.launch.xml]
    The traceback for the exception was written to the log file

    can you help me ?

    • Sophie

      Hmm, I’ll need more parts of the error message to be sure, but I think it has to do with a package or two missing from your ROS package path, or it not properly detecting the connected kinect.

      Can you post the entire output from when you run roslaunch openni_launch openni.launch?

      • erxiao

        hi:
        at first ,the error tells me i have no openni2.
        so i
        sudo apt-get install ros-indigo-openni2-launch

        then:

        erxiao@erxiao-Aspire-V3-5710G:~/catkin_ws$ source install/setup.bash
        erxiao@erxiao-Aspire-V3-5710G:~/catkin_ws$ roslaunch openni_launch openni.launch… logging to /home/erxiao/.ros/log/85972da8-18b7-11e6-9042-08edb9f5d8e9/roslaunch-erxiao-Aspire-V3-5710G-2707.log
        Checking log directory for disk usage. This may take awhile.
        Press Ctrl-C to interrupt
        Done checking log file disk usage. Usage is <1GB.

        unused args [depth_registered_filtered] for include of [/opt/ros/indigo/share/rgbd_launch/launch/includes/processing.launch.xml]
        The traceback for the exception was written to the log file
        erxiao@erxiao-Aspire-V3-5710G:~/catkin_ws$

        there are whole errors..

        • Sophie

          Huh, that’s interesting, I don’t think I’ve seen this error before.

          From what I can gather, it does seem like the problem is with missing packages. After running

          sudo apt-get update
          sudo apt-get upgrade

          Try directly installing rgbd-launch.

          sudo apt-get install ros-indigo-rgbd-launch

          If that doesn’t work, you could try directly installing the two openni packages via apt-get:

          sudo apt-get install ros-indigo-openni-camera
          sudo apt-get install ros-indigo-openni-launch

          Good luck, hope this helps :/

    • Michael

      Ha~I encountered with this problem too, and I found a way to deal with it.Just open the file /opt/ros/indigo/share/openni_launch/launch/openni.launch,and find this line:” “,then delete it(not recommended) or annotate it,and save!
      Of course,the system may not allows you to change this file,so you might need use this sentence to do it:
      $ sudo nautilus

      • Michael

        Oh, the key words are missing…
        well,you need to annotate the line in oppeni.launch with “depth_registered_filtered”,as this arg is said “unused”,so just annotate it.

  6. Abdou

    hello sophie,

    many thanks for this blog,

    please can you tell me how i can calibrate my Kinect , i did the intrinsic calibration , but i have problem with extrinsic calibration ,

    please help me

    • Sophie

      I can try my best to help! But I’ll need a bit more information. What’s the problem with your extrinsic calibration? What are the error messages?

  7. noamane

    i m looking for help to install kinect xbox one drivers on ubuntu 14.04 … Please help me … i shall be thankful to you

    • Sophie

      Sure, what’s wrong? Can you post the error messages?

      Kinect from the Xbox One isn’t officially supported, but there is an experimental branch on the OpenNI2 repo here.

  8. Quang

    i get this error.
    quang@duonggia:~/catkin_ws/src/SensorKinect/Bin/Sensor-Bin-Linux-x64-v5.1.2.1$ ./install.sh
    Installing PrimeSense Sensor
    ****************************

    creating config dir /usr/etc/primesense…mkdir: cannot create directory β€˜/usr/etc’: Permission denied

    • Quang

      I also get this error
      quang@duonggia:~/catkin_ws/src/openni_launch/launch$ roslaunch openni.launch
      … logging to /home/quang/.ros/log/3238b6b0-ed2c-11e5-81e7-b0104140e883/roslaunch-duonggia-28041.log
      Checking log directory for disk usage. This may take awhile.
      Press Ctrl-C to interrupt
      Done checking log file disk usage. Usage is <1GB.

      Traceback (most recent call last):
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/__init__.py", line 307, in main
      p.start()
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 268, in start
      self._start_infrastructure()
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 217, in _start_infrastructure
      self._load_config()
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 132, in _load_config
      roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/config.py", line 451, in load_config_default
      loader.load(f, config, verbose=verbose)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 730, in load
      self._load_launch(launch, ros_config, is_core=core, filename=filename, argv=argv, verbose=verbose)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 702, in _load_launch
      self._recurse_load(ros_config, launch.childNodes, self.root_context, None, is_core, verbose)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 636, in _recurse_load
      default_machine, is_core, verbose)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 666, in _recurse_load
      val = self._include_tag(tag, context, ros_config, default_machine, is_core, verbose)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 95, in call
      return f(*args, **kwds)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 587, in _include_tag
      inc_filename = self.resolve_args(tag.attributes['file'].value, context)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 183, in resolve_args
      return substitution_args.resolve_args(args, context=context.resolve_dict, resolve_anon=self.resolve_anon)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 312, in resolve_args
      resolved = _resolve_args(resolved, context, resolve_anon, commands)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 325, in _resolve_args
      resolved = commands[command](resolved, a, args, context)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 141, in _find
      source_path_to_packages=source_path_to_packages)
      File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 184, in _find_executable
      full_path = _get_executable_path(rp.get_path(args[0]), path)
      File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 200, in get_path
      raise ResourceNotFound(name, ros_paths=self._ros_paths)
      ResourceNotFound: rgbd_launch
      ROS path [0]=/opt/ros/indigo/share/ros
      ROS path [1]=/opt/ros/indigo/share
      ROS path [2]=/opt/ros/indigo/stacks

      • Sophie

        The error says that you don’t have rgbd_launch installed on your system. Try typing:

        sudo apt-get install ros-indigo-openni2-launch

  9. I try to hook up a kinect with my raspberry pi2 which has ubuntu 14.04 and ROS indigo installed. I tried you method, but still got the error message when do roslaunch. It complains as:

    terminate called after throwing an instance of ‘openni_wrapper::OpenNIException’
    what(): unsigned int openni_wrapper::OpenNIDriver::updateDeviceList() @ /home/ubuntu/catkin_ws/src/openni_camera/src/openni_driver.cpp @ 125 : enumerating image nodes failed. Reason: One or more of the following nodes could not be enumerated:

    Image: PrimeSense/SensorKinect/5.1.2.1: Failed to set USB interface!
    Image: PrimeSense/SensorV2/5.1.0.41: Failed to set USB interface!

    Could you help?

    • Adhelia

      Have u figure it out?
      After searching so many times, i hv few things important.
      1. if u failed installed all of the driver of kinect, go to openni directory then cd Platform/Linux/Bin/x64-release/
      after that check the niReg or NiReg file at here like this:
      Sudo ./niReg -l
      There’s output about your installation version. Your installation version of openni and it’s sensor cannot be conflict (search online about which version is good, for me OpenNi Unstable 1.4.0 and avin2 is the work one)
      2. Uninstall all your instalatation package by go to your installation directory of the package (where the install.sh exist) then try:
      sudo ./uninstall.sh
      Or
      sudo ./install.sh -u
      3. Install the right version of the openni and sensor (OpenNi unstable 1.4.0 and avin2)

      • Daqing Li

        I tried it on a laptop and get it done successfully. Now I need to rework on my raspbeery pi 2 to make it work. But I am more confident now. Thanks for your help.

  10. Ramkumar

    It works perfectly :-).

    As @adhelia said it didn’t work, it was the same for me in the first case where i tried the installation through your first method. But after trying the second method was when i was successful :-).

    Hats of Sophie πŸ™‚

  11. Ahmed Abdalla

    Hello Sophie πŸ™‚
    I’m fairly new to Ubuntu and ROS.
    At the very last step
    >>./install.sh
    I get,
    ————————————————————
    “creating config dir /usr/etc/primesense…OK
    copying shared libraries…cp: cannot create regular file β€˜/usr/lib/libXnCore.so’: Permission denied
    cp: cannot create regular file β€˜/usr/lib/libXnDDK.so’: Permission denied
    cp: cannot create regular file β€˜/usr/lib/libXnDeviceFile.so’: Permission denied
    cp: cannot create regular file β€˜/usr/lib/libXnDeviceSensorV2KM.so’: Permission denied
    cp: cannot create regular file β€˜/usr/lib/libXnFormats.so’: Permission denied”
    ————————————————————–
    Would you be kind enough to help me with that?
    I’ve been working on interfacing kinect for more than 2 weeks now with no luck πŸ™
    Thanks for your time and of course for this blog.

    • Ahmed Abdalla

      I had to type
      ———————————————–
      >>sudo ./install.sh
      ——————————————–
      but after using
      —————————————————
      >>roslaunch openni_launch openni.launch
      ————————————————–
      I still get:
      ———————————————-
      [openni.launch] is neither a launch file in package [openni_launch] nor is [openni_launch] a launch file name
      The traceback for the exception was written to the log file
      ———————————————————-
      πŸ™

      • Sophie

        Hi Ahmed!

        Did you cd back into your catkin_ws and run catkin_make? Typically when you get that second error it’s because ROS doesn’t know where the package is because catkin_make wasn’t run.

        -Sophie

  12. adhelia

    hello, i tried your step, but still got the same problem. it said that :

    [ INFO] [1446711237.861368363]: No devices connected…. waiting for devices to be connected
    ….

    though i’ve connected it to my 2.0 USB or 3.0 USB.
    what should i do now?

    • Sophie

      Hmm, USB2.0 vs 3.0 shouldn’t make too much a difference. Here’s a few steps to try:

      1. Have you installed the OpenNI patch? (It’s the last step in the setup procedure)

      2. Are you sure the Kinect is plugged in to both the wall and your laptop?

      Let me know how it goes!

        • dan

          hi,

          first, thank you sophie for this blog with the detailed and easy to follow instructions.

          i followed the tutorial and still get the message: [ INFO] [1457710319.029566830]: No devices connected…. waiting for devices to be connected

          i read here http://answers.ros.org/question/207642/freenect_launch-with-kinect/
          that openni_launch doesnt work anymore under ros indigo und tried to use freenect_launch as in this: http://answers.ros.org/question/196455/kinect-installation-and-setup-on-ros-updated/
          but still get the same message.

          lsusb gives:
          Bus 002 Device 002: ID 8087:8001 Intel Corp.
          Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
          Bus 001 Device 002: ID 8087:8009 Intel Corp.
          Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
          Bus 004 Device 009: ID 045e:02c4 Microsoft Corp.
          Bus 004 Device 008: ID 045e:02d9 Microsoft Corp.
          Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
          Bus 003 Device 004: ID 058f:6361 Alcor Micro Corp. Multimedia Card Reader
          Bus 003 Device 003: ID 413c:2003 Dell Computer Corp. Keyboard
          Bus 003 Device 002: ID 046d:c077 Logitech, Inc.
          Bus 003 Device 010: ID 045e:02d9 Microsoft Corp.
          Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

          so i have 3 entries for microsoft devices but the kinect is not mentioned explicitly, as i have seen in other posts.

          there is also no led on on the kinect.
          i am using ubuntu 14.04, kinect xbox one and ros indigo on a 64 system.

          any idea what might cause the problem?

          • Sophie

            Hmm, if there’s no LED on the kinect, I would double check that the kinect is plugged in to the wall and is plugged in to your computer.

            Edit: Ah, yep, the XBOne kinect isn’t really supported, though I know that there are people doing good work on it. A quick search shows that there is a development branch for the Kinect v2 sensor in the OpenNI repo here. Take a look and see if it helps!

    • Abdullah Ibrahim

      When you run:

      tar xjf SensorKinect093-Bin-Linux-x64-v5.1.2.1.tar.bz2

      Make sure that you choose x64 if you have 64-bit system
      and x86 if you have 32-bit system

  13. Chuong Nguyen

    Thank you. It saves me from frustrating. Just add a small thing, you may need to run
    $source install/setup.bash
    before run rosrun. Thanks again, great help.

    • Sophie

      Yep, definitely!
      An easier to do this could be to source catkin_ws/devel/setup.bash and add it to your .bashrc so you don’t have to source the setup.bash every time. It’s a helpful first step to do after installing ROS.

    • adhelia

      where should i run “$source install/setup.bash” ?

      it said that :
      bash: install/setup.bash: No such file or directory

      though in my workspace there’s a directory named install and have setup.bash inside it.

      • Sophie

        You should add the source to the setup.bash file in your bashrc. On Ubuntu, it’s a hidden file in your home directory named “.bashrc”

        Type

        gedit ~/.bashrc

        Add the following line to the bottom of the file.

        export ~/catkin_ws/devel/setup.bash

        Save the file and open a new terminal window and you’ll be able to run roscore without having to re-source the setup.bash file again and again.

  14. Nicolas

    Hey! Out of all the things I tried, this seemed to do it! You might want to post this in the ROS question and Answers

    • Sophie

      Haha, I might, though this post is really just pulling a lot of info from the ROS forums into one place. Glad I could help! πŸ™‚

  15. kun

    This blog really helps me to fix the problem of using kinect with openni_launch package at now. I want to say thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *