Radar lock: standalone reusable module #39

Closed
opened 2026-08-20 23:27:29 +02:00 by SirStone · 1 comment
Owner

Parent

#37

What to build

A standalone, bot-agnostic radar lock module at libs/radar_lock/ that any Robocode TankRoyale bot can import. Specialized for 1v1 — keeps the radar locked on a single enemy.

API:

  • init() — sets defaults (adjustRadarForBodyTurn=true, adjustRadarForGunTurn=true)
  • doRadar(currentRadarHeading, enemyBearing, ...) → float — returns the radarTurnRate to keep the enemy in the scan arc

The module handles angle wrapping (359° → 1°), clamps output to ±45°, and adds a small overshoot sweep to maintain lock. It must be called from onScannedBot for same-tick reactivity.

Includes its own .nimble file and test.

Acceptance criteria

  • libs/radar_lock/radar_lock.nim exists with init() and doRadar() procs
  • libs/radar_lock/radar_lock.nimble exists
  • libs/radar_lock/tests/test_radar_lock.nim passes
  • Handles angle wrapping correctly (e.g., radar at 350°, enemy at 10°)
  • Output clamped to [-45.0, +45.0]
  • No imports from any bot-specific module — fully standalone

Blocked by

None — can start immediately.

## Parent #37 ## What to build A standalone, bot-agnostic radar lock module at `libs/radar_lock/` that any Robocode TankRoyale bot can import. Specialized for 1v1 — keeps the radar locked on a single enemy. API: - `init()` — sets defaults (`adjustRadarForBodyTurn=true`, `adjustRadarForGunTurn=true`) - `doRadar(currentRadarHeading, enemyBearing, ...) → float` — returns the `radarTurnRate` to keep the enemy in the scan arc The module handles angle wrapping (359° → 1°), clamps output to ±45°, and adds a small overshoot sweep to maintain lock. It must be called from `onScannedBot` for same-tick reactivity. Includes its own `.nimble` file and test. ## Acceptance criteria - [ ] `libs/radar_lock/radar_lock.nim` exists with `init()` and `doRadar()` procs - [ ] `libs/radar_lock/radar_lock.nimble` exists - [ ] `libs/radar_lock/tests/test_radar_lock.nim` passes - [ ] Handles angle wrapping correctly (e.g., radar at 350°, enemy at 10°) - [ ] Output clamped to [-45.0, +45.0] - [ ] No imports from any bot-specific module — fully standalone ## Blocked by None — can start immediately.
SirStone added the ready-for-agent label 2026-08-20 23:27:29 +02:00
Author
Owner

Radar lock module complete — 14 tests passing, standalone in libs/radar_lock/. Merged to research/goto-controller.

Radar lock module complete — 14 tests passing, standalone in libs/radar_lock/. Merged to research/goto-controller.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SirStone/SirRoboGarage#39