LoginSignup
6
7

More than 3 years have passed since last update.

産総研のOpenVSLAMがJETSON NANOで動くか試してみる(Docker使用)

Last updated at Posted at 2019-06-02

2E61B062-F449-4AFA-81FC-8EBC51073032.jpeg

JETSON NANOでVSLAMをやりたい

トラブル対処の備忘録として記録を残します。
※注意!
前半はdockerを使用していますが、動きませんでした。備忘録として残してるので、ネイティブコンパイルした方を見てください。

  • 産総研のOpenVSRAMをdockerで動かす
  • JETSON nano
  • ラズパイV2のカメラ

デモが動くところまで持って行って、その後カメラを繋いでみる。
カメラはUSBタイプに変更するかも。

Dockerインストール

Users of Docker for Ubuntu can use Docker instead of preparing the dependencies manually. (Docker for Mac are not supported.)

UbuntuユーザーはDockerが使えるよ、ということでしたので、dockerでやってみることにしました。
基板はJETSON nanoです。

インストールガイドに沿って実行しましたが、なかなか時間がかかりそうです。
待ちきれなくなって寝ました。
朝には終わっていました。

dockerはJETSON nanoにすでにインストールされていましたが、nvidia docker2とは異なります。
nanoはグラフィックアクセラレータとは違うみたいです。
バージョンは
Docker version 18.06.1-ce, build e68fc7a
です。

インストールは成功しているようです。

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
openvslam-desktop   latest              cb61a4b5ee0f        7 hours ago         967MB
rs2                 latest              c23abfcb4ca8        29 hours ago        3.96GB
realsense           latest              5f75d785ec89        34 hours ago        3.69GB
ros                 ros-tutorials       142e25ff0589        2 days ago          1.18GB
ros                 latest              c8101f88fd31        3 days ago          1.13GB
ros                 kinetic             a1c0bb40d68b        4 days ago          1.11GB
ubuntu              18.04               9f020c638543        2 weeks ago         63.3MB

X11とは?

X11転送を有効にするには、追加のオプションが必要です。
と、記述がありますが、LINUXの知識がない人間にはよくわかりませんでした。
友人に聞くと、X11で実行した結果とかを別のマシンのディスプレイに転送できる。という話だったので、vncみたいなものかと勝手に思いながらも、わざわざ書いてるのだからやったほうがよさそうだとおもい、X11転送を有効にして起動します。
(まだ受ける側の対応をしていません)

~$ docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix:ro openvslam-desktop
root@262d5db680db:/openvslam/build# 

CUIで起動しました。
lsコマンドでサンプルプログラムのディレクトリが見えるようになったので、チュートリアルをやってみます。

チュートリアル

チュートリアルに記述された内容をそのままコマンドラインに貼り付けます。
Google Driveからデータを取って展開。
で、実行してみると。

command
root@262d5db680db:/openvslam/build# ./run_video_slam -v ./orb_vocab/orb_vocab.dbow2 -m ./aist_living_lab_1/movie.mp4 -s ./aist_living_lab_1/config.yaml --frame-skip 3 --no-sleep --map-db map.msg
[2019-06-01 23:11:46.982] [I] config file loaded: ./aist_living_lab_1/config.yaml
  ___               __   _____ _      _   __  __ 
 / _ \ _ __  ___ _ _\ \ / / __| |    /_\ |  \/  |
| (_) | '_ \/ -_) ' \\ V /\__ \ |__ / _ \| |\/| |
 \___/| .__/\___|_||_|\_/ |___/____/_/ \_\_|  |_|
      |_|                                        

Copyright (C) 2019,
National Institute of Advanced Industrial Science and Technology (AIST)
All rights reserved.

This is free software,
and you are welcome to redistribute it under certain conditions.
See the LICENSE file.

