From a4178f385b05434b7c60c5190316678d4e2e31a4 Mon Sep 17 00:00:00 2001 From: Steven Palma Date: Wed, 24 Sep 2025 11:28:56 +0200 Subject: [PATCH] feat(script): add entry point for find joints limits (#2010) Signed-off-by: Steven Palma --- docs/source/hilserl.mdx | 16 +++++++-------- pyproject.toml | 1 + src/lerobot/rl/actor.py | 2 +- ...limits.py => lerobot_find_joint_limits.py} | 20 +++++++++++-------- 4 files changed, 22 insertions(+), 17 deletions(-) rename src/lerobot/scripts/{find_joint_limits.py => lerobot_find_joint_limits.py} (93%) diff --git a/docs/source/hilserl.mdx b/docs/source/hilserl.mdx index 07f92b82..bc38408e 100644 --- a/docs/source/hilserl.mdx +++ b/docs/source/hilserl.mdx @@ -304,19 +304,19 @@ Before collecting demonstrations, you need to determine the appropriate operatio This helps simplify the problem of learning on the real robot in two ways: 1) by limiting the robot's operational space to a specific region that solves the task and avoids unnecessary or unsafe exploration, and 2) by allowing training in end-effector space rather than joint space. Empirically, learning in joint space for reinforcement learning in manipulation is often a harder problem - some tasks are nearly impossible to learn in joint space but become learnable when the action space is transformed to end-effector coordinates. -**Using find_joint_limits.py** +**Using lerobot-find-joint-limits** This script helps you find the safe operational bounds for your robot's end-effector. Given that you have a follower and leader arm, you can use the script to find the bounds for the follower arm that will be applied during training. Bounding the action space will reduce the redundant exploration of the agent and guarantees safety. ```bash -python -m lerobot.scripts.find_joint_limits \ - --robot.type=so100_follower \ - --robot.port=/dev/tty.usbmodem58760431541 \ - --robot.id=black \ - --teleop.type=so100_leader \ - --teleop.port=/dev/tty.usbmodem58760431551 \ - --teleop.id=blue +lerobot-find-joint-limits \ + --robot.type=so100_follower \ + --robot.port=/dev/tty.usbmodem58760431541 \ + --robot.id=black \ + --teleop.type=so100_leader \ + --teleop.port=/dev/tty.usbmodem58760431551 \ + --teleop.id=blue ``` **Workflow** diff --git a/pyproject.toml b/pyproject.toml index 3f5ef3f8..acd1e8a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -173,6 +173,7 @@ lerobot-eval="lerobot.scripts.eval:main" lerobot-train="lerobot.scripts.train:main" lerobot-dataset-viz="lerobot.scripts.lerobot_dataset_viz:main" lerobot-info="lerobot.scripts.lerobot_info:main" +lerobot-find-joint-limits="lerobot.scripts.lerobot_find_joint_limits:main" lerobot-imgtransform-viz="lerobot.scripts.lerobot_imgtransform_viz:main" # ---------------- Tool Configurations ---------------- diff --git a/src/lerobot/rl/actor.py b/src/lerobot/rl/actor.py index d1e70925..b38858ca 100644 --- a/src/lerobot/rl/actor.py +++ b/src/lerobot/rl/actor.py @@ -35,7 +35,7 @@ gamepad to take control of the robot during training. Initially intervene freque reduce interventions as the policy improves. **WORKFLOW**: -1. Determine robot workspace bounds using `find_joint_limits.py` +1. Determine robot workspace bounds using `lerobot-find-joint-limits` 2. Record demonstrations with `gym_manipulator.py` in record mode 3. Process the dataset and determine camera crops with `crop_dataset_roi.py` 4. Start the learner server with the training configuration diff --git a/src/lerobot/scripts/find_joint_limits.py b/src/lerobot/scripts/lerobot_find_joint_limits.py similarity index 93% rename from src/lerobot/scripts/find_joint_limits.py rename to src/lerobot/scripts/lerobot_find_joint_limits.py index f7e07514..07d57a76 100644 --- a/src/lerobot/scripts/find_joint_limits.py +++ b/src/lerobot/scripts/lerobot_find_joint_limits.py @@ -20,13 +20,13 @@ Simple script to control a robot from teleoperation. Example: ```shell -python -m lerobot.scripts.server.find_joint_limits \ - --robot.type=so100_follower \ - --robot.port=/dev/tty.usbmodem58760431541 \ - --robot.id=black \ - --teleop.type=so100_leader \ - --teleop.port=/dev/tty.usbmodem58760431551 \ - --teleop.id=blue +lerobot-find-joint-limits \ + --robot.type=so100_follower \ + --robot.port=/dev/tty.usbmodem58760431541 \ + --robot.id=black \ + --teleop.type=so100_leader \ + --teleop.port=/dev/tty.usbmodem58760431551 \ + --teleop.id=blue ``` """ @@ -117,5 +117,9 @@ def find_joint_and_ee_bounds(cfg: FindJointLimitsConfig): busy_wait(0.01) -if __name__ == "__main__": +def main(): find_joint_and_ee_bounds() + + +if __name__ == "__main__": + main()