Goto and AimTo controller functions #25
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.