def get_observation(self, *args: Any, observations, episode: Episode, **kwargs: Any): # TODO - Kind of weird - reset goal when no action sent ... goal_idx = self._select_goal_idx(episode, "action" not in kwargs) goal_idx = np.array([goal_idx], dtype=np.int) episode.goal_idx = goal_idx[0] return goal_idx
def _construct_dataset(num_episodes): episodes = [] for ii in range(num_episodes): episode = Episode( episode_id=str(ii), scene_id="scene_id_" + str(ii % 10), start_position=[0, 0, 0], start_rotation=[0, 0, 0, 1], ) episodes.append(episode) dataset = Dataset() dataset.episodes = episodes return dataset
def get_observation(self, *args: Any, observations, episode: Episode, **kwargs: Any): goal_idx = getattr(episode, "goal_idx", 0) camera_state = self._sim.get_agent_state().sensor_states["rgb"] camera_position = camera_state.position rotation_world_camera = camera_state.rotation goal_position = np.array(episode.t_coord[episode.target_idx[goal_idx]], dtype=np.float32) stats = self._compute_pointgoal(camera_position, rotation_world_camera, goal_position) # TODO bad, but necessary for other sensors of measurements to use :Ds episode.goal_coord_in_camera = stats return stats
def get_observation(self, *args: Any, observations, episode: Episode, **kwargs: Any): goal_idx = getattr(episode, "goal_idx", 0) camera_state = self._sim.get_agent_state().sensor_states["rgb"] camera_position = camera_state.position rotation_world_camera = camera_state.rotation goal_position = np.array(episode.t_coord[episode.target_idx[goal_idx]], dtype=np.float32) goal_scale = np.array(episode.t_size[episode.target_idx[goal_idx]]) stats = self._compute_pointgoal_and_scale(camera_position, rotation_world_camera, goal_position, goal_scale) crt_ep_stats = stats all_stats = [] for idx, t_coord in enumerate(episode.t_coord): goal_position = np.array(t_coord, dtype=np.float32) goal_scale = np.array(episode.t_size[idx]) stats = self._compute_pointgoal_and_scale(camera_position, rotation_world_camera, goal_position, goal_scale) all_stats.append(stats) all_stats = np.concatenate(all_stats) episode.all_stats = all_stats return crt_ep_stats