diff --git a/SNNBot_garage/src/SNNBot.nim b/SNNBot_garage/src/SNNBot.nim index 1d6e151..a1b8864 100644 --- a/SNNBot_garage/src/SNNBot.nim +++ b/SNNBot_garage/src/SNNBot.nim @@ -399,7 +399,14 @@ method run*(bot: SNNBot) = # correctAngle must be [0,360): targetRel is -180..180, shift it var correctAngle = targetRel + 180.0 let aimRaw = bot.res.forward(bot.lastBinInput) - bot.res.learn(bot.lastBinInput, correctAngle) + # Dead zone: only learn if aim error > 1.5° (prevents ring buffer churn) + if aimRaw >= 0.0: + let aimErr = abs(normalizeRelativeAngle(aimRaw - correctAngle)) + if aimErr > 1.5: + bot.res.learn(bot.lastBinInput, correctAngle) + else: + # Cold start: always learn + bot.res.learn(bot.lastBinInput, correctAngle) let aimErr = if aimRaw >= 0.0: abs(normalizeRelativeAngle(aimRaw - correctAngle)) else: -1.0 echo "RES tick=" & $bot.tick & " aim=" & (if aimRaw >= 0.0: formatFloat(aimRaw, ffDecimal, 1) else: "cold") &