Initial commit

This commit is contained in:
2026-07-03 16:37:12 +07:00
commit 63b8c1ea8b
1931 changed files with 640587 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
using RobotNet.VDA5050.Type;
using RobotNet10.RobotApp.Services.Robot.Actions;
using Action = RobotNet.VDA5050.InstantAction.Action;
namespace RobotNet10.RobotApp.Interfaces;
public interface IAction
{
RobotNet.VDA5050.State.ActionState[] ActionStates { get; }
bool HasActionRunning { get; }
bool HasActionWaitting { get; }
RobotAction? this[string actionId] { get; }
IEnumerable<RobotAction> GetRunningActions();
void AddOrderActions(Action[] actions, ActionScope scope = ActionScope.NODE);
void AddInstantAction(Action[] action);
void StartOrderAction(string actionId);
void StopOrderAction(string actionId = "");
void FinishAction(string actionId);
Task ClearActions();
void PauseActions();
void ResumeActions();
}

View File

@@ -0,0 +1,16 @@
using RobotNet.VDA5050.State;
using RobotNet10.RobotApp.Services.Robot;
namespace RobotNet10.RobotApp.Interfaces;
public interface IError
{
Error[] ErrorsState { get; }
event Action? OnNewFatalError;
bool HasFatalError { get; }
void AddError(RobotError error, TimeSpan? clearAfter = null);
void DeleteErrorType(string errorType);
void DeleteErrorId(int id);
void ClearAllErrors();
void ClearFatalErrors();
}

View File

@@ -0,0 +1,9 @@
using RobotNet.VDA5050.Factsheet;
using RobotNet.VDA5050.Type;
namespace RobotNet10.RobotApp.Interfaces;
public interface IFactsheet
{
Task PubFactsheet();
}

View File

@@ -0,0 +1,11 @@
using RobotNet.VDA5050.State;
namespace RobotNet10.RobotApp.Interfaces;
public interface IInfomation
{
Information[] InformationState { get; }
void AddInfo(Information infor);
void DeleteInfoType(string infoType);
void ClearAllInfos();
}

View File

@@ -0,0 +1,11 @@
using RobotNet.VDA5050.State;
namespace RobotNet10.RobotApp.Interfaces;
public interface ILoad
{
Load[] Load { get; }
void AddLoad(Load load);
void ClearLoad();
}

View File

@@ -0,0 +1,63 @@
using RobotNet10.Shared;
namespace RobotNet10.RobotApp.Interfaces;
public interface ILocalization
{
/// <summary>
/// Trạng thái sẵn sàng của hệ thống định vị.
/// </summary>
bool IsReady { get; }
/// <summary>
/// Vị trí hiện tại của robot trong hệ tọa độ toàn cục theo trục X (đơn vị: mét).
/// </summary>
double X { get; }
/// <summary>
/// Vị trí hiện tại của robot trong hệ tọa độ toàn cục theo trục Y (đơn vị: mét).
/// </summary>
double Y { get; }
/// <summary>
/// Hướng hiện tại của robot trong hệ tọa độ toàn cục (đơn vị: radian).
/// </summary>
double Theta { get; }
/// <summary>
/// Giá trị cho phạm vi sai lệch của vị trí tính bằng mét..
/// </summary>
double DeviationRange { get; }
/// <summary>
/// Độ phù hợp của vị trí định vị hiện tại so với bản đồ (0.0 - 1.0).
/// </summary>
double LocalizationScore { get; }
/// <summary>
/// Bản đồ đang được sử dụng để định vị hiện tại.
/// </summary>
string CurrentActiveMap { get; }
/// <summary>
/// Giá trị thể hiện cho việc vị trí đã được khởi tạo.
/// </summary>
bool PositionInitialized { get; }
/// <summary>
/// Khởi tạo vị trí của robot trong hệ tọa độ toàn cục.
/// </summary>
/// <param name="x">đơn vị: mét</param>
/// <param name="y">đơn vị: mét</param>
/// <param name="theta">đơn vị: độ</param>
/// <returns></returns>
MessageResult SetInitializePosition(double x, double y, double theta);
/// <summary>
/// Khoảng cách từ vị trí hiện tại đến tọa độ (x, y) trong hệ tọa độ toàn cục.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
double DistanceTo(double x, double y);
}

View File

@@ -0,0 +1,47 @@
using RobotNet.VDA5050.Order;
using RobotNet10.RobotApp.Detection;
using RobotNet10.RobotApp.Shared.Enums;
namespace RobotNet10.RobotApp.Interfaces;
public enum NavigationState
{
None,
Idle,
Initializing,
Waiting,
Moving,
Rotating,
Docking,
FinePositioning,
MovingStraight,
Completed,
Canceled,
Paused,
Error,
SafetyStop
}
public interface INavigation
{
event Action<NavigationState>? OnNavigationFinished;
bool IsReady { get; }
bool Driving { get; }
double VelocityX { get; }
double VelocityY { get; }
double Omega { get; }
NavigationState State { get; }
void Move(OrderMsg order, bool hasLoad = false);
void MoveStraight(double x, double y, bool hasLoad = false, RobotDirection? direction = null);
void Rotate(double angle);
void DockTo(IDetectSession session, bool hasLoad = false, RobotDirection? direction = null);
void Pause();
void Resume();
void UpdateOrder(string lastBaseNodeId);
void RefreshOrder(Node[] nodes, Edge[] edges);
void Refresh();
void SafetyStop();
void CancelMovement();
void SetSpeed(double speed);
void Start();
void Stop();
}

View File

