Action decoding rewrite for command abstraction #27

Closed
opened 2026-08-17 18:55:41 +02:00 by SirStone · 1 comment
Owner

Parent

#24 — PRD: Command abstraction layer for PPO action space

What to build

Rewrite the action decoding layer (mapActions in actions.nim) to translate the new 6-dim network output into goto/aimTo commands and fire decisions.

New action mapping:

Dim Output Encoding
0 goto x sigmoid × battlefield width
1 goto y sigmoid × battlefield height
2 aimTo x sigmoid × battlefield width
3 aimTo y sigmoid × battlefield height
4 fire decision tanh → fire if ≥ 0
5 fire power sigmoid × 2.9 + 0.1

mapActions should:

  1. Decode goto(x, y) and aimTo(x, y) from sigmoid-bounded outputs
  2. Call the goto controller (from issue slice 1) to get (targetSpeed, turnRate)
  3. Call the aimTo controller (from issue slice 1) to get gunTurnRate
  4. Decode fire decision and fire power as before (threshold + sigmoid scaling)
  5. Return a BotActions struct (may need new fields for goto/aimTo targets)

mapActions will need additional parameters: bot position, heading, speed, gun direction (for the controllers). Update BotActions struct if needed to carry goto/aimTo target coordinates (PPO_Bot needs them for state vector computation).

Acceptance criteria

  • mapActions accepts 6-dim raw action tensor
  • Goto x, y are bounded to [0, arenaWidth] and [0, arenaHeight]
  • AimTo x, y are bounded to [0, arenaWidth] and [0, arenaHeight]
  • Fire decision triggers when dim 4 ≥ 0 and gunHeat ≤ 0
  • Fire power is in [0.1, 3.0]
  • Controllers are called correctly (goto → targetSpeed + turnRate, aimTo → gunTurnRate)
  • Unit tests verify coordinate bounds and fire logic

Blocked by

  • #25 — Goto and AimTo controller functions
  • #26 — Network and state vector dimension changes
## Parent #24 — PRD: Command abstraction layer for PPO action space ## What to build Rewrite the action decoding layer (`mapActions` in `actions.nim`) to translate the new 6-dim network output into goto/aimTo commands and fire decisions. **New action mapping:** | Dim | Output | Encoding | |-----|--------|----------| | 0 | goto x | sigmoid × battlefield width | | 1 | goto y | sigmoid × battlefield height | | 2 | aimTo x | sigmoid × battlefield width | | 3 | aimTo y | sigmoid × battlefield height | | 4 | fire decision | tanh → fire if ≥ 0 | | 5 | fire power | sigmoid × 2.9 + 0.1 | `mapActions` should: 1. Decode goto(x, y) and aimTo(x, y) from sigmoid-bounded outputs 2. Call the goto controller (from issue slice 1) to get `(targetSpeed, turnRate)` 3. Call the aimTo controller (from issue slice 1) to get `gunTurnRate` 4. Decode fire decision and fire power as before (threshold + sigmoid scaling) 5. Return a `BotActions` struct (may need new fields for goto/aimTo targets) `mapActions` will need additional parameters: bot position, heading, speed, gun direction (for the controllers). Update `BotActions` struct if needed to carry goto/aimTo target coordinates (PPO_Bot needs them for state vector computation). ## Acceptance criteria - [ ] `mapActions` accepts 6-dim raw action tensor - [ ] Goto x, y are bounded to [0, arenaWidth] and [0, arenaHeight] - [ ] AimTo x, y are bounded to [0, arenaWidth] and [0, arenaHeight] - [ ] Fire decision triggers when dim 4 ≥ 0 and gunHeat ≤ 0 - [ ] Fire power is in [0.1, 3.0] - [ ] Controllers are called correctly (goto → targetSpeed + turnRate, aimTo → gunTurnRate) - [ ] Unit tests verify coordinate bounds and fire logic ## Blocked by - #25 — Goto and AimTo controller functions - #26 — Network and state vector dimension changes
SirStone added the ready-for-agent label 2026-08-17 18:55:41 +02:00
Author
Owner

Implemented in commit c713585 on branch research/goto-controller.

Implemented in commit c713585 on branch 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#27