Skip to content

Commit

Permalink
Isaac ROS 0.20.0 (DP2)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaiveersinghNV committed Oct 19, 2022
1 parent bdfca13 commit 4c6309b
Show file tree
Hide file tree
Showing 26 changed files with 279 additions and 109 deletions.
43 changes: 24 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Isaac ROS Common

## Overview
The [Isaac ROS Common](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common) repository contains a number of scripts and Dockerfiles to help streamline development and testing with the Isaac ROS suite.

The [Isaac ROS Common](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common) repository contains a number of scripts and Dockerfiles to help streamline development and testing with the Isaac ROS suite.

The Docker images included in this package provide pre-compiled binaries for ROS2 Humble on Ubuntu 20.04 Focal.

Expand All @@ -10,29 +11,30 @@ Additionally, on x86_64 platforms, Docker containers allow us to quickly setup a
For solutions to known issues, please visit the [Troubleshooting](./docs/troubleshooting.md) section.

### Docker Development Scripts

`run_dev.sh` sets up a development environment with ROS2 installed and key versions of NVIDIA frameworks prepared for both x86_64 and Jetson. Running this script will prepare a Docker image with supported configuration for the
host machine and deliver you into a bash prompt running inside the container. From here, you are ready to execute ROS2 build/run commands with your host workspace files mounted into the container, available to edit both on the host and in the container as appropriate. If you run this script again while it is running, it will attach a new shell to the same container.


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:

```bash
scripts/run_dev.sh <path to workspace>
```

### Configuring run_dev.sh

`run_dev.sh` prepares a base Docker image and mounts your target workspace into the running container. The Docker image is assembled by parsing a period-delimited image key into matching Dockerfiles and building each one in a sequence. For example, an image key of `first.second.third` could match {`Dockerfile.first`, `Dockerfile.second`, `Dockerfile.third`} where `run_dev.sh` will build the image for `Dockerfile.first`, then feed that image as the base image while building `Dockerfile.second` and so on. The file matching looks for the largest subsequence, so `first.second.third` could also match {`Dockerfile.first.second`, `Dockerfile.third`} depending on which files exist in the search paths. Using this pattern, you can add your own layers on top of the base images provided in Isaac ROS to setup your environment your way, such as installing additional packages to use.

If you write a file with the name `.isaac_ros_common-config` in the same directory as the `run_dev.sh`, you can configure the development environment. The following keys can be configured in `.isaac_ros_common-config`:

| Key | Type | Description | Examples |
| --------------------------- | -------------------- | ----------------------------------------------------------- | -------------------------------------- |
| `CONFIG_IMAGE_KEY` | String | Image key with period-delimited components | `humble.nav2.realsense` <br/> `humble` |
| `CONFIG_DOCKER_SEARCH_DIRS` | Bash array of string | List of directories to search for Dockerfiles when matching | `($HOME/ros_ws/docker $HOME/docker)` |

| Key | Type | Description | Examples |
| --------------------------- | -------------------- | ----------------------------------------------------------- | ------------------------------------- |
| `CONFIG_IMAGE_KEY` | String | Image key with period-delimited components | `humble.nav2.realsense` <br> `humble` |
| `CONFIG_DOCKER_SEARCH_DIRS` | Bash array of string | List of directories to search for Dockerfiles when matching | `($HOME/ros_ws/docker $HOME/docker)` |

For example, suppose you had a directory structure as follows:
```

```log
workspaces/isaac_ros-dev
workspaces/isaac_ros-dev/ros_ws
workspaces/isaac_ros-dev/ros_ws/src
Expand All @@ -58,45 +60,48 @@ COPY myfile.txt /myfile.txt
... more steps ...
```

You could extend the base image launched as a container by `run_dev.sh` as follows.
You could extend the base image launched as a container by `run_dev.sh` as follows.

`workspaces/isaac_ros-dev/ros_ws/src/isaac_ros_common/scripts/.isaac_ros_common-config`
```

```vim
CONFIG_IMAGE_KEY="humble.nav2.mine"
CONFIG_DOCKER_SEARCH_DIRS=(workspaces/isaac_ros-dev/ros_ws/docker)
```

