0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure KinectをUbuntu 22.04 ROS2 Humbleで動かす手順

Posted at

Azure KinectをUbuntu 22.04 ROS2 Humbleで動かす手順

1. Azure Kinect SDKのインストール

1.1. .debファイルのダウンロード

以下のコマンドを実行して、Azure Kinect SDKの.debファイルをダウンロードします。

wget -P /tmp https://github.com/asukiaaa/Azure-Kinect-Sensor-SDK/releases/download/2923-08-26-ubuntu-22-04/libk4a1.4\_1.4.1\_amd64.deb

1.2. .debファイルのインストール

ダウンロードした.debファイルをインストールします。

sudo apt install /tmp/libk4a1.4\_1.4.1\_amd64.deb

1.3. USBの再接続

インストール後、Azure KinectのUSBケーブルを抜き差しして、デバイスを再認識させます。

2. ROS2 Humble用Azure Kinectドライバーの設定

2.1. 99-k4a.rulesファイルのダウンロードと配置

Azure Kinectをroot権限なしで利用するために、99-k4a.rulesファイルをダウンロードし、/etc/udev/rules.d/に配置します。

wget https://raw.githubusercontent.com/microsoft/Azure-Kinect-Sensor-SDK/develop/scripts/99-k4a.rules
sudo cp 99-k4a.rules /etc/udev/rules.d/

2.2. Azure_Kinect_ROS_Driverのビルド

ROS2 Humble用のAzure Kinectドライバーをビルドします。まず、ROS2のワークスペースを作成し、ドライバーのリポジトリをクローンします。

mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone -b humble https://github.com/microsoft/Azure_Kinect_ROS_Driver.git
cd ~/ros2_ws
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install

2.3. ROS2ノードの起動確認

ビルドが完了したら、ROS2ノードを起動してAzure Kinectが認識されているか確認します。

source install/setup.bash
ros2 launch azure_kinect_ros_driver driver.launch.py

3. 動作確認 (Python Wrapper)

Azure Kinect SDKのインストールとROS2ドライバーの設定が完了したら、Pythonのwrapper (pyk4a) を利用して動作確認を行うことができます。

3.1. pyk4aのインストール

sudo apt install python3-pip
pip3 install pyk4a

3.2. 深度ビューアの実行

pyk4aのサンプルコードである深度ビューアをダウンロードして実行します。helpers.pyも一緒にダウンロードしてください。

wget -P /tmp https://raw.githubusercontent.com/etiennedub/pyk4a/master/example/helpers.py https://raw.githubusercontent.com/etiennedub/pyk4a/master/example/viewer_depth.py
python3 /tmp/viewer_depth.py

これにより、Azure Kinectから取得した深度情報が表示され、SDKとドライバーが正しく動作していることを確認できます。

4. アンインストール

Azure Kinect SDKをアンインストールする場合は、以下のコマンドを実行します。

sudo apt autoremove libk4a1.4

5. 参考資料

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?