Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
46e0f2b
Update Docker build configuration for Jetson support
GerdsenAI-Admin Jan 30, 2026
97cfc16
Enhance test suite with ROS2 availability detection and new test cases
GerdsenAI-Admin Jan 30, 2026
8c0b4be
Update model catalog and parameters
GerdsenAI-Admin Jan 30, 2026
6de1bc7
Update gitignore rules to exclude IDE and temporary files
GerdsenAI-Admin Jan 30, 2026
f85934b
Update documentation and changelog with latest changes
GerdsenAI-Admin Jan 30, 2026
9b2c5c2
Update CLAUDE.md with specialized agent instructions and Jetson deplo…
GerdsenAI-Admin Jan 30, 2026
25c1709
Update Docker configuration for Jetson deployment
GerdsenAI-Admin Jan 30, 2026
8770d1d
Fix PyTorch CUDA support for Jetson builds
GerdsenAI-Admin Jan 30, 2026
100932e
Add Jetson platform detection module for hardware identification
GerdsenAI-Admin Jan 30, 2026
f88262f
Add TODO.md for task tracking
GerdsenAI-Admin Jan 30, 2026
6c77d91
Update CHANGELOG.md with recent changes (v0.1.0)
GerdsenAI-Admin Jan 30, 2026
03d0554
Update model catalog with VRAM requirements and platform recommendations
GerdsenAI-Admin Jan 30, 2026
8fde2f8
Enhance model setup script with interactive selection and Jetson support
GerdsenAI-Admin Jan 30, 2026
0888973
Update TensorRT conversion script with improved error handling and paths
GerdsenAI-Admin Jan 30, 2026
38c5935
Optimize inference implementation for better performance
GerdsenAI-Admin Jan 30, 2026
6416476
Add script to build TensorRT engine from ONNX
GerdsenAI-Admin Jan 30, 2026
8fa5eca
Add example script for TensorRT optimization
GerdsenAI-Admin Jan 30, 2026
d8f7e15
Optimize ROS2 node implementation
GerdsenAI-Admin Jan 30, 2026
9ea5c95
Update Dockerfile and add TensorRT optimization documentation
GerdsenAI-Admin Jan 30, 2026
fb28f03
Update optimization guide and Docker entrypoint script
GerdsenAI-Admin Jan 30, 2026
75dcd1e
Update optimization guide and docker-compose configuration
GerdsenAI-Admin Jan 30, 2026
6b25d7b
Update Dockerfile: enhance Jetson build process and add verification …
GerdsenAI-Admin Jan 30, 2026
7c649f5
Update TODO list and TensorRT optimization plan
GerdsenAI-Admin Jan 30, 2026
ae9d591
Update Dockerfile, model catalog, and TensorRT build script
GerdsenAI-Admin Jan 30, 2026
8afc6a0
Update Dockerfile, Jetson detector, and TensorRT build script
GerdsenAI-Admin Jan 30, 2026
bdc3434
Update Dockerfile, Jetson detector, build script, and optimization plan
GerdsenAI-Admin Jan 30, 2026
f6ff468
Fix linting errors in build_tensorrt_engine.py
GerdsenAI-Admin Jan 30, 2026
02bda00
Update Dockerfile and standard inference script
GerdsenAI-Admin Jan 31, 2026
55ef1b5
Update TODO.md with project audit and roadmap
GerdsenAI-Admin Jan 31, 2026
e46b8a1
Document TensorRT opset incompatibility and performance baseline
GerdsenAI-Admin Jan 31, 2026
14842cb
Add deployment guide and performance baselines documentation
GerdsenAI-Admin Jan 31, 2026
fe22f4d
Upgrade to L4T r36.4.0 (TensorRT 10.3) to resolve DINOv2 compatibility
GerdsenAI-Admin Jan 31, 2026
dd68520
Streamline TODO.md and add TRT 10.3 host validation script
GerdsenAI-Admin Jan 31, 2026
a8fdc46
Fix f-string linting and update docs
GerdsenAI-Admin Jan 31, 2026
4b32979
Update trtexec workspace flag for TensorRT 10.x compatibility
GerdsenAI-Admin Jan 31, 2026
9f7f48d
Update TRT host validation script
GerdsenAI-Admin Jan 31, 2026
faaec99
Update TRT host validation script with workspace flag fix
GerdsenAI-Admin Jan 31, 2026
5361213
Update Dockerfile to L4T r36.4.0 base for TensorRT 10.3 support
GerdsenAI-Admin Jan 31, 2026
7f28923
Update optimization guide with TRT 10.3 findings
GerdsenAI-Admin Jan 31, 2026
16aa07a
Update README with latest L4T requirement
GerdsenAI-Admin Jan 31, 2026
090280a
Update TODO roadmap with L4T r36.4.0 plan
GerdsenAI-Admin Jan 31, 2026
7a15c5f
Update CHANGELOG with TRT 10.3 host validation results
GerdsenAI-Admin Jan 31, 2026
803d8df
Update docs/BASELINES.md
GerdsenAI-Admin Jan 31, 2026
889684c
Update docker-compose.yml with TRT 10.3 path mapping
GerdsenAI-Admin Jan 31, 2026
c22b9aa
Update docker/README.md with L4T r36.4.0 instructions
GerdsenAI-Admin Jan 31, 2026
90d7be9
Update roadmap with TensorRT 10.3 validation results and deployment plan
GerdsenAI-Admin Jan 31, 2026
f931374
Update docker-compose.yml with host TRT and engine mounts
GerdsenAI-Admin Jan 31, 2026
90990e3
Add automated Jetson deployment script using host TensorRT
GerdsenAI-Admin Jan 31, 2026
88aeafa
Add Jetson deployment guide
GerdsenAI-Admin Jan 31, 2026
11e0f32
Update roadmap with Host-Container split architecture plan
GerdsenAI-Admin Jan 31, 2026
7696878
Update README with latest optimization status
GerdsenAI-Admin Jan 31, 2026
148f382
Add host-side TensorRT inference service
GerdsenAI-Admin Jan 31, 2026
e03b557
Update inference module to support shared memory communication
GerdsenAI-Admin Jan 31, 2026
b7aaf2c
Normalize line endings for deploy script
GerdsenAI-Admin Jan 31, 2026
1884580
Normalize line endings for deployment guide
GerdsenAI-Admin Jan 31, 2026
abf19b6
Normalize line endings for docker-compose
GerdsenAI-Admin Jan 31, 2026
e850cc9
Update Dockerfile
GerdsenAI-Admin Jan 31, 2026
d75b079
Update README
GerdsenAI-Admin Jan 31, 2026
e59bd47
Update docker README
GerdsenAI-Admin Jan 31, 2026
d51e3f9
Add performance monitoring script
GerdsenAI-Admin Jan 31, 2026
afc8fa0
Update README with Host-Container split architecture details
GerdsenAI-Admin Jan 31, 2026
cef4171
Update performance baselines
GerdsenAI-Admin Jan 31, 2026
2f597d8
Update Jetson deployment guide
GerdsenAI-Admin Jan 31, 2026
7603bc3
Update utils module
GerdsenAI-Admin Jan 31, 2026
bf426c5
Update host TRT service
GerdsenAI-Admin Jan 31, 2026
213abfb
Add demo script
GerdsenAI-Admin Jan 31, 2026
4841fb0
Add camera detection script
GerdsenAI-Admin Jan 31, 2026
79c3910
Remove legacy convert_to_tensorrt.py script
GerdsenAI-Admin Jan 31, 2026
f166490
Add demo launch file
GerdsenAI-Admin Feb 1, 2026
40880bd
Add DA3 Demo desktop shortcut
GerdsenAI-Admin Feb 1, 2026
7e1b4c3
Add DA3 Monitor desktop shortcut
GerdsenAI-Admin Feb 1, 2026
51cd2d0
Add DA3 Rviz desktop shortcut
GerdsenAI-Admin Feb 1, 2026
594b0ef
Add desktop shortcuts installation script
GerdsenAI-Admin Feb 1, 2026
7bfc120
Add .claude directory to gitignore
Feb 1, 2026
e6b9336
Add dependency installation script for first-time setup
Feb 1, 2026
d6fbe0c
Add full RViz demo script with multi-terminal support
Feb 1, 2026
66abbb4
Update README with Quick Install section and demo documentation
Feb 1, 2026
abcae12
Add sample images for testing and demo
Feb 1, 2026
984a349
Merge remote changes from GitHub
GerdsenAI-Admin Feb 1, 2026
b0dde87
Update Dockerfile
GerdsenAI-Admin Feb 1, 2026
998d292
Update install_dependencies.sh
GerdsenAI-Admin Feb 1, 2026
9b570c7
Update test_with_images.py
GerdsenAI-Admin Feb 1, 2026
51c97e9
Update install_dependencies.sh with line endings fix
GerdsenAI-Admin Feb 1, 2026
94c35cb
update
GerdsenAI-Admin Feb 1, 2026
ccfa20d
Add CLAUDE.md to .gitignore
Feb 1, 2026
3aad801
Improve Docker documentation and scripts - Add docker group membershi…
Feb 1, 2026
293e23c
Fix Windows line endings in Dockerfile build - Add sed command to con…
Feb 1, 2026
e0f6f53
Fix DA3 model loading to use registry pattern - Use depth_anything_3 …
Feb 1, 2026
6fc3e9b
Add Docker prerequisites section - Document adding user to docker group
Feb 1, 2026
3cefe72
Fix demo.sh for Jetson containers - Add docker group membership check…
Feb 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ huggingface/

