feat(phase-6): implement analytics, kpi calculator, event store, heatmaps, and experiment runner

This commit is contained in:
2026-10-21 12:19:15 +05:30
parent 1e50508f53
commit 4c4419a06c
25 changed files with 2725 additions and 63 deletions
+18 -3
View File
@@ -138,6 +138,10 @@ class Robot:
min_battery_percent: float = 100.0
total_energy_consumed_kwh: float = 0.0
total_energy_charged_kwh: float = 0.0
loaded_distance: float = 0.0
empty_distance: float = 0.0
handling_time: float = 0.0
yield_wait_time: float = 0.0
@classmethod
def from_fleet_dict(cls, fleet_data: Dict[str, Any], type_specs: Dict[str, RobotTypeSpec]) -> Robot:
@@ -219,10 +223,21 @@ class Robot:
return True
return zone_id in self.allowed_zones
def update_position(self, new_position: Position3D, distance_delta: float, yaw: Optional[float] = None) -> None:
"""Update robot spatial coordinates, accumulated travel distance, and heading."""
def update_position(
self,
new_position: Position3D,
distance_delta: float,
yaw: Optional[float] = None,
is_loaded: bool = False,
) -> None:
"""Update robot spatial coordinates, travel distance (loaded/empty), and heading."""
self.position = new_position
self.accumulated_distance += max(0.0, distance_delta)
dist = max(0.0, distance_delta)
self.accumulated_distance += dist
if is_loaded:
self.loaded_distance += dist
else:
self.empty_distance += dist
if yaw is not None:
self.yaw_degrees = yaw % 360.0