def get_datasource(self, key): """ allows the agent to read a value from a datasource. overrides default to make sure newscene signals are picked up by the node net """ if key == "major-newscene": if self.datasource_snapshots[key] == 1: self.datasources[key] = 0 return 1 else: return WorldAdapter.get_datasource(self, key)
def __init__(self, world, uid=None, **data): world.spockplugin.clientinfo.spawn_position = self.spawn_position WorldAdapter.__init__(self, world, uid=uid, **data)
def __init__(self, world, uid=None, **data): WorldAdapter.__init__(self, world, uid=uid, **data) self.datasources = {'test_source': 0.7} self.datatargets = {'test_target': 0} self.datatarget_feedback = {'test_target': 0.3}
def __init__(self, world, uid=None, **data): WorldAdapter.__init__(self, world, uid, **data) self.datatarget_feedback = { 'take_exit_one': 0, 'take_exit_two': 0, 'take_exit_three': 0 } # prevent instabilities in datatargets: treat a continuous ( /unintermittent ) signal as a single trigger self.datatarget_history = { 'take_exit_one': 0, 'take_exit_two': 0, 'take_exit_three': 0 } # a collection of conditions to check on every update(..), eg., for action feedback self.waiting_list = [] self.target_loco_node_uid = None self.current_loco_node = None self.active_fovea_actor = None self.spockplugin = self.world.spockplugin self.waiting_for_spock = True self.logger = logging.getLogger("world") # add datasources for fovea sensors aka fov__*_* for i in range(self.len_x): for j in range(self.len_y): name = "fov__%02d_%02d" % (i, j) self.datasources[name] = 0. self.supported_datasources.append(name) # add datasources for fovea position sensors aka fov_pos__*_* for x in range(self.tiling_x): for y in range(self.tiling_y): name = "fov_pos__%02d_%02d" % (x, y) self.datasources[name] = 0. self.supported_datasources.append(name) # add fovea actors to datatargets, datatarget_feedback, datatarget_history, and actions for x in range(self.tiling_x): for y in range(self.tiling_y): name = "fov_act__%02d_%02d" % (x, y) self.datatargets[name] = 0. self.datatarget_feedback[name] = 0. self.datatarget_history[name] = 0. self.supported_datatargets.append(name) self.actions.append(name) self.simulated_vision = False if 'simulate_vision' in cfg['minecraft']: self.simulated_vision = True self.simulated_vision_datafile = cfg['minecraft']['simulate_vision'] self.logger.info("Setting up minecraft_graph_locomotor to simulate vision from data file %s", self.simulated_vision_datafile) import os import csv self.simulated_vision_data = None self.simulated_vision_datareader = csv.reader(open(self.simulated_vision_datafile)) if os.path.getsize(self.simulated_vision_datafile) < (500 * 1024 * 1024): self.simulated_vision_data = [[float(datapoint) for datapoint in sample] for sample in self.simulated_vision_datareader] self.simulated_data_entry_index = 0 self.simulated_data_entry_max = len(self.simulated_vision_data) - 1 if 'record_vision' in cfg['minecraft']: self.record_file = open(cfg['minecraft']['record_vision'], 'a')
def __init__(self, world, uid=None, **data): world.spockplugin.clientinfo.spawn_position = self.spawn_position WorldAdapter.__init__(self, world, uid=uid, **data) self.datasources = dict((i, 0) for i in ['x', 'y', 'z', 'yaw', 'pitch', 'groundtype']) self.datatargets = dict((i, 0) for i in ['go_north', 'go_east', 'go_west', 'go_south', 'yaw', 'pitch'])