feat(phase-1): implement warehouse domain models, topological graph builder, connectivity validation, and export

This commit is contained in:
Warehouse Twin Dev
2026-10-19 15:12:38 +05:30
parent 7ef65ce65d
commit 88b922a3e1
13 changed files with 1535 additions and 50 deletions
+40 -38
View File
@@ -1,7 +1,7 @@
# Project Status: Warehouse Robot Fleet Digital Twin
**Last Updated**: October 19, 2026
**Current Phase**: **Phase 0: Environment and Project Foundation (COMPLETED)**
**Current Phase**: **Phase 1: Warehouse Model (COMPLETED)**
**Status**: Ready for User Review and Approval
---
@@ -10,9 +10,9 @@
| Phase | Description | Status | Test Coverage |
| :--- | :--- | :--- | :--- |
| **Phase 0** | **Environment and project foundation** | **COMPLETED** | **17 passed (100%)** |
| Phase 1 | Warehouse model | Planned (Pending Phase 0 approval) | - |
| Phase 2 | Robot and task models | Planned | - |
| **Phase 0** | **Environment and project foundation** | **COMPLETED** | **17 passed** |
| **Phase 1** | **Warehouse model** | **COMPLETED** | **26 passed (100%)** |
| Phase 2 | Robot and task models | Planned (Next) | - |
| Phase 3 | Discrete-event simulation | Planned | - |
| Phase 4 | Routing and fleet assignment | Planned | - |
| Phase 5 | Charging and operational constraints | Planned | - |
@@ -23,55 +23,57 @@
---
## 2. Completed Tasks (Phase 0)
## 2. Completed Tasks (Phase 1)
- [x] Host environment inspected: Ubuntu 24.04.3 LTS, Python 3.12.3, NVIDIA RTX 5090 (Driver 580.178.04), 8.9 GB free disk space.
- [x] NVIDIA Omniverse Kit inspected: Kit 110.4.0 running with `warehouse_twin.kit` at `/home/dmhai/nvidia-omniverse/kit-app-template`.
- [x] Verified virtual environment (`.venv`) configured with `simpy` 4.1.2, `networkx` 3.7, `pytest` 9.1.1, and `setuptools` 84.0.0.
- [x] Package metadata created in `pyproject.toml` and installed in editable mode (`warehouse-digital-twin` v0.1.0).
- [x] `.gitignore` and `.env.example` created with secondary disk relocation support.
- [x] Baseline configuration files created for all 5 domains in `config/`:
- `warehouse.json` (60x40m, Zones A, B, C, stations, chargers)
- `robots.json` (Light AMR, Heavy AMR, battery limits, fleet)
- `inventory.json` (Zone A fast, Zone B heavy, Zone C production raw items)
- `simulation.json` (3600s duration, seed 42, arrival rates)
- `dispatch_policies.json` (active policy, reservation settings)
- [x] Structured rotating logging implemented in `src/warehouse_twin/logging_config.py` with `application.log`, `simulation.log`, and `errors.log`.
- [x] Configuration loader with detailed schema and integrity validation implemented in `src/warehouse_twin/config/loader.py`.
- [x] CLI entry point implemented in `src/warehouse_twin/cli.py` (`warehouse-twin validate-env`, `warehouse-twin validate-config`).
- [x] Automated verification scripts created: `scripts/check_environment.sh`, `scripts/run_tests.sh`.
- [x] Unit test suite implemented in `tests/unit/`:
- `test_environment.py` (5 tests)
- `test_logging.py` (3 tests)
- `test_config_loader.py` (9 tests)
- [x] Comprehensive documentation delivered in `docs/` and `docs/phases/phase_0_foundation.md`.
- [x] Defined complete warehouse domain models in `src/warehouse_twin/domain/warehouse.py`:
- `Position3D` with Euclidean metric and formatting.
- `ZoneArea`, `ZoneDefinition`, `WarehouseDimensions`.
- `Station`, `ChargingStation`, `StorageLocation`, `WarehouseNode`, `WarehouseEdge`.
- `WarehouseModel` constructor parsing raw configuration dictionaries.
- [x] Created `WarehouseGraphBuilder` in `src/warehouse_twin/routing/graph_builder.py`:
- Unified coordinate hashing to guarantee deterministic waypoint alignment.
- Perimeter highways: South ($y=2.0$), North ($y=38.0$), West ($x=2.0$), East ($x=58.0$).
- Vertical transfer corridors: $x=26.0$ (Zone A-B transfer), $x=46.0$ (Zone B-C transfer).
- Zone internal grid networks for Zone A ($x \in [6, 24]$), Zone B ($x \in [30, 44]$), Zone C ($x \in [48, 56]$).
- Operational stations: 2 inbound docks, 1 outbound dock, 2 picking stations, 1 production feed.
- Charging bays: 4 charging stations.
- Storage racks: 13 storage locations across Zones A, B, and C.
- [x] Enforced operational movement restrictions:
- Zone B internal edges restricted exclusively to `{"heavy_amr"}`.
- Transit corridors and Zones A & C accessible to both `light_amr` and `heavy_amr`.
- [x] Implemented connectivity validation:
- Strong connectivity verification ($1$ component).
- Operational reachability verification ($6/6$ stations, $4/4$ chargers, $13/13$ racks).
- Sub-graph robot class reachability verification.
- Raised `DisconnectedGraphError` and `UnreachableStationError` on malformed graphs.
- [x] Implemented structured JSON graph export (`results/reports/warehouse_graph.json`, 526 KB).
- [x] Added CLI commands: `warehouse-twin validate-graph` and `warehouse-twin export-graph`.
- [x] Implemented comprehensive unit tests in `tests/unit/test_warehouse_graph.py` (9 tests, 100% pass rate).
- [x] Created `docs/phases/phase_1_warehouse_model.md`.
---
## 3. Test & Validation Summary
- **Total Unit Tests Executed**: 17
- **Passed**: 17
- **Total Unit Tests Executed**: 26
- **Passed**: 26
- **Failed**: 0
- **Skipped**: 0
- **Execution Time**: 0.09s
- **CLI Verification**: Exit code 0, 0 failures, 1 warning (low disk space).
- **Configuration Verification**: Exit code 0, all 5 configuration files valid.
- **Execution Time**: 0.21s
- **Graph Topology**: 540 nodes, 1,730 directed edges, 1,692m lane length, strongly connected.
- **CLI Commands**: `validate-env`, `validate-config`, `validate-graph`, `export-graph` all exit with code 0.
---
## 4. Known Environment Constraints & Mitigations
- **Constrained Primary Disk (`/dev/nvme0n1p4`)**:
- Capacity: 886 GB total, 832 GB used, **8.9 GB free (99% used)**.
- Mitigations:
- Rotating file logs capped at 10 MB each with 5 backups.
- Large generated outputs ignored in Git.
- `WAREHOUSE_TWIN_SECONDARY_DRIVE` environment variable supported to route logs and simulation output to an external mount if configured.
- NVIDIA Isaac Sim installation omitted as required.
- **Primary Disk Space (`/dev/nvme0n1p4`)**: 99% used (~8.85 GB free).
- Graph JSON export is 526 KB.
- Logs continue to rotate under 10 MB caps.
- Standalone architecture preserves zero dependency on Isaac Sim.
---
## 5. Next Recommended Action
Obtain user approval for Phase 0 completion, then begin **Phase 1: Warehouse Model** (graph representation, Zone A/B/C nodes, docks, stations, connectivity validation, and export).
Obtain user approval for Phase 1 completion, then begin **Phase 2: Robot and Task Models** (AMR state machine, task lifecycle, payload constraints, compatibility rules, and deterministic fixtures).