From 03f49ceaf0b740445ba9521da420feeec08dbfe5 Mon Sep 17 00:00:00 2001 From: berjaoui Date: Mon, 9 Dec 2024 00:17:49 +0100 Subject: [PATCH 1/4] Update 7_get_started_with_real_robot.md (#559) --- examples/7_get_started_with_real_robot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/7_get_started_with_real_robot.md b/examples/7_get_started_with_real_robot.md index 76408275d..1c5cd1047 100644 --- a/examples/7_get_started_with_real_robot.md +++ b/examples/7_get_started_with_real_robot.md @@ -29,7 +29,7 @@ For a visual walkthrough of the assembly process, you can refer to [this video t ## 2. Configure motors, calibrate arms, teleoperate your Koch v1.1 -First, install the additional dependencies required for robots built with dynamixel motors like Koch v1.1 by running one of the following commands. +First, install the additional dependencies required for robots built with dynamixel motors like Koch v1.1 by running one of the following commands (make sure gcc is installed). Using `pip`: ```bash From 44f9b21e74936c366b55609d1847b843bd04f3ab Mon Sep 17 00:00:00 2001 From: Claudio Coppola Date: Mon, 9 Dec 2024 10:32:25 +0000 Subject: [PATCH 2/4] LerobotDataset pushable to HF from any folder (#563) --- lerobot/common/datasets/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lerobot/common/datasets/utils.py b/lerobot/common/datasets/utils.py index 5f088b118..af5b03cc0 100644 --- a/lerobot/common/datasets/utils.py +++ b/lerobot/common/datasets/utils.py @@ -13,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import importlib.resources import json import logging import textwrap @@ -476,6 +477,8 @@ def create_lerobot_dataset_card( Note: If specified, license must be one of https://huggingface.co/docs/hub/repositories-licenses. """ card_tags = ["LeRobot"] + card_template_path = importlib.resources.path("lerobot.common.datasets", "card_template.md") + if tags: card_tags += tags if dataset_info: @@ -493,8 +496,9 @@ def create_lerobot_dataset_card( } ], ) + return DatasetCard.from_template( card_data=card_data, - template_path="./lerobot/common/datasets/card_template.md", + template_path=str(card_template_path), **kwargs, ) From 4c41f6fcc624e1e495daf1d319034148df3f6793 Mon Sep 17 00:00:00 2001 From: Simon Alibert <75076266+aliberts@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:32:18 +0100 Subject: [PATCH 3/4] Fix example 6 (#572) --- .pre-commit-config.yaml | 8 ++++---- examples/6_add_image_transforms.py | 7 ++++--- lerobot/common/datasets/image_writer.py | 2 +- lerobot/scripts/control_sim_robot.py | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1637151bd..58eca3206 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: debug-statements @@ -14,11 +14,11 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.16.0 + rev: v3.19.0 hooks: - id: pyupgrade - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.2 + rev: v0.8.2 hooks: - id: ruff args: [--fix] @@ -32,6 +32,6 @@ repos: - "--check" - "--no-update" - repo: https://github.com/gitleaks/gitleaks - rev: v8.18.4 + rev: v8.21.2 hooks: - id: gitleaks diff --git a/examples/6_add_image_transforms.py b/examples/6_add_image_transforms.py index 82b70f5c1..882710e3d 100644 --- a/examples/6_add_image_transforms.py +++ b/examples/6_add_image_transforms.py @@ -10,10 +10,10 @@ from lerobot.common.datasets.lerobot_dataset import LeRobotDataset -dataset_repo_id = "lerobot/aloha_static_tape" +dataset_repo_id = "lerobot/aloha_static_screw_driver" # Create a LeRobotDataset with no transformations -dataset = LeRobotDataset(dataset_repo_id) +dataset = LeRobotDataset(dataset_repo_id, episodes=[0]) # This is equivalent to `dataset = LeRobotDataset(dataset_repo_id, image_transforms=None)` # Get the index of the first observation in the first episode @@ -28,12 +28,13 @@ [ v2.ColorJitter(brightness=(0.5, 1.5)), v2.ColorJitter(contrast=(0.5, 1.5)), + v2.ColorJitter(hue=(-0.1, 0.1)), v2.RandomAdjustSharpness(sharpness_factor=2, p=1), ] ) # Create another LeRobotDataset with the defined transformations -transformed_dataset = LeRobotDataset(dataset_repo_id, image_transforms=transforms) +transformed_dataset = LeRobotDataset(dataset_repo_id, episodes=[0], image_transforms=transforms) # Get a frame from the transformed dataset transformed_frame = transformed_dataset[first_idx][transformed_dataset.meta.camera_keys[0]] diff --git a/lerobot/common/datasets/image_writer.py b/lerobot/common/datasets/image_writer.py index 9564fb591..85dd6830b 100644 --- a/lerobot/common/datasets/image_writer.py +++ b/lerobot/common/datasets/image_writer.py @@ -28,7 +28,7 @@ def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Exception as e: - dataset = kwargs.get("dataset", None) + dataset = kwargs.get("dataset") image_writer = getattr(dataset, "image_writer", None) if dataset else None if image_writer is not None: print("Waiting for image writer to terminate...") diff --git a/lerobot/scripts/control_sim_robot.py b/lerobot/scripts/control_sim_robot.py index 85dfca64a..4fffa8c75 100644 --- a/lerobot/scripts/control_sim_robot.py +++ b/lerobot/scripts/control_sim_robot.py @@ -35,7 +35,7 @@ --episode-index 0 ``` -- Replay a sequence of test episodes: +- Replay a sequence of test episodes: ```bash python lerobot/scripts/control_sim_robot.py replay \ --robot-path lerobot/configs/robot/your_robot_config.yaml \ From 66f87365988cb5424435ea03b428426b4ede98cb Mon Sep 17 00:00:00 2001 From: s1lent4gnt Date: Wed, 11 Dec 2024 14:57:52 +0100 Subject: [PATCH 4/4] fixing typo from 'teloperation' to 'teleoperation' (#566) --- examples/9_use_aloha.md | 2 +- lerobot/common/robot_devices/control_utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/9_use_aloha.md b/examples/9_use_aloha.md index 1abf7c495..f531a2c1d 100644 --- a/examples/9_use_aloha.md +++ b/examples/9_use_aloha.md @@ -56,7 +56,7 @@ python lerobot/scripts/control_robot.py teleoperate \ --robot-overrides max_relative_target=5 ``` -By adding `--robot-overrides max_relative_target=5`, we override the default value for `max_relative_target` defined in `lerobot/configs/robot/aloha.yaml`. It is expected to be `5` to limit the magnitude of the movement for more safety, but the teloperation won't be smooth. When you feel confident, you can disable this limit by adding `--robot-overrides max_relative_target=null` to the command line: +By adding `--robot-overrides max_relative_target=5`, we override the default value for `max_relative_target` defined in `lerobot/configs/robot/aloha.yaml`. It is expected to be `5` to limit the magnitude of the movement for more safety, but the teleoperation won't be smooth. When you feel confident, you can disable this limit by adding `--robot-overrides max_relative_target=null` to the command line: ```bash python lerobot/scripts/control_robot.py teleoperate \ --robot-path lerobot/configs/robot/aloha.yaml \ diff --git a/lerobot/common/robot_devices/control_utils.py b/lerobot/common/robot_devices/control_utils.py index 9b9649dde..8cc0f3260 100644 --- a/lerobot/common/robot_devices/control_utils.py +++ b/lerobot/common/robot_devices/control_utils.py @@ -184,7 +184,7 @@ def init_policy(pretrained_policy_name_or_path, policy_overrides): def warmup_record( robot, events, - enable_teloperation, + enable_teleoperation, warmup_time_s, display_cameras, fps, @@ -195,7 +195,7 @@ def warmup_record( display_cameras=display_cameras, events=events, fps=fps, - teleoperate=enable_teloperation, + teleoperate=enable_teleoperation, )