@@ -31,23 +31,83 @@ RUN chmod +x /opt/zed/install-zed-x86_64.sh /opt/zed/install-zed-aarch64.sh && \
3131# ------------------------------------------------------------------------------
3232# Install zed-ros2-wrapper into a workspace and build it
3333# Expects:
34- # - ROS 2 Jazzy already installed in the base image with ${ROS_ROOT} set
35- # - rosdep initialized (as in our ros2_jazzy base)
34+ # - ROS 2 Jazzy already installed in the base image at /opt/ros/${ROS_DISTRO}
35+ # - rosdep initialized (as in our isaac_ros base)
3636# -------------------------------------------------------------------------------
37+ ARG ROS_DISTRO=jazzy
38+ ENV ROS_DISTRO=${ROS_DISTRO}
39+ ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
40+
3741ARG ISAAC_ROS_WS=/opt/ros_ws
3842ENV ISAAC_ROS_WS=${ISAAC_ROS_WS}
3943
4044# Clone zed-ros2-wrapper (with submodules)
4145RUN --mount=type=cache,sharing=locked,target=/var/cache/apt --mount=type=cache,sharing=locked,target=/var/lib/apt/lists \
4246 mkdir -p ${ISAAC_ROS_WS}/src && cd ${ISAAC_ROS_WS}/src \
43- && git clone --recurse-submodules https://github.com/stereolabs/zed-ros2-wrapper
47+ && git clone --recurse-submodules https://github.com/stereolabs/zed-ros2-wrapper -b v5.2.0
48+
49+ # Disable ZED SDK AI features by default in zed-ros2-wrapper config.
50+ # We install the ZED SDK with `skip_od_module`, so Neural Depth / Object Detection / Body Tracking
51+ # must not be requested at runtime (avoids TensorRT dependency and SDK "corrupted installation" errors).
52+ RUN python3 - <<'PY'
53+ from __future__ import annotations
54+
55+ from pathlib import Path
56+
57+ cfg_dir = Path("/opt/ros_ws/src/zed-ros2-wrapper/zed_wrapper/config")
58+ if not cfg_dir.is_dir():
59+ raise SystemExit(f"Expected config directory not found: {cfg_dir}")
60+
61+ def patch_text(text: str) -> str:
62+ # SDK5-style config (strings)
63+ text = text.replace("depth_mode: 'NEURAL_LIGHT'", "depth_mode: 'NONE'")
64+ text = text.replace("depth_mode: 'NEURAL'", "depth_mode: 'NONE'")
65+ text = text.replace("depth_mode: 'NEURAL_PLUS'", "depth_mode: 'NONE'")
66+ # Older-style config (numeric quality: 0 == NONE)
67+ text = text.replace("quality: 1", "quality: 0")
68+ text = text.replace("quality: 2", "quality: 0")
69+ text = text.replace("quality: 3", "quality: 0")
70+ # Explicitly disable detection/tracking toggles if present
71+ text = text.replace("od_enabled: true", "od_enabled: false")
72+ text = text.replace("bt_enabled: true", "bt_enabled: false")
73+ return text
74+
75+ patched_any = False
76+ for path in sorted(cfg_dir.glob("common*.yaml")):
77+ original = path.read_text(encoding="utf-8")
78+ patched = patch_text(original)
79+ if patched != original:
80+ path.write_text(patched, encoding="utf-8")
81+ patched_any = True
82+
83+ if not patched_any:
84+ raise SystemExit(
85+ f"No common*.yaml files were modified under {cfg_dir}. "
86+ "Wrapper config format may have changed."
87+ )
88+ PY
4489
4590# Install dependencies and build only up to zed_wrapper
4691RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
4792 cd ${ISAAC_ROS_WS} \
4893 && apt-get update \
49- && source ${ROS_ROOT}/setup.bash \
94+ && if [[ -f "${ROS_ROOT}/setup.bash" ]]; then source " ${ROS_ROOT}/setup.bash"; else echo "Missing ROS setup: ${ROS_ROOT}/setup.bash" && exit 1; fi \
5095 && rosdep update \
96+ # zed-ros2-wrapper's build expects CUDA toolchain to be available.
97+ # Install CUDA via rosdep (matches isaac_ros_zed's `cuda-toolkit` dependency).
98+ && mkdir -p /tmp/isaac_ros_zed_deps \
99+ && printf '%s\n' \
100+ '<?xml version="1.0"?>' \
101+ '<package format="3">' \
102+ ' <name>isaac_ros_zed_deps</name>' \
103+ ' <version>0.0.0</version>' \
104+ ' <description>Dependency shim for ZED image build</description>' \
105+ ' <maintainer email="isaac-ros-maintainers@nvidia.com">Isaac ROS Maintainers</maintainer>' \
106+ ' <license>Apache-2.0</license>' \
107+ ' <depend>cuda-toolkit</depend>' \
108+ '</package>' \
109+ > /tmp/isaac_ros_zed_deps/package.xml \
110+ && rosdep install --from-paths /tmp/isaac_ros_zed_deps --ignore-src -r -y \
51111 && rosdep install --from-paths src/zed-ros2-wrapper --ignore-src -r -y \
52112 && colcon build --symlink-install --packages-up-to zed_wrapper \
53113 && echo "source ${ISAAC_ROS_WS}/install/setup.bash" | tee --append /etc/bash.bashrc
0 commit comments