LoginSignup
7
7

More than 5 years have passed since last update.

RTAB-Mapで作った3D-MapをPotreeでWeb配信する。

Last updated at Posted at 2017-05-30

目的

RTAB-Mapで作った3D-MapをPotreeでWeb配信する。

test.jpg

環境

-Ubuntu1604 x64 or Ubuntu1404 x64
-ROS:kinetic or indigo
-Kinect v1 (XBOX360)

rtabmapとKinectv1のドライバーのインストール

ROS動作環境であれば下記コマンドでバイナリがインストールされる。

kinetic:

 sudo apt-get install ros-kinetic-freenect-launch
 sudo apt-get install ros-kinetic-rtabmap-ros

indigo:

sudo apt-get install ros-indigo-freenect-launch 
sudo apt-get install ros-indigo-rtabmap-ros

Kinectv1の動作確認

カラー画像とデプス画像がとれることを確認する。

 roslaunch freenect_launch freenect.launch
 rosrun image_view image_view image:=/camera/rgb/image_color
 rosrun image_view image_view image:=/camera/depth/image_raw

RTAB-Mapで地図を生成する

New DataBase→Startを実行後、周囲をぐるぐる回して3D-Mapを生成、
Stopで停止する。

File→Export 3D cloud(*.ply *.pcd *.obj)でplyファイルで保存する。
例えば、今回はcloud.ply。

$ rtabmap

Screenshot from 2017-05-25 07-24-10.png

Potree Converterのインストール

plyファイルをPotreeというファイルフォーマットに変換する。
Potreeはプラウザでポイントクラウドを扱うファイルフォーマットである。
lastoolsとPotreeConverterをmake install する

lastools

cd ~/dev/workspaces/lastools
git clone https://github.com/m-schuetz/LAStools.git master
cd master/LASzip
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install

PotreeConverter

cd ~/dev/workspaces/PotreeConverter
git clone https://github.com/potree/PotreeConverter.git master
cd master
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release - DLASZIP_INCLUDE_DIRS=~/dev/workspaces/lastools/master/LASzip/dll -DLASZIP_LIBRARY=~/dev/workspaces/lastools/master/LASzip/build/src/liblaszip.so ..
make 
sudo make install

ウェブサーバの設置

sudo apt-get install apach2

ウェブサーバへPotreeの設置

 git clone https://github.com/potree/potree.git potree
 cp -R potree /var/www/html/

プラウザで
http://127.0.0.1/potree/examples/
のアドレスにアクセスすると、下記のExampleが見られる。

annotations.html        lasmap.html    measurements.html
arena4d.html            lines.html     meshes.html
clipping_volume.html    lion.html      multiple_pointclouds.html
elevation_profile.html  lion_las.html  viewer.html
entwine_greyhound.html  lion_laz.html

Potree ConverterでplyからPotreeへ変換

Potreeを設置しているディレクトリに、plyから変換したPotreeファイルを配置する。

PotreeConverter cloud.ply -o /var/www/html/potree --generate-page pageName --overwrite

HTMLファイルの作成

サンプル(lion)のhtmlファイルを編集して、生成されたPotreeを選ぶ

gedit /var/www/html/potree/examples/lion.html

    // Sigeom
    Potree.loadPointCloud("../pointclouds/pageName/cloud.js", "pageName", function(e){
        viewer.scene.addPointCloud(e.pointcloud);
        viewer.fitToScreen();
    });

以下で表示される。
http://127.0.0.1/potree/examples/lion.html

参考

-rtabmap_ros
https://github.com/introlab/rtabmap_ros

-rtabmap
http://introlab.github.io/rtabmap/

-PotreeConverter
https://github.com/potree/PotreeConverter

-potree
http://www.potree.org/

7
7
1

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