using RobotNet.Script.Expressions; using System.Linq.Expressions; namespace RobotNet.Script; /// /// Service điểu khiển robot trong hệ thống RobotNet. /// public interface IRobot { /// /// Di chuyển robot đến một nút trong bản đồ với action kết thúc. /// /// /// /// /// Task Move(string nodeName, IDictionary> actions, CancellationToken cancellationToken); /// /// Di chuyển robot đến một nút trong bản đồ với action kết thúc. /// /// /// /// /// /// Task Move(string nodeName, IDictionary> actions, double lastAngle, CancellationToken cancellationToken); /// /// Di chuyển robot đến một nút trong bản đồ với action kết thúc. /// /// /// /// /// Task Move(string nodeName, IEnumerable lastActions, CancellationToken cancellationToken); /// /// Di chuyển robot đến một nút trong bản đồ với action kết thúc. /// /// /// /// /// /// Task Move(string nodeName, IEnumerable lastActions, double lastAngle, CancellationToken cancellationToken); /// /// Di chuyển robot đến một nút trong bản đồ mà không cần action kết thúc. /// /// /// /// /// Task Move(string nodeName, double lastAngle, CancellationToken cancellationToken); /// /// Di chuyển robot đến một nút trong bản đồ mà không cần action kết thúc. /// /// /// /// Task Move(string nodeName, CancellationToken cancellationToken); /// /// Hủy bỏ hành động di chuyển hiện tại của robot, nếu có. /// /// Task AbortMovement(); /// /// Thực hiện một hành động ngay lập tức trên robot mà không cần chờ đợi. /// /// /// /// Task Execute(RobotAction action, CancellationToken cancellationToken); /// /// Lấy trạng thái của robot /// /// Task GetState(); /// /// Waits for the system to reach a ready state. /// /// A token to monitor for cancellation requests. If the token is canceled, the operation will be aborted. /// A task that represents the asynchronous operation. The task result is if the system /// reaches a ready state; otherwise, if the operation is canceled or the system fails to /// become ready. Task WaitForReady(CancellationToken cancellationToken); /// /// /// /// /// Task RequestACSIn(string id); /// /// /// /// /// Task RequestACSOut(string id); /// /// Trả về danh sách các tải trọng hiện tại của robot, bao gồm ID, loại, vị trí và trọng lượng. /// /// Task GetLoads(); /// /// /// /// Task CancelOrder(); /// /// /// /// Task CancelAction(); /// /// Chức năng di chuyển robot giả lập theo tọa độ (x, y) trong không gian 2D. /// /// /// /// /// Task SimMoveStraight(double x, double y, CancellationToken cancellationToken); /// /// Chức năng xoay robot giả lập theo một góc nhất định (đơn vị: độ). /// /// /// /// Task SimRotate(double angle, CancellationToken cancellationToken); } /// /// Service quản lý các robot trong hệ thống RobotNet. /// public interface IRobotManager { /// /// Trả về đối tượng điểu khiển robot theo ID. /// /// /// Task GetRobotById(string robotId); /// /// Lấy trạng thái của một robot theo ID. /// /// /// Task GetRobotState(string robotId); /// /// Tìm kiếm các robot trong bản đồ theo tên và mô hình. /// /// /// /// Task> SearchRobots(string map, string model); /// /// Tìm kiếm các robot trong bản đồ theo tên và mô hình. /// /// /// /// /// Task> SearchRobots(string map, string model, Expression> expr); } /// /// Regulates if the action is allowed to be executed during movement and/or parallel to other actions. /// public enum BlockingType { /// /// Action can happen in parallel with others, including movement. /// NONE, /// /// Action can happen simultaneously with others, but not while moving. /// SOFT, /// /// No other actions can be performed while this action is running. /// HARD } /// /// Mô tả một hành động của robot. /// /// /// public record RobotAction(string ActionType, BlockingType BlockingType) { /// /// Danh sách các tham số của hành động robot. /// public IDictionary? Parameters { get; set; } } /// /// Dữ liệu trả về từ các hành động của robot, bao gồm thông tin về thành công hay thất bại và thông điệp mô tả. /// /// /// public record RobotResult(bool IsSuccess, string Message); /// /// Thông tin về tải trọng của robot, bao gồm ID, loại, vị trí và trọng lượng. /// /// /// /// /// public record RobotLoad(string Id, string Type, string Position, double Weight);