Merge branch 'main' into aloha_hd5_to_dataset_v2
This commit is contained in:
commit
b65fd4428d
|
@ -3,7 +3,7 @@ default_language_version:
|
||||||
python: python3.10
|
python: python3.10
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.6.0
|
rev: v5.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
- id: debug-statements
|
- id: debug-statements
|
||||||
|
@ -14,11 +14,11 @@ repos:
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v3.16.0
|
rev: v3.19.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.5.2
|
rev: v0.8.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix]
|
args: [--fix]
|
||||||
|
@ -32,6 +32,6 @@ repos:
|
||||||
- "--check"
|
- "--check"
|
||||||
- "--no-update"
|
- "--no-update"
|
||||||
- repo: https://github.com/gitleaks/gitleaks
|
- repo: https://github.com/gitleaks/gitleaks
|
||||||
rev: v8.18.4
|
rev: v8.21.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: gitleaks
|
- id: gitleaks
|
||||||
|
|
|
@ -10,10 +10,10 @@ from torchvision.transforms import ToPILImage, v2
|
||||||
|
|
||||||
from lerobot.common.datasets.lerobot_dataset import LeRobotDataset
|
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
|
# 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)`
|
# This is equivalent to `dataset = LeRobotDataset(dataset_repo_id, image_transforms=None)`
|
||||||
|
|
||||||
# Get the index of the first observation in the first episode
|
# Get the index of the first observation in the first episode
|
||||||
|
@ -28,12 +28,13 @@ transforms = v2.Compose(
|
||||||
[
|
[
|
||||||
v2.ColorJitter(brightness=(0.5, 1.5)),
|
v2.ColorJitter(brightness=(0.5, 1.5)),
|
||||||
v2.ColorJitter(contrast=(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),
|
v2.RandomAdjustSharpness(sharpness_factor=2, p=1),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create another LeRobotDataset with the defined transformations
|
# 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
|
# Get a frame from the transformed dataset
|
||||||
transformed_frame = transformed_dataset[first_idx][transformed_dataset.meta.camera_keys[0]]
|
transformed_frame = transformed_dataset[first_idx][transformed_dataset.meta.camera_keys[0]]
|
||||||
|
|
|
@ -56,7 +56,7 @@ python lerobot/scripts/control_robot.py teleoperate \
|
||||||
--robot-overrides max_relative_target=5
|
--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
|
```bash
|
||||||
python lerobot/scripts/control_robot.py teleoperate \
|
python lerobot/scripts/control_robot.py teleoperate \
|
||||||
--robot-path lerobot/configs/robot/aloha.yaml \
|
--robot-path lerobot/configs/robot/aloha.yaml \
|
||||||
|
|
|
@ -28,7 +28,7 @@ def safe_stop_image_writer(func):
|
||||||
try:
|
try:
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
dataset = kwargs.get("dataset", None)
|
dataset = kwargs.get("dataset")
|
||||||
image_writer = getattr(dataset, "image_writer", None) if dataset else None
|
image_writer = getattr(dataset, "image_writer", None) if dataset else None
|
||||||
if image_writer is not None:
|
if image_writer is not None:
|
||||||
print("Waiting for image writer to terminate...")
|
print("Waiting for image writer to terminate...")
|
||||||
|
|
|
@ -184,7 +184,7 @@ def init_policy(pretrained_policy_name_or_path, policy_overrides):
|
||||||
def warmup_record(
|
def warmup_record(
|
||||||
robot,
|
robot,
|
||||||
events,
|
events,
|
||||||
enable_teloperation,
|
enable_teleoperation,
|
||||||
warmup_time_s,
|
warmup_time_s,
|
||||||
display_cameras,
|
display_cameras,
|
||||||
fps,
|
fps,
|
||||||
|
@ -195,7 +195,7 @@ def warmup_record(
|
||||||
display_cameras=display_cameras,
|
display_cameras=display_cameras,
|
||||||
events=events,
|
events=events,
|
||||||
fps=fps,
|
fps=fps,
|
||||||
teleoperate=enable_teloperation,
|
teleoperate=enable_teleoperation,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ python lerobot/scripts/visualize_dataset.py \
|
||||||
--episode-index 0
|
--episode-index 0
|
||||||
```
|
```
|
||||||
|
|
||||||
- Replay a sequence of test episodes:
|
- Replay a sequence of test episodes:
|
||||||
```bash
|
```bash
|
||||||
python lerobot/scripts/control_sim_robot.py replay \
|
python lerobot/scripts/control_sim_robot.py replay \
|
||||||
--robot-path lerobot/configs/robot/your_robot_config.yaml \
|
--robot-path lerobot/configs/robot/your_robot_config.yaml \
|
||||||
|
|
Loading…
Reference in New Issue