@@ -0,0 +1,20 @@
namespace RobotNet10.RobotApp.Interfaces;
public interface IOrder
{
string OrderId { get; }
int OrderUpdateId { get; }
string LastNodeId { get; }
int LastNodeSequenceId { get; }
bool NewBaseRequest { get; }
double DistanceSinceLastNode { get; }
bool IsPaused { get; }
RobotNet.VDA5050.State.NodeState[] NodeStates { get; }
RobotNet.VDA5050.State.EdgeState[] EdgeStates { get; }
void UpdateOrder(RobotNet.VDA5050.Order.OrderMsg order);
void StopOrder();
void PauseOrder();
void ResumeOrder();
}

View File

@@ -0,0 +1,140 @@
using RobotNet.VDA5050.Type;
namespace RobotNet10.RobotApp.Interfaces;
public enum PeripheralButton
{
Start,
Reset,
Stop,
}
public enum SystemState
{
INIT,
PAUSED,
IDLE,
PROCCESSING,
DOCKING,
MAINTENANCE,
MANUAL,
OVERRIDE,
CHARGING,
ERROR,
}
public enum StopStateType
{
EMC,
Bumper,
FrontProtective,
BackProtective,
TimProtective,
None,
}
public enum OperationState
{
Move,
Lifting,
LiftRotating,
None,
}
public enum RFMode
{
Maintenance,
Override,
Default,
None
}
public enum SafetySpeed
{
Very_Slow,
Slow,
Normal,
Medium,
Optimal,
Fast,
Very_Fast,
}
public interface IPlcController
{
event Action<OperatingMode>? OnPeripheralModeChanged;
event Action<PeripheralButton>? OnButtonPressed;
event Action<StopStateType>? OnStop;
event Action<SafetySpeed>? OnSafetySpeedChanged;
bool IsReady { get; }
bool IsDisconected { get; }
OperatingMode PeripheralMode { get; }
SafetySpeed SafetySpeed { get; }
bool Emergency { get; }
bool Bumper { get; }
bool LidarFrontProtectField { get; }
bool LidarBackProtectField { get; }
bool LidarFrontTimProtectField { get; }
bool LiftedUp { get; }
bool LiftedDown { get; }
bool LiftHome { get; }
bool LeftMotorReady { get; }
bool RightMotorReady { get; }
bool LiftMotorReady { get; }
bool ButtonStart { get; }
bool ButtonStop { get; }
bool ButtonReset { get; }
bool HasLoad { get; }
bool EnabledCharger { get; }
bool Charging { get; }
bool MutedBase { get; }
bool MutedLoad { get; }
// Write state tracking (các giá trị đã được ghi xuống PLC)
SystemState CurrentSystemState { get; }
OperationState CurrentOperationState { get; }
RFMode CurrentRFMode { get; }
bool SetHorizontalLoadValue { get; }
bool SetMutedBaseValue { get; }
bool SetMutedLoadValue { get; }
bool SetEnableChargerValue { get; }
bool SetHasLoadValue { get; }
bool SetRFEStopValue { get; }
bool SetBatteryLowValue { get; }
bool SetLightOnValue { get; }
void SetSystemState(SystemState state);
void SetOperationState(OperationState state);
void SetEnableCharger(bool value);
void SetHorizontalLoad(bool value);
void SetMutedBase(bool muted);
void SetMutedLoad(bool muted);
void SetRFMode(RFMode mode);
void SetHasLoad(bool hasLoad);
void SetRFEStop(bool stop);
void SetBatteryLow(bool value);
/// <summary>Bật/tắt đèn — ghi coil M918 (TCP address 2966).</summary>
void SetLightOn(bool value);
/// <summary>Ghi hướng di chuyển xuống PLC: tiến M931, lùi M932; không đi thì cả hai off.</summary>
void SetDirectionForwardBackward(bool forward, bool backward);
/// <summary>Ghi M815 Alarm Reset xuống PLC (pulse) — PLC thực hiện alarm reset.</summary>
void WriteAlarmResetM815();
/// <summary>Lift: Homing (pulse coil M933).</summary>
void LiftHoming();
/// <summary>Lift: Điều khiển theo velocity — lên/xuống/dừng (coils M934, M935).</summary>
void SetLiftVelocity(bool up, bool down);
/// <summary>Lift: Ghi vị trí đích (internal units: 10000 = 0.01m) và trigger di chuyển (pulse M936).</summary>
void SetLiftPositionAndGo(int position);
Task Start(CancellationToken cancellationToken);
void Stop();
}

View File

@@ -0,0 +1,29 @@
namespace RobotNet10.RobotApp.Interfaces;
public enum RFHandlerMode
{
Default,
Maintenance,
Override,
Unknown
}
public interface IRFHandler
{
bool IsConnected { get; }
bool IsEnabled { get; }
bool IsLocked { get; }
bool EStop { get; }
bool LiftUp { get; }
bool LiftDown { get; }
int Speed { get; }
bool Forward { get; }
bool Backward { get; }
bool RotateLeft { get; }
bool RotateRight { get; }
bool Left { get; }
bool Right { get; }
RFHandlerMode Mode { get; }
event Action<RFHandlerMode> OnStateChanged;
event Action<bool>? OnConnectionChanged;
}

View File

@@ -0,0 +1,11 @@
using RobotNet.VDA5050.Type;
using RobotNet10.RobotApp.Services.Robot.Actions;
namespace RobotNet10.RobotApp.Interfaces;
public interface IRobotActionProvider
{
bool IsInitialized { get; }
RobotAction GetRobotAction(ActionType type);
RobotAction[] GetRobotActions();
}

View File

@@ -0,0 +1,8 @@
namespace RobotNet10.RobotApp.Interfaces;
public interface IRobotController
{
void Pause();
void Resume();
bool TryClearFault();
}

View File

@@ -0,0 +1,6 @@
namespace RobotNet10.RobotApp.Interfaces;
public interface IState
{
Task PubState();
}