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
+18
View File
@@ -396,6 +396,24 @@ export class ActorController {
return { ...this.current, identity: copyIdentity(this.current.identity) };
}
/** Restore a trusted JSON snapshot for deterministic environment checkpointing. */
restore(snapshot: ActorControllerSnapshot): void {
const numeric = Object.entries(snapshot)
.filter(([, value]) => typeof value === "number")
.every(([, value]) => Number.isFinite(value));
if (
!numeric || !validKind(snapshot.kind) ||
(snapshot.mode !== "ground" && snapshot.mode !== "flight") ||
(snapshot.altitudeBoundContact !== "none" &&
snapshot.altitudeBoundContact !== "minimum" && snapshot.altitudeBoundContact !== "maximum") ||
!Number.isSafeInteger(snapshot.elapsedSteps) || snapshot.elapsedSteps < 0
) throw new RangeError("actor snapshot is incompatible or invalid");
Object.assign(this.current, snapshot, { identity: checkedIdentity(snapshot.identity) });
this.applyHorizontalBounds();
if (this.current.mode === "flight" && this.current.kind === "crow") this.applyAltitudeBounds();
this.accumulator = 0;
}
/** Replace profile/identity without changing kind, pose or position. */
setIdentity(identity: ActorIdentity): void {
this.current.identity = checkedIdentity(identity);