Skip to content

Commit

Permalink
NVIDIA Isaac ROS - EA2 Release
Browse files Browse the repository at this point in the history
release-ea2: 5fd7ed086de471571e4e221d048db069555e1f40
  • Loading branch information
hemalshahNV committed Oct 20, 2021
1 parent f9c60a0 commit b5261b2
Show file tree
Hide file tree
Showing 133 changed files with 26,300 additions and 43 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@
*.npy filter=lfs diff=lfs merge=lfs -text
# Debian package
*.deb filter=lfs diff=lfs merge=lfs -text
# Shared libraries
*.so.* filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text

# trtexec
trtexec_x86_64 filter=lfs diff=lfs merge=lfs -text

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Ignore all pycache files
**/__pycache__/**
# Ignore ROS build files
**/build/**
**/install/**
**/cc_internals/**
**/log/**
60 changes: 58 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,60 @@
# Isaac ROS Common

Isaac ROS common utilities for use in conjunction with the Isaac ROS suite of packages.
Note: Please refer to `scripts/README.md` for script used to setup dev environment
Isaac ROS common utilities and scripts for use in conjunction with the Isaac ROS suite of packages.

## Docker Scripts
`run_dev.sh` creates a dev environment with ROS2 installed and key versions of NVIDIA frameworks prepared for both x86_64 and Jetson. By default, the directory `/workspaces/isaac_ros-dev` in the container is mapped from `~/workspaces/isaac_ros-dev` on the host machine if it exists OR the current working directory from where the script was invoked otherwise. The host directory the container maps to can be explicitly set by running the script with the desired path as the first argument:
```
scripts/run_dev.sh <path to workspace>
```

## System Requirements
This script is designed and tested to be compatible with ROS2 Foxy on Jetson hardware in addition to on x86 systems with an Nvidia GPU.

### Jetson
- AGX Xavier or Xavier NX
- JetPack 4.6

### x86_64
- CUDA 11.1+ supported discrete GPU
- VPI 1.1.11
- Ubuntu 20.04+

You must first install the [Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) to make use of the Docker container development/runtime environment.

Configure `nvidia-container-runtime` as the default runtime for Docker by editing `/etc/docker/daemon.json` to include the following:
```
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
},
"default-runtime": "nvidia"
```
and then restarting Docker: `sudo systemctl daemon-reload && sudo systemctl restart docker`

**Note:** For best performance on Jetson, ensure that power settings are configured appropriately ([Power Management for Jetson](https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/power_management_jetson_xavier.html#wwpID0EUHA)).

## Troubleshooting
### `run_dev.sh` on x86 fails with `vpi-lib-1.1.11-cuda11-x86_64-linux.deb` is not a Debian format archive
When building a Docker image, `run_dev.sh` may fail because some files seem to be invalid. Debian packages for VPI on x86 are packaged in Isaac ROS using `git-lfs`. These files need to be fetched in order to install VPI in the Docker image.

#### Symptoms
```
dpkg-deb: error: 'vpi-lib-1.1.11-cuda11-x86_64-linux.deb' is not a Debian format archive
dpkg: error processing archive vpi-lib-1.1.11-cuda11-x86_64-linux.deb (--install):
dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
vpi-lib-1.1.11-cuda11-x86_64-linux.deb
```
#### Solution
Run `git lfs pull` in each Isaac ROS repository you have checked out, especially `isaac_ros_common`, to ensure all of the large binary files have been downloaded.


# Updates

| Date | Changes |
| -----| ------- |
| 2021-10-20 | Migrated to [NVIDIA-ISAAC-ROS](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common), added `isaac_ros_nvengine` and `isaac_ros_nvengine_interfaces` packages |
| 2021-08-11 | Initial release to [NVIDIA-AI-IOT](https://github.com/NVIDIA-AI-IOT/isaac_ros_common) |
112 changes: 103 additions & 9 deletions docker/Dockerfile.aarch64.base
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.

# Dockder file to aarch64 based Jetson device
ARG BASE_IMAGE=dustynv/ros:foxy-ros-base-l4t-r32.6.1
# Docker file for aarch64 based Jetson device
ARG BASE_IMAGE="dustynv/ros:foxy-ros-base-l4t-r32.6.1"
FROM ${BASE_IMAGE}

# Disable terminal interaction for apt
Expand All @@ -19,7 +19,9 @@ RUN apt-get update && apt-get install -y \
cmake \
curl \
git \
lsb-release \
sudo \
tar \
unzip \
vim \
wget \
Expand All @@ -46,6 +48,7 @@ RUN apt-get update && apt-get install -y \
python3-distutils \
libboost-all-dev \
libboost-dev \
libpcl-dev \
&& rm -rf /var/lib/apt/lists/*

# sklearn dependencies
Expand All @@ -70,13 +73,43 @@ RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.d
git-lfs \
&& rm -rf /var/lib/apt/lists/*

# Nvidia container runtime mounts cuda libraries from the host into the container, but dpkg still
# thinks that they are not installed. Tell dpkg that these libraries are installed so VPI's
# dependencies will be satisfied.
ARG DPKG_STATUS
RUN echo "$DPKG_STATUS" >> /var/lib/dpkg/status

# Add nvidia repo/public key and install VPI libraries
RUN curl https://repo.download.nvidia.com/jetson/jetson-ota-public.asc > /etc/apt/trusted.gpg.d/jetson-ota-public.asc \
&& echo "deb https://repo.download.nvidia.com/jetson/common r32.6 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list \
&& echo "deb https://repo.download.nvidia.com/jetson/t194 r32.6 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list \
&& apt-get update \
&& apt-get install -y \
libnvvpi1 \
vpi1-dev

# Install Realsense
RUN apt update \
&& apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE \
&& add-apt-repository -y "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-key \
F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key \
F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE \
&& add-apt-repository -y \
"deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u \
&& apt-get install -y rsync librealsense2-utils librealsense2-dev \
&& rm -rf /var/lib/apt/lists/*

# Install Tao converter
RUN mkdir -p /opt/nvidia/tao && \
cd /opt/nvidia/tao && \
wget https://developer.nvidia.com/jp46-20210820t231431z-001zip && \
unzip jp46-20210820t231431z-001zip && \
chmod 755 /opt/nvidia/tao/jp4.6/tao-converter && \
ln -sf /opt/nvidia/tao/jp4.6/tao-converter /opt/nvidia/tao/tao-converter && \
rm jp46-20210820t231431z-001zip

ENV PATH="${PATH}:/opt/nvidia/tao"

# Update environment
ENV LD_LIBRARY_PATH="/opt/nvidia/vpi1/lib64:${LD_LIBRARY_PATH}"
ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu/tegra:${LD_LIBRARY_PATH}"
Expand All @@ -85,23 +118,84 @@ ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu/tegra-egl:${LD_LIBRARY_PATH}"

RUN echo "source /opt/ros/foxy/install/setup.bash" > /opt/ros/foxy/setup.bash

# Restore using the default Foxy DDS middleware: FastRTPS
# Restore using the default Foxy DDS middleware: FastRTPS
ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp

# Install Triton server 2.13 from https://github.com/triton-inference-server/server/releases/tag/v2.13.0
RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
libb64-dev \
libcurl4-openssl-dev \
libopenblas-dev \
libre2-dev \
libssl-dev \
libtool \
patchelf \
rapidjson-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /opt/tritonserver && cd /opt/tritonserver \
&& wget https://github.com/triton-inference-server/server/releases/download/v2.13.0/tritonserver2.13.0-jetpack4.6.tgz \
&& tar -xzvf tritonserver2.13.0-jetpack4.6.tgz \
&& rm tritonserver2.13.0-jetpack4.6.tgz

ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/tritonserver/lib"

# Install perception_pcl
RUN mkdir -p /opt/ros/foxy/src && cd /opt/ros/foxy/src \
&& git clone https://github.com/ros-perception/pcl_msgs.git && cd pcl_msgs && git checkout ros2 && cd .. \
&& git clone https://github.com/ros-perception/perception_pcl.git \
&& source /opt/ros/foxy/setup.bash \
&& cd /opt/ros/foxy \
&& rosdep install -y --ignore-src --from-paths src --rosdistro foxy \
&& colcon build --merge-install --packages-up-to pcl_conversions \
&& rm -Rf src logs build

# Install sensor_msgs_py
RUN mkdir -p /opt/ros/foxy/src && cd /opt/ros/foxy/src \
&& git clone https://github.com/ros2/common_interfaces.git && cd common_interfaces && git checkout 2.2.3 && cd .. \
&& source /opt/ros/foxy/setup.bash \
&& cd /opt/ros/foxy \
&& rosdep install -y --ignore-src --from-paths src --rosdistro foxy \
&& colcon build --merge-install --packages-up-to sensor_msgs_py \
&& rm -Rf src logs build

# Install gcc8 for cross-compiled binaries from Ubuntu 20.04
RUN apt-get update -y && add-apt-repository -y ppa:ubuntu-toolchain-r/test && apt-get install -y \
gcc-8 \
g++-8 \
libstdc++6 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 \
&& rm -rf /usr/bin/aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-g++ \
/usr/bin/aarch64-linux-gnu-g++-7 /usr/bin/aarch64-linux-gnu-gcc-7 \
&& update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc \
/usr/bin/gcc-8 8 \
&& update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ \
/usr/bin/g++-8 8 \
&& rm -rf /var/lib/apt/lists/*

### -----------------------------

# Setup non-root admin user
ARG USERNAME=admin
ARG USER_UID=1000
ARG USER_GID=1001
ARG USER_GID=1000

# Create the 'admin' user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& adduser admin video && adduser admin sudo
&& adduser ${USERNAME} video && adduser ${USERNAME} sudo

COPY scripts/workspace-entrypoint.sh /home/$USERNAME/workspace-entrypoint.sh
RUN chmod +x /home/$USERNAME/workspace-entrypoint.sh
# Copy scripts
RUN mkdir -p /usr/local/bin/scripts
COPY scripts/*entrypoint.sh /usr/local/bin/scripts/
RUN chmod +x /usr/local/bin/scripts/*.sh

ENV USERNAME=${USERNAME}
ENV USER_GID=${USER_GID}
ENV USER_UID=${USER_UID}
68 changes: 55 additions & 13 deletions docker/Dockerfile.x86_64.base
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
# Docker file to build on x86_64
ARG BASE_IMAGE=nvidia/cuda:11.2.0-devel-ubuntu20.04
# https://docs.nvidia.com/deeplearning/frameworks/user-guide/index.html
ARG BASE_IMAGE=nvcr.io/nvidia/tritonserver:21.08-py3
FROM ${BASE_IMAGE}

# disable terminal interaction for apt
Expand All @@ -28,6 +29,7 @@ RUN apt-get update && apt-get install -y \
software-properties-common \
wget \
vim \
unzip \
mlocate \
&& rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -56,6 +58,15 @@ RUN apt-get update && apt-get install -y \
libcunit1-dev \
&& rm -rf /var/lib/apt/lists/*

# TensorRT 8
RUN apt-get update && apt-get install -y \
libnvinfer8 \
libnvonnxparsers8 \
libnvparsers8 \
libnvinfer-plugin8 \
python3-libnvinfer \
&& rm -rf /var/lib/apt/lists/*

# Python3 (PIP)
RUN python3 -m pip install -U \
argcomplete \
Expand All @@ -69,11 +80,14 @@ RUN python3 -m pip install -U \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
onnx \
pytest-repeat \
pytest-rerunfailures \
pytest \
pydocstyle \
scikit-learn
scikit-learn \
torch \
torchvision

# Install Git-LFS
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
Expand Down Expand Up @@ -110,6 +124,10 @@ RUN apt-get update && apt-get install -y \
ros-foxy-turtlesim \
ros-foxy-v4l2-camera \
ros-foxy-realsense2-camera \
ros-foxy-vision-msgs \
ros-foxy-pcl-conversions \
ros-foxy-sensor-msgs-py \
ros-foxy-stereo-image-proc \
&& rm -rf /var/lib/apt/lists/*

RUN rosdep init
Expand All @@ -121,21 +139,45 @@ RUN apt update \
&& add-apt-repository -y "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u \
&& apt-get install -y librealsense2-utils librealsense2-dev

# Restore using the default Foxy DDS middleware: FastRTPS
# Install Tao converter
RUN mkdir -p /opt/nvidia/tao && \
cd /opt/nvidia/tao && \
wget https://developer.nvidia.com/tao-converter-80 && \
unzip tao-converter-80 && \
chmod 755 /opt/nvidia/tao/cuda11.3-trt8.0/tao-converter && \
ln -sf /opt/nvidia/tao/cuda11.3-trt8.0/tao-converter /opt/nvidia/tao/tao-converter && \
rm tao-converter-80

ENV PATH="${PATH}:/opt/nvidia/tao"

# Install prebuilt trtexec
COPY tensor_rt/trtexec_x86_64 /usr/src/tensorrt/bin/trtexec

# Update environment
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/tritonserver/lib"

# Restore using the default Foxy DDS middleware: FastRTPS
ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp

# Setup non-root admin user
ARG USERNAME=admin
ARG USER_UID=1000
ARG USER_GID=1001
ARG USER_GID=1000

# Create the 'admin' user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& adduser admin video && adduser admin sudo

COPY scripts/workspace-entrypoint.sh /home/$USERNAME/workspace-entrypoint.sh
RUN chmod +x /home/$USERNAME/workspace-entrypoint.sh

RUN groupmod --gid ${USER_GID} -n ${USERNAME} triton-server \
&& usermod -l ${USERNAME} -m -d /home/${USERNAME} triton-server \
&& mkdir -p /home/${USERNAME} \
&& sudo chown ${USERNAME}:${USERNAME} /home/${USERNAME} \
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME} \
&& adduser ${USERNAME} video && adduser ${USERNAME} sudo

# Copy scripts
RUN mkdir -p /usr/local/bin/scripts
COPY scripts/*entrypoint.sh /usr/local/bin/scripts/
RUN chmod +x /usr/local/bin/scripts/*.sh

ENV USERNAME=${USERNAME}
ENV USER_GID=${USER_GID}
ENV USER_UID=${USER_UID}
3 changes: 3 additions & 0 deletions docker/tensor_rt/trtexec_x86_64
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
char buffer[VPI_MAX_STATUS_MESSAGE_LENGTH]; \
vpiGetLastStatusMessage(buffer, sizeof(buffer)); \
std::ostringstream ss; \
ss << vpiStatusGetName(status) << ": " << buffer; \
ss << __FILE__ << ":" << __LINE__ << ": " << vpiStatusGetName(status) << ": " << buffer; \
throw std::runtime_error(ss.str()); \
} \
} while (0);
Expand Down
Loading

0 comments on commit b5261b2

Please sign in to comment.