-
Notifications
You must be signed in to change notification settings - Fork 5
Add docker build for robotic ultrasound #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2d4680f
Add docker build for robotic ultrasound
mingxin-zheng d45a0c8
add xhost
mingxin-zheng f5b085c
update
mingxin-zheng 29c9d21
fix whitespace
mingxin-zheng 3c62696
copyright
mingxin-zheng 19deb76
fix
mingxin-zheng 1b69934
Merge branch 'main' into mz/docker_robotus
mingxin-zheng aad1e21
Merge branch 'main' into mz/docker_robotus
mingxin-zheng d68631a
fix
mingxin-zheng 87fd687
fix doc
mingxin-zheng 10c8e01
fix typo
mingxin-zheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/bash | ||
|
|
||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
|
|
||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| set -e | ||
|
|
||
| # Get the parent directory of the current script | ||
| PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)" | ||
|
|
||
| # Allow setting the python in PYTHON_EXECUTABLE | ||
| PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE:-python} | ||
|
|
||
| LEROBOT_DIR=${1:-$PROJECT_ROOT/third_party/lerobot} | ||
|
|
||
| echo "Installing lerobot..." | ||
| git clone https://github.com/huggingface/lerobot.git $LEROBOT_DIR | ||
| pushd $LEROBOT_DIR | ||
| git checkout 6674e368249472c91382eb54bb8501c94c7f0c56 | ||
|
|
||
| # Update pyav dependency in pyproject.toml | ||
| sed -i 's/pyav/av/' pyproject.toml | ||
|
|
||
| $PYTHON_EXECUTABLE -m pip install -e . | ||
| popd | ||
|
|
||
| echo "Lerobot installed successfully!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # syntax=docker/dockerfile:1.4 | ||
|
|
||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
|
|
||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| FROM nvcr.io/nvidia/isaac-lab:2.0.2 | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| # Fix livestream public endpoint address issue in 2.0.2/2.1.0 | ||
| RUN sed -i '/--\/app\/livestream\/publicEndpointAddress=/d' /workspace/isaaclab/source/isaaclab/isaaclab/app/app_launcher.py | ||
|
|
||
| # Install uv using curl for openpi | ||
| RUN apt-get update && \ | ||
| apt-get install -y software-properties-common && \ | ||
| add-apt-repository ppa:ubuntu-toolchain-r/test && \ | ||
| apt-get update && \ | ||
| apt-get install -y \ | ||
| curl \ | ||
| openssh-client \ | ||
| cmake \ | ||
| wget \ | ||
| build-essential \ | ||
| pybind11-dev \ | ||
| lsb-release \ | ||
| libglib2.0-0 \ | ||
| libdbus-1-3 \ | ||
| libopengl0 \ | ||
| libxcb-keysyms1 \ | ||
| libxcb-cursor0 \ | ||
| ninja-build \ | ||
| libgl1-mesa-dev \ | ||
| ffmpeg \ | ||
| gcc-12 \ | ||
| g++-12 && \ | ||
| update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 && \ | ||
| update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 && \ | ||
| mkdir -p ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
|
|
||
| # Install CUDA 12.8 | ||
|
|
||
| WORKDIR /tmp | ||
|
|
||
| RUN apt-get update && \ | ||
| wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \ | ||
| dpkg -i cuda-keyring_1.1-1_all.deb && \ | ||
| apt-get update && \ | ||
| apt-get -y install cuda-toolkit-12-8 | ||
|
|
||
| ENV PATH=/usr/local/cuda-12.8/bin${PATH:+:${PATH}} | ||
| ENV LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | ||
|
|
||
| COPY tools/env_setup/install_lerobot.sh /tmp/env_setup/ | ||
| COPY tools/env_setup/install_pi0.sh /tmp/env_setup/ | ||
| COPY tools/env_setup/install_holoscan.sh /tmp/env_setup/ | ||
| COPY tools/env_setup/install_robotic_us_ext.sh /tmp/env_setup/ | ||
|
|
||
| COPY workflows/robotic_ultrasound/scripts /workspace/robotic_ultrasound/scripts | ||
|
|
||
| ENV PYTHON_EXECUTABLE=/workspace/isaaclab/_isaac_sim/python.sh | ||
|
|
||
| # # Set up the Simulation | ||
| RUN --mount=type=ssh \ | ||
| $PYTHON_EXECUTABLE -m pip install --no-deps \ | ||
| git+ssh://[email protected]/isaac-for-healthcare/i4h-asset-catalog.git@main && \ | ||
| $PYTHON_EXECUTABLE -m pip install \ | ||
| rti.connext==7.3.0 \ | ||
| pyrealsense2==2.55.1.6486 \ | ||
| toml==0.10.2 \ | ||
| dearpygui==2.0.0 \ | ||
| setuptools==75.8.0 \ | ||
| pydantic==2.10.6 | ||
|
|
||
| RUN mkdir -p /workspace/third_party | ||
|
|
||
| RUN /tmp/env_setup/install_robotic_us_ext.sh /workspace/robotic_ultrasound/scripts/simulation | ||
|
|
||
| RUN /tmp/env_setup/install_lerobot.sh /workspace/third_party/lerobot | ||
|
|
||
| RUN /tmp/env_setup/install_pi0.sh /workspace/third_party/openpi | ||
|
|
||
| RUN /tmp/env_setup/install_holoscan.sh /workspace/robotic_ultrasound/scripts/holoscan_apps | ||
|
|
||
| COPY tools/env_setup/install_cosmos_transfer1.sh /tmp/env_setup/ | ||
|
|
||
| COPY tools/env_setup/install_cudnn.sh /tmp/env_setup/ | ||
|
|
||
| RUN /tmp/env_setup/install_cudnn.sh | ||
|
|
||
| RUN --mount=type=ssh \ | ||
| /tmp/env_setup/install_cosmos_transfer1.sh /workspace/third_party/cosmos-transfer1 | ||
|
|
||
| WORKDIR /workspace/robotic_ultrasound/scripts | ||
|
|
||
| ENV PYTHONPATH=/workspace/robotic_ultrasound/scripts:/workspace/third_party/cosmos-transfer1 | ||
|
|
||
| ENV RTI_LICENSE_FILE=/root/rti/rti_license.dat | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Simulation LiveStream from Remote Docker Container | ||
|
|
||
| This document describes how to run the simulation in a remote docker container and stream the simulation to a local machine. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Please refer to [Livestream Clients Guide in Isaac Sim](https://docs.isaacsim.omniverse.nvidia.com/latest/installation/manual_livestream_clients.html#isaac-sim-short-webrtc-streaming-client) and download [Isaac Sim WebRTC Streamiing Client](https://docs.isaacsim.omniverse.nvidia.com/latest/installation/download.html#isaac-sim-latest-release) | ||
mingxin-zheng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Build Docker Image | ||
|
|
||
| To build the docker image, you will need to set up the SSH agent and add your SSH key to the agent, so that the docker build process can access the private repository. | ||
|
|
||
| ```bash | ||
| export DOCKER_BUILDKIT=1 | ||
| eval "$(ssh-agent -s)" | ||
| ssh-add ~/.ssh/id_ed25519 # Replace with your SSH key | ||
| docker build --ssh default -f workflows/robotic_ultrasound/docker/Dockerfile -t robot_us:latest . | ||
| ``` | ||
|
|
||
| ## Prepare the I4H Asset and RTI License Locally | ||
|
|
||
| Please refer to the [Environment Setup](../README.md#environment-setup) for instructions to prepare the I4H assets and RTI license locally. | ||
|
|
||
| The environment setup will create a directory `~/.cache/i4h-assets/<sha256>` containing the I4H assets, which will be mounted to the docker container. | ||
|
|
||
| The license file should also be copied to the `~/docker/rti` directory, which will be mounted to the docker container. | ||
|
|
||
| ## Run the Container | ||
|
|
||
| Since we need to run multiple instances (policy runner, simulation, etc.), we need to use `-d` to run the container in detached mode. | ||
|
|
||
| ```bash | ||
| xhost +local:docker | ||
| docker run --name isaac-sim --entrypoint bash -itd --runtime=nvidia --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \ | ||
| -e DISPLAY=$DISPLAY \ | ||
| -e "PRIVACY_CONSENT=Y" \ | ||
| -v /tmp/.X11-unix:/tmp/.X11-unix \ | ||
| -v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache:rw \ | ||
| -v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw \ | ||
| -v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw \ | ||
| -v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw \ | ||
| -v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw \ | ||
| -v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw \ | ||
| -v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \ | ||
| -v ~/docker/isaac-sim/documents:/root/Documents:rw \ | ||
| -v ~/.cache/i4h-assets:/root/.cache/i4h-assets:rw \ | ||
| -v ~/docker/rti:/root/rti:ro \ | ||
| robot_us:latest | ||
| ``` | ||
|
|
||
| ### Run Policy | ||
|
|
||
| ```bash | ||
| docker exec -it isaac-sim bash | ||
| # Inside the container, run the policy | ||
| docker exec -it isaac-sim bash -c "python policy_runner/run_policy.py" | ||
| ``` | ||
|
|
||
| The policy runner will be running in an environment managed by `uv` located in `/workspace/openpi/.venv`. | ||
|
|
||
| ### Run Simulation | ||
|
|
||
| ```bash | ||
| docker exec -it isaac-sim bash -c "python simulation/environments/sim_with_dds.py --enable_camera --livestream 2" | ||
| # Inside the container, run the simulation | ||
|
|
||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.