test
This commit is contained in:
parent
b9b9a41c3c
commit
a336138ee2
4 changed files with 24 additions and 9 deletions
|
|
@ -61,6 +61,7 @@ public class BotOrchestrator : IAsyncDisposable
|
||||||
TradeQueue = tradeQueue;
|
TradeQueue = tradeQueue;
|
||||||
Links = links;
|
Links = links;
|
||||||
Navigation = new NavigationExecutor(game);
|
Navigation = new NavigationExecutor(game);
|
||||||
|
logWatcher.AreaEntered += _ => Navigation.Reset();
|
||||||
_paused = store.Settings.Paused;
|
_paused = store.Settings.Paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ public class NavigationExecutor : IDisposable
|
||||||
_stuckCounter = 0;
|
_stuckCounter = 0;
|
||||||
_lastPosition = null;
|
_lastPosition = null;
|
||||||
SetState(NavigationState.Idle);
|
SetState(NavigationState.Idle);
|
||||||
|
Log.Information("Navigation reset (new area)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RunExploreLoop()
|
public async Task RunExploreLoop()
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,9 @@ public class MinimapConfig
|
||||||
public Scalar PlayerHiHSV { get; set; } = new(25, 255, 255);
|
public Scalar PlayerHiHSV { get; set; } = new(25, 255, 255);
|
||||||
|
|
||||||
// Wall detection: target #A2AEE5 (blue-lavender structure lines)
|
// Wall detection: target #A2AEE5 (blue-lavender structure lines)
|
||||||
// HSV(115, 75, 229) — blue hue, low saturation, bright
|
// HSV(115, 75, 229) — blue hue, low-medium saturation, bright
|
||||||
public Scalar WallLoHSV { get; set; } = new(100, 20, 150);
|
public Scalar WallLoHSV { get; set; } = new(100, 50, 190);
|
||||||
public Scalar WallHiHSV { get; set; } = new(130, 140, 255);
|
public Scalar WallHiHSV { get; set; } = new(130, 120, 255);
|
||||||
|
|
||||||
// Connected components: minimum area to keep (kills speckle)
|
// Connected components: minimum area to keep (kills speckle)
|
||||||
public int WallMinArea { get; set; } = 30;
|
public int WallMinArea { get; set; } = 30;
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,14 @@ public class WorldMap : IDisposable
|
||||||
_frameCount++;
|
_frameCount++;
|
||||||
|
|
||||||
// Noise gate: skip frames with too many wall pixels (waypoint glow, effects)
|
// Noise gate: skip frames with too many wall pixels (waypoint glow, effects)
|
||||||
|
// But NOT during warmup or re-bootstrap — we need to stitch something to get started
|
||||||
var wallPixels = Cv2.CountNonZero(wallMask);
|
var wallPixels = Cv2.CountNonZero(wallMask);
|
||||||
var totalPixels = wallMask.Width * wallMask.Height;
|
var totalPixels = wallMask.Width * wallMask.Height;
|
||||||
var density = (double)wallPixels / totalPixels;
|
var density = (double)wallPixels / totalPixels;
|
||||||
if (density > _config.WallMaxDensity)
|
var isNoisy = density > _config.WallMaxDensity;
|
||||||
|
var needsBootstrap = _frameCount <= _config.WarmupFrames || _consecutiveMatchFails >= 30;
|
||||||
|
|
||||||
|
if (isNoisy && !needsBootstrap)
|
||||||
{
|
{
|
||||||
Log.Information("Noise gate: {Density:P1} wall density ({Pixels} px), skipping ({Ms:F1}ms)",
|
Log.Information("Noise gate: {Density:P1} wall density ({Pixels} px), skipping ({Ms:F1}ms)",
|
||||||
density, wallPixels, sw.Elapsed.TotalMilliseconds);
|
density, wallPixels, sw.Elapsed.TotalMilliseconds);
|
||||||
|
|
@ -64,12 +68,21 @@ public class WorldMap : IDisposable
|
||||||
_prevWallMask?.Dispose();
|
_prevWallMask?.Dispose();
|
||||||
_prevWallMask = wallMask.Clone();
|
_prevWallMask = wallMask.Clone();
|
||||||
|
|
||||||
// Warmup: stitch at center with boosted confidence to bootstrap canvas
|
// Warmup / re-bootstrap: stitch at current position to seed the canvas
|
||||||
if (_frameCount <= _config.WarmupFrames)
|
if (needsBootstrap)
|
||||||
{
|
{
|
||||||
StitchWithConfidence(classifiedMat, _position, boosted: true);
|
StitchWithConfidence(classifiedMat, _position, boosted: _frameCount <= _config.WarmupFrames);
|
||||||
Log.Information("Warmup frame {N}/{Total}: stitch={Ms:F1}ms",
|
if (_consecutiveMatchFails >= 30)
|
||||||
_frameCount, _config.WarmupFrames, sw.Elapsed.TotalMilliseconds);
|
{
|
||||||
|
Log.Information("Re-bootstrap: stitching at current position after {Fails} match failures ({Ms:F1}ms)",
|
||||||
|
_consecutiveMatchFails, sw.Elapsed.TotalMilliseconds);
|
||||||
|
_consecutiveMatchFails = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Information("Warmup frame {N}/{Total}: stitch={Ms:F1}ms",
|
||||||
|
_frameCount, _config.WarmupFrames, sw.Elapsed.TotalMilliseconds);
|
||||||
|
}
|
||||||
return _position;
|
return _position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue