def create_msg(seuid, host, entity): msg = RatedStatistics() msg.seuid = seuid msg.host = host now = rospy.Time.now() msg.window_start = now - rospy.Duration(1) msg.window_stop = now msg.rated_statistics_entity = entity return msg
def create_simple_bag(): bag = rosbag.Bag('bags/john.bag', 'w') msg = RatedStatistics() msg.seuid = "n" + SEUID_DELIMITER + "node1" msg.host = "host1" now = rospy.Time.now() msg.window_start = now - rospy.Duration(5) msg.window_stop = now msg.rated_statistics_entity = [create_statistic_entity()] try: bag.write('/statistics_rated', msg) finally: bag.close()