Skip to content

Conversation

@jstnhuang
Copy link
Contributor

What this does

This PR updates the robot configurations so that max_relative_target can be a float instead of just an integer.

This PR also makes a couple of small related changes:

  • Updates the documentation for max_relative_target. Currently, it states that it can be a list of numbers, but the implementation of ensure_safe_goal_position only allows max_relative_target to be a scalar or a dictionary.
  • Removes max_relative_target from Stretch3RobotConfig. Stretch3Robot does not use max_relative_target.
  • Fixed an incorrect type annotation in ensure_safe_goal_position: dict[float] -> dict[str, float].

Fixes #1716 and fixes #1527.

How it was tested

I have an SO-101 and tested this change by running lerobot-teleoperate under 4 conditions:

  • --robot.max_relative_target 10
    • Manually verified that teleop worked with goal clamping applied to all joints when moved quickly
  • --robot.max_relative_target 10.5
    • Manually verified that teleop worked with goal clamping applied to all joints when moved quickly
  • --robot.max_relative_target '{"shoulder_pan":20.0,"shoulder_lift":20.0,"elbow_flex":20.0,"wrist_flex":20.0,"wrist_roll":20.0,"gripper":5.0}'
    • Manually verified that teleop worked, and goal clamping only applied to the gripper
  • And without --robot.max_relative_target
    • Manually verified that teleop worked with no goal clamping

I ran all the existing tests. All tests passed except for policy-related tests which I believe are unrelated environment setup issues:

FAILED tests/envs/test_envs.py::test_factory[aloha] - mujoco.FatalError: Default framebuffer is not complete, error 0x0 FAILED tests/policies/test_policies.py::test_policy[lerobot/aloha_sim_insertion_human-aloha-env_kwargs4-act-policy_kwargs4] - mujoco.FatalError: Default framebuffer is not complete, error 0x0 FAILED tests/policies/test_policies.py::test_policy[lerobot/aloha_sim_insertion_scripted-aloha-env_kwargs5-act-policy_kwargs5] - mujoco.FatalError: Default framebuffer is not complete, error 0x0 FAILED tests/policies/test_policies.py::test_policy[lerobot/aloha_sim_insertion_human-aloha-env_kwargs6-diffusion-policy_kwargs6] - mujoco.FatalError: Default framebuffer is not complete, error 0x0 FAILED tests/policies/test_policies.py::test_policy[lerobot/aloha_sim_transfer_cube_human-aloha-env_kwargs7-act-policy_kwargs7] - mujoco.FatalError: Default framebuffer is not complete, error 0x0 FAILED tests/policies/test_policies.py::test_policy[lerobot/aloha_sim_transfer_cube_scripted-aloha-env_kwargs8-act-policy_kwargs8] - mujoco.FatalError: Default framebuffer is not complete, error 0x0 6 failed, 816 passed, 12 skipped, 66 warnings in 193.68s (0:03:13)

How to checkout & try? (for the reviewer)

I tested this using a basic teleop command:

lerobot-teleoperate \
    --robot.type=so101_follower \
    --robot.port=$FOLLOWER \
    --robot.id=follower \
    --robot.cameras="$CAMERA_CONFIG" \
    --robot.max_relative_target 10 \
    --teleop.type=so101_leader \
    --teleop.port=$LEADER \
    --teleop.id=leader \
    --display_data=true

Where --robot.max_relative_target was set to one of the above.

@pkooij pkooij self-requested a review September 2, 2025 20:54
@pkooij pkooij added bug Something isn’t working correctly enhancement Suggestions for new features or improvements labels Sep 2, 2025
Copy link
Member

@pkooij pkooij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left only one small comment

@pkooij pkooij self-requested a review September 4, 2025 12:34
Copy link
Member

@pkooij pkooij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pkooij pkooij merged commit d74494d into huggingface:main Sep 5, 2025
12 checks passed
@jstnhuang jstnhuang deleted the float_max_relative_target branch September 5, 2025 17:14
BillmanH pushed a commit to BillmanH/lerobot that referenced this pull request Sep 7, 2025
* Remove unused max_relative_target for stretch3

* Fix type annotation and allow integer max_relative_target values

* Configure max_relative_target to be floats instead of ints

* Update docs and types to reflect that max_relative_target can be a dict

* Remove unnecessary isinstance check for ints

* Fix typo in name

---------

Co-authored-by: Justin Huang <justin.huang@jpl.nasa.gov>
manmohan659 pushed a commit to manmohan659/lerobot that referenced this pull request Sep 27, 2025
* Remove unused max_relative_target for stretch3

* Fix type annotation and allow integer max_relative_target values

* Configure max_relative_target to be floats instead of ints

* Update docs and types to reflect that max_relative_target can be a dict

* Remove unnecessary isinstance check for ints

* Fix typo in name

---------

Co-authored-by: Justin Huang <justin.huang@jpl.nasa.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn’t working correctly enhancement Suggestions for new features or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

max_relative_target should be a float Teleop "max_relative_target" Type Error

2 participants