Exemple #1
0
            print args.reset_position, args.reset_only
            robot.reset_all() #Use both right now. Strange gz reset
            reset_world()
            if args.reset_only:
                exit("Resetting done, exiting (remove --reset-and-exit to continue)")

    #Time the simulation
    start_time = time.time()

    #Actually run the simulation
    output = main_simulation_run(
        general_config
        , (nemo_simulation
           , (to_save, neuron_number)
           , stimuli_dict)
        , (robot)
        , (sensory_neurons_in
           , sensory_neurons_out)
        , simple_feedback=args.simple_feedback
        , bypass_debug=float(args.bypass_debug)
        , args.save_membrane
    )

    #Get the total run time
    end_time = time.time()
    general_config_out = {"steps": output["ran_steps"]} #Add various robot params
    #Save/process output + input
    uniqueId = hashDict(general_config_out)\
               + "_" + hashDict(dict_config)

    #Step is included in the output
    saveKey(uniqueId + "_output", output, output_dir)
Exemple #2
0
            from libs.pYARP import RobotYARP #Import only if strictly needed
            robot = RobotYARP ()
        else:
            robot = None

        #Save input files
        #saveKey(config_dict_hash + "_input", dict_config, output_dir)
        saveFile(config_file_name, output_dir + "/" + config_dict_hash + "_input.py")
        
        nemo_start_time = time.time()
        output = main_simulation_run(
            {
                "steps": steps
                , "use_cuda": use_cuda
                , "cuda_backend": cuda_backend
            }#general_config
            , (nemo_simulation, (to_save, neuron_number), stimuli_dict) #L1
            , (robot) #L2
            , (sensory_neurons_in, sensory_neurons_out) #L3
            , save_membrane=args.save_membrane
        )
        nemo_end_time = time.time()
        cprint("NeMo speedup: %s" % (output["ran_steps"]/((nemo_end_time - nemo_start_time)*1000)), 'okgreen', True)
        general_config_out = {"steps": output["ran_steps"]} #Add various robot params
        #Save/process output + input
        uniqueId = hashDict(general_config_out) + "_" + config_dict_hash
        
        #Step is included in the output
        print ("Saving output to %s_output" % uniqueId)
        saveKey(uniqueId + "_output", output, output_dir)