wg-perception / object_recognition_core

The core of object recognition, where the development now happens
48 stars 47 forks source link

On Ubuntu 16.04, objects loaded from couchdb are empty #45

Closed corot closed 7 years ago

corot commented 8 years ago

This causes issue https://github.com/wg-perception/tabletop/issues/31, but ecto crash reports rather cryptically "[what] = value type is 0 not 2". When loading objects from couchdb, the query returns the proper number of objects, but without data: the view fields map is empty. Then, this line fails because key "_id" cannot be found and returns end(). Then call get_str() on an empty objects fails because the object ype is 0 (object, but I suppose 0 is the default value). Actually, I'm shock that calling .second on the returned pointer, that must necessarily be end() doesn't crash before!.

Going deeper, the problem seems to be in the view_iterator. No idea why, but if I bypass the view_iterator * and ++ operators by making viewelements public and iterating directly over the vector, then magically objects contain data and all works as before:

      for (size_t i = 0; i < view_iterator.view_elements_.size(); ++i)
      {
        const or_json::mObject & obj = view_iterator.view_elements_[i].fields();

//      while (view_iterator != ViewIterator::end())
//      {

That said, no idea why this happens now on 16.04. Honestly, I don't understand the View and ViewIterator working, so much less why is not working.

hris2003 commented 7 years ago

@corot Does it happen with the whatever object in the db? Even with the coke mesh?

corot commented 7 years ago

yes. The problem seems to be in the way we grab the objects from the ViewIterator, because the objects are properly retrieved from the database and stored in the viewelements vector!

I wonder what is the ViewIterator underlying mechanism... maybe that could explain why it stopped working on 16.04 / kinetic!

corot commented 7 years ago

Works fine now. Thanks!