Skip to content

Azure Kinect

Thanyu edited this page Aug 17, 2023 · 16 revisions

Set up Azure Kinect on Ubuntu 20.04

Install Azure Kinect SDK on Ubuntu 20.04

Configure Microsoft's Package Repository

First, you'll need to configure Microsoft's Package Repository, following the instructions here.

Install Azure Kinect SDK

Install Azure Kinect SDK (Option 1)

Next, you'll need to install the Azure Kinect SDK. You can do this by running the following commands:

sudo apt install k4a-tools
sudo apt install libk4a1.4-dev

If the above commands fail, you may follow the below steps to install the SDK.

Install Azure Kinect SDK (Option 2)

Refer to issue:1263 Even though OS is for Ubuntu 18.04, it works for Ubuntu 20.04 as well.

Make sure to check the version[^1] of Azure Kinect SDK and Body Tracking SDK. You can check an option of libk4abt.-dev versions here And also libk4a.-dev here.

k4aVERSION=1.4
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/18.04/prod
curl -sSL https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft-prod.list
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-get update
sudo apt install libk4a{$k4aVERSION}-dev
# sudo apt install libk4abt${BodyTranckVERSION}-dev # you may not need this
sudo apt install k4a-tools=$k4aVERSION

[^1]: My version is 1.4.1 and 1.1 for SDK and Body Tracking SDK respectively.

Test Azure Kinect SDK

sudo k4aviewer

Linux Device Setup

To use Azure Kinect without sudo, you'll need to set up a udev rule. You can follow this page or do this by running the following command:

DO NOT COPY github.com link. USE raw.githubusercontent.com

# sudo mkdir -p '/etc/udev/rules.d/'
wget -P '/etc/udev/rules.d/' https://raw.githubusercontent.com/microsoft/Azure-Kinect-Sensor-SDK/develop/scripts/99-k4a.rules

Then, reattach Azure Kinect devices if attached during this process.

Hopefully, you should be able to run the following command without sudo:

k4aviewer

Use Azure Kinect in ROS

Install pyKinectAzure

This is a Python wrapper for Azure Kinect SDK. You should be able to just follow the instructions on the GitHub page, but I'll repeat them here for convenience.

You have two options to install pyKinectAzure.

  1. Simple ( if no need to change the source code)
pip install pykinect_azure
  1. Advanced ( if you want to change the source code)
mkdir -p $YOUR_WORK_REPO/third_party
cd $YOUR_WORK_REPO/third_party
git clone https://github.com/ibaiGorordo/pyKinectAzure.git
cd pyKinectAzure
pip install -e .

Test pyKinectAzure

pyKinectAzure has banch of exsamples. You can run them to test the installation.

python exsamples/exampleColorImage.py

Use Azure Kinect in ROS

Writing... rosrun tf2_ros static_transform_publisher 1 0 0 0 0 0 rgb_camera_link map


If you have any questions or find errors, please let me know. Thanks.

Clone this wiki locally