示例#1
0
        sim_params['num_particles'] = num_particles

        # Initialize model of world
        sim = Simulation(world_params)
        sstate = sim.get_state()

        # Reinitialize randomness after world generation
        np.random.seed(None)

        # Add a car model robot
        init_state = [5,5,0]
        sim.add_robot(robot_params,init_state)

        # add a radar sensor
        robot_id = robot_params['id']
        sim.add_sensor(robot_id, sensor_params)
        readings = sim.read_sensors()


        # Initialize player model for control input
        p = Player_vi(all_params, sim.get_occupied())


        # Initialize View

        if GUI_ON:
            rstate = sim.get_state()
            bstate = p.get_bstate()
            v = View()
            v.update_all(rstate, bstate)
示例#2
0
#import numpy as np

sim_params = {'world_type':'maze',
              'world_length':100,
              'world_width':100,
              'robot_length':2,
              'robot_stochastic':False,
              'radar_radius':8,}
robot_id = 1

v = View()

sim = Simulation(sim_params)
state = sim.get_state()
v.update_rstate(state)

sim.add_robot('car',robot_id)
state = sim.get_state()
v.update_rstate(state)

sim.add_sensor(robot_id, 'radar')
readings = sim.read_sensors()
print readings

raw_input('pause : press any key to finish...')

#maze = gen_terrain_dfs(100,100)
#world = Maze()
#x,y = np.nonzero(world.get_map())
#plt.scatter(x,y)
#plt.show()