def set_visible_area(point_dict, axes): min_x = 10e9 min_y = 10e9 max_x = -10e9 max_y = -10e9 for id, point in dict_utils.get_item_iterator(point_dict): min_x = min(point.x, min_x) min_y = min(point.y, min_y) max_x = max(point.x, max_x) max_y = max(point.y, max_y) axes.set_aspect('equal', adjustable='box') axes.set_xlim([min_x - 10, max_x + 10]) axes.set_ylim([min_y - 10, max_y + 10])
if flag_ped: pedestrian_dictionary = dataset_reader.read_pedestrian( pedestrian_file_name) elif args.load_mode == 'vehicle': track_dictionary = dataset_reader.read_tracks(track_file_name) elif args.load_mode == 'pedestrian': pedestrian_dictionary = dataset_reader.read_pedestrian( pedestrian_file_name) timestamp_min = 1e9 timestamp_max = 0 if track_dictionary is not None: #print(len(track_dictionary)) for key, track in dict_utils.get_item_iterator(track_dictionary): #print(track_dictionary) timestamp_min = min(timestamp_min, track.time_stamp_ms_first) timestamp_max = max(timestamp_max, track.time_stamp_ms_last) else: for key, track in dict_utils.get_item_iterator(pedestrian_dictionary): timestamp_min = min(timestamp_min, track.time_stamp_ms_first) timestamp_max = max(timestamp_max, track.time_stamp_ms_last) if args.start_timestamp is None: args.start_timestamp = timestamp_min button_pp = FrameControlButton([0.2, 0.05, 0.05, 0.05], '<<') button_p = FrameControlButton([0.27, 0.05, 0.05, 0.05], '<') button_f = FrameControlButton([0.4, 0.05, 0.05, 0.05], '>') button_ff = FrameControlButton([0.47, 0.05, 0.05, 0.05], '>>')
lon_origin = 0. # coordinates in which the tracks are provided; we decided to use (0|0) for every scenario print("Loading map...") if use_lanelet2_lib: projector = lanelet2.projection.UtmProjector(lanelet2.io.Origin(lat_origin, lon_origin)) laneletmap = lanelet2.io.load(lanelet_map_file, projector) map_vis_lanelet2.draw_lanelet_map(laneletmap, axes) else: map_vis_without_lanelet.draw_map_without_lanelet(lanelet_map_file, axes, lat_origin, lon_origin) # load the tracks print("Loading tracks...") track_dictionary = dataset_reader.read_tracks(track_file_name) timestamp_min = 1e9 timestamp_max = 0 for key, track in dict_utils.get_item_iterator(track_dictionary): timestamp_min = min(timestamp_min, track.time_stamp_ms_first) timestamp_max = max(timestamp_max, track.time_stamp_ms_last) if args.start_timestamp is None: args.start_timestamp = timestamp_min button_pp = FrameControlButton([0.2, 0.05, 0.05, 0.05], '<<') button_p = FrameControlButton([0.27, 0.05, 0.05, 0.05], '<') button_f = FrameControlButton([0.4, 0.05, 0.05, 0.05], '>') button_ff = FrameControlButton([0.47, 0.05, 0.05, 0.05], '>>') button_play = FrameControlButton([0.6, 0.05, 0.1, 0.05], 'play') button_pause = FrameControlButton([0.71, 0.05, 0.1, 0.05], 'pause') # storage for track visualization