# Logs
*.log

nul


# Claude AI
.claude/
CLAUDE.md
120 changes: 120 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Changelog

## [Unreleased] - 2026-01-31

### TensorRT 10.3 Validation - Phase 1 Complete

- **TensorRT 10.3 Performance Validated**:
- Platform: Jetson Orin NX 16GB
- Model: DA3-SMALL at 518x518 FP16
- Throughput: 35.3 FPS
- GPU Latency: 26.4ms median (25.5ms min)
- Engine Size: 58MB
- Speedup: 6.8x over PyTorch baseline (~5.2 FPS)
- Test Date: 2026-01-31
- Validation: Host script `scripts/test_trt10.3_host.sh`

### Critical Findings (Resolved)

- **TensorRT 8.6 Fundamentally Incompatible with DA3**:
- Root cause: DINOv2 backbone exports Einsum operations unsupported by TRT 8.6
- Error: "caskConvolutionV2Forward could not find any supported formats"
- NVIDIA GitHub Issue #4537 confirms DINOv2 failures persist until TRT 10.8+
- Workarounds (opset 17 re-export, graph surgery) not viable
- **Solution Validated:** Docker base image L4T r36.4.0 (TensorRT 10.3)
- Full analysis: `docs/TENSORRT_DA3_PLAN.md`

