initial commit
This commit is contained in:
32
Lab505.Script/Facades/IAmrFacade.cs
Normal file
32
Lab505.Script/Facades/IAmrFacade.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace Lab505.Script.Facades;
|
||||
|
||||
/// <summary>Script facade for the AMR robot — use named positions instead of raw coordinates.</summary>
|
||||
public interface IAmrFacade
|
||||
{
|
||||
/// <summary>Move to named position. Positions: "Cap1", "Cap2"</summary>
|
||||
Task GoTo(string position, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Undock from current docked station</summary>
|
||||
Task Undock(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Load items onto the robot via VDA</summary>
|
||||
Task Load(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Unload items from the robot via VDA</summary>
|
||||
Task Unload(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Pause the robot's current task (VDA startPause)</summary>
|
||||
Task Pause(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Resume a paused task (VDA stopPause)</summary>
|
||||
Task Resume(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Re-initialize the robot's pose (x, y in metres, theta in radians)</summary>
|
||||
Task InitPosition(double x, double y, double theta, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Cancel current task</summary>
|
||||
Task Cancel(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Check if robot is currently at named position</summary>
|
||||
bool IsAt(string position, double tol = 0.2);
|
||||
}
|
||||
21
Lab505.Script/Facades/IAmrRaw.cs
Normal file
21
Lab505.Script/Facades/IAmrRaw.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace Lab505.Script.Facades;
|
||||
|
||||
/// <summary>Subset of AmrVdaDriver methods needed by AmrFacade — breaks circular dependency.</summary>
|
||||
public interface IAmrRaw
|
||||
{
|
||||
Task DockToStation(string target, CancellationToken t = default);
|
||||
Task<string> UndockFromStation_AMR(CancellationToken t = default);
|
||||
Task<string> Load_Vda(CancellationToken t = default);
|
||||
Task<string> Unload_Vda(CancellationToken t = default);
|
||||
Task<string> StartPause(CancellationToken t = default);
|
||||
Task<string> StopPause(CancellationToken t = default);
|
||||
Task<string> InitPosition(double x, double y, double theta, CancellationToken t = default);
|
||||
Task Cancel_Vda(CancellationToken t = default);
|
||||
bool IsAtPosition(double tx, double ty, double tol = 0.2);
|
||||
|
||||
/// <summary>Chờ action có ActionID cụ thể đạt FINISHED. Throw nếu FAILED/ABORTED hoặc timeout.</summary>
|
||||
Task WaitActionIdCompleted(string actionId, int timeoutMs, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Chờ MoveTo hoàn thành — dựa vào NBR false→true.</summary>
|
||||
Task WaitMoveTo(int timeoutMs, CancellationToken ct = default);
|
||||
}
|
||||
25
Lab505.Script/Facades/IAsrsFacade.cs
Normal file
25
Lab505.Script/Facades/IAsrsFacade.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Lab505.Script.Facades;
|
||||
|
||||
/// <summary>Script-friendly ASRS interface — no dependency on ASRSState class.</summary>
|
||||
public interface IAsrsFacade
|
||||
{
|
||||
bool IsBusy { get; }
|
||||
bool IsLocked(string key);
|
||||
event Action? OnOperationStateChanged;
|
||||
|
||||
Task SYSTEM_HOMING(CancellationToken token = default);
|
||||
Task X1_S12(CancellationToken token = default);
|
||||
Task X2_S12(CancellationToken token = default);
|
||||
Task X3_S12(CancellationToken token = default);
|
||||
Task X1_S34(CancellationToken token = default);
|
||||
Task X2_S34(CancellationToken token = default);
|
||||
Task X3_S34(CancellationToken token = default);
|
||||
Task X1_R12(CancellationToken token = default);
|
||||
Task X2_R12(CancellationToken token = default);
|
||||
Task X3_R12(CancellationToken token = default);
|
||||
Task X1_R43(CancellationToken token = default);
|
||||
Task X2_R43(CancellationToken token = default);
|
||||
Task X3_R43(CancellationToken token = default);
|
||||
|
||||
Task<bool> WaitCoil(Func<bool?> selector, bool target, int timeoutMs = 10000);
|
||||
}
|
||||
24
Lab505.Script/Facades/IConveyorFacade.cs
Normal file
24
Lab505.Script/Facades/IConveyorFacade.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Lab505.Script.Facades;
|
||||
|
||||
/// <summary>
|
||||
/// Script-friendly conveyor interface — no dependency on ConveyorState class.
|
||||
/// Use State.WaitUntil(s => s.C1InOn) for condition waits.
|
||||
/// </summary>
|
||||
public interface IConveyorFacade
|
||||
{
|
||||
// ── Coil commands ──────────────────────────────────────────────
|
||||
bool C1In(bool state);
|
||||
bool C1Out(bool state);
|
||||
bool C1IMRin(bool state);
|
||||
bool C1IMRout(bool state);
|
||||
bool C1Ready(bool state);
|
||||
bool C2Ready(bool state);
|
||||
bool C2In(bool state);
|
||||
bool C2Out(bool state);
|
||||
bool C1HasGoods(bool state);
|
||||
bool C1NotGoods(bool state);
|
||||
bool C2HasGoods(bool state);
|
||||
bool C2NotGoods(bool state);
|
||||
|
||||
void StopAll();
|
||||
}
|
||||
11
Lab505.Script/Facades/IDobotFacade.cs
Normal file
11
Lab505.Script/Facades/IDobotFacade.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Lab505.Script.Facades;
|
||||
|
||||
/// <summary>Script-friendly Dobot interface.</summary>
|
||||
public interface IDobotFacade
|
||||
{
|
||||
Task PowerOn(CancellationToken t = default);
|
||||
Task GoHome(CancellationToken t = default);
|
||||
Task Continue(CancellationToken t = default);
|
||||
Task Cancel(CancellationToken t = default);
|
||||
Task Pickup(int ok, int ng, CancellationToken t = default);
|
||||
}
|
||||
10
Lab505.Script/Facades/IDobotRaw.cs
Normal file
10
Lab505.Script/Facades/IDobotRaw.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Lab505.Script.Facades;
|
||||
|
||||
/// <summary>Subset of DobotOpcDriver methods needed by DobotFacade — breaks circular dependency.</summary>
|
||||
public interface IDobotRaw
|
||||
{
|
||||
Task PowerOn(CancellationToken t = default);
|
||||
Task GoHome(CancellationToken t = default);
|
||||
Task Continue(CancellationToken t = default);
|
||||
Task Cancel(CancellationToken t = default);
|
||||
}
|
||||
35
Lab505.Script/Facades/IImrFacade.cs
Normal file
35
Lab505.Script/Facades/IImrFacade.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
namespace Lab505.Script.Facades;
|
||||
|
||||
/// <summary>Script facade for the IMR robot — use named positions instead of raw coordinates.</summary>
|
||||
public interface IImrFacade
|
||||
{
|
||||
/// <summary>Move to named position. Positions: "C1", "ABB"</summary>
|
||||
Task GoTo(string position, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Undock from a named docked position. Positions: "C1", "ABB"</summary>
|
||||
Task Undock(string fromPosition, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Load items onto the robot via VDA</summary>
|
||||
Task Load(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Unload items from the robot via VDA</summary>
|
||||
Task Unload(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Pick up items. ok = number of OK items, ng = number of NG items</summary>
|
||||
Task PickUp(int ok, int ng = 0, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Pause the robot's current task (VDA startPause)</summary>
|
||||
Task Pause(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Resume a paused task (VDA stopPause)</summary>
|
||||
Task Resume(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Re-initialize the robot's pose (x, y in metres, theta in radians)</summary>
|
||||
Task InitPosition(double x, double y, double theta, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Cancel current task</summary>
|
||||
Task Cancel(CancellationToken ct = default);
|
||||
|
||||
/// <summary>Check if robot is currently at named position</summary>
|
||||
bool IsAt(string position, double tol = 0.2);
|
||||
}
|
||||
22
Lab505.Script/Facades/IImrRaw.cs
Normal file
22
Lab505.Script/Facades/IImrRaw.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Lab505.Script.Facades;
|
||||
|
||||
/// <summary>Subset of ImrVdaDriver methods needed by ImrFacade — breaks circular dependency.</summary>
|
||||
public interface IImrRaw
|
||||
{
|
||||
Task DockToStation(string target, CancellationToken t = default);
|
||||
Task<string> UndockFromStation_IMR(double d, double v, CancellationToken t = default);
|
||||
Task<string> Load_Vda(CancellationToken t = default);
|
||||
Task<string> Unload_Vda(CancellationToken t = default);
|
||||
Task<string> PickUp_Vda(int ok, int ng, CancellationToken t = default);
|
||||
Task<string> StartPause(CancellationToken t = default);
|
||||
Task<string> StopPause(CancellationToken t = default);
|
||||
Task<string> InitPosition(double x, double y, double theta, CancellationToken t = default);
|
||||
Task Cancel_Vda(CancellationToken t = default);
|
||||
bool IsAtPosition(double tx, double ty, double tol = 0.2);
|
||||
|
||||
/// <summary>Chờ action có ActionID cụ thể đạt FINISHED. Throw nếu FAILED/ABORTED hoặc timeout.</summary>
|
||||
Task WaitActionIdCompleted(string actionId, int timeoutMs, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Chờ MoveTo hoàn thành — dựa vào NBR false→true.</summary>
|
||||
Task WaitMoveTo(int timeoutMs, CancellationToken ct = default);
|
||||
}
|
||||
Reference in New Issue
Block a user