Пример #1
0
    sim_step = 1.
    next_plot_time = options.skip_time
    accu = ObservationAccu()
    print "Simulation time: %.2fs" % options.sim_time
    i = 0
    while True:
        i += 1

        # step the simulation
        env.step(sim_step)

        cur_time = env.time()
        print " %*.2f %% " % (6, cur_time/options.sim_time *100)

        # gather observations for target 'target-hmm'
        new_observ = env.get_observation_for_target('target-hmm')
        accu.accumulate(new_observ)

        # do plots 
        if next_plot_time <= cur_time:
            next_plot_time += options.skip_time
            if options.video:
                env.plot(savepath=frames_dir + "/%.4d.png" % i)
            else:
                env.plot()

        # exit the sim. loop if we are past the choosen sim. lenght
        if cur_time >= options.sim_time:
            break

    # Save observation data to file