### Docker Base Image Update

- **Updated Jetson base image to L4T r36.4.0**:
- Previous: `dustynv/ros:humble-ros-base-l4t-r36.2.0` (TensorRT 8.6.2)
- Current: `dustynv/ros:humble-pytorch-l4t-r36.4.0` (TensorRT 10.3)
- Benefits: Full DINOv2/ViT support, validated 6.8x speedup
- TRT 10.x syntax: `--memPoolSize=workspace:2048MiB`
- ONNX 5D input: `pixel_values:1x1x3x518x518`

### Performance Baseline

- **Measured on Jetson Orin NX 16GB** (JetPack 6.0, L4T r36.2.0, CUDA 12.2):
- Model: DA3-SMALL (PyTorch, FP32)
- Resolution: 518x518
- Inference Time: ~193ms per frame
- FPS: ~5.2 FPS

### Added

- **Jetson Hardware Detection** (`depth_anything_3_ros2/jetson_detector.py`):
- Platform detection for Jetson modules (Orin AGX, Orin NX, Orin Nano, Xavier AGX, Xavier NX)
- GPU memory and VRAM detection
- JetPack and L4T version detection
- CUDA availability checking

- **Model Setup System**:
- `config/model_catalog.yaml`: Model catalog with VRAM requirements and platform recommendations
- `scripts/setup_models.py`: Interactive model selection and download script
- Hardware-aware model recommendations based on detected platform

- **Dockerfile - Jetson Support**:
- `L4T_VERSION=r36.2.0` build argument
- New `jetson-base` stage using `dustynv/ros:humble-ros-base-l4t-${L4T_VERSION}`
- OpenCV 4.8.1 version verification check
- cv_bridge and image_geometry built from source (resolves OpenCV 4.8.1 vs 4.5.4 conflict)
- `-DBUILD_TESTING=OFF` flag for cv_bridge build (avoids ament_lint_auto dependency)
- PyTorch 2.3.0 via direct NVIDIA wheel download (CUDA 12.2 support for L4T r36.2.0)
- torchvision 0.18.0 compatible with PyTorch 2.3.0
- OpenMPI and OpenBLAS runtime dependencies for PyTorch on ARM64
- Depth Anything 3 installation with `--no-deps` flag (avoids pycolmap/open3d ARM64 build failures)
- Windows line ending fix (`sed -i 's/\r$//'`) for ros_entrypoint.sh
- Model download at build time via `DOWNLOAD_MODELS_AT_BUILD` and `INSTALL_MODELS` args

