Skip to content

Commit

Permalink
Docker based on stereolabs image (#18)
Browse files Browse the repository at this point in the history
* Simplify version

* new version of zed-wrapper

* fix

* update rviz config

Signed-off-by: Jan Brzyk <[email protected]>

* Update README.md

* Update README.md

---------

Signed-off-by: Jan Brzyk <[email protected]>
Co-authored-by: Jan Brzyk <[email protected]>
  • Loading branch information
rafal-gorecki and JanBrzyk authored Dec 8, 2023
1 parent 3a454fd commit 5dc7585
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 140 deletions.
36 changes: 5 additions & 31 deletions Dockerfile.desktop
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -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 && \
Expand Down Expand Up @@ -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

Expand All @@ -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 && \
Expand Down
41 changes: 2 additions & 39 deletions Dockerfile.jetson
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 && \
Expand Down Expand Up @@ -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
Expand All @@ -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 && \
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@ Replace `<zed_image>` with appropriate Docker image from below table.

</div>

**3. Select the appropriate launch file**
**3. Select the appropriate camera model**

```bash
export CAMERA_LAUNCH=<camera_launch>
export CAMERA_MODEL=<camera_model>
```

Replace `<camera_launch>` with appropriate launch file for your camera from below table.
Replace `<camera_model>` with appropriate camera model from below table.

<div style="display: flex; justify-content: center;">

| **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 |

</div>

Expand Down
6 changes: 3 additions & 3 deletions demo/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
75 changes: 38 additions & 37 deletions demo/default.rviz
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 2.3203999996185303
Yaw: 3.640410900115967
Saved: ~
Window Geometry:
Displays:
Expand All @@ -227,7 +228,7 @@ Window Geometry:
Hide Right Dock: false
Image:
collapsed: false
QMainWindow State: 000000ff00000000fd000000040000000000000156000002b4fc0200000009fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000001f2000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d0061006700650100000233000000bc0000002800ffffff000000010000010f000002b4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b000002b4000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b00000025300fffffffb0000000800540069006d006501000000000000045000000000000000000000023f000002b400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
QMainWindow State: 000000ff00000000fd000000040000000000000156000002b4fc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000001bf000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d0061006700650100000200000000ef0000002800fffffffb0000000a0049006d0061006700650100000233000000bc0000000000000000000000010000010f000002b4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b000002b4000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b00000025300fffffffb0000000800540069006d006501000000000000045000000000000000000000023f000002b400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
Expand All @@ -237,5 +238,5 @@ Window Geometry:
Views:
collapsed: false
Width: 1200
X: 72
Y: 60
X: 313
Y: 102
Loading

0 comments on commit 5dc7585

Please sign in to comment.