Skip to content

Commit 4223edb

Browse files
committed
Merge branch 'master' into add_new_msg_srv
2 parents 5d43df2 + 9a62b98 commit 4223edb

10 files changed

+279
-124
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
LATEST CHANGES
22
==============
33

4+
2025-04-23
5+
----------
6+
- Clean shutdown of ZED components using `pre_shutdown_callback`
7+
8+
2025-04-22
9+
----------
10+
- Add backward compatibility with SDK v4.2
11+
412
2025-04-18
513
----------
614
- Add parameter 'debug.sdk_verbose_log_file' to Stereo and Mono components to set the path of the SDK verbose log file

docker/Dockerfile.desktop-humble

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG CUDA_MINOR=6
55
ARG CUDA_PATCH=3
66
ARG ZED_SDK_MAJOR=4
77
ARG ZED_SDK_MINOR=2
8-
ARG ZED_SDK_PATCH=3
8+
ARG ZED_SDK_PATCH=5
99

1010
ARG IMAGE_NAME=nvcr.io/nvidia/cuda:${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}-devel-ubuntu${UBUNTU_MAJOR}.${UBUNTU_MINOR}
1111

@@ -19,6 +19,8 @@ ARG CUDA_PATCH=3
1919
ARG ZED_SDK_MAJOR=4
2020
ARG ZED_SDK_MINOR=2
2121
ARG ZED_SDK_PATCH=3
22+
# Optional: Override ZED SDK URL
23+
ARG CUSTOM_ZED_SDK_URL=""
2224

2325
ARG ROS2_DIST=humble # ROS2 distribution
2426

