LoginSignup
14
10

More than 5 years have passed since last update.

D415/D435をROSで使用する環境を5分で構築する

Last updated at Posted at 2018-07-17

 はじめに

Dockerがインストールされているものとして、
RGBDカメラであるIntel Realsense D415/D435をROSで使用する環境を5分で構築する。

Dockerをインストールしていない方は、こちらを参考にDockerをインストールする。

インストール

基本的にはhttps://github.com/IntelRealSense/librealsenseのinstall手順に従ってインストールする。
https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md
https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md#prerequisites

prerequisites

sudo apt install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev 

/tmpなどにgit cloneしてくる。

cd /tmp
git clone https://github.com/IntelRealSense/librealsense
cd librealsense

続いてUbuntuのversion特有のインストール作業を行う。

  • Ubuntu 14 or when running of Ubuntu 16.04 live-disk:
sudo apt-get install
./scripts/install_glfw3.sh 
  • Ubuntu 16:
sudo apt install libglfw3-dev
  • Ubuntu 18:
sudo apt install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev 

udevにデバイス情報を記述する

sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger

kernelが低い場合の対処

librealsenseではkernelのversionが低いと動作しないようなので、kernelを上げるかpatchを上げる必要がある。
実際のロボットなどでは様々な理由があってすぐにはkernelを上げることができないという問題がある。
そこで、ここではkernelのversionを上げずにpatchを当てる方法を説明する。
基本的には下記のコマンドを実行してmodprobeすると見えるようになる。

./scripts/patch-uvcvideo-ubuntu-mainline.sh
sudo modprobe uvcvideo

D415/D435のDocker image

https://hub.docker.com/r/iory/docker-ros-d415/
にあるdockerイメージをpullする。

sudo docker pull iory/docker-ros-d415:docker.d415

実行

D415/D435をUSB3.0のポートに挿して、
以下のコマンドを実行すると、PointcloudなどのtopicがROSで見えるようになる。

sudo docker run --rm --net=host --privileged --volume=/dev:/dev -it iory/docker-ros-d415:docker.d415 /bin/bash -i -c 'roslaunch realsense2_camera rs_rgbd.launch enable_pointcloud:=true align_depth:=false depth_registered_processing:=true align_depth:=true'

RViz-_003.png

14
10
2

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
14
10