def get_demos(self, amount: int, live_demos: bool = False, image_paths: bool = False, callable_each_step: Callable[[Observation], None] = None, max_attempts: int = _MAX_DEMO_ATTEMPTS, ) -> List[Demo]: """Negative means all demos""" if not live_demos and (self._dataset_root is None or len(self._dataset_root) == 0): raise RuntimeError( "Can't ask for a stored demo when no dataset root provided.") if not live_demos: if self._dataset_root is None or len(self._dataset_root) == 0: raise RuntimeError( "Can't ask for stored demo when no dataset root provided.") demos = utils.get_stored_demos( amount, image_paths, self._dataset_root, self._variation_number, self._task.get_name(), self._obs_config) else: ctr_loop = self._robot.arm.joints[0].is_control_loop_enabled() self._robot.arm.joints[0].set_control_loop_enabled(True) demos = self._get_live_demos( amount, callable_each_step, max_attempts) self._robot.arm.joints[0].set_control_loop_enabled(ctr_loop) return demos
def get_demos(self, task_name: str, amount: int, variation_number=0, image_paths=False) -> List[Demo]: if self._dataset_root is None or len(self._dataset_root) == 0: raise RuntimeError( "Can't ask for a stored demo when no dataset root provided.") demos = utils.get_stored_demos( amount, image_paths, self._dataset_root, variation_number, task_name, self._obs_config) return demos