mirror of
https://github.com/huggingface/lerobot.git
synced 2026-08-05 16:09:47 +00:00
bad0260a46
* fix(cameras): add color_format config and auto-recovery for RealSense D405 The D405 delivers color from its stereo depth module, not a dedicated RGB sensor. The driver previously hardcoded rs.format.rgb8, causing silent frame capture failure on D405. Changes: - Add color_format field to RealSenseCameraConfig (default rgb8, D405 users set bgr8), validated against whitelist - Use configured format in _configure_rs_pipeline_config - Fix _postprocess_image to handle both rgb8 and bgr8 source formats - Add _hardware_reset auto-recovery: if warmup times out, perform USB hardware reset and retry once (common D405 recovery path) - Fix thread race in _read_loop (local ref to stop_event) Continuation of #3164 (closed due to deleted fork). Tested on Intel RealSense D405 at 1280x720@30fps with color_format=bgr8. * style: fix ruff lint B904 and format * refactor(cameras): clarify RealSense connection retry * refactor(cameras): address review, retry RealSense connect before hardware reset Drop color_format (device-side streaming state was the actual cause), keep _open_pipeline attempt-agnostic, catch only retry-worthy errors, reset only as last resort, guard read loop against late frame publication after stop. * refactor(cameras): restore BaseException teardown, shorten stop-check comment * test(cameras): expect ConnectionError after retries are exhausted