验证时序完成前的后续静态缓存不会误放行
This commit is contained in:
parent
70a6090f1a
commit
253bc2ea64
@ -37,6 +37,10 @@ internal static class ObservationWindowChecks
|
||||
config.Sop.Regions["work"] = new() { X1 = 0, Y1 = 0, X2 = 100, Y2 = 100 };
|
||||
config.Sop.Steps.Add(new() { Id = 1, Name = "通用过程", Description = "目标经历指定状态变化后到位",
|
||||
Detection = new() { Method = ConditionMethod.HandInRegion, Region = "work", Hand = "right", StableFrames = 1, Tolerance = 1 }, AiConfirmation = options });
|
||||
config.Sop.Regions["next"] = new() { X1 = 0, Y1 = 0, X2 = 100, Y2 = 100 };
|
||||
config.Sop.Steps.Add(new() { Id = 2, Name = "后续静态步骤", Description = "后续结果可见",
|
||||
Detection = new() { Method = ConditionMethod.HandInRegion, Region = "next", Hand = "right", StableFrames = 1, Tolerance = 1 },
|
||||
AiConfirmation = new() });
|
||||
var client = new Client(); var engine = new SopEngine { VisionDecisionClient = client }; engine.Load(config); engine.Start();
|
||||
VisionDecisionRequest? accepted = null; var evaluated = 0;
|
||||
engine.DecisionEvaluated += (r, d, ok) => { evaluated++; if (ok) accepted = r; };
|
||||
@ -59,9 +63,17 @@ internal static class ObservationWindowChecks
|
||||
var third = client.Calls.ElementAt(2); var frames = third.Request.Frames!;
|
||||
var finish = frames[^2];
|
||||
third.Result.SetResult(new(true, .99, "状态变化与结果均可见", VisionDecisionStatus.Completed, [frames[0].FrameId, finish.FrameId], finish.FrameId));
|
||||
await Until(() => { engine.ProcessFrame(Frame(7)); return engine.State == EngineState.Completed; });
|
||||
Check(engine.State == EngineState.Completed && accepted?.FrameId == finish.FrameId && accepted.SourceSeconds == finish.SourceSeconds,
|
||||
await Until(() => { engine.ProcessFrame(Frame(7)); return engine.CurrentStep?.Id == 2; });
|
||||
Check(accepted?.FrameId == finish.FrameId && accepted.SourceSeconds == finish.SourceSeconds,
|
||||
"完成证据和时间必须来自模型引用的真实完成帧,不能使用请求尾帧或返回时间");
|
||||
engine.ProcessFrame(Frame(7));
|
||||
Check(client.Calls.Count == 3 && !engine.HasPendingDecision && engine.State == EngineState.Running,
|
||||
"前序过程完成之前捕获的后续静态图必须丢弃,不能按旧图放行");
|
||||
Feed(8); await Until(() => client.Calls.Count == 4);
|
||||
var fourth = client.Calls.ElementAt(3);
|
||||
Check(fourth.Request.StepId == 2 && fourth.Request.FrameId == 8, "后续静态步骤须重新获取前序完成之后的真实画面");
|
||||
fourth.Result.SetResult(new(true, .99, "后续可见结果"));
|
||||
await Until(() => { engine.ProcessFrame(Frame(8)); return engine.State == EngineState.Completed; });
|
||||
engine.Stop(); Check(!engine.HasPendingDecision, "停止必须清空过程缓存");
|
||||
using var http = new HttpClient();
|
||||
var blocked = await new D3VisionDecisionClient(http).DecideAsync(first.Request, default);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user