"--report", type=str, action="store", help="The output file, if not use, will use stdout") parser.add_argument( "--topic", action="store", default="/apollo/planning", help="The planning module topic name") g_args = parser.parse_args() if not g_args.report: g_args.report = sys.stdout else: g_args.report = file(g_args.report, 'w') meta_msg = g_message_manager.get_msg_meta_by_topic(g_args.topic) if not meta_msg: print("Failed to find topic[%s] in message manager" % (g_args.topic)) sys.exit(0) if g_args.rosbag: dump_bag(g_args.rosbag, meta_msg, g_args.report) else: rospy.init_node("stat_planning", anonymous=True) rospy.Subscriber(g_args.topic, meta_msg.msg_type, on_receive_planning) rospy.spin() if g_args.report != sys.stdout: g_args.report.close()
type=str, help="the input ros bag") parser.add_argument("--report", type=str, action="store", help="The output file, if not use, will use stdout") parser.add_argument("--topic", action="store", default="/apollo/planning", help="The planning module topic name") g_args = parser.parse_args() if not g_args.report: g_args.report = sys.stdout else: g_args.report = file(g_args.report, 'w') meta_msg = g_message_manager.get_msg_meta_by_topic(g_args.topic) if not meta_msg: print("Failed to find topic[%s] in message manager" % (g_args.topic)) sys.exit(0) if g_args.rosbag: dump_bag(g_args.rosbag, meta_msg, g_args.report) else: rospy.init_node("stat_planning", anonymous=True) rospy.Subscriber(g_args.topic, meta_msg.msg_type, on_receive_planning) rospy.spin() if g_args.report != sys.stdout: g_args.report.close()
action="store", default="/apollo/drive_event", help="""the drive event topic""") parser.add_argument( "--localization_topic", action="store", default="/apollo/localization/pose", help="""the drive event topic""") parser.add_argument( "--dir", action="store", default="data/bag", help="""The log export directory.""") g_args = parser.parse_args() drive_event_meta_msg = g_message_manager.get_msg_meta_by_topic( g_args.drive_event_topic) if not drive_event_meta_msg: print "Unknown drive_event topic name: %s" % (g_args.drive_event_topic) sys.exit(0) localization_meta_msg = g_message_manager.get_msg_meta_by_topic( g_args.localization_topic) if not localization_meta_msg: print "Unknown localization topic name: %s" % ( g_args.localization_topic) sys.exit(0) cyber.init() node = cyber.Node("derive_event_node") node.create_reader(localization_meta_msg.topic, localization_meta_msg.msg_type, OnReceiveLocalization)
action="store", default="/apollo/drive_event", help="""the drive event topic""") parser.add_argument( "--localization_topic", action="store", default="/apollo/localization/pose", help="""the drive event topic""") parser.add_argument( "--dir", action="store", default="data/bag", help="""The log export directory.""") g_args = parser.parse_args() drive_event_meta_msg = g_message_manager.get_msg_meta_by_topic( g_args.drive_event_topic) if not drive_event_meta_msg: print "Unknown drive_event topic name: %s" % (g_args.drive_event_topic) sys.exit(0) localization_meta_msg = g_message_manager.get_msg_meta_by_topic( g_args.localization_topic) if not localization_meta_msg: print "Unknown localization topic name: %s" % ( g_args.localization_topic) sys.exit(0) rospy.init_node('drive_event_node', anonymous=True) rospy.Subscriber(localization_meta_msg.topic(), localization_meta_msg.msg_type(), OnReceiveLocalization)