Closed javieryu closed 2 weeks ago
Partial solution found on the ZED Community Forums!
https://community.stereolabs.com/t/zed-ros-2-wrapper-docker-build-fails/6756/5
This fix also worked for me and I can confirm that everything seems to work properly with my ZEDM afterwards. I'm not experiencing the topic issues that the OP for the forum post had, and that seems to be a separate issue.
I'll leave this open for now because it would seem that this indicates the current master
branch is broken for the docker install.
Copy of my working Dockerfile.l4t-humble
for posterity:
ARG L4T_VERSION=l4t-r35.4.1
ARG IMAGE_NAME=dustynv/ros:humble-ros-base-${L4T_VERSION}
FROM ${IMAGE_NAME}
ARG ZED_SDK_MAJOR=4
ARG ZED_SDK_MINOR=1
ARG ZED_SDK_PATCH=0
ARG JETPACK_MAJOR=5
ARG JETPACK_MINOR=0
ARG L4T_MAJOR=35
ARG L4T_MINOR=1
ARG ROS2_DIST=humble # ROS2 distribution
# ZED ROS2 Wrapper dependencies version
ARG XACRO_VERSION=2.0.8
ARG DIAGNOSTICS_VERSION=3.0.0
ARG AMENT_LINT_VERSION=0.12.4
ARG GEOGRAPHIC_INFO_VERSION=1.0.4
ARG ROBOT_LOCALIZATION_VERSION=3.4.2
ENV DEBIAN_FRONTEND noninteractive
# ZED SDK link
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"
# Check that this SDK exists
RUN if [ "$(curl -I "${ZED_SDK_URL}" -o /dev/null -s -w '%{http_code}\n' | head -n 1)" = "200" ]; then \
echo "The URL points to something."; \
else \
echo "The URL does not point to a .run file or the file does not exist."; \
exit 1; \
fi
# Disable apt-get warnings
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 42D5A192B819C5DA || true && \
apt-get update || true && apt-get install -y --no-install-recommends apt-utils dialog && \
rm -rf /var/lib/apt/lists/*
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt-get update && \
apt-get install --yes lsb-release wget less udev sudo build-essential cmake python3 python3-dev python3-pip python3-wheel git jq libpq-dev zstd usbutils && \
rm -rf /var/lib/apt/lists/*
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_JP.run \
${ZED_SDK_URL} && \
chmod +x ZED_SDK_Linux_JP.run ; ./ZED_SDK_Linux_JP.run silent skip_tools && \
rm -rf /usr/local/zed/resources/* && \
rm -rf ZED_SDK_Linux_JP.run && \
rm -rf /var/lib/apt/lists/*
# Install the ZED ROS2 Wrapper
ENV ROS_DISTRO ${ROS2_DIST}
# Copy the sources in the Docker image
WORKDIR /root/ros2_ws/src
COPY tmp_sources/ ./
# Install missing dependencies
WORKDIR /root/ros2_ws/src
RUN wget https://github.com/ros/xacro/archive/refs/tags/${XACRO_VERSION}.tar.gz -O - | tar -xvz && mv xacro-${XACRO_VERSION} xacro && \
wget https://github.com/ros/diagnostics/archive/refs/tags/${DIAGNOSTICS_VERSION}.tar.gz -O - | tar -xvz && mv diagnostics-${DIAGNOSTICS_VERSION} diagnostics && \
wget https://github.com/ament/ament_lint/archive/refs/tags/${AMENT_LINT_VERSION}.tar.gz -O - | tar -xvz && mv ament_lint-${AMENT_LINT_VERSION} ament-lint && \
wget https://github.com/cra-ros-pkg/robot_localization/archive/refs/tags/${ROBOT_LOCALIZATION_VERSION}.tar.gz -O - | tar -xvz && mv robot_localization-${ROBOT_LOCALIZATION_VERSION} robot-localization && \
wget https://github.com/ros-geographic-info/geographic_info/archive/refs/tags/${GEOGRAPHIC_INFO_VERSION}.tar.gz -O - | tar -xvz && mv geographic_info-${GEOGRAPHIC_INFO_VERSION} geographic-info && \
cp -r geographic-info/geographic_msgs/ . && \
rm -rf geographic-info && \
git clone https://github.com/ros-drivers/nmea_msgs.git --branch ros2 && \
git clone https://github.com/ros/angles.git --branch humble-devel && \
git clone https://github.com/ros2/rcpputils.git --branch humble && \
git clone https://github.com/ros-perception/point_cloud_transport.git --branch humble
# Check that all the dependencies are satisfied
WORKDIR /root/ros2_ws
RUN apt-get update -y || true && rosdep update && \
rosdep install --from-paths src --ignore-src -r -y && \
rm -rf /var/lib/apt/lists/*
# Install cython
RUN python3 -m pip install --upgrade cython
# Build the dependencies and the ZED ROS2 Wrapper
RUN /bin/bash -c "source /opt/ros/$ROS_DISTRO/install/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install --packages-select rcpputils point_cloud_transport \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' \
' --no-warn-unused-cli' "
RUN /bin/bash -c "source /opt/ros/$ROS_DISTRO/install/setup.bash && source install/local_setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' \
' --no-warn-unused-cli' "
WORKDIR /root/ros2_ws
# Set the default DDS middleware to FastRTPS for improved big data transmission
ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# Setup environment variables
COPY ros_entrypoint_jetson.sh /sbin/ros_entrypoint.sh
RUN sudo chmod 755 /sbin/ros_entrypoint.sh
ENTRYPOINT ["/sbin/ros_entrypoint.sh"]
CMD ["bash"]
Any idea why this multi-step build is necessary, even though the dependencies are stated correctly?
and
I'm sorry, I cannot understand your question.
In the patch that @javieryu posted, the build is separated into two steps.
First, rcpputils
and point_cloud_transport
are built separately
# Build the dependencies and the ZED ROS2 Wrapper
RUN /bin/bash -c "source /opt/ros/$ROS_DISTRO/install/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install --packages-select rcpputils point_cloud_transport \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' \
' --no-warn-unused-cli' "
Then, the rest is built
RUN /bin/bash -c "source /opt/ros/$ROS_DISTRO/install/setup.bash && source install/local_setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' \
' --no-warn-unused-cli' "
To my knowledge, this two-step process shoudn't be needed, because the dependencies are correctly stated, as alluded to in
Any idea why this multi-step build is necessary, even though the dependencies are stated correctly?
and
Do you understand my confusion?
@javieryu can you justify your choice?
Any idea why this multi-step build is necessary, even though the dependencies are stated correctly?
and
@javieryu can you justify your choice?
Per the post on the ZED community forums "I then also had to first build rcpputils and point_cloud_transport, source the local workspace and then build the rest of the packages. Otherwise it wouldn’t find the point_cloud_transport package". I also was not sure why the original solution used separate colcon builds, but I assume that the original author of the patch tested with the single call to colcon build
first. It seems like for whatever reason the zed_components
package.xml
is not being correctly parsed by colcon/rosdep.
The truth is that I have ICRA deadlines this week, and didn't have time to investigate a more elegant patch. Hence no PR etc.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days
Preliminary Checks
Description
When running the docker build process on my Jetson Orin Nano the docker build fails to complete the
colcon build
step in the docker file becausezed _components
is missing thepoint_cloud_transport
package.Steps to Reproduce
git clone --recursive https://github.com/stereolabs/zed-ros2-wrapper.git
cd zed-ros2-wrapper/docker
./jetson_build_dockerfile_from_sdk_and_l4T_version.sh l4t-r35.4.1 zedsdk4.1.2
...
Expected Result
Docker image finishes building.
Actual Result
Error snippet:
Here's a log file of the full output from the docker build: build.log
ZED Camera model
ZED Mini
Environment
Anything else?
The
rosdep install
step that I would have expected to install thepoint_cloud_transport
package seems to have run without throwing errors since the docker build proceeds past this step in the Dockerfile. When I inspect the logs for therosdep install
(see below for a snippet) I don't see any of the packages from thezed_components/package.xml
which suggests to me that there might be some other issue.