- **docker-compose.yml**:
- New `depth-anything-3-jetson` service with `BUILD_TYPE: jetson-base`
- Enhanced GPU access configuration with nvidia-container-runtime

- **Tests**:
- `test/__init__.py`: Package marker for test directory
- `test/conftest.py`: Shared fixtures and ROS2 availability detection
- `test/test_jetson_detector.py`: Unit tests for Jetson hardware detection
- Updated `test/test_node.py` with conditional imports and skipif decorators
- Updated `test/test_generic_camera.py` with graceful ROS2 module handling

- **.gitignore**:
- Added `CLAUDE.md`, `nul`, `.claude/settings.local.json`
- Line ending rules (`eol=lf`) for shell scripts

### Fixed

- **PyTorch CUDA Support on Jetson**:
- Changed from cu126 index to direct NVIDIA wheel (cu122 for L4T r36.2.0)
- Added libopenmpi3 and libopenblas0 to both builder and runtime stages
- `torch.cuda.is_available()` now returns `True` in container

- **cv_bridge OpenCV Conflict**:
- ROS Humble apt packages expect OpenCV 4.5.4
- dustynv base image ships with OpenCV 4.8.1 (CUDA-enabled)
- Solution: Build cv_bridge from source against existing OpenCV 4.8.1

- **ARM64 Python Package Dependencies**:
- pycolmap and open3d lack ARM64 wheels
- Solution: Install Depth Anything 3 with `--no-deps`, manually install required inference dependencies
- Runtime patch: api.py patched at container startup to handle missing pycolmap/evo imports

- **torchvision Source Build Required**:
- NVIDIA PyTorch wheel has ABI mismatch with pip torchvision
- NMS operator crashes at runtime with pip-installed torchvision
- Solution: Build torchvision 0.18.0 from source against NVIDIA PyTorch wheel

- **Windows CRLF Line Endings**:
- ros_entrypoint.sh fails with CRLF line endings on Windows-cloned repos
- Solution: Added `sed -i 's/\r$//'` in Dockerfile for entrypoint scripts