This configures the image key to match with `mine` included and where to look first for the Dockerfiles before the default.

## Table of Contents

- [Isaac ROS Common](#isaac-ros-common)
- [Overview](#overview)
- [Docker Development Scripts](#docker-development-scripts)
- [Configuring run_dev.sh](#configuring-run_devsh)
- [Table of Contents](#table-of-contents)
- [Latest Update](#latest-update)
- [Supported Platforms](#supported-platforms)
- [Updates](#updates)
- [Updates](#updates)

## Latest Update
Update 2022-08-31: Update to be compatible with JetPack 5.0.2

Update 2022-10-19: Minor updates and bugfixes

## Supported Platforms

This package is designed and tested to be compatible with ROS2 Humble running on [Jetson](https://developer.nvidia.com/embedded-computing) or an x86_64 system with an NVIDIA GPU.

> **Note**: Versions of ROS2 earlier than Humble are **not** supported. This package depends on specific ROS2 implementation features that were only introduced beginning with the Humble release.
| Platform | Hardware | Software | Notes |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Jetson | [Jetson Orin](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/) <br> [Jetson Xavier](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-agx-xavier/) | [JetPack 5.0.2](https://developer.nvidia.com/embedded/jetpack) | For best performance, ensure that [power settings](https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/SD/PlatformPowerAndPerformance.html) are configured appropriately. |
| x86_64 | NVIDIA GPU | [Ubuntu 20.04+](https://releases.ubuntu.com/20.04/) <br> [CUDA 11.6.1+](https://developer.nvidia.com/cuda-downloads) |

| Platform | Hardware | Software | Notes |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Jetson | [Jetson Orin](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/)<br/>[Jetson Xavier](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-agx-xavier/) | [JetPack 5.0.2](https://developer.nvidia.com/embedded/jetpack) | For best performance, ensure that [power settings](https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/SD/PlatformPowerAndPerformance.html) are configured appropriately. |
| x86_64 | NVIDIA GPU | [Ubuntu 20.04+](https://releases.ubuntu.com/20.04/) <br> [CUDA 11.6.1+](https://developer.nvidia.com/cuda-downloads) |


# Updates
## Updates

| Date | Changes |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 2022-10-19 | Minor updates and bugfixes |
| 2022-08-31 | Update to be compatible with JetPack 5.0.2 |
| 2022-06-30 | Support ROS2 Humble and miscellaneous bug fixes. |
| 2022-06-16 | Update `run_dev.sh` and removed `isaac_ros_nvengine` |
Expand Down
4 changes: 4 additions & 0 deletions docker/Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,7 @@ RUN apt-get update && apt-get install -y --only-upgrade \
# Downgrade protobuf
RUN python3 -m pip install \
protobuf==3.20.1

# GPU usage monitoring on Jetson
RUN python3 -m pip install -U \
jetson-stats
2 changes: 1 addition & 1 deletion docker/Dockerfile.aarch64.humble.nav2
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.

FROM nvcr.io/nvidia/isaac/ros:aarch64-humble-nav2_35120f31b84976ec36009722e16f1524
FROM nvcr.io/nvidia/isaac/ros:aarch64-humble-nav2_6dfaf7adbe190f1181c3a0a2f2418760
18 changes: 7 additions & 11 deletions docker/Dockerfile.humble
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ RUN mkdir -p ${ROS_ROOT}/src && \
> ros2.${ROS_DISTRO}.ros_base.rosinstall && \
cat ros2.${ROS_DISTRO}.ros_base.rosinstall && \
vcs import src < ros2.${ROS_DISTRO}.ros_base.rosinstall && \
rm ${ROS_ROOT}/*.rosinstall

# Install dependencies using rosdep
RUN cd ${ROS_ROOT} \
rm ${ROS_ROOT}/*.rosinstall && \
cd ${ROS_ROOT} \
&& apt-get update \
&& rosdep init \
&& rosdep update \
Expand All @@ -119,13 +117,11 @@ RUN cd ${ROS_ROOT} \
--rosdistro ${ROS_DISTRO} \
--skip-keys "fastcdr rti-connext-dds-6.0.1 rti-connext-dds-5.3.1 urdfdom_headers libopencv-dev libopencv-contrib-dev libopencv-imgproc-dev python-opencv python3-opencv" \
&& rm -Rf /var/lib/apt/lists/* \
&& apt-get clean

# Build ROS2 source
RUN cd ${ROS_ROOT} \
&& colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo --packages-up-to behaviortree_cpp_v3 \
&& colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo \
&& rm -Rf src build log
&& apt-get clean && \
cd ${ROS_ROOT} \
&& colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo --packages-up-to behaviortree_cpp_v3 \
&& colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo \
&& rm -Rf src build log

# Alias setup.bash for consistency with pre-built binary installations of ROS2
RUN echo "source /opt/ros/${ROS_DISTRO}/install/setup.bash ; export ROS_DISTRO=${ROS_DISTRO}" > /opt/ros/${ROS_DISTRO}/setup.bash
Expand Down
10 changes: 10 additions & 0 deletions docker/Dockerfile.realsense
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Dockerfile for setting up Realsense driver
# https://github.com/jetsonhacks/installRealSenseSDK
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

COPY scripts/build-librealsense.sh /opt/realsense/build-librealsense.sh
COPY scripts/install-realsense-dependencies.sh /opt/realsense/install-realsense-dependencies.sh

RUN chmod +x /opt/realsense/install-realsense-dependencies.sh && /opt/realsense/install-realsense-dependencies.sh
RUN chmod +x /opt/realsense/build-librealsense.sh && /opt/realsense/build-librealsense.sh
13 changes: 12 additions & 1 deletion docker/Dockerfile.x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# Docker file to build on x86_64
# https://docs.nvidia.com/deeplearning/frameworks/user-guide/index.html
ARG BASE_IMAGE=nvcr.io/nvidia/tritonserver:22.03-py3
ARG BASE_IMAGE=nvcr.io/nvidia/tritonserver:22.08-py3
FROM ${BASE_IMAGE}

# disable terminal interaction for apt
Expand Down Expand Up @@ -177,3 +177,14 @@ RUN apt-get update && apt-get install -y --only-upgrade \
# Downgrade protobuf
RUN python3 -m pip install \
protobuf==3.20.1

# GPU usage monitoring on x86
RUN python3 -m pip install \
gpustat==0.6.0

# Python3 (PIP)
RUN python3 -m pip install -U \
mailcap-fix

# Resolve vulnerability in mailcap.py by removing it (CVE-2015-20107)
RUN rm -f /opt/tritonserver/backends/dali/conda/envs/dalienv/lib/python3.8/mailcap.py
2 changes: 1 addition & 1 deletion docker/Dockerfile.x86_64.humble.nav2
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.

FROM nvcr.io/nvidia/isaac/ros:x86_64-humble-nav2_53c4c553a22864a0675e9b05bb7cf19b
FROM nvcr.io/nvidia/isaac/ros:x86_64-humble-nav2_5bd606e569673db8cb1f78f393a5c46b
2 changes: 0 additions & 2 deletions docker/realsense-dockerfile-example/.isaac_ros_common-config

This file was deleted.

10 changes: 0 additions & 10 deletions docker/realsense-dockerfile-example/Dockerfile.realsense

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ USE_CUDA=true

function usage ()
{
echo "Usage: ./buildLibrealsense.sh [-n | -no_cuda] [-v | -version <version>] [-j | --jobs <number of jobs>] [-h | --help] "
echo "Usage: ./build-librealsense.sh [-n | -no_cuda] [-v | -version <version>] [-j | --jobs <number of jobs>] [-h | --help] "
echo "-n | --no_cuda Build with no CUDA (Defaults to with CUDA)"
echo "-v | --version Version of librealsense to build
(defaults to latest release)"
Expand All @@ -21,7 +21,7 @@ function usage ()
exit 2
}

PARSED_ARGUMENTS=$(getopt -a -n buildLibrealsense.sh -o nv:j:h --longoptions version:,no_cuda,jobs:,help -- "$@" )
PARSED_ARGUMENTS=$(getopt -a -n build-librealsense.sh -o nv:j:h --longoptions version:,no_cuda,jobs:,help -- "$@" )
VALID_ARGUMENTS=$?

if [ "$VALID_ARGUMENTS" != "0" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# installDependencies.sh
# install-realsense-dependencies.sh
# Install dependencies for the Intel Realsense library librealsense2 on a Jetson Nano Developer Kit
# Copyright (c) 2016-19 Jetsonhacks
# MIT License
Expand All @@ -21,4 +21,4 @@ apt-get install libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev -y
apt-get install qtcreator -y

# Add Python 3 support
apt-get install -y python3 python3-dev
apt-get install -y python3 python3-dev
22 changes: 17 additions & 5 deletions docs/camera-calibration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
> **Note:** These instructions are specifically for a monocular camera. To calibrate a stereoscopic camera, please follow [these instructions](http://wiki.ros.org/camera_calibration).
1. Set up your development environment by following the instructions [here](./dev-env-setup.md).
2. Print a large checkerboard with known dimensions.
2. Print a large checkerboard with known dimensions.

This tutorial uses a 6x8 checkerboard with 200mm squares. Calibration uses the interior vertex points of the checkerboard, so a “7x9” board uses the interior vertex parameter “6x8” as in the example below. Checkerboards with specific dimensions can be downloaded [here](https://calib.io/pages/camera-calibration-pattern-generator).
3. Clone the ROS2 `usb_cam` package:
3. Clone the ROS2 `usb_cam` package:

```bash
cd ~/workspaces/isaac_ros-dev/src && \
git clone -b ros2 https://github.com/ros-drivers/usb_cam
Expand All @@ -15,41 +16,52 @@
> **Note:** Your camera vendor may offer a specific ROS2-compatible camera driver package that can be used in place of the `usb_cam` package.

4. Launch the Docker container using the `run_dev.sh` script:

```bash
cd ~/workspaces/isaac_ros-dev/src/isaac_ros_common && \
./scripts/run_dev.sh
```

5. Inside the container, build and source the workspace:

```bash
cd /workspaces/isaac_ros-dev && \
colcon build --symlink-install && \
source install/setup.bash
```

6. Run the `usb_cam` image publisher:

```bash
ros2 run usb_cam usb_cam_node_exe --remap __ns:=/my_camera --ros-args -p framerate:=30.0 -p image_height:=720 -p image_width:=1280
```

7. Attach another terminal to the Docker container using the `run_dev.sh` script:

```bash
cd ~/workspaces/isaac_ros-dev/src/isaac_ros_common && \
./scripts/run_dev.sh
```

8. Run the camera calibrator:

```bash
ros2 run camera_calibration cameracalibrator --size 6x8 --square 0.20 image:=/my_camera/image_raw camera:=/my_camera
```
9. Complete steps 6-8 from [this tutorial](https://navigation.ros.org/tutorials/docs/camera_calibration.html).
10. Make sure you press **Calibrate** and then the **Save** button.

9. Complete steps 6-8 from [this tutorial](https://navigation.ros.org/tutorials/docs/camera_calibration.html).
10. Make sure you press **Calibrate** and then the **Save** button.

You should see the following line in the second terminal:

```bash
('Wrote calibration data to', '/tmp/calibrationdata.tar.gz')
```

The calibration file will be stored at `/tmp/calibrationdata.tar.gz`.
10. Once the calibration file has been saved, enter `Ctrl+C` in each terminal to stop the nodes.
11. Once the calibration file has been saved, enter `Ctrl+C` in each terminal to stop the nodes.
12. Move the calibration file to the required location

```bash
cd /workspaces/isaac_ros-dev/src/<isaac_ros_metapackage>/<isaac_ros_package>/config/ && \
tar -xvf /tmp/calibrationdata.tar.gz -C ./ ost.yaml && \
Expand Down
Loading

0 comments on commit 4c6309b

Please sign in to comment.