Update base classes typing

This commit is contained in:
Simon Alibert
2025-03-12 17:15:39 +01:00
parent d6ccdc222c
commit 2357d4aceb
2 changed files with 8 additions and 8 deletions

View File

@@ -1,12 +1,13 @@
import abc
import numpy as np
from typing import Any
from lerobot.common.constants import HF_LEROBOT_CALIBRATION, ROBOTS
from .config import RobotConfig
# TODO(aliberts): action/obs typing such as Generic[ObsType, ActType] similar to gym.Env ?
# https://github.com/Farama-Foundation/Gymnasium/blob/3287c869f9a48d99454306b0d4b4ec537f0f35e3/gymnasium/core.py#L23
class Robot(abc.ABC):
"""The main LeRobot class for implementing robots."""
@@ -45,12 +46,12 @@ class Robot(abc.ABC):
pass
@abc.abstractmethod
def get_observation(self) -> dict[str, np.ndarray]:
def get_observation(self) -> dict[str, Any]:
"""Gets observation from the robot."""
pass
@abc.abstractmethod
def send_action(self, action: np.ndarray) -> np.ndarray:
def send_action(self, action: dict[str, Any]) -> dict[str, Any]:
"""Sends actions to the robot."""
pass

View File

@@ -1,6 +1,5 @@
import abc
import numpy as np
from typing import Any
from lerobot.common.constants import HF_LEROBOT_CALIBRATION, TELEOPERATORS
@@ -41,12 +40,12 @@ class Teleoperator(abc.ABC):
pass
@abc.abstractmethod
def get_action(self) -> np.ndarray:
def get_action(self) -> dict[str, Any]:
"""Gets the action to send to a teleoperator."""
pass
@abc.abstractmethod
def send_feedback(self, feedback: np.ndarray) -> None:
def send_feedback(self, feedback: dict[str, Any]) -> None:
"""Sends feedback captured from a robot to the teleoperator."""
pass