JackMasaki’s blog

掲載した記事ネタや作ったアプリ、参加したイベントレポートなどを掲載します

RealSense T265が届いたので動かしてみた【SLAM.unityについて追記更新】

RealSense T265が届いたので動かしてみたポエムです。

RealSense T265はIntelから発売されているインサイドアウト方式のトラッキングがついているデバイスです。

ただし、T265にはカラー画像の取得などがないため、基本的にはロボットなどに搭載して使用するか同じくIntelから発売されているRealSense D435iなどと組み合わせて使用します。

引用:

newsroom.intel.com

The Intel RealSense Tracking Camera T265 uses inside-out tracking, which means the device does not rely on any external sensors to understand the environment. Unlike other inside-out tracking solutions, the T265 delivers 6-degrees-of-freedom (6DoF) inside-out tracking by gathering inputs from two onboard fish-eye cameras, each with an approximate 170-degree range of view. The V-SLAM systems construct and continually update maps of unknown environments and the location of a device within that environment. Since all position calculations are performed directly on the device, tracking with the T265 is platform independent and allows the T265 to run on very low-compute devices.

The T265 complements Intel’s RealSense D400 series cameras, and the data from both devices can be combined for advanced applications like occupancy mapping, improved 3D scanning and advanced navigation and collision avoidance in GPS-restricted environments. The only hardware requirements are sufficient non-volatile memory to boot the device and a USB 2.0 or 3.0 connection that provides 1.5 watts of power.

単純に使用するだけであればいつも通りIntelGitHubIntel RealSense Viewerが更新されT265に対応し、Pre-releasesとして出ているため、ダウンロードしてインストールすれば確認できます。

Intel® RealSense™ SDK 2.0 (build 2.18.1) URL:https://github.com/IntelRealSense/librealsense/releases

正式リリースはIntel® RealSense™ SDK 2.0 (build 2.17.0)が最新版になります。

XY軸だけでなくZ軸の推定も早くそれなりに高精度です。

f:id:JackMasaki:20190304165852p:plain

高速で振るなどするとロストしてしまいますが、通常使用であればそこまでロストすることはないと思われます。

ちなみに配布されているUnityPackageに関してはScenes/Samplesに更新はありませんでしたが、 build 2.18.1のComparing changesのFiles changedを見てみるとSLAM.unityなるものが追加されています。

【2019/03/06追記】Intel® RealSense™ SDK 2.0 (build 2.19.0)がリリースされ、こちらではunitypackageが更新されているとのことでSLAMシーンも最初から内包されているとのことです

リポジトリのdevelopmentブランチをクローンしてみると、wrappers/unity/Assets/RealSenseSDK2.0/Scenes/Samplesの中にSLAM.unityがあります。

https://github.com/IntelRealSense/librealsense/tree/development/wrappers/unity/Assets/RealSenseSDK2.0/Scenes/Samples

開くと怒られが大量に発生していますが、DLLがないのが原因のようなのでUnityPackageの方から持ってきたりすると動きそうです。(まだ動かしてないです。)

UnityPackageに入っているDLLはPoseなどのクラスが含まれておらず、怒られが発生します。

なので、下記のURLを参考に自前でdevelopmentブランチをビルドします。

t.co

具体的には

  1. buildフォルダをrootに作成する。
  2. buildフォルダ内でcmake .. -DBUILD_CSHARP_BINDINGS=ON -DBUILD_UNITY_BINDINGS=ON -DBUILD_SHARED_LIBS=ON -DDOTNET_VERSION_LIBRARY=3.5 -DCMAKE_GENERATOR_PLATFORM=x64をするかGUIでConfigure&Generateする。
  3. realsense2.vcxprojをVSで開いてIntel.RealSenseをビルド
  4. dll完成!

という流れです。

が、私はUnityの初期インストール位置にUnity.exeがないと怒られが発生しました(該当フォルダにUnity Hubしかなかった)そのため、C:\Program Files\Unity\にUnity Editorをインストールしたところ無事CMakeが通り解決しました。

無事dllができたらいつも通り、Untiy側のAssets/Plugins/にIntel.RealSense.dllとrealsense2.dllを入れてあげればOKです。

SLAM.unityを動かすと下記の動画のようなIntel RealSense Viewerに近い動作を確認することができます。

小ネタ

T265とD400シリーズを接続するリグを作る必要がありそうですね。

と思ったらすでに作られてました。