initial commit

This commit is contained in:
robotics_x1
2026-10-12 15:24:08 +07:00
commit 55228b3772
367 changed files with 162893 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
namespace Lab505.Script;
/// <summary>
/// Unified condition checker exposed to user scripts.
/// Type 1 — instant: State.Assert(s => s.ImrReady, "msg")
/// Type 2 — async wait: await State.WaitUntil(s => s.ImrReadyAtC1)
/// await State.Require(s => s.C1HasGoods, "msg")
/// </summary>
public interface ICondition
{
// ── IMR ──────────────────────────────────────────────────────────────
bool ImrOnline { get; }
bool ImrReady { get; }
bool ImrBusy { get; }
bool ImrAtC1 { get; }
bool ImrAtABB { get; }
bool ImrReadyAtC1 { get; }
bool ImrReadyAtABB { get; }
// ── AMR ──────────────────────────────────────────────────────────────
bool AmrOnline { get; }
bool AmrReady { get; }
bool AmrBusy { get; }
bool AmrAtCap1 { get; }
bool AmrAtCap2 { get; }
bool AmrReadyAtCap1 { get; }
bool AmrReadyAtCap2 { get; }
// ── C1 ───────────────────────────────────────────────────────────────
bool C1Online { get; }
bool C1HasGoods { get; }
bool C1NotGoods { get; }
bool C1Ready { get; }
bool C1Idle { get; }
bool C1InOn { get; }
bool C1OutOn { get; }
bool C1IMRinOn { get; }
bool C1IMRoutOn { get; }
// ── C2 ───────────────────────────────────────────────────────────────
bool C2Online { get; }
bool C2HasGoods { get; }
bool C2Ready { get; }
bool C2Idle { get; }
bool C2InOn { get; }
bool C2OutOn { get; }
// ── Dobot ────────────────────────────────────────────────────────────
bool DobotOnline { get; }
// ── Condition methods ─────────────────────────────────────────────────
/// <summary>Instant check — throws InvalidOperationException if false. Use before sending a command.</summary>
void Assert(Func<ICondition, bool> condition, string errorMessage);
/// <summary>Event-driven wait. Returns false on timeout, throws on cancellation.</summary>
Task<bool> WaitUntil(Func<ICondition, bool> condition, int timeoutMs = 1_200_000, CancellationToken ct = default);
/// <summary>Event-driven wait. Throws TimeoutException if condition not met in time.</summary>
Task Require(Func<ICondition, bool> condition, string errorMessage, int timeoutMs = 1_200_000, CancellationToken ct = default);
}