diff --git a/Dockerfile.desktop b/Dockerfile.desktop index 32f69fc..0d792a9 100755 --- a/Dockerfile.desktop +++ b/Dockerfile.desktop @@ -1,16 +1,15 @@ # Reference: https://github.com/stereolabs/zed-ros2-wrapper/tree/master/docker -ARG UBUNTU_RELEASE_YEAR=22 +ARG UBUNTU_RELEASE_YEAR=22.04 ARG CUDA_MAJOR=11 -ARG CUDA_MINOR=7 -ARG CUDA_PATCH=1 +ARG CUDA_MINOR=8 ARG ZED_SDK_MAJOR=4 ARG ZED_SDK_MINOR=0 ARG ROS_DISTRO=humble ### DOWNLOAD HUSARNET ### -FROM ubuntu:20.04 AS husarnet-dds-getter +FROM ubuntu:${UBUNTU_RELEASE_YEAR} AS husarnet-dds-getter ARG TARGETARCH ARG HUSARNET_DDS_RELEASE="v1.3.5" @@ -23,12 +22,11 @@ RUN apt update && apt install -y \ RUN curl -L https://github.com/husarnet/husarnet-dds/releases/download/${HUSARNET_DDS_RELEASE}/husarnet-dds-linux-${TARGETARCH} -o /usr/bin/husarnet-dds ### BUILD IMAGE ### -FROM nvidia/cuda:${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}-devel-ubuntu${UBUNTU_RELEASE_YEAR}.04 AS build +FROM stereolabs/zed:${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-devel-cuda${CUDA_MAJOR}.${CUDA_MINOR}-ubuntu${UBUNTU_RELEASE_YEAR} AS build ARG UBUNTU_RELEASE_YEAR ARG CUDA_MAJOR ARG CUDA_MINOR -ARG CUDA_PATCH ARG ZED_SDK_MAJOR ARG ZED_SDK_MINOR ARG ROS_DISTRO @@ -38,18 +36,6 @@ SHELL ["/bin/bash", "-c"] ENV NVIDIA_DRIVER_CAPABILITIES \ ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}compute,video,utility -# Setup the ZED SDK -RUN echo "Europe/Paris" > /etc/localtime ; echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.0" > /usr/local/cuda/version.txt && \ - apt-get update -y || true && \ - apt-get install --no-install-recommends dialog bash-completion lsb-release wget less udev sudo build-essential cmake zstd python3 python3-pip libpng-dev libgomp1 -y && \ - python3 -m pip install --upgrade pip; python3 -m pip install numpy opencv-python-headless && \ - wget -q -O ZED_SDK_Linux_Ubuntu.run https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/cu${CUDA_MAJOR}${CUDA_MINOR}/ubuntu${UBUNTU_RELEASE_YEAR} && \ - chmod +x ZED_SDK_Linux_Ubuntu.run && \ - ./ZED_SDK_Linux_Ubuntu.run -- silent skip_tools skip_cuda && \ - ln -sf /lib/x86_64-linux-gnu/libusb-1.0.so.0 /usr/lib/x86_64-linux-gnu/libusb-1.0.so && \ - rm ZED_SDK_Linux_Ubuntu.run && \ - rm -rf /var/lib/apt/lists/* - # ROS install ENV ROS_DISTRO $ROS_DISTRO RUN echo "deb http://packages.ros.org/ros2/ubuntu jammy main" > /etc/apt/sources.list.d/ros2-latest.list && \ @@ -110,7 +96,7 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ ' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' ### BUILD RUNTIME ### # Reduction from 13.4GB to 8.6GB -FROM nvidia/cuda:${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}-runtime-ubuntu${UBUNTU_RELEASE_YEAR}.04 AS runtime +FROM stereolabs/zed:${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-runtime-cuda${CUDA_MAJOR}.${CUDA_MINOR}-ubuntu${UBUNTU_RELEASE_YEAR} AS runtime COPY --from=build /ros2_ws /ros2_ws @@ -126,18 +112,6 @@ SHELL ["/bin/bash", "-c"] ENV NVIDIA_DRIVER_CAPABILITIES \ ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}compute,video,utility -# Setup the ZED SDK -RUN echo "Europe/Paris" > /etc/localtime ; echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.0" > /usr/local/cuda/version.txt && \ - apt-get update -y || true && \ - apt-get install --no-install-recommends dialog bash-completion lsb-release wget less udev sudo build-essential cmake zstd python3 python3-pip libpng-dev libgomp1 -y && \ - python3 -m pip install --upgrade pip; python3 -m pip install numpy opencv-python-headless && \ - wget -q -O ZED_SDK_Linux_Ubuntu.run https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/cu${CUDA_MAJOR}${CUDA_MINOR}/ubuntu${UBUNTU_RELEASE_YEAR} && \ - chmod +x ZED_SDK_Linux_Ubuntu.run && \ - ./ZED_SDK_Linux_Ubuntu.run -- silent skip_tools skip_cuda && \ - ln -sf /lib/x86_64-linux-gnu/libusb-1.0.so.0 /usr/lib/x86_64-linux-gnu/libusb-1.0.so && \ - rm ZED_SDK_Linux_Ubuntu.run && \ - rm -rf /var/lib/apt/lists/* - # ROS install ENV ROS_DISTRO $ROS_DISTRO RUN echo "deb http://packages.ros.org/ros2/ubuntu jammy main" > /etc/apt/sources.list.d/ros2-latest.list && \ diff --git a/Dockerfile.jetson b/Dockerfile.jetson index 6fd7f15..0971241 100644 --- a/Dockerfile.jetson +++ b/Dockerfile.jetson @@ -2,9 +2,6 @@ ARG L4T_MAJOR=35 ARG L4T_MINOR=3 -ARG CUDA_MAJOR=11 -ARG CUDA_MINOR=4 -ARG CUDA_PATCH=19 ARG ZED_SDK_MAJOR=4 ARG ZED_SDK_MINOR=0 ARG ROS_DISTRO=foxy @@ -23,13 +20,10 @@ RUN apt update && apt install -y \ RUN curl -L https://github.com/husarnet/husarnet-dds/releases/download/${HUSARNET_DDS_RELEASE}/husarnet-dds-linux-${TARGETARCH} -o /usr/bin/husarnet-dds ### BUILD IMAGE ### -FROM nvcr.io/nvidia/l4t-cuda:${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}-devel AS build +FROM stereolabs/zed:${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-devel-l4t-r${L4T_MAJOR}.${L4T_MINOR} AS build ARG L4T_MAJOR ARG L4T_MINOR -ARG CUDA_MAJOR -ARG CUDA_MINOR -ARG CUDA_PATCH ARG ZED_SDK_MAJOR ARG ZED_SDK_MINOR ARG ROS_DISTRO @@ -39,20 +33,6 @@ SHELL ["/bin/bash", "-c"] ENV NVIDIA_DRIVER_CAPABILITIES \ ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}compute,video,utility -# Setup the ZED SDK -RUN echo "# R${L4T_MAJOR} (release), REVISION: ${L4T_MINOR}" > /etc/nv_tegra_release && \ - apt-get update -y || true && \ - apt-get install -y --no-install-recommends zstd wget less cmake curl gnupg2 \ - build-essential python3 python3-pip python3-dev python3-setuptools libusb-1.0-0-dev -y && \ - pip install protobuf && \ - wget -q --no-check-certificate -O ZED_SDK_Linux.run \ - https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/l4t${L4T_MAJOR}.${L4T_MINOR}/jetsons && \ - chmod +x ZED_SDK_Linux.run && \ - ./ZED_SDK_Linux.run -- silent skip_tools skip_cuda && \ - rm -rf /usr/local/zed/resources/* && \ - rm -rf ZED_SDK_Linux.run && \ - rm -rf /var/lib/apt/lists/* - # ROS install ENV ROS_DISTRO $ROS_DISTRO RUN echo "deb http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources.list.d/ros2-latest.list && \ @@ -121,13 +101,10 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ ' --no-warn-unused-cli' ### RUNTIME IMAGE ### # Reduction from 6.1GB to 3.9GB -FROM nvcr.io/nvidia/l4t-cuda:${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}-runtime AS runtime +FROM stereolabs/zed:${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-runtime-l4t-r${L4T_MAJOR}.${L4T_MINOR} AS runtime ARG L4T_MAJOR ARG L4T_MINOR -ARG CUDA_MAJOR -ARG CUDA_MINOR -ARG CUDA_PATCH ARG ZED_SDK_MAJOR ARG ZED_SDK_MINOR ARG ROS_DISTRO @@ -139,20 +116,6 @@ SHELL ["/bin/bash", "-c"] ENV NVIDIA_DRIVER_CAPABILITIES \ ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}compute,video,utility -# Setup the ZED SDK -RUN echo "# R${L4T_MAJOR} (release), REVISION: ${L4T_MINOR}" > /etc/nv_tegra_release && \ - apt-get update -y || true && \ - apt-get install -y --no-install-recommends zstd wget less cmake curl gnupg2 \ - build-essential python3 python3-pip python3-dev python3-setuptools libusb-1.0-0-dev -y && \ - pip install protobuf && \ - wget -q --no-check-certificate -O ZED_SDK_Linux.run \ - https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/l4t${L4T_MAJOR}.${L4T_MINOR}/jetsons && \ - chmod +x ZED_SDK_Linux.run && \ - ./ZED_SDK_Linux.run -- silent skip_tools skip_cuda && \ - rm -rf /usr/local/zed/resources/* && \ - rm -rf ZED_SDK_Linux.run && \ - rm -rf /var/lib/apt/lists/* - # ROS install ENV ROS_DISTRO $ROS_DISTRO RUN echo "deb http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources.list.d/ros2-latest.list && \ diff --git a/README.md b/README.md index 3dd2b80..93b1889 100644 --- a/README.md +++ b/README.md @@ -56,24 +56,24 @@ Replace `` with appropriate Docker image from below table. -**3. Select the appropriate launch file** +**3. Select the appropriate camera model** ```bash -export CAMERA_LAUNCH= +export CAMERA_MODEL= ``` -Replace `` with appropriate launch file for your camera from below table. +Replace `` with appropriate camera model from below table.
-| **Product name** | **Launch file** | -| ----------------- | ----------------------- | -| ZED | zed.launch.py | -| ZED Mini | zedm.launch.py | -| ZED 2 | zed2.launch.py | -| ZED 2i | zed2i.launch.py | -| ZED X | zedx.launch.py | -| ZED X Mini | zedxm.launch.py | +| **Product Name** | **Camera Model** | +| ----------------- | ---------------- | +| ZED | zed | +| ZED Mini | zedm | +| ZED 2 | zed2 | +| ZED 2i | zed2i | +| ZED X | zedx | +| ZED X Mini | zedxm |
diff --git a/demo/compose.yaml b/demo/compose.yaml index 792c6ba..da13250 100644 --- a/demo/compose.yaml +++ b/demo/compose.yaml @@ -5,15 +5,15 @@ services: network_mode: host ipc: host runtime: nvidia - environment: - - CAMERA_LAUNCH=${CAMERA_LAUNCH:-err} volumes: - ./params:/ros2_ws/src/zed-ros-wrapper/zed_wrapper/params - /dev/shm:/dev/shm - /tmp/zed_ai/:/usr/local/zed/resources/ # Configuration files for quick start - /tmp/argus_socket:/tmp/argus_socket privileged: true - command: ros2 launch zed_wrapper ${CAMERA_LAUNCH} + command: > + ros2 launch zed_wrapper zed_camera.launch.py + camera_model:=${CAMERA_MODEL} rviz: image: husarion/rviz2:humble diff --git a/demo/default.rviz b/demo/default.rviz index 1d14ebc..d713c0c 100644 --- a/demo/default.rviz +++ b/demo/default.rviz @@ -1,13 +1,13 @@ Panels: - Class: rviz_common/Displays - Help Height: 78 + Help Height: 163 Name: Displays Property Tree Widget: Expanded: - /Global Options1 - /Status1 Splitter Ratio: 0.5 - Tree Height: 361 + Tree Height: 225 - Class: rviz_common/Selection Name: Selection - Class: rviz_common/Tool Properties @@ -52,31 +52,31 @@ Visualization Manager: Frame Timeout: 15 Frames: All Enabled: true - base_link: - Value: true map: Value: true odom: Value: true - zed2_baro_link: + zed_baro_link: + Value: true + zed_camera_center: Value: true - zed2_base_link: + zed_camera_link: Value: true - zed2_camera_center: + zed_imu_link: Value: true - zed2_left_camera_frame: + zed_left_camera_frame: Value: true - zed2_left_camera_optical_frame: + zed_left_camera_optical_frame: Value: true - zed2_mag_link: + zed_mag_link: Value: true - zed2_right_camera_frame: + zed_right_camera_frame: Value: true - zed2_right_camera_optical_frame: + zed_right_camera_optical_frame: Value: true - zed2_temp_left_link: + zed_temp_left_link: Value: true - zed2_temp_right_link: + zed_temp_right_link: Value: true Marker Scale: 1 Name: TF @@ -86,23 +86,24 @@ Visualization Manager: Tree: map: odom: - base_link: - zed2_base_link: - zed2_camera_center: - zed2_baro_link: + zed_camera_link: + zed_camera_center: + zed_baro_link: + {} + zed_left_camera_frame: + zed_imu_link: + {} + zed_left_camera_optical_frame: + {} + zed_temp_left_link: + {} + zed_mag_link: + {} + zed_right_camera_frame: + zed_right_camera_optical_frame: {} - zed2_left_camera_frame: - zed2_left_camera_optical_frame: - {} - zed2_temp_left_link: - {} - zed2_mag_link: + zed_temp_right_link: {} - zed2_right_camera_frame: - zed2_right_camera_optical_frame: - {} - zed2_temp_right_link: - {} Update Interval: 0 Value: true - Class: rviz_default_plugins/Image @@ -117,7 +118,7 @@ Visualization Manager: Durability Policy: Volatile History Policy: Keep Last Reliability Policy: Reliable - Value: /zed2/zed_node/rgb/image_rect_color + Value: /zed/zed_node/rgb/image_rect_color Value: true - Alpha: 1 Autocompute Intensity Bounds: true @@ -149,7 +150,7 @@ Visualization Manager: Filter size: 10 History Policy: Keep Last Reliability Policy: Reliable - Value: /zed2/zed_node/point_cloud/cloud_registered + Value: /zed/zed_node/point_cloud/cloud_registered Use Fixed Frame: true Use rainbow: true Value: true @@ -199,7 +200,7 @@ Visualization Manager: Views: Current: Class: rviz_default_plugins/Orbit - Distance: 8.800000190734863 + Distance: 10.23872184753418 Enable Stereo Rendering: Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 @@ -214,10 +215,10 @@ Visualization Manager: Invert Z Axis: false Name: Current View Near Clip Distance: 0.009999999776482582 - Pitch: 0.6803981065750122 + Pitch: 0.5303981304168701 Target Frame: Value: Orbit (rviz) - Yaw: 2.3203999996185303 + Yaw: 3.640410900115967 Saved: ~ Window Geometry: Displays: @@ -227,7 +228,7 @@ Window Geometry: Hide Right Dock: false Image: collapsed: false - QMainWindow State: 000000ff00000000fd000000040000000000000156000002b4fc0200000009fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000001f2000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d0061006700650100000233000000bc0000002800ffffff000000010000010f000002b4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b000002b4000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b00000025300fffffffb0000000800540069006d006501000000000000045000000000000000000000023f000002b400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + QMainWindow State: 000000ff00000000fd000000040000000000000156000002b4fc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000001bf000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d0061006700650100000200000000ef0000002800fffffffb0000000a0049006d0061006700650100000233000000bc0000000000000000000000010000010f000002b4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b000002b4000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b00000025300fffffffb0000000800540069006d006501000000000000045000000000000000000000023f000002b400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Selection: collapsed: false Time: @@ -237,5 +238,5 @@ Window Geometry: Views: collapsed: false Width: 1200 - X: 72 - Y: 60 + X: 313 + Y: 102 diff --git a/healthcheck.cpp b/healthcheck.cpp index 60538d1..d7310e1 100644 --- a/healthcheck.cpp +++ b/healthcheck.cpp @@ -34,25 +34,14 @@ void healthy_check() { int main(int argc, char *argv[]) { rclcpp::init(argc, argv); auto node = rclcpp::Node::make_shared("healthcheck_node"); - char *zed = std::getenv("CAMERA_LAUNCH"); - - if (zed) { - std::string zed_str(zed); - zed_str = zed_str.substr(0, zed_str.find('.')); - std::string topic_name = zed_str + "/zed_node/rgb/image_rect_color"; - - std::cout << topic_name << std::endl; - auto sub = node->create_subscription( - topic_name, rclcpp::SensorDataQoS().keep_last(1), msg_callback); - - while (rclcpp::ok()) { - rclcpp::spin_some(node); - healthy_check(); - std::this_thread::sleep_for(LOOP_PERIOD); - } - } else { - std::cerr << "CAMERA_LAUNCH environment variable not set" << std::endl; - return 1; + + auto sub = node->create_subscription( + "zed/zed_node/rgb/image_rect_color", rclcpp::SensorDataQoS().keep_last(1), msg_callback); + + while (rclcpp::ok()) { + rclcpp::spin_some(node); + healthy_check(); + std::this_thread::sleep_for(LOOP_PERIOD); } return 0;