Analytics
Robot Analytics API endpoints
📄️ Get Robot State Timeline
Time-weighted distribution of the seven robot states over a window. The server reads raw state events from `event_analytics`, carries the last known state forward across gaps, measures the time spent in each state, and returns finished durations, percentages and timeline segments — the client does no math.
📄️ Get Robot State Distribution
Time spent in each of the seven robot states over a window, as overall totals and per-bucket durations. Uses the same carry-forward state measurement as `/robot-state-timeline`, then slices each state interval across bucket boundaries so every bucket holds the milliseconds spent in each state.
📄️ Get Safety Events
Per-bucket occurrence counts for four safety event groups (safety_stop, error, emergency_stop, manual_interaction) over a time window. An occurrence is a rising edge — one count each time the robot enters a tracked state, regardless of how long it stays there. When `export=true` the response is an XLSX file download instead of JSON.
📄️ Get Battery & Charging Timeline
Battery status (percentage) over a time window. The server reads raw `battery` events from `event_analytics`, carries the last known value forward to seed the window start, tags each reading as charging (rising %) or discharging (falling %), and returns an ascending time series. When `export=true` the response is a CSV file download instead of JSON.
📄️ Get Mission Analytics
Mission performance over a time window: a 4-card summary (total missions, success rate, average, total distance) plus four per-bucket chart series — success_rate (total vs success), result_distribution (success/failed/aborted/cancelled/others), mission_source (FMS vs native, derived from the mission_id prefix) and distance_trend (per-bucket distance + running cumulative). All four charts share the same `buckets`. When `export=true` the response is a single CSV file download (Summary block + Per-bucket table) instead of JSON.