Advertisement

Kinect v2 使用ork功能包进行物体识别

阅读量:

環境是 Ubuntu 14.04+ROS Indigo

首先來裝一些 ORK 需要用到的 package !

export DISTRO=indigo
sudo apt-get install libopenni-dev ros-{DISTRO}-catkin ros-{DISTRO}-ecto* ros-{DISTRO}-opencv-candidate ros-{DISTRO}-moveit-msgs

安裝 ORK 啦,

sudo apt-get install ros-indigo-object-recognition-*

【如果不行再使用最麻烦安裝方式:
catkin_workspace/src 底下

git clone http://github.com/wg-perception/object_recognition_msgs
git clone http://github.com/wg-perception/object_recognition_ros
git clone http://github.com/wg-perception/object_recognition_ros_visualization
git clone http://github.com/wg-perception/object_recognition_core
git clone http://github.com/wg-perception/linemod
git clone http://github.com/wg-perception/ork_renderer】
cd ../ && catkin_make

如果编译不成功因為是少了 GL/osmesa.h,所以需要額外下一個指令 sudo apt-get install libosmesa6-dev 來安裝。

roscd object_recognition_core
如果可以代表成功了

如果失败 可能是roscd沒有被加進 ROS_PACKAGE_PATH 中
先 vim ~/.bashrc 一下,然後在最下面補上一行:
export ROS_PACKAGE_PATH="$ROS_PACKAGE_PATH:/home/rosindigo/catkin_ws/src"

ORK 是一套以 template matching 方法為主的辨识工具,也就是說,他会把感測器看到的物体跟资料库中的物体比對,夠相似的就算是辨识成功,所以我們接著要來处理资料库。首先要安裝 CouchDB 這個工具
sudo apt-get install couchdb
接下來檢查一下是否有安裝成功
用 curl -X GET http://localhost:5984

rosrun object_recognition_core object_add.py -n "coke " -d "A universal can of coke" --commit

執行上面這個指令之後,你可以去 http://localhost:5984/_utils/database.html?object_recognition/_design/objects/_view/by_object_name 看看自己的資料庫裡是否已經新增了這個物體:

Value:
{_id: "ae8089cf1d0ddddfccd621c913000aa5", _rev: "1-0c41df69597740cfa5bc1a01f843f0e7", added: "2018-07-24T12:14:00Z", description: "A universal can of coke", tags: [], author_email: "", author_name: "", object_name: "coke ", Type: "Object"}

如果出现这个代表新增成功。

git clone https://github.com/wg-perception/ork_tutorials
cd .. && catkin_make

rosrun object_recognition_core mesh_add.py <YOUR_OBJECT_ID> <path to ork_tutorials/data/coke.stl> --commit
(例如:rosrun object_recognition_core mesh_add.py ae8089cf1d0ddddfccd621c913000aa5 /home/sy/catkin_ws/src/ork_tutorials/data/coke.stl --commit )

通过以下命令安装并运行一个couchapp工具查看模型:
sudo pip install git+https://github.com/couchapp/couchapp.git
rosrun object_recognition_core push.sh

这个时候终端会出现一个网址localhost:5984,打开网址可以查看模型(注意:必须开蓝灯 )

模型训练:
rosrun object_recognition_core training -c rospack find object_recognition_linemod/conf/training.ork

识别:
roscore
roslaunch openni2_launch openni2.launch
rosrun dynamic_reconfigure dynparam set /camera/driver depth_registration True
rosrun dynamic_reconfigure dynparam set /camera/driver image_mode 2
rosrun dynamic_reconfigure dynparam set /camera/driver depth_mode 2
rosrun topic_tools relay /camera/depth_registered/image_raw /camera/depth_registered/image
rosrun object_recognition_core detection -c rospack find object_recognition_linemod/conf/detection.ros.ork
rosrun rviz rviz

在物体抓取等应用中会用到这种识别
rosrun object_recognition_core detection -c rospack find object_recognition_tabletop/conf/detection.object.ros.ork

全部评论 (0)

还没有任何评论哟~