How To Setup Kinect with ROS and RGBD SLAM

I recently setup a Kinect with ROS for SLAM  but the instructions are all spread out. So, in this tutorial we go through the steps required to setup a Microsoft Kinect with ROS and do some cool live 3D SLAM with the kinect and RGBD SLAM algorithm.

Tested Configuration: Ubuntu 14.04 LTS, ROS Indigo, Kinect Model 1473 (Kinect for Xbox 360 purchased in 2014)

Installing and configuring:

  1. Install libfreenect and required packages to run kinect: $sudo apt-get install ros-indigo-freenect-launch ros-indigo-openni-launch libfreenect-dev
  2. Source your ROS setup: $source /opt/ros/indigo/setup.bash
  3. Create a catkin workspace if you don’t have one with instructions here.
  4. Setup rosdep with instructions here.
  5. Clone RGBDSLAM V2 from here into the ~/catkin_ws/src directory.
  6. $cd ~/catkin_ws
  7. $source devel/setup.bash
  8. Install RGBD SLAM dependencies: $rosdep install rgbdslam
  9. Make RGBD-SLAM: $catkin_make


  1. Open 3 terminal windows.
  2. In the first we run the ros core server: $roscore
  3. In the second we launch the kinect driver: $roslaunch freenect_launch freenect.launch
  4. In the third we launch RGBD SLAM: $roslaunch rgbdslam rgbdslam.launch


  1. Karthik said:

    Have you tried visualizing octomap on Rviz using kinect? I’m having trouble generating and visualizing octomap on ROS. Any help will be much appreciated. Thankyou.

    December 5, 2016
    • sauravagarwal said:

      Haven’t tried it 🙁 I don’t have the bandwidth to look at it now but be sure to share it with the community when you figure it out 🙂

      December 23, 2016
    • Thao Nguyen said:

      Hello, this is what I’ve done to visualize octomap in rviz (I’m using ROS Indigo). The “$” symbol denotes commands run in the terminal. Hope this helps!

      – Visualize in rviz while building octomap (works best for running rgbdslam headless because we can see what we are mapping):

      $ roslaunch openni_launch openni.launch
      $ roslaunch rgbdslam headless.launch
      $ roslaunch rgbdslam octomap_server.launch # I use octomap_server to save octomaps
      $ rosrun rviz rviz

      + In rviz, for fixed frame, select ‘odom’
      + Add subscriber to topic ‘occupied_cells_vis_array’ as ‘Marker Arrays’
      + Navigate robot around to build map, using visualization in rviz
      + Save map when done using below command
      $ rosrun octomap_server octomap_saver

      – Visualize existing octomap in rviz:

      $ roscore
      $ rosrun octomap_server octomap_server_node # the existing octomap file
      $ rosrun rviz rviz

      + In rviz, add subscriber to topic ‘occupied_cells_vis_array’ as ‘Marker Arrays’ and you will see the octomap visualization in rivz

      December 25, 2016
      • sauravagarwal said:

        Thank you so much Thao :). I have fixed the missing filename part, its basically wordpress tries to remove suspicious looking text. I have given it a code like look. Really appreciate the contribution.

        December 26, 2016
  2. Abhijit B. said:

    During making of RGBD slam using $catkin_make i get the following error

    CMake Warning at rgbdslam_v2/CMakeLists.txt:100 (find_package):
    By not providing “FindQt5Concurrent.cmake” in CMAKE_MODULE_PATH this
    project has asked CMake to find a package configuration file provided by
    “Qt5Concurrent”, but CMake did not find one.

    Could not find a package configuration file provided by “Qt5Concurrent”
    with any of the following names:


    Add the installation prefix of “Qt5Concurrent” to CMAKE_PREFIX_PATH or set
    “Qt5Concurrent_DIR” to a directory containing one of the above files. If
    “Qt5Concurrent” provides a separate development package or SDK, be sure it
    has been installed.

    Using OpenCV from /usr/share/OpenCV
    CMake Error at rgbdslam_v2/CMakeLists.txt:212 (qt5_add_resources):
    Unknown CMake command “qt5_add_resources”.

    — Configuring incomplete, errors occurred!
    See also “/home/abhijit/catkin_ws/build/CMakeFiles/CMakeOutput.log”.
    See also “/home/abhijit/catkin_ws/build/CMakeFiles/CMakeError.log”.
    make: *** [cmake_check_build_system] Error 1
    Invoking “make cmake_check_build_system” failed

    Cant understand the error.

    March 28, 2017
    • sauravagarwal said:

      CMake configuration files for Qt5 seem to be missing on your computer. When you install QT5 these should be installed. Try re-installing qt5 or manually build and install it.

      May 12, 2017
    • Geek said:

      you should create your own package

      June 13, 2017
  3. Amir said:

    Hi, thanks for your article.

    I have the following issue, it just does not run on my ROS Indigo:

    … logging to /home/amir-ai/.ros/log/9bf8ce5c-4b5c-11e7-9659-38d547df45ba/roslaunch-Amir–415.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.

    started roslaunch server http://Amir:43954/


    * /rgbdslam/config/use_gui: False
    * /rosdistro: indigo
    * /rosversion: 1.11.20

    rgbdslam (rgbdslam/rgbdslam)


    core service [/rosout] found
    process[rgbdslam-1]: started with pid [433]
    ================================================================================REQUIRED process [rgbdslam-1] has died!
    process has died [pid 433, exit code -11, cmd /home/amir-ai/catkin_ws/devel/lib/rgbdslam/rgbdslam __name:=rgbdslam __log:=/home/amir-ai/.ros/log/9bf8ce5c-4b5c-11e7-9659-38d547df45ba/rgbdslam-1.log].
    log file: /home/amir-ai/.ros/log/9bf8ce5c-4b5c-11e7-9659-38d547df45ba/rgbdslam-1*.log
    Initiating shutdown!
    [rgbdslam-1] killing on exit
    shutting down processing monitor…
    … shutting down processing monitor complete

    I would appreciate your help.

    June 7, 2017
    • sauravagarwal said:

      Thanks for sharing but this terminal output does not seem to have any useful information to debug the issue. It may be you’re running out of RAM or it may be that a required process on which RGD slam depends died. Its not clear which process died or it could be that your driver for the kinect malfunctioned. You can try RGBD SLAM with simulated data using Gazebo and check for the same issue.

      June 7, 2017
    • PAA said:

      hello,I have the same problem as yours,do you have solve this problem?If so,can you tell me what you do?

      May 10, 2018
  4. Soroush said:

    Hi, you don’t realize how helpful your blog has been for me these past couple of days, I really appreciate the content you have created.
    I’m using a Macbook Pro 2015 and your post on using Lubuntu on VMware saved me from a ton of headaches, because previously I had tried to dual boot lubuntu onto my mac (to ensure flawless sims) which didn’t end very well (had to wipe out my mac, reinstall OSX and restore its content from backup) so I really wasn’t looking forward to giving dual boot lubuntu another shot and your post was a life saver, so really thanks alot man!
    Currently I’m trying to use Xbox one’s Kinect with this same setup (Lubuntu 16 on VMware, using ROS kinetic) and everything went fine except on the last two steps:
    after trying “$roslaunch freenect_launch freenect.launch” I get the error “No devices connected…. waiting for devices to be connected”, so kinect isn’t recognized for some reason. All my macbook’s ports are usb3, and I did change VMware’s USB settings to usb3 (by default it was usb2), and after trying “$lsusb” in terminal I get the following:
    “Bus 004 Device 010: ID 045e:02c4 Microsoft Corp.
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 005: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
    Bus 003 Device 004: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
    Bus 003 Device 003: ID 0e0f:0008 VMware, Inc.
    Bus 003 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 004: ID 0e0f:000b VMware, Inc.
    Bus 001 Device 003: ID 0e0f:000b VMware, Inc.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 002: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub”
    so I was wondering if you have a solution to this.
    Secondly on the last step after I put in “$roslaunch rgbdslam rgbdslam.launch” I get the error:
    “[rgbdslam.launch] is neither a launch file in package [rgbdslam] nor is [rgbdslam] a launch file name
    The traceback for the exception was written to the log file”
    which I don’t really understand either. The only difference from my directories to the ones you told us to create is that my rgbdslam is in the directory “~/Code/rgbdslam_catkin_ws/src” instead of being in “~/catkin_ws/src”.
    I would greatly appreciate any help.

    August 12, 2017
    • sauravagarwal said:

      Thanks Soroush, happy to know that the blog has been helpful to you. The location of catkin_ws directory shouldn’t be affecting anything. What do you see when you do lsusb in your macOS terminal? Does your mac recognize the device? I have never tried to connect a kinect to a virtual machine on my mac. It might be that your mac doesn’t recognize the Kinect, or the VM is not getting access to that device as it is being used by the host (mac) OS. There is an old thread here on connecting kinect to a VM. If you do get it working please share your trick back on the blog so it can help others 🙂

      August 12, 2017

Comments are closed.