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:
@@ -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") &
|
||||
|
||||
Reference in New Issue
Block a user