4 from std_msgs.msg
import Int64, Bool
5 from threading
import Thread
6 import mongodb_store_msgs.srv
as dc_srv
7 import mongodb_store.util
as dc_util
8 from mongodb_store.message_store
import MessageStoreProxy
12 def __init__(self, topic, delay, rate, count=20):
13 super(TestPublisher, self).
__init__()
14 self.
publisher = rospy.Publisher(topic, Int64, queue_size=min(10, count))
22 rospy.sleep(self.
delay)
24 for i
in range(self.
count):
25 self.publisher.publish(i)
31 if __name__ ==
'__main__':
33 rospy.init_node(
"mongodb_log_test_publisher")
37 to_publish = [ (
'test_0', rospy.Duration(10), rospy.Rate(1), 20), (
'test_1', rospy.Duration(20), rospy.Rate(1), 20) ]
40 map(
lambda pub: pub.thread.start(), publishers)
41 map(
lambda pub: pub.thread.join(), publishers)
46 for target
in to_publish:
47 msg_store = MessageStoreProxy(database=
'roslog', collection=target[0])
48 print len(msg_store.query(Int64._type)) == target[3]
def __init__(self, topic, delay, rate, count=20)