fix(SNNBot): skip learning when aim error < 1.5° (dead zone)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 08:10:31 +02:00
parent 844abe0bb7
commit 8685f0e794
+8 -1
View File
@@ -399,7 +399,14 @@ method run*(bot: SNNBot) =
# correctAngle must be [0,360): targetRel is -180..180, shift it # correctAngle must be [0,360): targetRel is -180..180, shift it
var correctAngle = targetRel + 180.0 var correctAngle = targetRel + 180.0
let aimRaw = bot.res.forward(bot.lastBinInput) 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 let aimErr = if aimRaw >= 0.0: abs(normalizeRelativeAngle(aimRaw - correctAngle)) else: -1.0
echo "RES tick=" & $bot.tick & echo "RES tick=" & $bot.tick &
" aim=" & (if aimRaw >= 0.0: formatFloat(aimRaw, ffDecimal, 1) else: "cold") & " aim=" & (if aimRaw >= 0.0: formatFloat(aimRaw, ffDecimal, 1) else: "cold") &