0
$\begingroup$

Rosanswers logo

I am trying to install the object recognition stack on Ubuntu 11.10 / ROS Electric. I started with looking at https://github.com/wg-perception/recognition_kitchen where the Readme tells me that for Electric, I should rather look at https://github.com/wg-perception/ros-object_recognition. I am wondering whether installation can be done any easier?

-

Compiling ros-object_recognition

In my ROS workspace, I add to my .rosinstall file

- git: {
     local-name: ros-object_recognition,
     uri: 'git://github.com/wg-perception/ros-object_recognition.git',
     version: master
}

and let rosinstall clone ros-object_recognition into my workspace

$ rosinstall .
$ source setup.bash
$ roscd ros-object_recognition

There are 186 packages to build on my machine (I tripled my 2 GB RAM on my notebook for this task). I had all the system dependencies installed previously. Note that I got ros-object_recognition at 56f07e1653bbf816e2f709d502b51cfd56e4ca9a.

$ rosmake

Resulting in

tabletop/src/table/TableVisualizationMsgAssembler.cpp:
In member function
‘void tabletop::TableVisualizationMsgAssembler::addConvexHullTable(const Table&)’:
  tabletop/src/table/TableVisualizationMsgAssembler.cpp:215:107

After patching the broken commit (e-mail me for a patch in case), compilation stopped with another error:

$ rosmake object_recognition_core

cd /home/julius/ros/ros-object_recognition/object_recognition_core && ./pypath.sh         #create a soft link to our python path
  + find lib/python2.7 -path *ecto -print0
  + libname=lib/python2.7/dist-packages/ecto
  + dirname lib/python2.7/dist-packages/ecto
  + libname2=lib/python2.7/dist-packages
  + ln -sf lib/python2.7/dist-packages pyshared
