feat(docker): add Thor (Jetson) Docker image with inference + inference-ros targets#106
Open
kingb wants to merge 1 commit into
Open
feat(docker): add Thor (Jetson) Docker image with inference + inference-ros targets#106kingb wants to merge 1 commit into
kingb wants to merge 1 commit into
Conversation
…ce-ros targets Adds docker/thor/Dockerfile with two multi-stage parallel branches: - `inference`: no-ROS policy + unitree_sdk2. Smaller image for joystick/keyboard input or users bringing their own velocity source. - `inference-ros`: adds ros-jazzy-ros-base + rmw-cyclonedds-cpp for Ros2Input (subscribing to /cmd_vel from Nav2, for example). Layer ordering optimizes for cache hits on code edits: CUDA base → python-base → long-deps (NVPL/cuDSS/TensorRT) → common-deps (pinocchio/scipy/etc.) → app-deps (unitree wheel + COPY src) → terminal. Source is COPY'd last so day-to-day changes only rebuild the final layers. Platform: Jetson Thor, JetPack 7.1, Ubuntu 24.04 aarch64, CUDA 13. Base image: nvcr.io/nvidia/cuda:13.0.2-devel-ubuntu24.04. Includes: - docker/thor/compose.yaml — Docker Compose with runtime flags preset (--runtime nvidia, host net/ipc, --privileged, CycloneDDS env for the ROS target) - docker/thor/.env.example — MODEL_PATH override - docker/thor/README.md — build/run commands, layer diagram, troubleshooting - docker/thor/Makefile — scoped shortcuts: `make inference`, `make run-inference ARGS='...'` Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5a7033c to
56c70a2
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add
docker/thor/with two multi-stage parallel targets for runningholosoma_inferenceon Jetson Thor (JetPack 7.1, Ubuntu 24.04 Noble, CUDA 13, aarch64 SBSA):inferenceinference-rosRos2Input— subscribe to/cmd_velfrom any ROS publisher.Also adds
docker/thor/compose.yaml(with runtime flags + env preset),docker/thor/.env.example,docker/thor/README.md,docker/thor/Makefile(scoped:make inference,make inference-ros,make run-inference ARGS=...), anddocker/thor/scripts/run_*.shlaunch helpers for common input-mode combinations.Layer strategy
Stable → volatile, so code edits only rebuild the last layer:
The branches duplicate
long-deps→app-depsbecause ROS 2 install mutates apt state; heavy layers still cache independently per branch, so day-to-day code edits don't rebuild TensorRT or ROS install.DDS coexistence (
inference-rostarget)unitree_sdk2's pybind11 wheel bundles CycloneDDS 0.10.2, which is ABI-incompatible with Jazzy's CycloneDDS 0.10.5 (C++ template signatures changed —free(): invalid pointeron participant init). Fix:RMW_IMPLEMENTATION=rmw_fastrtps_cpp, set as image ENV default)./opt/venv/.../unitree_interface/toLD_LIBRARY_PATHafter sourcing ROS so Jazzy's libddsc doesn't hijack unitree's runtime lookup.Cross-vendor DDS interop (CycloneDDS publisher → FastDDS subscriber) is hardware-validated for
TwistStampedon/cmd_velwhen both sides are on the same ROS 2 distro (Jazzy-to-Jazzy tested). Seescripts/run_shuttle_publisher_cyclonedds.shfor the test.Base image / pinning
nvcr.io/nvidia/cuda:13.0.2-devel-ubuntu24.04(matches JetPack 7.1).packages.ros.org.unitree_sdk2:0.1.3viaARG UNITREE_SDK2_VERSION=0.1.3, fetched fromgithub.com/amazon-far/unitree_sdk2release assets.setup.pycp tag fix PR for native installs (Docker fetches the wheel directly, so technically not a blocker).Scope
Not included in this first pass:
pyzed— deferred; not needed for the blind-locomotion policy target.Known tradeoff: Python deps duplicated between Dockerfile and setup.py
The
common-depsstage duplicates theinstall_requireslist fromsrc/holosoma_inference/setup.pyverbatim. Intentional — buys layered caching so day-to-day code edits only invalidate the finalapp-depslayer (~seconds) instead of re-running pip install (~30-60 s on aarch64).setup.pyremains the source of truth; the Dockerfile comment calls this out as drift risk.Alternatives considered and rejected for v1:
uv pip install -e .[unitree,booster]in a single stage — simpler, but every code change re-installs ~20 packages.scripts/setup_inference_via_uv.shinside the build — same single-layer cache cost, plus the script does laptop-oriented things (Ubuntu detection,sudo nvpmodel, etc.) that don't apply in a container.Happy to switch if reviewers prefer single-source-of-truth over cache speed.
Test plan
docker build --target inferenceon Jetson Thor (aarch64 native) — builds cleanly.docker build --target inference-ros— builds cleanly.docker compose run --rm inference --help+inference-ros --helpboth startrun_policy.py, register policy configs, no import errors.run_joystick.sh(joystick+joystick) on real G1 — robot walks responsively.run_ros2_joystick.sh+run_shuttle_publisher.sh(both FastDDS) on real G1 — robot shuttles forward/back correctly.run_ros2_joystick.sh+ CycloneDDS-based shuttle publisher on real G1 — robot shuttles. Cross-vendor DDS works.Image sizes
inference: ~17.9 GB uncompressed (~6.85 GB compressed on disk).inference-ros: ~18.4 GB uncompressed (~6.95 GB compressed).Size is dominated by NVIDIA TensorRT runtime libs (~2.3 GB) and CUDA devel base — unavoidable for the platform.