Initial commit

This commit is contained in:
2026-07-13 09:25:40 +07:00
parent c08ff54676
commit bccfb156d7
1938 changed files with 641646 additions and 0 deletions

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();
}