Inspiration

Real robots don't get clean data. Camera detections are noisy, arrive late, or are simply wrong; targets disappear behind obstacles; the tracker renames things mid-match; and a safety signal can stop everything at any moment. The Heat Robotics challenge captured that perfectly: a replay of a robot's sensor stream at 20 Hz, where every frame we have to decide which target to engage, how to drive, where to aim, and whether to fire, without ever seeing the future.

When we ran the organizers' baseline controller, it fired about 213 shots per 30-second match from a 20-round magazine and jumped between targets every time a confidence value flickered. We wanted to build the opposite: a controller that understands what it's looking at, takes few but accurate shots, and treats safety as the final word.

What it does

Our controller reads observations.csv one frame at a time and writes one command row per frame. Each frame runs the same eight-stage pipeline:

  1. Validate: parse every cell defensively, dead-reckon the robot's position when localization drops, and throw out stale, low-confidence or fake detections.
  2. Track: run a Kalman filter for every target, matching detections by position rather than by ID, so renamed tracks and misread armor plates don't break identity.
  3. Select: prioritize by armor plate, and stay locked on through noise and short occlusions.
  4. Aim: point the launcher at the filtered target position.
  5. Drive: move to a good firing distance while respecting collision warnings, field boundaries and acceleration limits.
  6. Fire: request a single shot only when it's fresh, accurate, aligned and allowed, counting our own ammo and cooldown.
  7. Safety gate: handle e-stop, disabled and fault states. It runs last and can only make a command safer.
  8. Limit: clamp every value to the published limits.

How we built it

The controller is written in C# on .NET 8 with no third-party runtime dependencies. We built it with Claude Code as our AI programming assistant, under our direction and review. Before writing anything clever, we ported the organizers' sample controller line by line and confirmed it scored identically to the Python original. That proved our CSV handling was correct, so every later score change came from the algorithm.

Each target's position and velocity are estimated with a constant-velocity Kalman filter, separately per axis:

$$\hat{x}{k|k-1} = F\,\hat{x}{k-1}, \qquad P_{k|k-1} = F P_{k-1} F^\top + Q$$

$$K_k = P_{k|k-1} H^\top \left(H P_{k|k-1} H^\top + R\right)^{-1}, \qquad \hat{x}k = \hat{x}{k|k-1} + K_k\left(z_k - H\hat{x}_{k|k-1}\right)$$

On hard-mode noise this puts our estimate 4.6× closer to the truth (8.8 cm → 1.9 cm average error per axis). The filter's own uncertainty also drives the firing decision. A shot is only taken if the predicted aim error fits inside the tolerance:

$$2\,\sigma_\theta + 0.01 \;\le\; 0.06 \text{ rad}, \qquad \sigma_\theta = \frac{\sigma_{\text{position}}}{\text{distance}}$$

To spread 20 rounds across the match, shots are paced as well:

$$\Delta t_{\text{since last shot}} \;\ge\; 0.7 \cdot \frac{T_{\text{remaining}}}{N_{\text{ammo left}}}$$

We built our own test bench around the organizers' benchmark.py. One command generates scenarios across easy, medium and hard, runs the controller, scores it with the official evaluator, and runs our strict checker. The strict checker enforces rules the practice scorer skips: ammo, cooldown, acceleration limits and single-pulse firing. We tuned only on seeds 1–10 and confirmed every change on holdout seeds 101–110 we never tuned on. We also wrote 16 unit tests, including a 20,000-case randomized test proving no output can ever exceed a limit, plus a 15-case stress suite of corrupted inputs.

Results

Sample controller Ours
Practice score (30 scenarios) 84.61 96.66
Holdout seeds (never tuned on) – 96.36
Validation scenario 82.05 98.06
Shots per match ~213 from 20 rounds ~20, 100% good
Rule violations 15,230 0

We also computed an "honest ceiling": the score of a controller with perfect knowledge of the hidden answers that obeys the same rules we do. That ceiling is 97.02. We reach 99.6% of it.

Challenges we ran into

  • The robot leaves the field. Our first full run improved almost everything but made driving worse than the baseline. After digging in, we found the practice data's robot drives up to 9 m outside the field in every scenario, and the reference ignores walls. We kept the boundary rule but apply it only while the robot is actually inside the field: drivetrain score went from 10.8 to 14.3 out of 15.
  • The practice scorer doesn't check everything the rules describe. Ammo, cooldown and acceleration aren't scored, so a reckless controller looks fine. We enforced them anyway and built our own checker to prove it.
  • Occlusions. When the preferred target vanished for a second, our tracker dropped it and switched targets. Letting tracks coast on their prediction for up to 2 s cut the aim loss in those moments by about 90%.
  • Knowing when to stop. Late in the project, more tuning only moved scores by ±0.02, which is noise. Instead of overfitting, we measured the honest ceiling and tested alternatives properly: a moving average and an alpha-beta filter both lost to the Kalman filter on held-out data.

Accomplishments that we're proud of

  • Fully rule-compliant: zero safety or rule violations across every scenario we tested.
  • Every shot is a good one: about 20 shots per match, all accurate.
  • Close to the ceiling: within 0.4 points of the best score the rules allow.
  • Integrity over points: we turned down shortcuts that would have scored higher, such as reporting a different target than the one we're aiming at, or relaxing collision safety for +0.02.

What we learned

  • Measure before changing anything. Building the bench first meant every decision had evidence behind it.
  • Holdout data keeps you honest. Several "improvements" vanished on seeds we hadn't tuned on.
  • Filtering beats reacting. Estimating the world before acting on it was worth more than any single tuning trick.
  • Safety works best as an architecture decision. Running the safety gate last, so it can only make commands safer, made correctness easy to reason about and test.

What's next

  • Settings ready for the organizers' rules: the preferred-target rule, lead compensation and gravity compensation are already settings, so the controller can follow different rules without code changes.
  • Smarter selection: add a scoring-based selection mode tuned for scenarios where armor priority isn't the rule.
  • Real hardware: run the same pipeline closed-loop on a real robot, where our drive commands actually change what happens next.

Built With

Share this project:

Updates

Submission history