mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 10:16:09 +00:00
imports and comments
This commit is contained in:
@@ -22,7 +22,7 @@ import time
|
|||||||
from lerobot.utils.robot_utils import precise_sleep
|
from lerobot.utils.robot_utils import precise_sleep
|
||||||
|
|
||||||
from ..context import RolloutContext
|
from ..context import RolloutContext
|
||||||
from . import RolloutStrategy, infer_action
|
from .core import RolloutStrategy, infer_action
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ from lerobot.utils.constants import OBS_STR
|
|||||||
from lerobot.utils.feature_utils import build_dataset_frame
|
from lerobot.utils.feature_utils import build_dataset_frame
|
||||||
from lerobot.utils.robot_utils import precise_sleep
|
from lerobot.utils.robot_utils import precise_sleep
|
||||||
|
|
||||||
|
from ..inference import InferenceEngine
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from lerobot.rollout.configs import RolloutStrategyConfig
|
from ..configs import RolloutStrategyConfig
|
||||||
from lerobot.rollout.context import RolloutContext
|
from ..context import RolloutContext
|
||||||
from lerobot.rollout.inference import InferenceEngine
|
from ..inference import InferenceEngine
|
||||||
|
|
||||||
|
|
||||||
class RolloutStrategy(abc.ABC):
|
class RolloutStrategy(abc.ABC):
|
||||||
@@ -54,7 +56,6 @@ class RolloutStrategy(abc.ABC):
|
|||||||
Call this from ``setup()`` to avoid duplicating the engine
|
Call this from ``setup()`` to avoid duplicating the engine
|
||||||
construction across every strategy.
|
construction across every strategy.
|
||||||
"""
|
"""
|
||||||
from lerobot.rollout.inference import InferenceEngine
|
|
||||||
|
|
||||||
self._interpolator = ActionInterpolator(multiplier=ctx.cfg.interpolation_multiplier)
|
self._interpolator = ActionInterpolator(multiplier=ctx.cfg.interpolation_multiplier)
|
||||||
self._engine = InferenceEngine(
|
self._engine = InferenceEngine(
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from threading import Event as ThreadingEvent
|
from threading import Event as ThreadingEvent
|
||||||
|
|
||||||
|
from lerobot.common.control_utils import is_headless
|
||||||
from lerobot.datasets import VideoEncodingManager
|
from lerobot.datasets import VideoEncodingManager
|
||||||
from lerobot.utils.constants import ACTION, OBS_STR
|
from lerobot.utils.constants import ACTION, OBS_STR
|
||||||
from lerobot.utils.feature_utils import build_dataset_frame
|
from lerobot.utils.feature_utils import build_dataset_frame
|
||||||
@@ -44,8 +45,6 @@ class HighlightStrategy(RolloutStrategy):
|
|||||||
2. Live recording continues until the save key is pressed again.
|
2. Live recording continues until the save key is pressed again.
|
||||||
3. The episode is saved and the ring buffer resumes capturing.
|
3. The episode is saved and the ring buffer resumes capturing.
|
||||||
|
|
||||||
All actions flow through ``robot_action_processor`` before reaching
|
|
||||||
the robot, supporting EE-space recording with joint-space robots.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
config: HighlightStrategyConfig
|
config: HighlightStrategyConfig
|
||||||
@@ -173,7 +172,6 @@ class HighlightStrategy(RolloutStrategy):
|
|||||||
|
|
||||||
def _setup_keyboard(self) -> None:
|
def _setup_keyboard(self) -> None:
|
||||||
"""Set up keyboard listener for the save key."""
|
"""Set up keyboard listener for the save key."""
|
||||||
from lerobot.common.control_utils import is_headless
|
|
||||||
|
|
||||||
if is_headless():
|
if is_headless():
|
||||||
logger.warning("Headless environment — highlight save key unavailable")
|
logger.warning("Headless environment — highlight save key unavailable")
|
||||||
|
|||||||
@@ -17,17 +17,13 @@
|
|||||||
"""Policy deployment engine with pluggable rollout strategies.
|
"""Policy deployment engine with pluggable rollout strategies.
|
||||||
|
|
||||||
``lerobot-rollout`` is the single CLI for running trained policies on
|
``lerobot-rollout`` is the single CLI for running trained policies on
|
||||||
real robots. It uses a **Strategy Pattern** to provide completely
|
real robots.
|
||||||
isolated, mutually exclusive execution loops:
|
|
||||||
|
|
||||||
--strategy.type=base 24/7 autonomous rollout (no recording)
|
--strategy.type=base 24/7 autonomous rollout (no recording)
|
||||||
--strategy.type=sentry Continuous recording with auto-upload
|
--strategy.type=sentry Continuous recording with auto-upload
|
||||||
--strategy.type=highlight Ring buffer + keystroke save
|
--strategy.type=highlight Ring buffer + keystroke save
|
||||||
--strategy.type=dagger Human-in-the-loop (DAgger/RaC)
|
--strategy.type=dagger Human-in-the-loop (DAgger/RaC)
|
||||||
|
|
||||||
All strategies accept ``--rtc.enabled=true`` for asynchronous inference
|
|
||||||
with slow VLA models (Pi0, Pi0.5, SmolVLA).
|
|
||||||
|
|
||||||
Usage examples::
|
Usage examples::
|
||||||
|
|
||||||
# Base mode (sync inference)
|
# Base mode (sync inference)
|
||||||
@@ -92,6 +88,7 @@ from lerobot.teleoperators import ( # noqa: F401
|
|||||||
so_leader,
|
so_leader,
|
||||||
unitree_g1 as unitree_g1_teleop,
|
unitree_g1 as unitree_g1_teleop,
|
||||||
)
|
)
|
||||||
|
from lerobot.utils.import_utils import register_third_party_plugins
|
||||||
from lerobot.utils.utils import init_logging
|
from lerobot.utils.utils import init_logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -123,8 +120,6 @@ def rollout(cfg: RolloutConfig):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
from lerobot.utils.import_utils import register_third_party_plugins
|
|
||||||
|
|
||||||
register_third_party_plugins()
|
register_third_party_plugins()
|
||||||
rollout()
|
rollout()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user