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,52 @@
using RobotNet10.FleetManager.Script;
using RobotNet10.FleetManager.Services.RobotController;
namespace RobotNet10.FleetManager.Services.Script;
public class ScriptRobot(string robotId, string robotName, Guid modelId, Guid? mapId, IRobotController robotController) : IRobot
{
public string RobotId { get; } = robotId;
public string Name { get; } = robotName;
public Guid ModelId { get; } = modelId;
public Guid? MapId { get; } = mapId;
public RobotState State => new( robotController.IsReady,
robotController.Data.State?.BatteryState.BatteryVoltage ?? 0,
robotController.Data.State?.Loads ?? [],
robotController.Data.State?.BatteryState.Charging ?? false,
robotController.Data.Visualization?.AgvPosition.X ?? 0,
robotController.Data.Visualization?.AgvPosition.Y ?? 0,
robotController.Data.Visualization?.AgvPosition.Theta ?? 0);
public Task AbortMovement()
{
throw new NotImplementedException();
}
public async Task<RobotResult> Execute(RobotNet.VDA5050.InstantAction.Action action, CancellationToken cancellationToken)
{
var result = await robotController.SendInstantActionAsync(action, cancellationToken);
return new(result.IsSuccess, result.Message);
}
public async Task<RobotResult> MoveToNode(string nodeName, CancellationToken cancellationToken)
{
var result = await robotController.MoveToNodeAsync(nodeName, null, cancellationToken);
return new(result.IsSuccess, result.Message);
}
public async Task<RobotResult> MoveToNode(string nodeName, double lastAngle, CancellationToken cancellationToken)
{
var result = await robotController.MoveToNodeAsync(nodeName, lastAngle, cancellationToken);
return new(result.IsSuccess, result.Message);
}
public async Task<RobotResult> MoveToStation(string stationName, StationAction action, CancellationToken cancellationToken)
{
var result = await robotController.MoveToStationAsync(stationName, action, cancellationToken);
return new(result.IsSuccess, result.Message);
}
}