- **Test Collection Failures (Issue #21)**:
- Tests failed when ROS2 environment not sourced
- Solution: Added ROS2 availability detection and pytest skipif decorators

### Changed

- **Dockerfile**:
- Base image for Jetson changed from `nvcr.io/nvidia/l4t-ros` to `dustynv/ros` (no NGC auth required)
- PyTorch installation method changed from pip index to direct wheel download
- cv_bridge installation changed from apt to source build
144 changes: 144 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# CLAUDE.md

## Always offer to pull down issues with Github CLI, address issues before beginning

## DO NOT MAKE ANY COMMITS, USER WILL MAKE COMMITS

## Always see if there are specialized agents to helps with tasks and troubleshooting, orchestrate agents to work together

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Build & Development Commands

```bash
# Build the package
colcon build --packages-select depth_anything_3_ros2

# Run tests
colcon test --packages-select depth_anything_3_ros2
colcon test-result --verbose

# Run a single test file
python3 -m pytest test/test_inference.py -v

# Lint and format
flake8 depth_anything_3_ros2/
black --check depth_anything_3_ros2/
black depth_anything_3_ros2/ # auto-format

# Launch with USB camera
ros2 launch depth_anything_3_ros2 depth_anything_3.launch.py image_topic:=/camera/image_raw

# Docker (GPU)
docker-compose up -d depth-anything-3-gpu

# Deploy to Jetson (via SCP)
scp -r . gerdsenai@10.69.7.112:~/depth_anything_3_ros2/
```

## Architecture

This is a ROS2 Humble wrapper for ByteDance's Depth Anything 3 monocular depth estimation, targeting >30 FPS on NVIDIA Jetson Orin AGX.

### 3-Layer Design
- **Node Layer** (`depth_anything_3_node.py`, `*_optimized.py`): ROS2 interface, parameter handling, topic management
- **Inference Layer** (`da3_inference.py`, `*_optimized.py`): Model loading via HuggingFace, CUDA/CPU inference
- **Utility Layer** (`utils.py`, `gpu_utils.py`): Depth processing, colorization, GPU acceleration

### Dual Implementation Pattern
- Standard nodes: Baseline functionality
- Optimized nodes (`*_optimized.py`): TensorRT, async processing, >30 FPS target
- Both expose identical ROS2 interfaces - changes to one should be reflected in the other

### Inference Wrapper Return Format
```python
{'depth': np.ndarray, # (H, W) float32
'confidence': np.ndarray, # (H, W) float32, optional
'camera_params': dict} # optional
```

## Critical Design Principles

### Camera-Agnostic Design (Non-Negotiable)
- NEVER add camera-specific logic to core modules
- Camera integration ONLY via topic remapping and example launch files in `launch/examples/`
- All cameras work through standard `sensor_msgs/Image` interface

### ROS2 Patterns
- Use relative topic names with `~` prefix (e.g., `~/depth`, `~/image_raw`)
- BEST_EFFORT QoS for image subscribers (allows frame drops)
- Declare all parameters in node constructor

## Coding Standards

- **No emojis** - Forbidden in code, comments, docstrings, logs, and commits
- **Line length**: 88 characters (Black formatter)
- **Docstrings**: Google-style with type hints on all functions
- **Naming**: `PascalCase` classes, `snake_case` functions, `_private_methods`, `UPPER_SNAKE_CASE` constants

## Testing

Tests use mocked DA3 model (doesn't require GPU):
- `test/test_inference.py` - Unit tests for inference wrapper
- `test/test_node.py` - Integration tests for ROS2 node
- `test/test_generic_camera.py` - Camera-agnostic functionality

## Key Files

- `package.xml`, `setup.py` - ROS2 ament_python package config
- `launch/depth_anything_3.launch.py` - Main launch file with 13 configurable arguments
- `config/params.yaml` - Default parameters
- `.github/copilot-instructions.md` - Extended AI coding guidelines

## Specialized Agents

This repository includes specialized agents in `.claude/agents/`. Use them proactively for domain-specific tasks.

### Available Agents

| Agent | Domain | Use When |
|-------|--------|----------|
| `jetson-expert` | Hardware | Module selection, flashing, BSP, carrier boards, GPIO/CSI, thermal, boot issues |
| `nvidia-expert` | Software | CUDA, TensorRT, DeepStream, Isaac ROS, containers, profiling, PyTorch/TensorFlow |

### Agent Selection Guide

**Hardware questions** -> `jetson-expert`:
- "Which Jetson module should I use?"
- "How do I flash JetPack 6.x?"
- "Camera not detected on CSI port"
- "Thermal throttling issues"
- "Carrier board GPIO configuration"
- "Boot hangs after flashing"
- "Device tree or pinmux setup"

**Software questions** -> `nvidia-expert`:
- "How do I convert ONNX to TensorRT?"
- "Optimize inference performance"
- "DeepStream pipeline design"
- "Isaac ROS node optimization"
- "CUDA memory management"
- "Container can't access GPU"
- "INT8 calibration for TensorRT"

### Multi-Agent Scenarios

Some issues require both agents working together:

| Scenario | Primary Agent | Secondary Agent | Reason |
|----------|---------------|-----------------|--------|
| Slow inference on Orin NX | `nvidia-expert` | `jetson-expert` | Software first, then check thermal/power |
| Container can't access GPU | `nvidia-expert` | `jetson-expert` | Runtime config first, then driver/L4T check |
| CSI camera not detected | `jetson-expert` | - | Hardware/device tree issue |
| TensorRT build fails | `nvidia-expert` | - | Software/model issue |
| JetPack 6.x upgrade | `jetson-expert` | `nvidia-expert` | Flash first, then container compatibility |
| Performance varies wildly | `nvidia-expert` | `jetson-expert` | Profile first, then check thermal throttling |

### Proactive Agent Usage

ALWAYS consider using specialized agents when:
1. User mentions Jetson hardware or deployment -> Consider `jetson-expert`
2. User asks about AI/ML optimization -> Consider `nvidia-expert`
3. Troubleshooting involves both HW and SW -> Use both agents sequentially
4. Task is outside ROS2/Python expertise -> Use appropriate agent
5. Performance issues arise -> Start with `nvidia-expert`, escalate to `jetson-expert` if thermal
Loading
Loading