def Run(run_name, cars, the_arena, bair_car_data_location): D = {} D['Purpose'] = d2s(inspect.stack()[0][3], ':', 'Run object.') D['run_name'] = run_name D['cars'] = cars D['our_car_name'] = car_name_from_run_name(run_name) our_car_name = D['our_car_name'] D['our_car'] = cars[our_car_name] our_car = D['our_car'] D['the_arena'] = the_arena if len(gg(opjD(bair_car_data_location, 'meta', run_name, '*'))) < 5: print_stars() print("len(gg(opjD(bair_car_data_location,'meta',run_name,'*'))) < 5") print_stars() return False traj = our_car['runs'][run_name]['traj'] D['T0'] = traj['ts'][0] D['Tn'] = traj['ts'][-1] D['list_of_other_car_trajectories'] = our_car['runs'][run_name][ 'list_of_other_car_trajectories'] def _rewind(): for c in C['car_names']: D['cars'][c]['rewind']() D['rewind'] = _rewind car_spatial_dic, marker_spatial_dic = Spatial_Relations.setup_spatial_dics( D) D['car_spatial_dic'] = car_spatial_dic D['marker_spatial_dic'] = marker_spatial_dic D['rewind']() return D
def Run(run_name, cars, the_arena, bair_car_data_location): D = {} D['Purpose'] = d2s(inspect.stack()[0][3], ':', 'Run object.') D['run_name'] = run_name D['cars'] = cars D['our_car_name'] = car_name_from_run_name(run_name) our_car_name = D['our_car_name'] D['our_car'] = cars[our_car_name] our_car = D['our_car'] D['the_arena'] = the_arena if len( gg(opjD(bair_car_data_location, 'meta', run_name, '*')) ) < 5: #'caffe2_z2_color_direct_local_01Jan13_00h01m07s_Mr_Yellow' in run_name: print("len(gg(opjD(bair_car_data_location,'meta',run_name,'*'))) < 5") return False traj = our_car['runs'][run_name]['trajectory'] D['T0'] = traj['ts'][0] D['Tn'] = traj['ts'][-1] D['list_of_other_car_trajectories'] = our_car['runs'][run_name][ 'list_of_other_car_trajectories'] def _rewind(): for c in C['car_names']: D['cars'][c]['rewind']() D['rewind'] = _rewind try: our_car['load_image_and_meta_data'](run_name, bair_car_data_location) except Exception as e: print( "********** Exception *** cars[our_car]['load_image_and_meta_data'](run_name,bair_car_data_location) ********************" ) print(our_car_name, run_name) print(e.message, e.args) return False car_spatial_dic, marker_spatial_dic = Spatial_Relations.setup_spatial_dics( D) D['car_spatial_dic'] = car_spatial_dic D['marker_spatial_dic'] = marker_spatial_dic D['rewind']() return D
ctr_timer = Timer(0) timer = Timer(5) ctr = 0 wise_delta = 10 current_run['rewind']() clockwise = True for t in arange(current_run['T0'] + T_OFFSET_VALUE, current_run['Tn'], 1 / 30.): if timer.check(): pd2s( dp(ctr / ctr_timer.time() / 30.0), dp(t - current_run['T0']), dp(100.0 * (t - current_run['T0']) / (current_run['Tn'] - current_run['T0'])), '%') timer.reset() if Spatial_Relations.update_spatial_dics( current_run, current_run['car_spatial_dic'], current_run['marker_spatial_dic'], t): heading = current_run['our_car']['state_info']['heading'] if heading != None: car_angle_dist_view = Spatial_Relations.get_angle_distance_view( current_run, 'car_spatial_dic') if True: #len(car_angle_dist_view) > 0: other_cars_in_view_xy_list = [] for c in current_run['car_spatial_dic'].keys(): if current_run['car_spatial_dic'][c]['in_view']: other_cars_in_view_xy_list.append( current_run['car_spatial_dic'][c]['xy']) an_arena['other_cars'](