コード例 #1
0
    def makeActions(self, world_states, actions, last_obs, beamed=False):
        ''' Take an action using the full state dependent action interface (with batched input).
        Each action is an index in the adj_loc_list,
        0 means staying still (i.e. stop)
    '''
        def f(sim, world_state, action, last_ob):
            load_world_state(sim, world_state)
            # load the location attribute corresponding to the action
            if action >= len(last_ob['adj_loc_list']):
                pdb.set_trace()
            loc_attr = last_ob['adj_loc_list'][action]

            if 'max_sent_id' in last_ob:
                max_sent_id = last_ob['max_sent_id']
            else:
                max_sent_id = 0
            _navigate_to_location(sim,
                                  loc_attr['nextViewpointId'],
                                  max_sent_id=max_sent_id)
            # sim.makeAction(index, heading, elevation)

            return get_world_state(sim, reading='max_sent_id' in last_ob)

        out = structured_map(f,
                             self.sims_view(beamed),
                             world_states,
                             actions,
                             last_obs,
                             nested=beamed)
        return out
コード例 #2
0
    def getStates(self, world_states, beamed=False):
        ''' Get list of states. '''
        def f(sim, world_state):
            load_world_state(sim, world_state)
            return _get_panorama_states(sim)

        return structured_map(f,
                              self.sims_view(beamed),
                              world_states,
                              nested=beamed)
コード例 #3
0
    def getStates(self, world_states, beamed=False, reading=False):
        ''' Get list of states. '''
        def f(sim, world_state, reading=False):
            load_world_state(sim, world_state)
            return _get_panorama_states(sim, reading=reading)

        readings = [[reading] * len(ws) for ws in world_states]
        return structured_map(f,
                              self.sims_view(beamed),
                              world_states,
                              readings,
                              nested=beamed)
コード例 #4
0
 def makeActions(self, world_states, actions, last_obs, beamed=False):
     ''' Take an action using the full state dependent action interface (with batched input).
         Each action is an index in the adj_loc_list,
         0 means staying still (i.e. stop)
     '''
     def f(sim, world_state, action, last_ob):
         load_world_state(sim, world_state)
         # load the location attribute corresponding to the action
         loc_attr = last_ob['adj_loc_list'][action]
         _navigate_to_location(
             sim, loc_attr['nextViewpointId'], loc_attr['absViewIndex'])
         # sim.makeAction(index, heading, elevation)
         return get_world_state(sim)
     return structured_map(f, self.sims_view(beamed), world_states, actions, last_obs, nested=beamed)