32 from docutils.nodes
import topic
37 """ Return a list of topics stored in this bag """ 39 return bag.get_type_and_topic_info()[1].keys()
42 """ Generates a sequence of messages in the topic from the bag """ 44 for top, msg, t
in bag.read_messages():
52 Compares contents of two bags; fails if the contents are not identical (except for ROS seqno, timestamp). 55 ref_msg.header.seq = 0
56 uut_msg.header.seq = 0
58 ref_msg.header.stamp =
None 59 uut_msg.header.stamp =
None 61 if(ref_msg != uut_msg):
62 rospy.logerr(
"Messages do not match:")
63 rospy.logerr(
"Ref:\r\n" + str(ref_msg))
64 rospy.logerr(
"UUT:\r\n" + str(uut_msg))
72 Verifies that two bags contain semantically identical sequence of messages. 77 for topic
in ref_topics:
81 for ref_msg
in ref_gen:
82 uut_msg = next(uut_gen)
83 if not compare(ref_msg, uut_msg):
84 rospy.logerr(
"Topic: {} Msg No: {}".format(topic, msgno))
89 rospy.loginfo(
"Verified {} '{}' messages".format(msgno, topic))
91 unexpected_messages = 0
94 uut_top, uut_msg, uut_t = next(uut_gen)
95 rospy.logerr(
"Unexpected message")
97 unexpected_messages += 1
103 traceback.print_exc()
106 assert(unexpected_messages == 0)
def get_topic_list(bag_name)
def compare(ref_msg, uut_msg)
def make_msg_gen(bag_name, topic)
def verify_bag_equivalency(ref_bag, uut_bag)