@@ -31,19 +33,11 @@ ENV NVIDIA_DRIVER_CAPABILITIES \
3133
RUN apt-get update || true && apt-get install -y --no-install-recommends apt-utils dialog curl && \
3234
rm -rf /var/lib/apt/lists/*
3335

34-
# Create the ZED SDK link
35-
ARG CUDA_MINOR_DW=1
36-
RUN if [ "$CUDA_MAJOR" = "12" ] && [ "$CUDA_MINOR" != "1" ]; then \
37-
CUDA_MINOR_DW=1; \
38-
fi
39-
RUN if [ "$CUDA_MAJOR" = "11" ] && [ "$CUDA_MINOR" != "8" ]; then \
40-
CUDA_MINOR_DW=8; \
41-
fi
42-
ENV ZED_SDK_URL="https://stereolabs.sfo2.cdn.digitaloceanspaces.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/ZED_SDK_Ubuntu${UBUNTU_MAJOR}_cuda${CUDA_MAJOR}.${CUDA_MINOR_DW}_v${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}.${ZED_SDK_PATCH}.zstd.run"
36+
ENV ZED_SDK_URL=${CUSTOM_ZED_SDK_URL:-"https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}.${ZED_SDK_PATCH}/cu${CUDA_MAJOR}/ubuntu${UBUNTU_MAJOR}"}
4337

4438
# Check that this SDK exists
4539
RUN echo "SDK link: $ZED_SDK_URL"
46-
RUN if [ "$(curl -I "${ZED_SDK_URL}" -o /dev/null -s -w '%{http_code}\n' | head -n 1)" = "200" ]; then \
40+
RUN if [ "$(curl -L -I "${ZED_SDK_URL}" -o /dev/null -s -w '%{http_code}\n' | head -n 1)" = "200" ]; then \
4741
echo "The URL points to something."; \
4842
else \
4943
echo "The URL does not point to a .run file or the file does not exist."; \

docker/Dockerfile.l4t-humble

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
# Define the L4T_VERSION argument
12
ARG L4T_VERSION=l4t-r36.3.0
2-
ARG IMAGE_NAME=dustynv/ros:humble-ros-base-${L4T_VERSION}
3+
ARG IMAGE_NAME=dustynv/ros:humble-ros-base-l4t-r36.3.0
34

45
FROM ${IMAGE_NAME}
56

@@ -8,6 +9,8 @@ ARG ZED_SDK_MINOR=2
89
ARG ZED_SDK_PATCH=3
910
ARG L4T_MAJOR=36
1011
ARG L4T_MINOR=3
12+
# Optional: Override ZED SDK URL
13+
ARG CUSTOM_ZED_SDK_URL=""
1114

1215
# ROS2 distribution
1316
ARG ROS2_DIST=humble
@@ -30,10 +33,10 @@ ARG RMW_CYCLONEDDS_VERSION=1.3.4
3033
ENV DEBIAN_FRONTEND=noninteractive
3134

3235
# ZED SDK link
33-
ENV ZED_SDK_URL="https://stereolabs.sfo2.cdn.digitaloceanspaces.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/ZED_SDK_Tegra_L4T${L4T_MAJOR}.${L4T_MINOR}_v${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}.${ZED_SDK_PATCH}.zstd.run"
36+
ENV ZED_SDK_URL=${CUSTOM_ZED_SDK_URL:-"https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}.${ZED_SDK_PATCH}/l4t${L4T_MAJOR}.${L4T_MINOR}/jetsons"}
3437

3538
# Check that this SDK exists
36-
RUN if [ "$(curl -I "${ZED_SDK_URL}" -o /dev/null -s -w '%{http_code}\n' | head -n 1)" = "200" ]; then \
39+
RUN if [ "$(curl -L -I "${ZED_SDK_URL}" -o /dev/null -s -w '%{http_code}\n' | head -n 1)" = "200" ]; then \
3740
echo "The URL points to something."; \
3841
else \
3942
echo "The URL does not point to a .run file or the file does not exist."; \

docker/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,18 @@ We provide a script to build your image with the right L4T / ZED SDK version.
5454
Examples:
5555

5656
```bash
57-
# Jetson with JP6.0 and ZED SDK v4.2.3
58-
./jetson_build_dockerfile_from_sdk_and_l4T_version.sh l4t-r36.3.0 zedsdk-4.2.3
57+
# Jetson with JP6.0 and ZED SDK v4.2.5
58+
./jetson_build_dockerfile_from_sdk_and_l4T_version.sh l4t-r36.3.0 zedsdk-4.2.5
5959
```
6060

6161
```bash
62-
# Desktop on Ubuntu 22.04m CUDA 12.6.3 and ZED SDK v4.2.3
63-
./desktop_build_dockerfile_from_sdk_ubuntu_and_cuda_version.sh ubuntu-22.04 cuda-12.6.3 zedsdk-4.2.3
62+
# Jetson with JP6.2 and ZED SDK v5.0.0
63+
./jetson_build_dockerfile_from_sdk_and_l4T_version.sh l4t-r36.4.0 zedsdk-5.0.0
64+
```
65+
66+
```bash
67+
# Desktop on Ubuntu 22.04m CUDA 12.6.3 and ZED SDK v4.2.5
68+
./desktop_build_dockerfile_from_sdk_ubuntu_and_cuda_version.sh ubuntu-22.04 cuda-12.6.3 zedsdk-4.2.5
6469
```
6570

6671
> :warning: Some configurations will not work. For example, if a specific ZED SDK does not exist for a given Ubuntu/CUDA/L4T version, or if the given ROS 2 wrapper is not compatible with the selected Ubuntu version.

docker/desktop_build_dockerfile_from_sdk_ubuntu_and_cuda_version.sh

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ fi
1717
ubuntu_version=$1
1818
ubuntu_version_number="${ubuntu_version#ubuntu-}"
1919

20+
# Split the string and assign to variables
21+
IFS='.' read -r ubuntu_major ubuntu_minor <<< "$ubuntu_version_number"
22+
echo "Ubuntu $ubuntu_major.$ubuntu_minor detected."
23+
2024
# CUDA version
2125
# Verify the format (l4t-r digits.digits.digits)
2226
if ! [[ $2 =~ ^cuda-[0-9]+\.[0-9]\.[0-9]$ ]]; then
@@ -27,48 +31,63 @@ fi
2731
cuda_version=$2
2832
cuda_version_number="${cuda_version#cuda-}"
2933

34+
# Split the string and assign to variables
35+
IFS='.' read -r cuda_major cuda_minor cuda_patch <<< "$cuda_version_number"
36+
echo "CUDA $cuda_major.$cuda_minor.$cuda_patch detected."
3037

31-
# Verify the ZED SDK format (digits.digits.digits)
32-
if ! [[ $3 =~ ^zedsdk-[0-9]\.[0-9]\.[0-9]$ ]]; then
33-
echo "Invalid ZED SDK version format."
34-
exit 1
35-
fi
3638

3739
ZED_SDK_version=$3
38-
# Remove the prefix 'zedsdk-'
39-
zed_sdk_version_number="${ZED_SDK_version#zedsdk-}"
4040

4141
# copy the wrapper content
4242
rm -r ./tmp_sources
4343
mkdir -p ./tmp_sources
4444
cp -r ../zed* ./tmp_sources
4545

46-
# Split the string and assign to variables
47-
IFS='.' read -r cuda_major cuda_minor cuda_patch <<< "$cuda_version_number"
48-
echo "CUDA $cuda_major.$cuda_minor.$cuda_patch detected."
46+
# Check if the third arg is a custom path
47+
CUSTOM_ZED_SDK_URL=$3
48+
# Use curl to check if the URL is valid (returns HTTP 200)
49+
if [ "$(curl -L -I "${CUSTOM_ZED_SDK_URL}" -o /dev/null -s -w '%{http_code}\n' | head -n 1)" = "200" ]; then
50+
echo "${ZED_SDK_version} detected as a valid custom installer URL"
4951

50-
###########
52+
echo "Building dockerfile for $1, CUDA $2 and a custom ZED SDK"
5153

52-
# Split the string and assign to variables
53-
IFS='.' read -r ubuntu_major ubuntu_minor <<< "$ubuntu_version_number"
54-
echo "Ubuntu $ubuntu_major.$ubuntu_minor detected."
55-
###########
54+
docker build -t zed_ros2_desktop_u${ubuntu_major}.${ubuntu_minor}_sdk_custom_cuda_${cuda_major}.${cuda_minor}.${cuda_patch} \
55+
--build-arg CUSTOM_ZED_SDK_URL=$CUSTOM_ZED_SDK_URL \
56+
--build-arg UBUNTU_MAJOR=$ubuntu_major \
57+
--build-arg UBUNTU_MINOR=$ubuntu_minor \
58+
--build-arg CUDA_MAJOR=$cuda_major \
59+
--build-arg CUDA_MINOR=$cuda_minor \
60+
--build-arg CUDA_PATCH=$cuda_patch \
61+
-f ./Dockerfile.desktop-humble .
62+
else
63+
# Verify the ZED SDK format (digits.digits.digits)
64+
if ! [[ $3 =~ ^zedsdk-[0-9]\.[0-9]\.[0-9]$ ]]; then
65+
echo "Invalid ZED SDK version format."
66+
exit 1
67+
fi
5668

57-
# Split the string and assign to variables
58-
IFS='.' read -r sdk_major sdk_minor sdk_patch <<< "$zed_sdk_version_number"
59-
echo "ZED SDK $major.$minor.$patch detected."
60-
61-
echo "Building dockerfile for $1, CUDA $2 and ZED SDK $3"
62-
docker build -t zed_ros2_desktop_u${ubuntu_major}.${ubuntu_minor}_sdk_${sdk_major}.${sdk_minor}.${sdk_patch}_cuda_${cuda_major}.${cuda_minor}.${cuda_patch} \
63-
--build-arg ZED_SDK_MAJOR=$sdk_major \
64-
--build-arg ZED_SDK_MINOR=$sdk_minor \
65-
--build-arg ZED_SDK_PATCH=$sdk_patch \
66-
--build-arg UBUNTU_MAJOR=$ubuntu_major \
67-
--build-arg UBUNTU_MINOR=$ubuntu_minor \
68-
--build-arg CUDA_MAJOR=$cuda_major \
69-
--build-arg CUDA_MINOR=$cuda_minor \
70-
--build-arg CUDA_PATCH=$cuda_patch \
71-
-f ./Dockerfile.desktop-humble .
69+
# Remove the prefix 'zedsdk-'
70+
zed_sdk_version_number="${ZED_SDK_version#zedsdk-}"
71+
72+
# Split the string and assign to variables
73+
IFS='.' read -r sdk_major sdk_minor sdk_patch <<< "$zed_sdk_version_number"
74+
echo "ZED SDK $major.$minor.$patch detected."
75+
76+
echo "Building dockerfile for $1, CUDA $2 and ZED SDK $3"
77+
78+
docker build -t zed_ros2_desktop_u${ubuntu_major}.${ubuntu_minor}_sdk_${sdk_major}.${sdk_minor}.${sdk_patch}_cuda_${cuda_major}.${cuda_minor}.${cuda_patch} \
79+
--build-arg ZED_SDK_MAJOR=$sdk_major \
80+
--build-arg ZED_SDK_MINOR=$sdk_minor \
81+
--build-arg ZED_SDK_PATCH=$sdk_patch \
82+
--build-arg UBUNTU_MAJOR=$ubuntu_major \
83+
--build-arg UBUNTU_MINOR=$ubuntu_minor \
84+
--build-arg CUDA_MAJOR=$cuda_major \
85+
--build-arg CUDA_MINOR=$cuda_minor \
86+
--build-arg CUDA_PATCH=$cuda_patch \
87+
-f ./Dockerfile.desktop-humble .
88+
fi
89+
90+
###########
7291

7392
# Remove the temporary folder
7493
rm -r ./tmp_sources

docker/jetson_build_dockerfile_from_sdk_and_l4T_version.sh

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cd $(dirname $0)
33

44
if [ "$#" -lt 2 ]; then
55
echo "Please enter valid L4T version and ZED SDK version has parameters. For example:"
6-
echo "./jetson_build_dockerfile_from_sdk_and_l4T_version.sh l4t-r36.3.0 zedsdk-4.2.3"
6+
echo "./jetson_build_dockerfile_from_sdk_and_l4T_version.sh l4t-r36.3.0 zedsdk-4.2.5"
77
exit 1
88
fi
99

@@ -18,15 +18,9 @@ L4T_version=$1
1818
# Remove the prefix 'l4t-r'
1919
l4t_version_number="${L4T_version#l4t-r}"
2020

21-
# Verify the ZED SDK format (digits.digits.digits)
22-
if ! [[ $2 =~ ^zedsdk-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
23-
echo "Invalid ZED SDK version format."
24-
exit 1
25-
fi
2621

2722
ZED_SDK_version=$2
28-
# Remove the prefix 'zedsdk-'
29-
zed_sdk_version_number="${ZED_SDK_version#zedsdk-}"
23+
3024

3125
# copy the wrapper content
3226
rm -r ./tmp_sources
@@ -37,18 +31,55 @@ cp -r ../zed* ./tmp_sources
3731
IFS='.' read -r l4t_major l4t_minor l4t_patch <<< "$l4t_version_number"
3832
###########
3933

40-
# Split the string and assign to variables
41-
IFS='.' read -r sdk_major sdk_minor sdk_patch <<< "$zed_sdk_version_number"
42-
43-
echo "Building dockerfile for $1 and ZED SDK $2"
44-
docker build -t zed_ros2_l4t_${l4t_major}.${l4t_minor}.${l4t_patch}_sdk_${sdk_major}.${sdk_minor}.${sdk_patch} \
45-
--build-arg ZED_SDK_MAJOR=$sdk_major \
46-
--build-arg ZED_SDK_MINOR=$sdk_minor \
47-
--build-arg ZED_SDK_PATCH=$sdk_patch \
48-
--build-arg L4T_VERSION=$1 \
49-
--build-arg L4T_MAJOR=$l4t_major \
50-
--build-arg L4T_MINOR=$l4t_minor \
51-
-f ./Dockerfile.l4t-humble .
34+
L4T_VERSION=${1:-l4t-r${l4t_major}.${l4t_minor}.${l4t_patch}}
35+
36+
# Determine the IMAGE_NAME based on the L4T_VERSION
37+
if [[ "$L4T_VERSION" == *"l4t-r36.4"* ]]; then
38+
IMAGE_NAME="dustynv/ros:humble-desktop-${L4T_VERSION}"
39+
else
40+
IMAGE_NAME="dustynv/ros:humble-ros-base-${L4T_VERSION}"
41+
fi
42+
43+
# Check if the third arg is a custom path
44+
CUSTOM_ZED_SDK_URL=$2
45+
# Use curl to check if the URL is valid (returns HTTP 200)
46+
if [ "$(curl -L -I "${CUSTOM_ZED_SDK_URL}" -o /dev/null -s -w '%{http_code}\n' | head -n 1)" = "200" ]; then
47+
echo "${ZED_SDK_version} detected as a valid custom installer URL"
48+
49+
echo "Building dockerfile for $1 and a custom ZED SDK"
50+
51+
docker build -t zed_ros2_l4t_${l4t_major}.${l4t_minor}.${l4t_patch}_sdk_custom \
52+
--build-arg CUSTOM_ZED_SDK_URL=$CUSTOM_ZED_SDK_URL \
53+
--build-arg L4T_VERSION=$1 \
54+
--build-arg L4T_MAJOR=$l4t_major \
55+
--build-arg L4T_MINOR=$l4t_minor \
56+
--build-arg IMAGE_NAME=$IMAGE_NAME \
57+
-f ./Dockerfile.l4t-humble .
58+
else
59+
# Verify the ZED SDK format (digits.digits.digits)
60+
if ! [[ $2 =~ ^zedsdk-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
61+
echo "Invalid ZED SDK version format."
62+
exit 1
63+
fi
64+
65+
# Remove the prefix 'zedsdk-'
66+
zed_sdk_version_number="${ZED_SDK_version#zedsdk-}"
67+
68+
# Split the string and assign to variables
69+
IFS='.' read -r sdk_major sdk_minor sdk_patch <<< "$zed_sdk_version_number"
70+
71+
echo "Building dockerfile for $1 and ZED SDK $2"
72+
73+
docker build -t zed_ros2_l4t_${l4t_major}.${l4t_minor}.${l4t_patch}_sdk_${sdk_major}.${sdk_minor}.${sdk_patch} \
74+
--build-arg ZED_SDK_MAJOR=$sdk_major \
75+
--build-arg ZED_SDK_MINOR=$sdk_minor \
76+
--build-arg ZED_SDK_PATCH=$sdk_patch \
77+
--build-arg L4T_VERSION=$1 \
78+
--build-arg L4T_MAJOR=$l4t_major \
79+
--build-arg L4T_MINOR=$l4t_minor \
80+
--build-arg IMAGE_NAME=$IMAGE_NAME \
81+
-f ./Dockerfile.l4t-humble .
82+
fi
5283

5384
# Remove the temporary folder
5485
rm -r ./tmp_sources

zed_components/src/zed_camera/include/zed_camera_component.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class ZedCamera : public rclcpp::Node
4242
void initServices();
4343
void initThreads();
4444

45+
void close();
46+
4547
void getDebugParams();
4648
void getSimParams();
4749
void getGeneralParams();
@@ -79,6 +81,7 @@ class ZedCamera : public rclcpp::Node
7981
void stopSvoRecording();
8082
bool startStreamingServer();
8183
void stopStreamingServer();
84+
void closeCamera();
8285
// <---- Initialization functions
8386

8487
// ----> Callbacks
@@ -753,6 +756,7 @@ class ZedCamera : public rclcpp::Node
753756

754757
std::atomic<bool> mStreamingServerRunning;
755758

759+
bool mUsingCustomOd = false;
756760
bool mCustomLabelsGood = false;
757761
uint64_t mHeartbeatCount = 0;
758762
// <---- Status Flags

zed_components/src/zed_camera/include/zed_camera_one_component.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ class ZedCameraOne : public rclcpp::Node
5454
void getStreamingServerParams();
5555
void getAdvancedParams();
5656

57+
void close();
58+
5759
bool startCamera();
60+
void closeCamera();
5861
void startTempPubTimer();
5962
bool startStreamingServer();
6063
void stopStreamingServer();

0 commit comments

Comments
 (0)