Update base classes typing
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
import abc
|
import abc
|
||||||
|
from typing import Any
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
from lerobot.common.constants import HF_LEROBOT_CALIBRATION, ROBOTS
|
from lerobot.common.constants import HF_LEROBOT_CALIBRATION, ROBOTS
|
||||||
|
|
||||||
from .config import RobotConfig
|
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):
|
class Robot(abc.ABC):
|
||||||
"""The main LeRobot class for implementing robots."""
|
"""The main LeRobot class for implementing robots."""
|
||||||
|
|
||||||
@@ -45,12 +46,12 @@ class Robot(abc.ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_observation(self) -> dict[str, np.ndarray]:
|
def get_observation(self) -> dict[str, Any]:
|
||||||
"""Gets observation from the robot."""
|
"""Gets observation from the robot."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@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."""
|
"""Sends actions to the robot."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import abc
|
import abc
|
||||||
|
from typing import Any
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
from lerobot.common.constants import HF_LEROBOT_CALIBRATION, TELEOPERATORS
|
from lerobot.common.constants import HF_LEROBOT_CALIBRATION, TELEOPERATORS
|
||||||
|
|
||||||
@@ -41,12 +40,12 @@ class Teleoperator(abc.ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_action(self) -> np.ndarray:
|
def get_action(self) -> dict[str, Any]:
|
||||||
"""Gets the action to send to a teleoperator."""
|
"""Gets the action to send to a teleoperator."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@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."""
|
"""Sends feedback captured from a robot to the teleoperator."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user