1
0

feat(arena): add deterministic headless RL environments

This commit is contained in:
2026-08-19 01:10:30 -07:00
parent 79793faed2
commit 747744fa6c
23 changed files with 2387 additions and 1 deletions
+19
View File
@@ -334,6 +334,25 @@ export class AircraftController {
return { ...this.current };
}
/** Restore a trusted JSON snapshot for deterministic environment checkpointing. */
restore(snapshot: AircraftControllerSnapshot): void {
const numeric = Object.entries(snapshot)
.filter(([, value]) => typeof value === "number")
.every(([, value]) => Number.isFinite(value));
const envelope = this.options.envelope;
if (
!numeric || (snapshot.mode !== "manual" && snapshot.mode !== "assisted") ||
snapshot.lat < envelope.minLat || snapshot.lat > envelope.maxLat ||
snapshot.lng < envelope.minLng || snapshot.lng > envelope.maxLng ||
snapshot.altitudeM < envelope.minAltitudeM || snapshot.altitudeM > envelope.maxAltitudeM ||
snapshot.speedMps < this.options.minimumSpeedMps ||
snapshot.speedMps > this.options.maximumSpeedMps ||
!Number.isSafeInteger(snapshot.elapsedSteps) || snapshot.elapsedSteps < 0
) throw new RangeError("aircraft snapshot is incompatible or invalid");
Object.assign(this.current, snapshot);
this.accumulator = 0;
}
reset(): void {
this.accumulator = 0;
Object.assign(this.current, this.options.initialPosition, {