Address comments

This commit is contained in:
Remi Cadene
2024-09-16 14:50:53 +02:00
parent ccc0586d45
commit 6636db5b51
8 changed files with 112 additions and 62 deletions

View File

@@ -1,3 +1,28 @@
"""
Tests for physical robots and their mocked versions.
If the physical robots are not connected to the computer, or not working,
the test will be skipped.
Example of running a specific test:
```bash
pytest -sx tests/test_control_robot.py::test_teleoperate
```
Example of running test on real robots connected to the computer:
```bash
pytest -sx 'tests/test_control_robot.py::test_teleoperate[koch-False]'
pytest -sx 'tests/test_control_robot.py::test_teleoperate[koch_bimanual-False]'
pytest -sx 'tests/test_control_robot.py::test_teleoperate[aloha-False]'
```
Example of running test on a mocked version of robots:
```bash
pytest -sx 'tests/test_control_robot.py::test_teleoperate[koch-True]'
pytest -sx 'tests/test_control_robot.py::test_teleoperate[koch_bimanual-True]'
pytest -sx 'tests/test_control_robot.py::test_teleoperate[aloha-True]'
```
"""
from pathlib import Path
import pytest
@@ -9,9 +34,9 @@ from tests.test_robots import make_robot
from tests.utils import DEFAULT_CONFIG_PATH, DEVICE, TEST_ROBOT_TYPES, require_robot
@pytest.mark.parametrize("robot_type", TEST_ROBOT_TYPES)
@pytest.mark.parametrize("robot_type, mock", TEST_ROBOT_TYPES)
@require_robot
def test_teleoperate(request, robot_type):
def test_teleoperate(request, robot_type, mock):
robot = make_robot(robot_type)
teleoperate(robot, teleop_time_s=1)
teleoperate(robot, fps=30, teleop_time_s=1)
@@ -19,17 +44,17 @@ def test_teleoperate(request, robot_type):
del robot
@pytest.mark.parametrize("robot_type", TEST_ROBOT_TYPES)
@pytest.mark.parametrize("robot_type, mock", TEST_ROBOT_TYPES)
@require_robot
def test_calibrate(request, robot_type):
def test_calibrate(request, robot_type, mock):
robot = make_robot(robot_type)
calibrate(robot)
del robot
@pytest.mark.parametrize("robot_type", TEST_ROBOT_TYPES)
@pytest.mark.parametrize("robot_type, mock", TEST_ROBOT_TYPES)
@require_robot
def test_record_without_cameras(tmpdir, request, robot_type):
def test_record_without_cameras(tmpdir, request, robot_type, mock):
root = Path(tmpdir)
repo_id = "lerobot/debug"
@@ -37,9 +62,9 @@ def test_record_without_cameras(tmpdir, request, robot_type):
record(robot, fps=30, root=root, repo_id=repo_id, warmup_time_s=1, episode_time_s=1, num_episodes=2)
@pytest.mark.parametrize("robot_type", TEST_ROBOT_TYPES)
@pytest.mark.parametrize("robot_type, mock", TEST_ROBOT_TYPES)
@require_robot
def test_record_and_replay_and_policy(tmpdir, request, robot_type):
def test_record_and_replay_and_policy(tmpdir, request, robot_type, mock):
env_name = "koch_real"
policy_name = "act_koch_real"