/** * THE KEYBOARD LAUNCH — what a player on W/A/D actually gets, in the same runtime solver the instrument uses. * * WHY. `measureVehicle` launches with `throttle: 1, steer: 0` on a perfectly symmetric pad. That IS a digital launch, * but nothing ever disturbs the car's heading, so a car that is directionally UNSTABLE under power — the rear spinning, * its lateral grip gone — still runs dead straight and posts its best figure. A keyboard player cannot modulate the * throttle (W is 0 or 1; the platform does not ramp it, `VehicleDriveAbility` passes it straight to `setInput`), so on * such a car every heading correction meets a rear that has no grip to give, and the car snaps. A round-8 car posted * 4.38 s 0-100 in the instrument and hit the arena wall 3 runs out of 3 on a live keyboard launch. * * Two measurements, both in the served runtime (Rapier, land solver v2, 60 Hz): * * 1. THE RUN. A full-throttle launch from rest exactly as the live drive ability sends it: auto-hold brake released, * throttle 0 → 1 in one tick, automatic shifts. Steering is a keyboard PLAYER: every 100 ms it looks at what it saw * 100 ms ago (reaction time), decides a correction from the heading error to the lane (with a 30 m look-ahead on * the lateral offset) plus the yaw rate, and taps A or D for a fraction of the next 100 ms. While a steer key is * down the platform's keyboard `move` vector is normalised (`InputService`: |(x, y)| ≤ 1), so W+A sends throttle * 0.707 and steer −0.707 — modelled here exactly. The car starts 2° off its lane, so the player has to steer. * Reported: keyboard 0-100 against the instrument's, wheelspin (driven slip ratio > 0.2) time and peak slip per * gear, and for 1.5 s after each upshift re-engages the peak yaw rate, heading error and sideslip; the worst * heading error, sideslip and lane offset of the whole run. * 2. THE PROBE. The same launch HANDS OFF (steer 0), with a 0.2 rad/s yaw-rate nudge — less than one short keyboard * tap — at 20, 40, 60 and 100 km/h and at the moment each of the first two upshifts re-engages, each in a fresh * run, both directions. A drivable car damps it: the yaw rate decays and the sideslip stays small. A car that is * unstable under power amplifies it into a spin; the player then has to catch every disturbance within a few * tenths of a second, which a keyboard cannot do reliably. * * VERDICT. * FAIL (not drivable on a keyboard): any probe spins (sideslip ≥ 20°, or the yaw rate grows to ≥ 3× the nudge), or the * run spins (sideslip or heading error ≥ 20°) or leaves its 3.5 m lane (centre more than 1.75 m off). * WARN: the run needs big corrections (heading error or sideslip > 0.1 rad ≈ 5.7°); a probe does not settle (yaw rate * still > half the nudge after 1 s, or sideslip > 0.1 rad); or the keyboard 0-100 is > 15 % slower than the * instrument's (or never reached). */ type Json = Record; type Engine = Record; export declare const KEYBOARD_LAUNCH: { /** Player: decisions every this many ticks (100 ms), each on what it saw this many ticks earlier (100 ms reaction). */ readonly decisionTicks: 6; readonly reactionTicks: 6; /** The car starts this far off its lane heading, so the player has to steer from the first moment. */ readonly misalignDeg: 2; /** Lateral offset → heading demand: aim at the lane centre this far ahead. */ readonly lookAheadM: 30; /** Correction u = kp·heading + kd·yawRate, as a fraction of a 100 ms tap; |u| below the deadband is "leave it". */ readonly kp: 3; readonly kd: 0.6; readonly deadband: 0.08; /** Half a 3.5 m lane. */ readonly laneHalfM: 1.75; /** Probe nudge, rad/s of yaw rate — about a third of what one short keyboard tap commands at 80 km/h. */ readonly nudgeRadS: 0.2; readonly probeKph: readonly number[]; readonly probeUpshifts: 2; readonly probeWatchS: 2.5; readonly spinSideslipRad: 0.35; readonly spinYawGain: 3; readonly marginalRad: 0.1; readonly unsettledFraction: 0.5; readonly wheelspinSlip: 0.2; readonly gapWarn: 0.15; readonly postShiftS: 1.5; readonly endKph: 160; readonly maxS: 20; }; export type Verdict = 'PASS' | 'WARN' | 'FAIL'; export interface GearSpin { gear: number; seconds: number; wheelspinS: number; peakSlip: number; } export interface PostShift { from: number; to: number; kph: number; atS: number; peakYawRateRadS: number; peakHeadingRad: number; peakSideslipRad: number; peakSlip: number; } export interface ProbeResult { at: string; kph: number; gear: number; slipAtNudge: number; direction: 1 | -1; peakYawRateRadS: number; peakSideslipRad: number; yawRateAfter1sRadS: number; outcome: 'settles' | 'unsettled' | 'spins'; } export interface KeyboardLaunchReport { verdict: Verdict; /** One line per reason, FAIL reasons first. */ reasons: string[]; run: { zeroToHundredKphS: number | null; instrumentZeroToHundredKphS: number | null; /** keyboard − instrument, s and fraction of the instrument figure. */ gapS: number | null; gapFraction: number | null; maxHeadingRad: number; maxSideslipRad: number; maxLaneOffsetM: number; maxYawRateRadS: number; spun: boolean; endKph: number; endS: number; /** Seconds the car's traction control was cutting torque; null when the car has none (or the runtime predates it). */ tractionControlS?: number | null; gears: GearSpin[]; upshifts: PostShift[]; }; probe: ProbeResult[]; player: typeof KEYBOARD_LAUNCH; } /** The keyboard composite: W held, A/D as a tap; normalised like `InputService` normalises `move`. */ export declare function keyboardInput(steerKey: -1 | 0 | 1): { throttle: number; steer: number; }; /** The player's tap for the next decision window: [ticks held, direction]. */ export declare function playerTap(headingRad: number, lateralM: number, yawRateRadS: number, p?: { /** Player: decisions every this many ticks (100 ms), each on what it saw this many ticks earlier (100 ms reaction). */ readonly decisionTicks: 6; readonly reactionTicks: 6; /** The car starts this far off its lane heading, so the player has to steer from the first moment. */ readonly misalignDeg: 2; /** Lateral offset → heading demand: aim at the lane centre this far ahead. */ readonly lookAheadM: 30; /** Correction u = kp·heading + kd·yawRate, as a fraction of a 100 ms tap; |u| below the deadband is "leave it". */ readonly kp: 3; readonly kd: 0.6; readonly deadband: 0.08; /** Half a 3.5 m lane. */ readonly laneHalfM: 1.75; /** Probe nudge, rad/s of yaw rate — about a third of what one short keyboard tap commands at 80 km/h. */ readonly nudgeRadS: 0.2; readonly probeKph: readonly number[]; readonly probeUpshifts: 2; readonly probeWatchS: 2.5; readonly spinSideslipRad: 0.35; readonly spinYawGain: 3; readonly marginalRad: 0.1; readonly unsettledFraction: 0.5; readonly wheelspinSlip: 0.2; readonly gapWarn: 0.15; readonly postShiftS: 1.5; readonly endKph: 160; readonly maxS: 20; }): { ticks: number; dir: -1 | 0 | 1; }; /** Run the keyboard launch and the hands-off probe and judge them. Needs the real runtime (Rapier). */ export declare function measureKeyboardLaunch(hc: Engine, tuning: Json, instrumentZeroToHundredKphS: number | null, p?: { /** Player: decisions every this many ticks (100 ms), each on what it saw this many ticks earlier (100 ms reaction). */ readonly decisionTicks: 6; readonly reactionTicks: 6; /** The car starts this far off its lane heading, so the player has to steer from the first moment. */ readonly misalignDeg: 2; /** Lateral offset → heading demand: aim at the lane centre this far ahead. */ readonly lookAheadM: 30; /** Correction u = kp·heading + kd·yawRate, as a fraction of a 100 ms tap; |u| below the deadband is "leave it". */ readonly kp: 3; readonly kd: 0.6; readonly deadband: 0.08; /** Half a 3.5 m lane. */ readonly laneHalfM: 1.75; /** Probe nudge, rad/s of yaw rate — about a third of what one short keyboard tap commands at 80 km/h. */ readonly nudgeRadS: 0.2; readonly probeKph: readonly number[]; readonly probeUpshifts: 2; readonly probeWatchS: 2.5; readonly spinSideslipRad: 0.35; readonly spinYawGain: 3; readonly marginalRad: 0.1; readonly unsettledFraction: 0.5; readonly wheelspinSlip: 0.2; readonly gapWarn: 0.15; readonly postShiftS: 1.5; readonly endKph: 160; readonly maxS: 20; }): Promise; /** Human-readable block for `formatSimulationReport`. */ export declare function formatKeyboardLaunch(k: KeyboardLaunchReport): string[]; export {};