#NEWLINE# def _load_config( self , config_file ) : #NEWLINE# #INDENT# if exists ( config_file ) : #NEWLINE# #INDENT# with open ( config_file , 'r' ) as fp : #NEWLINE# #INDENT# config_obj = json . load ( fp ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# logger . warn ( 'sim/config.json not found, using default simulation parameters' ) #NEWLINE# config_obj = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# config_obj . setdefault ( 'pyfrc' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'robot' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'robot' ] . setdefault ( 'w' , 2 ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'robot' ] . setdefault ( 'h' , 3 ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'robot' ] . setdefault ( 'starting_x' , 0 ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'robot' ] . setdefault ( 'starting_y' , 0 ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'robot' ] . setdefault ( 'starting_angle' , 0 ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'field' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'field' ] . setdefault ( 'w' , 1 ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'field' ] . setdefault ( 'h' , 1 ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'field' ] . setdefault ( 'px_per_ft' , 10 ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'field' ] . setdefault ( 'objects' , [ ] ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'analog' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'CAN' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'dio' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'pwm' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'relay' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'solenoid' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] . setdefault ( 'joysticks' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for i in range ( 6 ) : #NEWLINE# #INDENT# config_obj [ 'pyfrc' ] [ 'joysticks' ] . setdefault ( str ( i ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'joysticks' ] [ str ( i ) ] . setdefault ( 'axes' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'joysticks' ] [ str ( i ) ] . setdefault ( 'buttons' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'joysticks' ] [ str ( i ) ] [ 'buttons' ] . setdefault ( '1' , 'Trigger' ) #NEWLINE# config_obj [ 'pyfrc' ] [ 'joysticks' ] [ str ( i ) ] [ 'buttons' ] . setdefault ( '2' , 'Top' ) #NEWLINE# #UNINDENT# return config_obj