Add calibrate
This commit is contained in:
@@ -67,11 +67,13 @@ class MockRobot(Robot):
|
||||
def is_connected(self) -> bool:
|
||||
return self._is_connected
|
||||
|
||||
def connect(self) -> None:
|
||||
def connect(self, calibrate: bool = True) -> None:
|
||||
if self.is_connected:
|
||||
raise DeviceAlreadyConnectedError(f"{self} already connected")
|
||||
|
||||
self._is_connected = True
|
||||
if calibrate:
|
||||
self.calibrate()
|
||||
|
||||
@property
|
||||
def is_calibrated(self) -> bool:
|
||||
|
||||
@@ -51,11 +51,13 @@ class MockTeleop(Teleoperator):
|
||||
def is_connected(self) -> bool:
|
||||
return self._is_connected
|
||||
|
||||
def connect(self) -> None:
|
||||
def connect(self, calibrate: bool = True) -> None:
|
||||
if self.is_connected:
|
||||
raise DeviceAlreadyConnectedError(f"{self} already connected")
|
||||
|
||||
self._is_connected = True
|
||||
if calibrate:
|
||||
self.calibrate()
|
||||
|
||||
@property
|
||||
def is_calibrated(self) -> bool:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import time
|
||||
|
||||
from lerobot.calibrate import CalibrateConfig, calibrate
|
||||
from lerobot.record import DatasetRecordConfig, RecordConfig, record
|
||||
from lerobot.replay import DatasetReplayConfig, ReplayConfig, replay
|
||||
from lerobot.teleoperate import TeleoperateConfig, teleoperate
|
||||
@@ -8,6 +9,12 @@ from tests.mocks.mock_robot import MockRobotConfig
|
||||
from tests.mocks.mock_teleop import MockTeleopConfig
|
||||
|
||||
|
||||
def test_calibrate():
|
||||
robot_cfg = MockRobotConfig()
|
||||
cfg = CalibrateConfig(device=robot_cfg)
|
||||
calibrate(cfg)
|
||||
|
||||
|
||||
def test_teleoperate():
|
||||
robot_cfg = MockRobotConfig()
|
||||
teleop_cfg = MockTeleopConfig()
|
||||
|
||||
Reference in New Issue
Block a user