def _reset_internal(self): """ Resets simulation internal configurations. """ # Run superclass reset functionality super()._reset_internal() # Reset controllers reset_controllers() # Reset action dim self._action_dim = 0 # Reset robot and update action space dimension along the way for robot in self.robots: robot.reset(deterministic=self.deterministic_reset) self._action_dim += robot.action_dim # Update cameras if appropriate if self.use_camera_obs: temp_names = [] for cam_name in self.camera_names: if "all-" in cam_name: # We need to add all robot-specific camera names that include the key after the tag "all-" start_idx = len(temp_names) - 1 key = cam_name.replace("all-", "") for robot in self.robots: for robot_cam_name in robot.robot_model.cameras: if key in robot_cam_name: temp_names.append(robot_cam_name) # We also need to broadcast the corresponding values from each camera dimensions as well end_idx = len(temp_names) - 1 self.camera_widths = (self.camera_widths[:start_idx] + [self.camera_widths[start_idx]] * (end_idx - start_idx) + self.camera_widths[(start_idx + 1):]) self.camera_heights = ( self.camera_heights[:start_idx] + [self.camera_heights[start_idx]] * (end_idx - start_idx) + self.camera_heights[(start_idx + 1):]) self.camera_depths = (self.camera_depths[:start_idx] + [self.camera_depths[start_idx]] * (end_idx - start_idx) + self.camera_depths[(start_idx + 1):]) else: # We simply add this camera to the temp_names temp_names.append(cam_name) # Lastly, replace camera names with the updated ones self.camera_names = temp_names
def _reset_internal(self): """ Resets simulation internal configurations. """ # Run superclass reset functionality super()._reset_internal() # Reset controllers reset_controllers() # Reset action dim self._action_dim = 0 # Reset robot and update action space dimension along the way for robot in self.robots: robot.reset(deterministic=self.deterministic_reset) self._action_dim += robot.action_dim