#24 — PRD: Command abstraction layer for PPO action space
Pure controller functions that translate spatial targets into per-tick motor commands, independent of the PPO pipeline.
Goto controller — gotoTick(targetX, targetY, botX, botY, direction, speed) → (targetSpeed, turnRate):
gotoTick(targetX, targetY, botX, botY, direction, speed) → (targetSpeed, turnRate)
directionTo
|bearing| > 90°
calcMaxTurnRate(speed)
dirSign × getNewTargetSpeed(MAX_SPEED, |speed|, distance)
GotoTest/GotoTest.nim
AimTo controller — aimToTick(targetX, targetY, botX, botY, gunDirection) → gunTurnRate:
aimToTick(targetX, targetY, botX, botY, gunDirection) → gunTurnRate
normalizeRelativeAngle(bearing - gunDirection)
±MAX_GUN_TURN_RATE
Both functions use existing utilities: getNewTargetSpeed from utils.nim, calcMaxTurnRate/normalizeRelativeAngle/directionTo from tankroyale_botapi.
getNewTargetSpeed
utils.nim
calcMaxTurnRate
normalizeRelativeAngle
tankroyale_botapi
gotoTick
aimToTick
None — can start immediately
Implemented in commit c713585 on branch research/goto-controller.
No dependencies set.
The note is not visible to the blocked user.
Parent
#24 — PRD: Command abstraction layer for PPO action space
What to build
Pure controller functions that translate spatial targets into per-tick motor commands, independent of the PPO pipeline.
Goto controller —
gotoTick(targetX, targetY, botX, botY, direction, speed) → (targetSpeed, turnRate):directionTo(Tank Royale north=0° CW convention)|bearing| > 90°: reverse (negate speed, adjust bearing by 180°)calcMaxTurnRate(speed)dirSign × getNewTargetSpeed(MAX_SPEED, |speed|, distance)for smooth decelerationGotoTest/GotoTest.nimprototypeAimTo controller —
aimToTick(targetX, targetY, botX, botY, gunDirection) → gunTurnRate:directionTonormalizeRelativeAngle(bearing - gunDirection)±MAX_GUN_TURN_RATE(20°/tick)Both functions use existing utilities:
getNewTargetSpeedfromutils.nim,calcMaxTurnRate/normalizeRelativeAngle/directionTofromtankroyale_botapi.Acceptance criteria
gotoTickreturns positive speed for targets within 90° of heading, negative for targets behindgotoTickdecelerates smoothly near target (speed → 0 as distance → 0)gotoTickturn rate never exceedscalcMaxTurnRate(speed)aimToTickreturns positive turn for targets to the right of gun, negative for leftaimToTickturn rate never exceeds ±20°/tickaimToTickreturns near-zero turn rate when gun is already alignedBlocked by
None — can start immediately
Implemented in commit c713585 on branch research/goto-controller.