From 81ebcac8d7581010006b93ad2fb650a49d74eb66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=2E/c=C2=B2?= Date: Mon, 15 Dec 2025 11:56:33 -0500 Subject: [PATCH] docs: update IL robots API example and add OpenCV workaround (#2648) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: update IL robots API example and add OpenCV workaround - Fix import path from lerobot.record to lerobot.scripts.lerobot_record - Add required processor parameters to record_loop calls - Document fourcc="MJPG" workaround for OpenCV async errors - Improve code formatting in robot configuration examples Fixes compatibility issues for users following the tutorial on embedded systems and ensures API examples match current codebase requirements. * Update il_robots.mdx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: ./c² --------- Signed-off-by: ./c² Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Steven Palma --- docs/source/il_robots.mdx | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/docs/source/il_robots.mdx b/docs/source/il_robots.mdx index 93a6bf72e..0bc1ca681 100644 --- a/docs/source/il_robots.mdx +++ b/docs/source/il_robots.mdx @@ -201,7 +201,8 @@ from lerobot.teleoperators.so100_leader.so100_leader import SO100Leader from lerobot.utils.control_utils import init_keyboard_listener from lerobot.utils.utils import log_say from lerobot.utils.visualization_utils import init_rerun -from lerobot.record import record_loop +from lerobot.scripts.lerobot_record import record_loop +from lerobot.processor import make_default_processors NUM_EPISODES = 5 FPS = 30 @@ -209,12 +210,19 @@ EPISODE_TIME_SEC = 60 RESET_TIME_SEC = 10 TASK_DESCRIPTION = "My task description" -# Create the robot and teleoperator configurations -camera_config = {"front": OpenCVCameraConfig(index_or_path=0, width=640, height=480, fps=FPS)} +# Create robot configuration robot_config = SO100FollowerConfig( - port="/dev/tty.usbmodem58760434471", id="my_awesome_follower_arm", cameras=camera_config + id="my_awesome_follower_arm", + cameras={ + "front": OpenCVCameraConfig(index_or_path=0, width=640, height=480, fps=FPS) # Optional: fourcc="MJPG" for troubleshooting OpenCV async error. + }, + port="/dev/tty.usbmodem58760434471", +) + +teleop_config = SO100LeaderConfig( + id="my_awesome_leader_arm", + port="/dev/tty.usbmodem585A0077581", ) -teleop_config = SO100LeaderConfig(port="/dev/tty.usbmodem585A0077581", id="my_awesome_leader_arm") # Initialize the robot and teleoperator robot = SO100Follower(robot_config) @@ -243,6 +251,9 @@ init_rerun(session_name="recording") robot.connect() teleop.connect() +# Create the required processors +teleop_action_processor, robot_action_processor, robot_observation_processor = make_default_processors() + episode_idx = 0 while episode_idx < NUM_EPISODES and not events["stop_recording"]: log_say(f"Recording episode {episode_idx + 1} of {NUM_EPISODES}") @@ -251,6 +262,9 @@ while episode_idx < NUM_EPISODES and not events["stop_recording"]: robot=robot, events=events, fps=FPS, + teleop_action_processor=teleop_action_processor, + robot_action_processor=robot_action_processor, + robot_observation_processor=robot_observation_processor, teleop=teleop, dataset=dataset, control_time_s=EPISODE_TIME_SEC, @@ -265,6 +279,9 @@ while episode_idx < NUM_EPISODES and not events["stop_recording"]: robot=robot, events=events, fps=FPS, + teleop_action_processor=teleop_action_processor, + robot_action_processor=robot_action_processor, + robot_observation_processor=robot_observation_processor, teleop=teleop, control_time_s=RESET_TIME_SEC, single_task=TASK_DESCRIPTION,