mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-30 21:19:40 +00:00
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 <imstevenpmwork@ieee.org>
This commit is contained in:
@@ -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,
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user