cd /home/julius/ros/ros-object_recognition/object_recognition_core
    && cp -fr ./pyshared/object_recognition_msgs/*     ../object_recognition_msgs/src/object_recognition_msgs
  cp: target `../object_recognition_msgs/src/object_recognition_msgs' is not a directory
-------------------------------------------------------------------------------

Being adventurous, I took the straight-forward approach to create the missing directory

$ roscd object_recognition_msgs
$ mkdir -p src/object_recognition_msgs

Compilation now succeded

[ rosmake ] Results:                                                                                                                                                                                                               
[ rosmake ] Built 186 packages with 0 failures. 

Initializing and tracking a template plane

So I went over to learning a reference frame (a step necessary to learn models from objects) as described in http://ecto.willowgarage.com/recognition/release/latest/capture/index.html#orb-template .

$ roscore
$ roslaunch openni_launch openni.launch

Before running anything, I sourced into another environment just because paths weren't set and env.sh is apparently setting some paths.

$ roscd object_recognition_core
$ source env.sh 

Now

$ rosrun object_recognition_core orb_template.py -o ~/template_plane

This worked pretty well and the template plane was robustly tracked with or without object placed upon the plane.

$ rosrun object_recognition_core orb_track.py --track_directory ~/template_plane

Works like a charm, really.

-

-

Capturing model data

Now following http://ecto.willowgarage.com/recognition/release/latest/capture/index.html#platform-specific-instructions, I proceeded to capture a model by

$ rosrun object_recognition_core capture -i ~/template_plane --seg_z_min 0.01 -o a.bag

Unfortunately, I am running out of luck here and happen to run into some Python path troubles

Traceback (most recent call last):
  File "/home/julius/ros/ros-object_recognition/object_recognition_core/bin/capture",
line 70, in <module>
    use_turn_table=False)
  File "/home/julius/ros/ros-object_recognition/object_recognition_core/lib/python2.7/dist-packages/capture/openni_capture.py",
line 81, in create_capture_plasm
    from ecto_ros import Mat2Image, RT2PoseStamped
ImportError: cannot import name Mat2Image

Inspecting the python path, I can see

/home/julius/ros/object_recognition/object_recognition_core/lib/python2.7/dist-packages
/opt/ros/electric/ros/core/roslib/src

Manually looking into what is available

$ sudo apt-get install ipython
$ ipython
> from ecto_ros import Mat2Image
# ImportError: cannot import name Mat2Image
> from ecto_ros.ecto_ros import Mat2Image
# works!

It looks weird to me that ecto_ros is a module within ecto_ros. Am I doing something wrong here? Did I miss to include paths? Or are there some inconsistencies in the python scripts which do not show up when compiling packages? How to resolve this problem?

$ roscd object_recognition_core
$ cd lib/python2.7/dist-packages
$ vim capture/openni_capture.py

Now changing the import line results is progress:

-    from ecto_ros import Mat2Image, RT2PoseStamped
+    from ecto_ros.ecto_ros import Mat2Image, RT2PoseStamped

Now capture fails at a later point in execution:

Traceback (most recent call last):
  File "/home/julius/ros/ros-object_recognition/object_recognition_core/bin/capture",
line 70, in <module>
    use_turn_table=False)
  File "/home/julius/ros/ros-object_recognition/object_recognition_core/lib/python2.7/dist-packages/capture/openni_capture.py",
line 97, in create_capture_plasm
    delta_pose = ecto.If('delta R|T', cell=capture.DeltaRT(angle_thresh=angle_thresh,
AttributeError: 'module' object has no attribute 'DeltaRT'

Now grepping for DeltaRT in dist-packages gives

$ grep "DeltaRT" -r .
..
Binary file ./capture/ecto_cells/capture.so matches
..

and grepping in object_recognition_core

$ grep "DeltaRT" -r .
...
./build/source/capture/cells/CMakeLists.txt:  DeltaRT.cpp
./build/source/capture/cells/DeltaRT.cpp:    struct DeltaRT
...

... and ...

$ nm -C lib/python2.7/dist-packages/capture/ecto_cells/capture.so | grep "DeltaRT"

ros-object_recognition uses Boost Python and from what I see, I guess that DeltaRT.cpp is compiled into capture.so and accessed via some Python-C++ bindings.

$ ipython
> import capture
> help(capture.DeltaRT)
# AttributeError: 'module' object has no attribute 'DeltaRT'
$ import capture.ecto_cells.capture
$ help(capture.ecto_cells.capture.DeltaRT)
# works

Fixing the offending lines in in openni_capture.py by

import capture
+import capture.ecto_cells.capture
...
-    delta_pose = ecto.If('delta R|T', cell=capture.DeltaRT(angle_thresh=angle_thresh,
+    delta_pose = ecto.If('delta R|T', cell=capture.ecto_cells.capture.DeltaRT(angle_thresh=angle_thresh,

...

Now I can successfully run (the calibration markers are recognized)

$ rosrun object_recognition_core capture --preview

or with the textured template plane (mentioned above)

$ rosrun object_recognition_core capture --preview -i ~/template_plane

works quite well and an object placed on the plane is also automatically segmented from the background.

-

-

The Ultimate Question

Can this be done with less effort, less cursing, and less hacking? Have I done something wrong? Is ros_object-recognition intended to be used in ROS Electric? Or can I call it a day and be happy that I have managed to install ECTO object recognition on my machine?


Originally posted by Julius on ROS Answers with karma: 960 on 2012-04-17

Post score: 4

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Hi Julius, your comments should have been a bug report on https://github.com/wg-perception/ros-object_recognition as mentioned on http://www.ros.org/wiki/object_recognition/

You are definitely not supposed to go through so much hassle to get it to work and I am sorry the stack was released in such an unstable state. A loooot of infrastructure work has happened.

0.4.4 got released (soon to be synchronized with the official repos) and I successfully tested the pipelines there on Electric. It should work for you.


Originally posted by Vincent Rabaud with karma: 1111 on 2012-04-20

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by sam on 2012-10-28:
Is object recognition stable for fuerte now? Which procedure should I follow? Thank you~

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.