From 2b578e68f645c4fc874c09e294f6bf1e24cbd00f Mon Sep 17 00:00:00 2001 From: Xingdong Zuo Date: Fri, 31 Jul 2026 00:21:07 +0900 Subject: [PATCH] fix(lekiwi): pin MJPG capture in the default camera config (#4083) Without an explicit fourcc, OpenCV's V4L2 auto-negotiation selects uncompressed YUYV when the camera offers it: ~147 Mbps per camera at 640x480@30 on the Pi's shared USB 2.0 bus, versus ~9 Mbps as MJPG for identical frames. Two default cameras already exceed the bus, so frame rates sag silently. Pinning fourcc="MJPG" is backward compatible: it is an existing OpenCVCameraConfig field, frames still arrive as BGR ndarrays, user configs that set their own fourcc are unaffected, and a camera without MJPG fails loudly at validation rather than degrading silently. Co-authored-by: Xingdong Zuo <18168681+zuoxingdong@users.noreply.github.com> Co-authored-by: Steven Palma --- src/lerobot/robots/lekiwi/config_lekiwi.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lerobot/robots/lekiwi/config_lekiwi.py b/src/lerobot/robots/lekiwi/config_lekiwi.py index 2384c4172..c75bf8d2d 100644 --- a/src/lerobot/robots/lekiwi/config_lekiwi.py +++ b/src/lerobot/robots/lekiwi/config_lekiwi.py @@ -23,10 +23,20 @@ from ..config import RobotConfig def lekiwi_cameras_config() -> dict[str, CameraConfig]: return { "front": OpenCVCameraConfig( - index_or_path="/dev/video0", fps=30, width=640, height=480, rotation=Cv2Rotation.ROTATE_180 + index_or_path="/dev/video0", + fps=30, + width=640, + height=480, + fourcc="MJPG", + rotation=Cv2Rotation.ROTATE_180, ), "wrist": OpenCVCameraConfig( - index_or_path="/dev/video2", fps=30, width=480, height=640, rotation=Cv2Rotation.ROTATE_90 + index_or_path="/dev/video2", + fps=30, + width=480, + height=640, + fourcc="MJPG", + rotation=Cv2Rotation.ROTATE_90, ), }