| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| """Run a trained policy on LeKiwi without recording (base rollout). |
| |
| Uses the rollout engine's :class:`BaseStrategy` (autonomous execution, |
| no dataset) with :class:`SyncInferenceConfig` (inline policy call per |
| control tick). For a CLI entry point with the same capabilities plus |
| recording, upload, and human-in-the-loop variants, see ``lerobot-rollout``. |
| """ |
|
|
| from lerobot.configs import PreTrainedConfig |
| from lerobot.robots.lekiwi import LeKiwiClientConfig |
| from lerobot.rollout import BaseStrategyConfig, RolloutConfig, build_rollout_context |
| from lerobot.rollout.inference import SyncInferenceConfig |
| from lerobot.rollout.strategies import BaseStrategy |
| from lerobot.utils.process import ProcessSignalHandler |
| from lerobot.utils.utils import init_logging |
|
|
| FPS = 30 |
| DURATION_SEC = 60 |
| TASK_DESCRIPTION = "My task description" |
| HF_MODEL_ID = "<hf_username>/<model_repo_id>" |
|
|
|
|
| def main(): |
| init_logging() |
|
|
| |
| robot_config = LeKiwiClientConfig(remote_ip="172.18.134.136", id="lekiwi") |
|
|
| |
| |
| policy_config = PreTrainedConfig.from_pretrained(HF_MODEL_ID) |
| policy_config.pretrained_path = HF_MODEL_ID |
|
|
| |
| cfg = RolloutConfig( |
| robot=robot_config, |
| policy=policy_config, |
| strategy=BaseStrategyConfig(), |
| inference=SyncInferenceConfig(), |
| fps=FPS, |
| duration=DURATION_SEC, |
| task=TASK_DESCRIPTION, |
| ) |
|
|
| |
| signal_handler = ProcessSignalHandler(use_threads=True) |
|
|
| |
| |
| ctx = build_rollout_context(cfg, signal_handler.shutdown_event) |
|
|
| strategy = BaseStrategy(cfg.strategy) |
| try: |
| strategy.setup(ctx) |
| strategy.run(ctx) |
| finally: |
| strategy.teardown(ctx) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|