Camera Configuration:
- name: RICOH THETA S 960
- setup: Monocular
- fps: 30
- cols: 1920
- rows: 960
- color: RGB
- model: Equirectangular
ORB Configuration:
- number of keypoints: 2000
- scale factor: 1.2
- number of levels: 8
- initial fast threshold: 20
- minimum fast threshold: 7
- edge threshold: 19
- patch size: 31
- half patch size: 15
- mask rectangles:
  - [0, 1, 0, 0.1]
  - [0, 1, 0.84, 1]
  - [0, 0.2, 0.7, 1]
  - [0.8, 1, 0.7, 1]
Tracking Configuration:

[2019-06-01 23:11:46.983] [I] loading ORB vocabulary: ./orb_vocab/orb_vocab.dbow2
[2019-06-01 23:11:48.733] [I] startup SLAM system
[2019-06-01 23:11:48.734] [I] start mapping module
[2019-06-01 23:11:48.734] [I] start global optimization module
error: XDG_RUNTIME_DIR not set in the environment.
No protocol specified
terminate called after throwing an instance of 'std::runtime_error'
  what():  Pangolin X11: Failed to open X display
*** Aborted at 1559430709 (unix time) try "date -d @1559430709" if you are using GNU date ***
PC: @                0x0 (unknown)
*** SIGABRT (@0x29) received by PID 41 (TID 0x7f83a79010) from PID 41; stack trace: ***
    @       0x7f8b8d76c0 ([vdso]+0x6bf)
    @       0x7f8ab554d8 raise
Aborted (core dumped)
root@262d5db680db:/openvslam/build# 

途中で止まりましたが、原因はX11にある模様。
設定していないので当然ですね。
ということは、Dockerで呼び出しは成功しているようです。

X11とは?(2回目)

とりあえず、xhostへのアクセス権限がないとダメだということで、仮に
xhost +
でフルオープン(乱暴)にすると、エラーの内容も変化しました。

[2019-06-02 00:11:27.561] [I] loading ORB vocabulary: ./orb_vocab/orb_vocab.dbow2
[2019-06-02 00:11:28.945] [I] startup SLAM system
[2019-06-02 00:11:28.945] [I] start mapping module
[2019-06-02 00:11:28.946] [I] start global optimization module
error: XDG_RUNTIME_DIR not set in the environment.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
[2019-06-02 00:11:32.405] [I] initialization succeeded with E
X11 Error: BadMatch (invalid parameter attributes)
X11 Error: BadValue (integer parameter out of range for operation)
terminate called after throwing an instance of 'std::runtime_error'
  what():  Pangolin X11: Failed to create an OpenGL context
*** Aborted at 1559434292 (unix time) try "date -d @1559434292" if you are using GNU date ***
PC: @                0x0 (unknown)
*** SIGABRT (@0x48) received by PID 72 (TID 0x7fa9e2a010) from PID 72; stack trace: ***
    @       0x7fb1c886c0 ([vdso]+0x6bf)
    @       0x7fb0f064d8 raise
Aborted (core dumped)
root@262d5db680db:/openvslam/build# 

X11の前に、libGLが異常を起こしています。
OpenGLをホスト側に用意する必要がありそうなメッセージです。

***現在ここまで

Docker側でGPUを使うための設定などの情報。
調べて対策を打てるならやってみること

[ 81%] Building CXX object test/helper/CMakeFiles/test_helper.dir/bearing_vector.cc.o
[ 82%] Linking CXX shared library libtest_helper.so
CMakeFiles/test_helper.dir/landmark.cc.o: file not recognized: File truncated
collect2: error: ld returned 1 exit status
test/helper/CMakeFiles/test_helper.dir/build.make:120: recipe for target 'test/helper/libtest_helper.so' failed
make[2]: *** [test/helper/libtest_helper.so] Error 1
CMakeFiles/Makefile2:1281: recipe for target 'test/helper/CMakeFiles/test_helper.dir/all' failed
make[1]: *** [test/helper/CMakeFiles/test_helper.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

6
7
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
6
7