Beispiel #1
0
 def get_adjs(self, world_states):
   def f(world_state):
     query = '_'.join([world_state.scan_id,
                       world_state.viewpoint_id,
                       str(world_state.view_index)])
     return self.adj_dict[query]
   
   return structured_map(f, world_states)
Beispiel #2
0
    def get_start_state(self, scan_ids, viewpoint_ids, headings):
        def f(scan_id, viewpoint_id, heading):
            elevation = 0
            view_index = (12 * round(elevation / ANGLE_INC + 1) +
                          round(heading / ANGLE_INC) % 12)
            return WorldState(scan_id=scan_id,
                              viewpoint_id=viewpoint_id,
                              view_index=view_index,
                              heading=heading,
                              elevation=elevation)

        return structured_map(f, scan_ids, viewpoint_ids, headings)
Beispiel #3
0
    def make_actions(self, world_states, actions, attrs):
        def f(world_state, action, loc_attrs):
            if action == 0:
                return world_state
            else:
                loc_attr = loc_attrs[action]
                return WorldState(
                    scan_id=world_state.scan_id,
                    viewpoint_id=loc_attr['nextViewpointId'],
                    view_index=loc_attr['absViewIndex'],
                    heading=(loc_attr['absViewIndex'] % 12) * ANGLE_INC,
                    elevation=(loc_attr['absViewIndex'] // 12 - 1) * ANGLE_INC)

        return structured_map(f, world_states, actions, attrs)