Skip to content

Commit ad9b89c

Browse files
committed
mac realsense tested
1 parent 46f8fb7 commit ad9b89c

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

‎eval/lerobot_so101/script/shell/build_robot_cameras.py‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import json
66
import os
7+
import platform
78
import sys
89

910

@@ -25,18 +26,20 @@ def build() -> dict:
2526
if driver == "realsense":
2627
serial = os.environ.get("REALSENSE_SERIAL", "").strip()
2728
if serial and not serial.startswith("?"):
28-
return {
29-
key: {
30-
"type": "realsense_crop",
31-
"serial_number_or_name": serial,
32-
"width": _int("CAMERA_WIDTH", 640),
33-
"height": _int("CAMERA_HEIGHT", 480),
34-
"fps": fps,
35-
"resize_width": resize_w,
36-
"resize_height": resize_h,
37-
"warmup_s": warmup_s,
38-
}
29+
entry: dict = {
30+
"type": "realsense_crop",
31+
"serial_number_or_name": serial,
32+
"resize_width": resize_w,
33+
"resize_height": resize_h,
34+
"warmup_s": warmup_s,
3935
}
36+
auto = os.environ.get("REALSENSE_AUTO_PROFILE", "").strip().lower()
37+
if platform.system() == "Darwin" and auto in ("", "1", "true", "yes"):
38+
return {key: entry}
39+
entry["width"] = _int("CAMERA_WIDTH", 640)
40+
entry["height"] = _int("CAMERA_HEIGHT", 480)
41+
entry["fps"] = fps
42+
return {key: entry}
4043
print(
4144
"[warn] REALSENSE_SERIAL not set. OpenCV index may show SMPTE color bars.",
4245
file=sys.stderr,

‎eval/lerobot_so101/script/shell/so101_env.sh‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
66
ROBOT_CPP_ROOT="$(cd "${ROOT}/../.." && pwd)"
77

8-
export PYTHONPATH="${ROBOT_CPP_ROOT}:${ROOT}:${ROBOT_CPP_ROOT}/robot_client/python:${ROBOT_CPP_ROOT}/robot_client${PYTHONPATH:+:${PYTHONPATH}}"
8+
# eval.* needs repo root; camera plugin comes from pip install -e (see environment.yaml).
9+
# Do not add ${ROOT} here — it shadows lerobot_camera_opencv_crop and breaks RealSenseCameraCrop.
10+
export PYTHONPATH="${ROBOT_CPP_ROOT}:${ROBOT_CPP_ROOT}/robot_client/python:${ROBOT_CPP_ROOT}/robot_client${PYTHONPATH:+:${PYTHONPATH}}"
911

1012
# --- Robot serial ports ---
1113
export ROBOT_PORT="${ROBOT_PORT:-?ROBOT_PORT must be set}"
@@ -94,11 +96,15 @@ _verify_python_imports() {
9496
echo " Run from ${ROOT}: ./test/run_camera_test.sh" >&2
9597
exit 1
9698
fi
99+
if ! env -u DYLD_LIBRARY_PATH "${py}" -c "from lerobot_camera_opencv_crop import RealSenseCameraCrop" 2>/dev/null; then
100+
echo "[error] RealSenseCameraCrop not found. Install the camera plugin:" >&2
101+
echo " cd ${ROBOT_CPP_ROOT} && pip install -e eval/lerobot_so101/lerobot_camera_opencv_crop" >&2
102+
exit 1
103+
fi
97104
if [[ "${CAMERA_DRIVER:-}" == "realsense" && "$(uname -s)" == "Darwin" ]]; then
98105
if ! env -u DYLD_LIBRARY_PATH "${py}" -c "import pyrealsense2 as rs" 2>/dev/null; then
99106
echo "[error] pyrealsense2 import failed." >&2
100107
echo " Fix: bash ${ROOT}/script/shell/fix_macos_pyrealsense_lib.sh" >&2
101-
echo " Setup: bash ${ROOT}/script/shell/setup_macos_realsense.sh" >&2
102108
exit 1
103109
fi
104110
fi

0 commit comments

Comments
 (0)