Using a Kinect v1 with ROS 2 Humble: RGB, Depth, Audio, Tilt and LED

The original Xbox Kinect is cheap on the second-hand market and still a capable sensor: an RGB camera, a depth camera, a four-microphone array, a tilt motor and a status LED. I packaged everything needed to use it with ROS 2 Humble, and this post explains how.

My setup

  • OS: Ubuntu 22.04
  • ROS 2: Humble Hawksbill
  • Sensor: Kinect v1 (Kinect for Windows, model 1517)
  • Driver: libfreenect

One package per feature

Rather than one big node, I built a separate ROS 2 package for each feature, so you only run what you need:

  • ros2_kinect_rgb: colour camera images
  • ros2_kinect_depth: depth images
  • ros2_kinect_mic: audio from the microphone array
  • ros2_kinect_tilt: the tilt motor
  • ros2_kinect_led: the front LED
  • ros2_tests: viewers and test scripts for each of the above

If you'd rather run everything in one process, switch to the ros2-humble-unified branch, which combines all features into a single node.

No more manual firmware step: the Kinect's audio needs firmware uploaded every time it is plugged in. The nodes now do this automatically, so you don't have to run freenect-micview first.

Building the workspace

Set up libfreenect first (the repo has a detailed guide). Then build from a clean environment. Make sure no ROS 1 setup is sourced, since mixing them causes confusing build errors:

mkdir ~/Ros2-KinectV1 && cd ~/Ros2-KinectV1
rm -rf build/ install/ log/

unset AMENT_PREFIX_PATH
unset CMAKE_PREFIX_PATH
source /opt/ros/humble/setup.bash

colcon build --symlink-install
source install/setup.bash

RGB and depth

Start a node in one terminal and its viewer in another:

# RGB
ros2 run ros2_kinect_rgb rgb_node
ros2 run ros2_tests rgb_viewer

# Depth
ros2 run ros2_kinect_depth depth_node
ros2 run ros2_tests depth_viewer

Tilt motor

The tilt node listens for simple string commands on /kinect/tilt_cmd:

ros2 run ros2_kinect_tilt ros2_kinect_tilt_node

ros2 topic pub --once /kinect/tilt_cmd std_msgs/String "data: 'up'"
ros2 topic pub --once /kinect/tilt_cmd std_msgs/String "data: 'center'"
ros2 topic pub --once /kinect/tilt_cmd std_msgs/String "data: 'set -15'"   # degrees, negative is down

LED

ros2 run ros2_kinect_led ros2_kinect_led_node

ros2 topic pub --once /kinect/led_cmd std_msgs/String "data: 'green'"
ros2 topic pub --once /kinect/led_cmd std_msgs/String "data: 'blink_green'"
ros2 topic pub --once /kinect/led_cmd std_msgs/String "data: 'red'"
ros2 topic pub --once /kinect/led_cmd std_msgs/String "data: 'off'"

Or run every LED and tilt command in sequence with ros2 run ros2_tests led_test and ros2 run ros2_tests tilt_test.

Audio

ros2 run ros2_kinect_mic_node ros2_kinect_mic_node

# Records 15 seconds to mic_output.wav and plays it back live
ros2 run ros2_tests mic_listener

Why it's useful

With every sensor available through ROS 2, the Kinect becomes a low-cost perception head for robotics projects: depth for obstacle detection, RGB for vision, and the microphone array for voice.

Share
written by Sriharsha Shesham

Comments