feat(assets): integrate realistic 3d openusd assets, modular builder, and robot animator
This commit is contained in:
@@ -0,0 +1,195 @@
|
||||
# Implementation Report: Realistic 3D Asset Integration
|
||||
|
||||
**Warehouse Robot Fleet Digital Twin**
|
||||
**Subsystem**: NVIDIA Omniverse OpenUSD 3D Visualization
|
||||
**Platform**: Ubuntu 24.04 LTS | NVIDIA Omniverse Kit 110.4 | OpenUSD ASCII (`.usda`)
|
||||
|
||||
---
|
||||
|
||||
## 1. Assessment of Prior Implementation
|
||||
|
||||
Prior to this milestone, the warehouse 3D visualization relied on procedurally generated primitive cubes and cylinders (`WarehouseUSDGenerator` and `AnimatedUSDGenerator`):
|
||||
- Racks were represented by single extruded rectangular bounding boxes with solid colors.
|
||||
- Pallets and cargo cartons were simple monolithic blocks without structural detail.
|
||||
- Robots were represented by basic cuboids with small indicator prisms.
|
||||
- Architectural elements (walls, floors, columns) lacked structural framing, concrete slabs, dock doors, or safety bollards.
|
||||
- Stations and charging pads were flat rectangular plates.
|
||||
|
||||
While mathematically accurate and aligned with the NetworkX graph nodes, the visual appearance did not reflect a production-grade industrial facility.
|
||||
|
||||
### Preservation Guarantees
|
||||
The underlying discrete-event simulation engine, path planning, and spatial topology remain **100% preserved**:
|
||||
- **NetworkX Graph**: Grid nodes, edge lengths, traversal costs, and 4.0m wider aisles in Zone B remain the single source of truth.
|
||||
- **SimPy Discrete-Event Simulation**: Master clock, Poisson order generation, time-space conflict reservations, priority yielding, and opportunity charging operate identically.
|
||||
- **Strict Decoupling**: Simulation logic contains zero dependencies on visual meshes or rendering APIs.
|
||||
|
||||
---
|
||||
|
||||
## 2. Modular Architecture & Responsibilities
|
||||
|
||||
The visualization subsystem is structured into dedicated, decoupled modules under `src/warehouse_twin/visualization/`:
|
||||
|
||||
```
|
||||
src/warehouse_twin/visualization/
|
||||
├── __init__.py # Package exports
|
||||
├── asset_loader.py # Manifest resolution, validation, and USD referencing
|
||||
├── coordinate_mapper.py # Deterministic graph-to-world coordinate transformation
|
||||
├── materials.py # Industrial PBR UsdPreviewSurface shader library
|
||||
├── route_visualizer.py # Navigation highway corridor and lane visualizers
|
||||
├── warehouse_builder.py # Static 3D warehouse builder referencing modular assets
|
||||
├── robot_animator.py # Time-sampled kinematic track generator for 3D AMRs
|
||||
├── animated_usd.py # Legacy/primitive animation engine (preserved)
|
||||
└── trajectory_player.py # Continuous trajectory interpolation and playback state machine
|
||||
|
||||
assets/
|
||||
├── warehouse/
|
||||
│ ├── building_shell.usda # Concrete floor, perimeter walls, structural I-beam columns
|
||||
│ └── safety_barrier.usda # Industrial tubular steel safety guardrail
|
||||
├── racks/
|
||||
│ ├── pallet_rack_heavy.usda # Multi-tier heavy pallet rack with cross beams and decking
|
||||
│ └── shelving_unit_light.usda # High-density small parts shelving for Zone A
|
||||
├── pallets/
|
||||
│ ├── euro_pallet.usda # Standard European EPAL wooden pallet
|
||||
│ └── pallet_with_cartons.usda # Euro-pallet loaded with corrugated cardboard cartons
|
||||
├── robots/
|
||||
│ ├── amr_light.usda # Agile lightweight AMR with drive wheels, casters, LiDAR pucks
|
||||
│ └── amr_heavy.usda # Heavy-duty AMR with reinforced chassis, dual drives, lift bed
|
||||
└── stations/
|
||||
├── dock_inbound.usda # Inbound dock bay with leveler ramp, bumpers, bollards
|
||||
├── picking_station.usda # Ergonomic workstation table, terminal arm, roller conveyor
|
||||
└── charging_station.usda # Automated inductive charging pad with power pedestal tower
|
||||
|
||||
config/
|
||||
└── asset_manifest.json # Declarative catalog recording asset roles, dimensions, scales
|
||||
```
|
||||
|
||||
### Module Responsibilities
|
||||
|
||||
1. **`asset_loader.py` (`AssetManifest`, `USDAssetLoader`)**:
|
||||
- Parses and validates `config/asset_manifest.json`.
|
||||
- Resolves relative file paths between scene directories and asset files.
|
||||
- Generates non-destructive OpenUSD references (`references = @.../asset.usda@`).
|
||||
- Maintains registered prim paths to prevent namespace collisions or duplicate prims.
|
||||
|
||||
2. **`coordinate_mapper.py` (`CoordinateMapper`)**:
|
||||
- Maps 2D/3D graph coordinates to continuous world coordinates.
|
||||
- Configurable origin `(0.0, 0.0, 0.0)`, floor elevation, and scale multiplier.
|
||||
- Computes multi-level shelf elevations for pallets seated on rack tiers.
|
||||
|
||||
3. **`materials.py` (`MaterialManager`)**:
|
||||
- Defines standard industrial PBR materials compliant with `UsdPreviewSurface`.
|
||||
- Includes `ConcreteFloor`, `SafetyYellow`, `SafetyAmber`, `StructuralSteel`, `WoodPine`, `KraftCardboard`, `TechWhite`, `BeaconCyan`, and `BeaconEmerald`.
|
||||
|
||||
4. **`route_visualizer.py` (`RouteVisualizer`)**:
|
||||
- Generates navigation highway corridors, lane markings, and aisle boundaries under `/World/Routes/...`.
|
||||
|
||||
5. **`warehouse_builder.py` (`Warehouse3DBuilder`)**:
|
||||
- Constructs the complete static 3D warehouse stage.
|
||||
- Instantiates architecture, zones, storage racks, multi-tier pallets, stations, charging bays, barriers, camera presets, and robot fleet.
|
||||
|
||||
6. **`robot_animator.py` (`Robot3DAnimator`)**:
|
||||
- Connects simulation trajectory waypoints to 3D robot assets.
|
||||
- Generates time-sampled translation (`xformOp:translate.timeSamples`) and rotation (`xformOp:rotateXYZ.timeSamples`).
|
||||
- Overrides status dome beacon colors dynamically based on operational state.
|
||||
- Dynamically mounts cargo pallets atop the AMR lift bed with time-sampled visibility (`visibility.timeSamples = { t: "inherited" / "invisible" }`).
|
||||
|
||||
---
|
||||
|
||||
## 3. Validated 3D Assets & Manifest
|
||||
|
||||
All 11 assets are valid OpenUSD ASCII stages (`.usda`) adhering to `metersPerUnit = 1.0` and `upAxis = "Z"`:
|
||||
|
||||
| Asset ID | Role | Dimensions (L x W x H) | File Path | Key Features |
|
||||
| :--- | :--- | :---: | :--- | :--- |
|
||||
| `building_shell` | Architecture | 60.0m x 40.0m x 8.0m | `assets/warehouse/building_shell.usda` | Concrete slab, perimeter walls, structural I-beam columns with hazard base guards |
|
||||
| `safety_barrier` | Barrier | 1.8m x 0.25m x 0.9m | `assets/warehouse/safety_barrier.usda` | High-vis yellow tubular guardrails with mounting floor flanges |
|
||||
| `pallet_rack_heavy` | Storage Rack | 2.8m x 1.2m x 4.5m | `assets/racks/pallet_rack_heavy.usda` | 4 structural steel uprights, 3 safety orange load beam tiers, steel decking, anchor footplates |
|
||||
| `shelving_unit_light`| Storage Shelf | 1.9m x 0.8m x 3.2m | `assets/racks/shelving_unit_light.usda`| 4 slotted posts, 4 powder-coated blue steel shelves, canopy cover |
|
||||
| `euro_pallet` | Pallet | 1.2m x 0.8m x 0.144m | `assets/pallets/euro_pallet.usda` | 5 top deck boards, 3 stringers, 9 spacer blocks, 3 base runners (EPAL standard) |
|
||||
| `pallet_with_cartons`| Inventory | 1.2m x 0.8m x 0.95m | `assets/pallets/pallet_with_cartons.usda`| Euro-pallet loaded with 8 corrugated cardboard boxes, shipping labels, strap bands |
|
||||
| `amr_light` | Robot | 0.8m x 0.6m x 0.35m | `assets/robots/amr_light.usda` | Beveled tech-white chassis, recessed drive wheels, casters, LiDAR scanner, 360 status dome, E-stop |
|
||||
| `amr_heavy` | Robot | 1.4m x 1.0m x 0.45m | `assets/robots/amr_heavy.usda` | Reinforced amber steel chassis, dual high-torque wheels, corner LiDARs, hydraulic pallet lift bed |
|
||||
| `dock_inbound` | Station | 2.6m x 3.0m x 3.6m | `assets/stations/dock_inbound.usda` | Hydraulic leveler ramp, rubber bumpers, yellow safety bollards, overhead roll-up portal frame |
|
||||
| `picking_station` | Station | 2.0m x 1.5m x 1.8m | `assets/stations/picking_station.usda` | Steel workbench, articulated terminal display arm, roller conveyor, kitting tote bins |
|
||||
| `charging_station` | Station | 1.5m x 1.5m x 1.4m | `assets/stations/charging_station.usda` | Copper inductive contact pad, vertical power pedestal tower, digital battery telemetry display |
|
||||
|
||||
---
|
||||
|
||||
## 4. Coordinate & Scale Conventions
|
||||
|
||||
- **Units**: 1 USD unit = 1.0 meter (`metersPerUnit = 1.0`).
|
||||
- **Coordinate System**: Right-handed Cartesian (`upAxis = "Z"`).
|
||||
- $+X$: Facility Width (0.0m to 60.0m, East).
|
||||
- $+Y$: Facility Depth (0.0m to 40.0m, North).
|
||||
- $+Z$: Facility Elevation (0.0m ground floor to 8.0m roof clearance).
|
||||
- **Origin**: South-West corner of the warehouse interior floor is at $(0.0, 0.0, 0.0)$.
|
||||
- **Storage Rack Alignment**: Racks are placed at exact storage location positions defined in `config/warehouse.json`.
|
||||
- **Aisle Clearance**:
|
||||
- Standard Zone A/C aisles: 2.5m - 3.0m width.
|
||||
- Slow-moving Zone B aisles: 4.0m width, strictly restricted to `heavy_amr`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Generated 3D Stages
|
||||
|
||||
The system exports two primary stages into `omniverse/scenes/`:
|
||||
|
||||
1. **Static Realistic Stage** ([`omniverse/scenes/warehouse_realistic.usda`](file:///home/dmhai/warehouse-digital-twin/omniverse/scenes/warehouse_realistic.usda)):
|
||||
- Complete facility populated with modular referenced building shell, multi-tier racks, pallets, cartons, stations, charging bays, barriers, camera presets, and stationary AMR fleet.
|
||||
- Size: ~35 KB (compact due to modular referencing).
|
||||
|
||||
2. **Animated Dynamic Stage** ([`omniverse/scenes/warehouse_realistic_animated.usda`](file:///home/dmhai/warehouse-digital-twin/omniverse/scenes/warehouse_realistic_animated.usda)):
|
||||
- Complete facility plus time-sampled kinematic tracks for the 4-AMR fleet across 1 hour of simulation (86,383 animation frames at 24 fps).
|
||||
- Time-sampled translation, rotation, status beacon colors, and dynamic cargo pallet attachment.
|
||||
- Size: ~1.3 MB.
|
||||
|
||||
---
|
||||
|
||||
## 6. How to Open and Play in NVIDIA Omniverse Kit
|
||||
|
||||
### Option 1: Native Timeline Playback (Zero Extensions Required)
|
||||
1. Launch Omniverse Kit:
|
||||
```bash
|
||||
/home/dmhai/Desktop/nvidia-omniverse/kit-app-template/_build/linux-x86_64/release/warehouse_twin.kit.sh
|
||||
```
|
||||
2. In the Kit application, select **File $\rightarrow$ Open**.
|
||||
3. Select `omniverse/scenes/warehouse_realistic_animated.usda`.
|
||||
4. Press **Spacebar** (or click **Play** on the timeline toolbar at the bottom).
|
||||
5. Use the Camera menu in the viewport to switch between:
|
||||
- `OverviewCamera` (elevated 3/4 perspective view of the entire facility).
|
||||
- `TopDownCamera` (orthographic floorplan view).
|
||||
- `Free Camera` (WASD + right-click navigation).
|
||||
|
||||
### Option 2: Inspect Static Stage
|
||||
```bash
|
||||
warehouse-twin export-usd
|
||||
```
|
||||
Opens `omniverse/scenes/warehouse_realistic.usda` to inspect architecture, rack placement, pallets, and stations without playback.
|
||||
|
||||
---
|
||||
|
||||
## 7. Testing & Verification Summary
|
||||
|
||||
A dedicated test suite was added in `tests/unit/test_assets_validation.py` and `tests/unit/test_realistic_3d_assets.py`.
|
||||
|
||||
```bash
|
||||
.venv/bin/pytest tests/ -v
|
||||
```
|
||||
|
||||
- **Total Unit Tests Executed**: 164
|
||||
- **Passed**: 164
|
||||
- **Failed**: 0
|
||||
- **Pass Rate**: 100.0%
|
||||
- **Execution Time**: ~2.53 seconds
|
||||
|
||||
```
|
||||
tests/unit/test_assets_validation.py::test_asset_manifest_structure_and_completeness PASSED [ 1%]
|
||||
tests/unit/test_assets_validation.py::test_manifest_assets_exist_on_disk PASSED [ 1%]
|
||||
tests/unit/test_assets_validation.py::test_rack_and_robot_usda_syntax PASSED [ 2%]
|
||||
tests/unit/test_realistic_3d_assets.py::test_coordinate_mapper_bidirectional PASSED [ 59%]
|
||||
tests/unit/test_realistic_3d_assets.py::test_asset_loader_creates_valid_references PASSED [ 60%]
|
||||
tests/unit/test_realistic_3d_assets.py::test_warehouse_builder_generates_valid_scene PASSED[ 60%]
|
||||
tests/unit/test_realistic_3d_assets.py::test_robot_animator_single_and_multi_robot PASSED [ 61%]
|
||||
...
|
||||
============================= 164 passed in 2.53s ==============================
|
||||
```
|
||||
Reference in New Issue
Block a user