LoginSignup
5
3

ROSでPCLのサンプルを動かす - lccp segmentaion

Last updated at Posted at 2020-05-30

#1 概要

  • 今回はROSでPCLのセグメンテーションのサンプル内のlccp_segmentationを動かす手順を記載します。lccpはグラフ化された点群を凹面(concave)によって分離するアルゴリズムです。例えば「Picking Towels in Point Clouds 」という論文ではタオルのばら積みシーンでロボットが把持可能な凸部分をlccpと似たような考え方を利用して抽出し、ピッキングしています。サンプルプログラムではSuperVoxel-Clusteringで点群をグラフ化しlccpによって物体を分離しています。

  • ROSで動かすには、最新のサンプルではビルドが通らなかったのでpclのソースをgit cloneし、適切なバージョンに下げたのちプログラムを使用しました。

#2 環境
Ubuntu 18.04
ROS Melodic

#3 手順
##3.1 ROSのインストール
Desktop-Fullをインストールします。
melodic/Installation/Ubuntu - ROS Wiki

##3.2 ワークスペースの作成

ワークスペースの作成
mkdir -p ~/catkin_ws/src

##3.3 パッケージの作成

パッケージの作成
cd ~/catkin_ws/src
catkin_create_pkg pcl_tutorial
mkdir pcl_tutorial/src

##3.4 ソースプログラムの取得

cd
git clone https://github.com/PointCloudLibrary/pcl.git

#バージョンの変更
cd pcl
git checkout e7135639c

#ソースコピー
cp ~/pcl/examples/segmentation/example_lccp_segmentation.cpp ~/catkin_ws/src/pcl_tutorial/src/lccp.cpp

##3.5 ビルド
1.CMakeFile.txtの作成

pcl_tutorial/CMakeFile.txt
cmake_minimum_required(VERSION 3.0.2)
project(pcl_tutorial)

find_package(catkin REQUIRED)
find_package(PCL 1.8 REQUIRED)

catkin_package(
)

include_directories(
 include
 ${PCL_INCLUDE_DIRS}
 #${catkin_INCLUDE_DIRS}
)

add_executable(lccp src/lccp.cpp)

target_link_libraries(lccp
  ${PCL_LIBRARIES}
  #${catkin_LIBRARIES}
)

2.ビルド

sudo apt-get install python-catkin-tools
cd ~/catkin_ws
catkin build 
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

##3.6 実行
1.点群データの取得

cd
git clone https://github.com/PointCloudLibrary/data.git

2.実行

roscore
rosrun pcl_tutorial lccp data/tutorials/correspondence_grouping/milk_cartoon_all_small_clorox.pcd 

3.結果
セグメンテーション結果が表示されました。
ミルクが分離できていないのでパラメータ調整していきます。

##3.7 パラメータ調整
LCCPSegmentationの凹面判定のしきい値であるconcavity_tolerance_threshold(lccp.cpp 256行目)を10から1に変えて見ましたがミルクは分離できませんでした。そこでlccpの凹面判定の結果を表示(pcl viewer上でで「2」キーをクリック)してみると一部凹面と判定されていませんでした。

グラフ化の仕方に問題がありそうだと思いSupervoxelのnormal_importance(lccp.cpp 251行目)を4.0fから8.0fにしたところミルクも分離できました。

#4 結論
LCCPセグメンテーションを行いテーブルとその上にある物体を分離できました。今後はこのような技術を使ってロボットでピッキングを実現したいです。

#5 参考文献

宣伝

販売製品

3D Vision Controllerというものを開発しました.ロボットアームによる3次元ピッキングをWebUIから構築するためのソフトウェアが内蔵されているコントローラです.
ご興味ございましたら是非ご連絡下さい!

お仕事依頼

メールアドレス : ryotaro.hoshina@gmail.com

coconala : https://coconala.com/users/4162706

CloudWorks : https://crowdworks.jp/public/employees/5569031

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