also looking at this
feat: add shared-clock scoped vehicle simulation sessions
#98
42 files
+2764
-127
| @@ -3,7 +3,8 @@ import type { GeodeticOrigin, Quaternion } from '../estimation/frames' | ||
| 3 | 3 | import type { SensorVector } from '../sensors/types' |
| 4 | 4 | import type { MissionAction, MissionObservation, MissionState } from '../missions/engine' |
| 5 | 5 | |
| 6 | export type VehicleKind = 'fixed-wing' | 'vtol' | 'ground' | 'surface' | 'subsea' | |
| 6 | export const vehicleKinds = ['quadcopter', 'fixed-wing', 'vtol', 'ground', 'surface', 'subsea'] as const | |
| 7 | export type VehicleKind = typeof vehicleKinds[number] | |
| 7 | 8 | export interface VehicleActuator { name: string, unit: 'normalized' | 'newton' | 'radian' | 'metres-per-second', min: number, max: number, neutral: number } |
| 8 | 9 | export interface VehiclePlantState { |
| 9 | 10 | positionM: SensorVector |
| @@ -88,7 +89,7 @@ export type VehicleMissionTask = | ||
| 88 | 89 | | { id: string, kind: 'takeoff' | 'waypoint' | 'land' | 'stop', positionM: SensorVector, acceptanceM: number, maxArrivalSpeedMps: number, settleMs: number, timeoutMs: number, next?: string } |
| 89 | 90 | | { id: string, kind: 'return', acceptanceM: number, maxArrivalSpeedMps: number, settleMs: number, timeoutMs: number, next: string } |
| 90 | 91 | | { id: string, kind: 'loiter', positionM: SensorVector, acceptanceM: number, maxArrivalSpeedMps: number, settleMs: number, timeoutMs: number, next: string } |
| 91 | | { id: string, kind: 'payload', operation: VehiclePayloadOperation, containerId: string | null, timeoutMs: number, next: string } | |
| 92 | | { id: string, kind: 'payload', operation: VehiclePayloadOperation, containerId: string | null, timeoutMs: number, next: string, onFailure?: string } | |
| 92 | 93 | | { id: string, kind: 'branch', batteryAtLeast: number, then: string, otherwise: string } |
| 93 | 94 | | { id: string, kind: 'abort' } |
| 94 | 95 | /** Explicit v2 profile; v1 quadcopter plans and traces retain their original contract. */ |
| @@ -121,6 +122,8 @@ export interface VehicleMissionSnapshot { | ||
| 121 | 122 | transition?: VehicleVtolTransitionCommand | null |
| 122 | 123 | /** Present after entering an explicitly planned transition-failure hover/landing route. */ |
| 123 | 124 | recovery?: { failedEventId: string | null, failedTaskId: string, hoverTaskId: string, triggeredAtMs: number, cause: 'timeout' | 'controller-aborted' | 'operator-abort' | 'operator-pause' | 'operator-recover', abortRequestedAtMs?: number } |
| 125 | /** A declared one-way payload failure route. Landing it does not confirm delivery. */ | |
| 126 | payloadFailure?: { eventId: string, taskId: string, operation: VehiclePayloadOperation, containerId: string | null, reason: 'timeout' | 'rejected' | 'uncertain' | 'scope-mismatch', triggeredAtMs: number, approachTaskId: string, landingTaskId: string } | |
| 124 | 127 | reason: string |
| 125 | 128 | elapsedMs: number |
| 126 | 129 | } |
| @@ -171,6 +174,8 @@ export interface VehicleFaults { | ||
| 171 | 174 | /** One execution owns its plant, controller, payload and measurement sequence. */ |
| 172 | 175 | export interface VehicleNavigation { update(base: EstimatorSnapshot, measurement: VehicleMeasurement | null, nowMs: number): EstimatorSnapshot } |
| 173 | 176 | export interface VehicleSession { |
| 177 | /** Optional received link evidence on the runtime's monotonic clock, without receipt-time restamping. */ | |
| 178 | linkObservation?(nowMs: number): { capturedAtMs: number, connected: boolean } | |
| 174 | 179 | createNavigation?(): VehicleNavigation |
| 175 | 180 | createPlant(): VehiclePlant |
| 176 | 181 | createController(): VehicleController |