Go to the documentation of this file.00001
00002
00003
00004
00005 import roslib
00006 roslib.load_manifest('semanticmodel')
00007
00008 import rospy
00009 import sys
00010 import mongo_ros as mr
00011 import sensor_msgs.msg as sm
00012
00013 rospy.init_node('show_image')
00014 pub = rospy.Publisher('image', sm.Image, latch=True)
00015
00016 db = 'world_model' if len(sys.argv)<3 else sys.argv[2]
00017 c = mr.MessageCollection(db, 'images', sm.Image)
00018
00019 print("Blob ids are {0}".
00020 format(sorted([m['cluster_id'] for m in c.query({}, metadata_only=True)])))
00021 if len(sys.argv)>1:
00022 print("Publishing blob {0}".format(sys.argv[1]))
00023 img = next(c.query({'cluster_id': int(sys.argv[1])}))[0]
00024 pub.publish(img)
00025 rospy.sleep(2.0)
00026 else:
00027 print "Usage: {0} BLOB_ID".format(sys.argv[0])
00028