ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have found a workaround for my problem, so I am answering my own question. Maybe this workaround could be useful to someone.

To obtain same result of the following code:

meta = {}
meta['name'] = '{$regex: /p1/}'
p1 = kbi.db.query(Pose._type, {}, meta, True, [], {}, 0)

I used the approach of:

  1. Asking ROSPlan all object types existing in the domain.
  2. After that I used types together name to query the DB until I have a result.

Of course, this approach is not best approach as it makes a lot of queries to the DB, but it works.

res = services['get_domain_types']()
for type_name in res.types:
    instance = db.query_named('%s__%s' % (type_name, item_name), return_type)
    if instance is not None:
        return instance, type_name

I am answering my own question again, this is happening so many times... :-) Although it could seem that I am writing questions too quick, I spent several time trying to fix this situation four months ago. So, it seems that asking here my question is helping me to think about the problem from other perspective.

I have found a workaround for my problem, so I am answering my own question. Maybe this workaround could be useful to someone.

To obtain same result of the following code:

meta = {}
meta['name'] = '{$regex: /p1/}'
p1 = kbi.db.query(Pose._type, {}, meta, True, [], {}, 0)

I used the approach of:

  1. Asking ROSPlan all object types existing in the domain.
  2. After that I used types together name to query the DB until I have a result.

Of course, this approach is not best approach as it makes a lot of queries to the DB, but it works.

res = services['get_domain_types']()
for type_name in res.types:
    instance = db.query_named('%s__%s' % (type_name, item_name), return_type)
    if instance is not None:
        return instance, type_name

I am answering my own question again, this is happening so many times... :-) Although it could seem that I am writing questions too quick, I spent several time trying to fix this situation four months ago. So, it seems that asking here my question is helping me to think about the problem from other perspective.

This code is part of rosplan_interface package.

I have found a workaround for my problem, so I am answering my own question. Maybe this workaround could be useful to someone.someone but it only works with 'ROSPlan' and not direct requests to 'mongodb_store' package.

To obtain same result of the following code:

meta = {}
meta['name'] = '{$regex: /p1/}'
p1 = kbi.db.query(Pose._type, {}, meta, True, [], {}, 0)

I used the approach of:

  1. Asking ROSPlan all object types existing in the domain.
  2. After that I used types together name to query the DB until I have a result.

Of course, this approach is not best approach as it makes a lot of queries to the DB, but it works.

res = services['get_domain_types']()
for type_name in res.types:
    instance = db.query_named('%s__%s' % (type_name, item_name), return_type)
    if instance is not None:
        return instance, type_name

I am answering my own question again, this is happening so many times... :-) Although it could seem that I am writing questions too quick, I spent several time trying to fix this situation four months ago. So, it seems that asking here my question is helping me to think about the problem from other perspective.

This code is part of rosplan_interface package.