feat(phase2): implement AMR robot state machine, task lifecycles, inventory catalog, and Phase 2 OpenUSD scene

This commit is contained in:
2026-10-19 16:16:23 +05:30
parent 0427ab273d
commit 863eda87f5
21 changed files with 2206 additions and 74 deletions
+44 -47
View File
@@ -1,7 +1,7 @@
# Project Status: Warehouse Robot Fleet Digital Twin
**Last Updated**: October 19, 2026
**Current Phase**: **Phase 1: Warehouse Model (COMPLETED)**
**Current Phase**: **Phase 2: Robot and Task Models (COMPLETED)**
**Status**: Ready for User Review and Approval
---
@@ -11,9 +11,9 @@
| Phase | Description | Status | Test Coverage |
| :--- | :--- | :--- | :--- |
| **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 1** | **Warehouse model** | **COMPLETED** | **26 passed** |
| **Phase 2** | **Robot and task models** | **COMPLETED** | **56 passed (100%)** |
| Phase 3 | Discrete-event simulation | Planned (Next) | - |
| Phase 4 | Routing and fleet assignment | Planned | - |
| Phase 5 | Charging and operational constraints | Planned | - |
| Phase 6 | Analytics and experiment framework | Planned | - |
@@ -23,57 +23,54 @@
---
## 2. Completed Tasks (Phase 1)
## 2. Completed Tasks (Phase 2)
- [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`.
- [x] Defined complete robot domain models in `src/warehouse_twin/domain/robot.py`:
- `RobotState` enum (`IDLE`, `DISPATCHED`, `PICKING`, `LOADED_TRANSIT`, `DROPPING`, `TRANSIT_TO_CHARGE`, `CHARGING`, `MAINTENANCE`).
- `LEGAL_ROBOT_TRANSITIONS` lookup table enforcing valid state machine jumps.
- `RobotTypeSpec` data model parsing `config/robots.json`.
- `Robot` model tracking position, SoC battery level, energy consumption, kinematics, active tasks, and routes.
- `Robot.validate_task_compatibility()` enforcing payload capacity limits and zone accessibility.
- `Robot.assign_task()` and `Robot.complete_task()`.
- Linear energy consumption and fast-charging modeling.
- [x] Defined warehouse task models in `src/warehouse_twin/domain/task.py`:
- `TaskType` enum (`INBOUND_TRANSPORT`, `OUTBOUND_PICKING`, `PRODUCTION_FEED`, `REPLENISHMENT`, `CHARGING`).
- `TaskStatus` enum (`PENDING`, `ASSIGNED`, `IN_PROGRESS`, `COMPLETED`, `CANCELLED`, `FAILED`).
- `LEGAL_TASK_TRANSITIONS` table preventing invalid state jumps.
- `Task` dataclass tracking turnaround time, queue waiting time, execution duration, and SLA deadline overdues.
- [x] Defined inventory models in `src/warehouse_twin/domain/inventory.py`:
- `InventoryItem` tracking stock levels, reservations, reorder thresholds, and restocking amounts.
- `InventoryCatalog` loading 13 SKUs across Fast Moving, Slow Moving/Heavy, and Raw Material categories.
- [x] Defined simulation telemetry in `src/warehouse_twin/domain/events.py`:
- `SimulationEventType` enum and `SimulationEvent` dataclass with JSONL serialization.
- [x] Integrated AMR fleet into 3D OpenUSD generator (`src/warehouse_twin/interfaces/usd_generator.py`):
- Added visual prims for `light_amr` (pearl white chassis, cyan status dome) and `heavy_amr` (industrial amber chassis, emerald status dome).
- Exported OpenUSD scene `omniverse/scenes/warehouse_phase2.usda`.
- [x] Added 30 new unit tests (56 total unit tests passing in 0.24s).
- [x] Created `docs/phases/phase_2_robot_and_task_models.md`.
---
## 3. Test & Validation Summary
- **Total Unit Tests Executed**: 26
- **Passed**: 26
- **Total Unit Tests Executed**: 56
- **Passed**: 56
- **Failed**: 0
- **Skipped**: 0
- **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.
- **Execution Time**: ~0.24 seconds
- **Test Suites**:
- `test_environment.py`: 5 passed
- `test_logging.py`: 3 passed
- `test_config_loader.py`: 9 passed
- `test_warehouse_graph.py`: 11 passed
- `test_robot_model.py`: 14 passed
- `test_task_model.py`: 9 passed
- `test_inventory_model.py`: 4 passed
- `test_events_model.py`: 1 passed
---
## 4. Known Environment Constraints & Mitigations
## 4. Environment & Constraints Compliance
- **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 1 completion, then begin **Phase 2: Robot and Task Models** (AMR state machine, task lifecycle, payload constraints, compatibility rules, and deterministic fixtures).
- **Storage**: Root NVMe partition at 99% capacity (~8.8 GB available). Maintained zero uncontrolled growth.
- **USD Export**: `omniverse/scenes/warehouse_phase2.usda` (19 KB) generated cleanly without GPU dependencies.
- **Active Omniverse Kit Instance**: Running PID 74367 (`warehouse_twin.kit`) on RTX 5090.