############################################################################### """ This program can extract driving trajectory from a record """ import argparse import shutil import os import time import sys from cyber_py import cyber from cyber_py import record from common.message_manager import PbMessageManager g_message_manager = PbMessageManager() def write_to_file(file_path, topic_pb): """ write pb message to file """ with open(file_path, 'w') as fp: fp.write(str(topic_pb)) def extract_record(in_record, output): freader = record.RecordReader(in_record) print("begin to extract from record {}".format(in_record)) time.sleep(1) seq = 0 localization_topic = '/apollo/localization/pose'
This program can dump a rosbag into separate text files that contains the pb messages """ import rosbag import rospy import std_msgs import argparse import shutil import StringIO import os import sys from std_msgs.msg import String from common.message_manager import PbMessageManager g_message_manager = PbMessageManager() g_args = None def stat_planning(planning_msg): stats = {} if planning_msg.HasField("estop"): return stats stats["total_time"] = planning_msg.latency_stats.total_time_ms stats["init_time"] = planning_msg.latency_stats.init_frame_time_ms used_time = stats["init_time"] stats["obstacles"] = len(planning_msg.decision.object_decision.decision) for task in planning_msg.latency_stats.task_stats: stats[task.name] = task.time_ms used_time += task.time_ms stats["other"] = stats["total_time"] - used_time
This program can publish drive event message """ from cyber_py import cyber import argparse import datetime import shutil import time import os import sys from common.message_manager import PbMessageManager from common import proto_utils g_message_manager = PbMessageManager() g_args = None g_localization = None def OnReceiveLocalization(localization_msg): global g_localization g_localization = localization_msg if __name__ == "__main__": parser = argparse.ArgumentParser( description="A tool to write events when recording rosbag") parser.add_argument(
import rosbag import std_msgs import argparse import datetime import shutil import time import os import rospy import sys from std_msgs.msg import String from common.message_manager import PbMessageManager from common import proto_utils g_message_manager = PbMessageManager() g_args = None g_localization = None def OnReceiveLocalization(localization_msg): global g_localization g_localization = localization_msg if __name__ == "__main__": parser = argparse.ArgumentParser( description="A tool to write events when recording rosbag") parser.add_argument(