How to make linemod and KinectV2 work with ROS Indigo?

I’m using Ubuntu 14.04.5 with ROS Indigo, and I want to make ork work with linemod, a fairly simple need. But sometimes if some packages are not maintained well (especially in ROS), you have to investigate the problem and even to contribute code to the project…

Following the installation guide to install ork is very simple, don’t forget to install couchdb. Building from source is the only choice now, you have to modify the code to make it work as you wish.

In my case, tabletop method works well with KinectV1, even with KinectV2(but only the hd resolution config worked). However, linemod caused a huge memory leak, nearly 1GB/s, and it didn’t publish /recognized_object_array topic. At the beginning I thought it is the problem is in linemod, but it turned out to be in ork_renderer. A thread in ORK Google Group said,

Currently LINEMOD uses ork_renderer for its training phase. ork_renderer uses either GLUT or osmesa to generate synthetic images of the training data. It seems that the ork_renderer in your computer is linked to osmesa.

Fortunately now we just can change CMakeLists.txt to use GLUT. Just change option(USE_GLUT "Use GLUT instead of OSMesa" OFF) to option(USE_GLUT "Use GLUT instead of OSMesa" ON).

Update: Now I just use the version from JimmyDaSilva but not the official wg-perception.

But the current linemod version still have some problem related to assimp_devel, it seems the developer is working on it, you have to revert linemod to the previous version(35aebd).

So I just created a repo here to make the whole thing work. When linemod is training it will show a assimp window, but it do not contain anything in my case, not a serious problem, linemod works anyway with KinectV1, but not with KinectV2, because KinectV2 has a special resolution, causing an OpenCV error in linearMemoryPyramid. Fortunately again an awesome guy has worked it out, and he also fixed many other issues. I need to use KinectV2 in my work, so I followed this guy’s modification and successfully made it work on KinectV2 with QHD resolution. If you want to use SD resolution, you can set T={2,4} in linemod_detect.cpp and renderer_width: 512 renderer_height: 424 in training.ork as JimmyDaSilva said.

This ork repo integrated all of them, just to make it easier to work on ork, maybe for myself in the future.

Tips:

  • If you used linemod to train, you’d better delete the whole object_recognition database in CouchDB.
  • Using coke.stl is simpler, using coke.obj with texture will get a better result.
  • When training linemod, make sure you are in the folder which contains the obj, mtl and image files.