当前位置: 首页>>代码示例>>Python>>正文


Python MessageStoreProxy.query_id方法代码示例

本文整理汇总了Python中mongodb_store.message_store.MessageStoreProxy.query_id方法的典型用法代码示例。如果您正苦于以下问题:Python MessageStoreProxy.query_id方法的具体用法?Python MessageStoreProxy.query_id怎么用?Python MessageStoreProxy.query_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mongodb_store.message_store.MessageStoreProxy的用法示例。


在下文中一共展示了MessageStoreProxy.query_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_message_store_messages

# 需要导入模块: from mongodb_store.message_store import MessageStoreProxy [as 别名]
# 或者: from mongodb_store.message_store.MessageStoreProxy import query_id [as 别名]
 def get_message_store_messages(self, typ=None):
     msgs = []
     proxy = MessageStoreProxy()
     for msg in self._msg_store_objects:
         if typ != msg.typ and typ is not None:
             continue
         proxy.database =  msg.database
         proxy.collection =  msg.collection
         msgs.append(proxy.query_id(msg.obj_id, msg.typ)[0])
     return msgs
开发者ID:PDuckworth,项目名称:soma,代码行数:12,代码来源:state.py

示例2: StringPairList

# 需要导入模块: from mongodb_store.message_store import MessageStoreProxy [as 别名]
# 或者: from mongodb_store.message_store.MessageStoreProxy import query_id [as 别名]
        
        # now store ids togther in store, addition types for safety
        spl = StringPairList()
        for pair in stored:
            spl.pairs.append(StringPair(pair[0], pair[1]))

        # and add some meta information
        meta = {}
        meta['description'] = "this wasn't great"    
        meta['result_time'] = datetime.utcfromtimestamp(rospy.get_rostime().to_sec())
        msg_store.insert(spl, meta = meta)

        # now let's get all our logged data back
        results = msg_store.query(StringPairList._type)
        for message, meta in results:
            if 'description' in meta:
                print 'description: %s' % meta['description']
            print 'result time (UTC from rostime): %s' % meta['result_time']            
            print 'inserted at (UTC from rostime): %s' % meta['inserted_at']
            pose = msg_store.query_id(message.pairs[0].second, Pose._type)
            point = msg_store.query_id(message.pairs[1].second, Point._type)
            quaternion = msg_store.query_id(message.pairs[2].second, Quaternion._type)
            result = msg_store.query_id(message.pairs[3].second, Bool._type)

        
    except rospy.ServiceException, e:
        print "Service call failed: %s"%e


        
开发者ID:AIRLab-POLIMI,项目名称:iDrive,代码行数:29,代码来源:example_multi_event_log.py

示例3:

# 需要导入模块: from mongodb_store.message_store import MessageStoreProxy [as 别名]
# 或者: from mongodb_store.message_store.MessageStoreProxy import query_id [as 别名]
        p_id = msg_store.insert(['test1', 'test2'])         

        # get it back with a name
        print msg_store.query_named("my favourite pose", Pose._type)

        p.position.x = 666

        # update it with a name
        msg_store.update_named("my favourite pose", p)

        p.position.y = 2020

        # update the other inserted one using the id
        msg_store.update_id(p_id, p)

        stored_p, meta = msg_store.query_id(p_id, Pose._type)

        assert stored_p.position.x == 666
        assert stored_p.position.y == 2020
        print "stored object ok"
        print "stored object inserted at %s (UTC rostime) by %s" % (meta['inserted_at'], meta['inserted_by'])
        print "stored object last updated at %s (UTC rostime) by %s" % (meta['last_updated_at'], meta['last_updated_by'])

        # some other things you can do...

        # get it back with a name
        print msg_store.query_named("my favourite pose", Pose._type)


        # try to get it back with an incorrect name, so get None instead
        print msg_store.query_named("my favourite position", Pose._type)
开发者ID:Vesperal-Hunter,项目名称:navigation_data_collecting,代码行数:33,代码来源:client.py


注:本文中的mongodb_store.message_store.MessageStoreProxy.query_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。