123 lines
2.9 KiB
Markdown
123 lines
2.9 KiB
Markdown
# API and Data Contracts
|
|
|
|
This document formalizes the data interchange models between the simulation engine, event logging, trajectory output, and the Omniverse visualizer.
|
|
|
|
---
|
|
|
|
## 1. Domain Data Models
|
|
|
|
### 1.1 Robot Model (`Robot`)
|
|
```json
|
|
{
|
|
"robot_id": "amr_light_01",
|
|
"robot_type": "light_amr",
|
|
"position": [2.0, 36.0, 0.0],
|
|
"maximum_speed": 1.8,
|
|
"payload_capacity": 150.0,
|
|
"battery_level": 3.0,
|
|
"battery_capacity": 3.0,
|
|
"energy_consumption": {
|
|
"idle_kw": 0.05,
|
|
"moving_empty_kw": 0.35,
|
|
"moving_loaded_kw": 0.65,
|
|
"handling_kw": 0.15
|
|
},
|
|
"current_state": "IDLE",
|
|
"current_task_id": null,
|
|
"current_route": [],
|
|
"accumulated_distance": 0.0,
|
|
"busy_time": 0.0,
|
|
"idle_time": 0.0,
|
|
"charging_time": 0.0
|
|
}
|
|
```
|
|
|
|
### 1.2 Robot State Enumeration
|
|
- `IDLE`: Stationed at node, awaiting assignment.
|
|
- `DISPATCHED`: En route to pickup station or warehouse storage rack.
|
|
- `PICKING`: Handling/loading cargo at source.
|
|
- `LOADED_TRANSIT`: En route to dropoff destination with payload.
|
|
- `DROPPING`: Unloading cargo at destination.
|
|
- `TRANSIT_TO_CHARGE`: Traveling to assigned charging station.
|
|
- `CHARGING`: Actively recharging at charging bay.
|
|
- `MAINTENANCE` / `ERROR`: Out of service.
|
|
|
|
### 1.3 Task Model (`Task`)
|
|
```json
|
|
{
|
|
"task_id": "task_ord_00101",
|
|
"task_type": "ORDER_PICK",
|
|
"source": "rack_a_01",
|
|
"destination": "picking_station_a1",
|
|
"priority": 1,
|
|
"release_time": 124.5,
|
|
"deadline": 424.5,
|
|
"required_payload": 25.0,
|
|
"status": "COMPLETED",
|
|
"assigned_robot_id": "amr_light_01",
|
|
"completion_time": 312.0
|
|
}
|
|
```
|
|
|
|
### 1.4 Task Types
|
|
- `ORDER_PICK`: Fulfilling an outbound picking order (predominantly Zone A & B).
|
|
- `REPLENISHMENT`: Inbound dock to storage rack restocking.
|
|
- `PRODUCTION_LINE_FEED`: Time-critical material transfer to production line (Zone C).
|
|
- `CHARGING`: Internal battery maintenance dispatch.
|
|
|
|
---
|
|
|
|
## 2. Simulation Event Record Schema
|
|
|
|
Events recorded in `logs/simulation.log` and exported to `results/experiments/events.jsonl`:
|
|
|
|
```json
|
|
{
|
|
"event_id": "evt_000984",
|
|
"simulation_time": 128.5,
|
|
"event_type": "TASK_DISPATCHED",
|
|
"entity_id": "amr_light_01",
|
|
"task_id": "task_ord_00101",
|
|
"metadata": {
|
|
"source": "rack_a_01",
|
|
"destination": "picking_station_a1",
|
|
"route_length_m": 24.0,
|
|
"estimated_duration_s": 15.2,
|
|
"battery_soc_pct": 94.2
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 3. Trajectory Export Schema (For Omniverse USD Playback)
|
|
|
|
Saved under `results/trajectories/trajectory_<run_id>.json`:
|
|
|
|
```json
|
|
{
|
|
"metadata": {
|
|
"simulation_run_id": "sim_20261019_144000",
|
|
"time_step_seconds": 0.5,
|
|
"coordinate_system": "right_handed_cartesian_meters_z_up",
|
|
"total_duration_seconds": 3600.0
|
|
},
|
|
"robots": {
|
|
"amr_light_01": [
|
|
{
|
|
"t": 0.0,
|
|
"pos": [2.0, 36.0, 0.0],
|
|
"yaw_deg": 0.0,
|
|
"state": "IDLE"
|
|
},
|
|
{
|
|
"t": 0.5,
|
|
"pos": [2.0, 35.1, 0.0],
|
|
"yaw_deg": 180.0,
|
|
"state": "DISPATCHED"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|