diff --git a/lerobot/calibrate.py b/lerobot/calibrate.py index b21ee89d8..c58a2a395 100644 --- a/lerobot/calibrate.py +++ b/lerobot/calibrate.py @@ -12,6 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" +Helper to recalibrate your device (robot or teleoperator). + +Example: + +```shell +python -m lerobot.calibrate \ + --device.type=so100_leader \ + --device.port=/dev/tty.usbmodem58760431551 \ + --device.id=blue +``` +""" + import logging from dataclasses import asdict, dataclass from pprint import pformat diff --git a/lerobot/find_port.py b/lerobot/find_port.py index 47c2dfea9..05d0eb8fd 100644 --- a/lerobot/find_port.py +++ b/lerobot/find_port.py @@ -11,6 +11,17 @@ # 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. + +""" +Helper to find the USB port associated with your MotorsBus. + +Example: + +```shell +python -m lerobot.find_port +``` +""" + import os import time from pathlib import Path @@ -51,5 +62,4 @@ def find_port(): if __name__ == "__main__": - # Helper to find the USB port associated with your MotorsBus. find_port() diff --git a/lerobot/record.py b/lerobot/record.py index e8f81286e..0059752b8 100644 --- a/lerobot/record.py +++ b/lerobot/record.py @@ -12,6 +12,26 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" +Records a dataset. Actions for the robot can be either generated by teleoperation or by a policy. + +Example: + +```shell +python -m lerobot.record \ + --robot.type=so100_follower \ + --robot.port=/dev/tty.usbmodem58760431541 \ + --robot.cameras="{laptop: {type: opencv, camera_index: 0, width: 640, height: 480}}" \ + --robot.id=black \ + --teleop.type=so100_leader \ + --teleop.port=/dev/tty.usbmodem58760431551 \ + --teleop.id=blue \ + --dataset.repo_id=aliberts/record-test \ + --dataset.num_episodes=2 \ + --dataset.single_task="Grab the cube" +``` +""" + import logging import time from dataclasses import asdict, dataclass diff --git a/lerobot/replay.py b/lerobot/replay.py index 0de0d4539..5b8f86190 100644 --- a/lerobot/replay.py +++ b/lerobot/replay.py @@ -12,6 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" +Replays the actions of an episode from a dataset on a robot. + +Example: + +```shell +python -m lerobot.replay \ + --robot.type=so100_follower \ + --robot.port=/dev/tty.usbmodem58760431541 \ + --robot.id=black \ + --dataset.repo_id=aliberts/record-test \ + --dataset.episode=2 +``` +""" + import logging import time from dataclasses import asdict, dataclass diff --git a/lerobot/setup_motors.py b/lerobot/setup_motors.py index 7e004c324..d85e2810a 100644 --- a/lerobot/setup_motors.py +++ b/lerobot/setup_motors.py @@ -1,3 +1,29 @@ +# Copyright 2024 The HuggingFace Inc. team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +""" +Helper to set motor ids and baudrate. + +Example: + +```shell +python -m lerobot.setup_motors \ + --device.type=so100_leader \ + --device.port=/dev/tty.usbmodem575E0031751 +``` +""" + from dataclasses import dataclass import draccus diff --git a/lerobot/teleoperate.py b/lerobot/teleoperate.py index 0c421e2b5..f14f9a796 100644 --- a/lerobot/teleoperate.py +++ b/lerobot/teleoperate.py @@ -12,6 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" +Simple script to control a robot from teleoperation. + +Example: + +```shell +python -m lerobot.teleoperate \ + --robot.type=so100_follower \ + --robot.port=/dev/tty.usbmodem58760431541 \ + --robot.cameras="{laptop: {type: opencv, camera_index: 0}}" \ + --robot.id=black \ + --teleop.type=so100_leader \ + --teleop.port=/dev/tty.usbmodem58760431551 \ + --teleop.id=blue +``` +""" + import logging import time from dataclasses import asdict, dataclass