update
This commit is contained in:
parent
73038de662
commit
99716cc414
|
|
@ -4,4 +4,4 @@
|
|||
@rendermode InteractiveServer
|
||||
|
||||
@attribute [Authorize]
|
||||
<h1>Welcome to RobotApp!</h1>
|
||||
@* <h1>Welcome to RobotApp!</h1> *@
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"launchBrowser": true,
|
||||
"workingDirectory": "$(TargetDir)",
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"applicationUrl": "https://localhost:7150;http://localhost:5229",
|
||||
"applicationUrl": "https://0.0.0.0:7150;http://localhost:5229",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,11 +191,11 @@ public class MQTTClient : IAsyncDisposable
|
|||
|
||||
if (isValid)
|
||||
{
|
||||
Console.WriteLine("[BROKER] CLIENT CERTIFICATE VALID");
|
||||
Console.WriteLine("Broker CERTIFICATE VALID");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("[BROKER] CLIENT CERTIFICATE INVALID");
|
||||
Console.WriteLine("Broker CERTIFICATE INVALID");
|
||||
foreach (var status in arg.Chain.ChainStatus)
|
||||
Console.WriteLine($" -> Chain error: {status.Status} - {status.StatusInformation}");
|
||||
}
|
||||
|
|
@ -222,7 +222,7 @@ public class MQTTClient : IAsyncDisposable
|
|||
{
|
||||
var tlsOptions = new MqttClientTlsOptionsBuilder()
|
||||
.UseTls(true)
|
||||
.WithSslProtocols(System.Security.Authentication.SslProtocols.Tls12)
|
||||
.WithSslProtocols(System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls13)
|
||||
.WithCertificateValidationHandler(ValidateCertificates)
|
||||
.WithClientCertificatesProvider(new MQTTClientCertificatesProvider(VDA5050Setting.CerFile, VDA5050Setting.KeyFile))
|
||||
.Build();
|
||||
|
|
@ -304,11 +304,11 @@ public class MQTTClient : IAsyncDisposable
|
|||
{
|
||||
try
|
||||
{
|
||||
var applicationMessage = new MqttApplicationMessageBuilder()
|
||||
.WithTopic(topic)
|
||||
.WithPayload(data)
|
||||
.WithQualityOfServiceLevel(MqttQualityOfServiceLevel.AtLeastOnce)
|
||||
.Build();
|
||||
var applicationMessage = MqttClientFactory.CreateApplicationMessageBuilder()
|
||||
.WithTopic(topic)
|
||||
.WithPayload(data)
|
||||
.WithQualityOfServiceLevel(MqttQualityOfServiceLevel.AtLeastOnce)
|
||||
.Build();
|
||||
if (MqttClient is null || !IsConnected) return new(false, "Chưa có kết nối tới broker");
|
||||
var publish = await MqttClient.PublishAsync(applicationMessage);
|
||||
if (!publish.IsSuccess) continue;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public abstract class RobotAction(IServiceProvider serviceProvider) : IDisposabl
|
|||
{
|
||||
HistoryStatus = Status;
|
||||
Status = ActionStatus.PAUSED;
|
||||
IsPaused = true;
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
|
|
@ -68,7 +69,8 @@ public abstract class RobotAction(IServiceProvider serviceProvider) : IDisposabl
|
|||
|
||||
public void Cancel()
|
||||
{
|
||||
if(!IsCompleted) IsCancelAction = true;
|
||||
if (!IsCompleted) IsCancelAction = true;
|
||||
if (Status == ActionStatus.WAITING) StopAction();
|
||||
}
|
||||
|
||||
public async Task WaitAsync(CancellationToken cancellationToken)
|
||||
|
|
@ -94,6 +96,7 @@ public abstract class RobotAction(IServiceProvider serviceProvider) : IDisposabl
|
|||
|
||||
protected virtual Task StopAction()
|
||||
{
|
||||
Console.WriteLine($"StopAction {Type}");
|
||||
Status = ActionStatus.FAILED;
|
||||
ResultDescription = "Action bị hủy bỏ.";
|
||||
return Task.CompletedTask;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class RobotActionController(Logger<RobotActionController> Logger, RobotAc
|
|||
ActionStatus = a.Status.ToString(),
|
||||
ResultDescription = a.ResultDescription,
|
||||
})];
|
||||
public bool HasActionRunning => !ActionQueue.IsEmpty || Actions.Values.Any(a => !a.IsCompleted);
|
||||
public bool HasActionRunning => !ActionQueue.IsEmpty || Actions.Values.Any(a => a.Type != ActionType.cancelOrder && !a.IsCompleted);
|
||||
|
||||
private readonly Dictionary<string, RobotAction> Actions = [];
|
||||
private readonly ConcurrentQueue<(ActionScopes scope, VDA5050.InstantAction.Action action)> ActionQueue = [];
|
||||
|
|
@ -62,7 +62,7 @@ public class RobotActionController(Logger<RobotActionController> Logger, RobotAc
|
|||
{
|
||||
foreach (var action in Actions.Values)
|
||||
{
|
||||
if (!action.IsCompleted) action.Cancel();
|
||||
if (!action.IsCompleted && action.Type != ActionType.cancelOrder) action.Cancel();
|
||||
}
|
||||
}
|
||||
else if (Actions.TryGetValue(actionId, out RobotAction? robotAction) && robotAction is not null) robotAction.Cancel();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using RobotApp.VDA5050.InstantAction;
|
|||
using RobotApp.VDA5050.Order;
|
||||
using RobotApp.VDA5050.State;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Data;
|
||||
using Action = RobotApp.VDA5050.InstantAction.Action;
|
||||
|
||||
namespace RobotApp.Services.Robot;
|
||||
|
|
@ -111,6 +112,7 @@ public class RobotOrderController(INavigation NavigationManager,
|
|||
CurrentBaseNode = null;
|
||||
Nodes = [];
|
||||
Edges = [];
|
||||
UpdateState();
|
||||
StateManager.TransitionTo(AutoStateType.Idle);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ public class RobotStates(RobotConfiguration RobotConfiguration,
|
|||
IDriver DriverManager) : BackgroundService
|
||||
{
|
||||
private uint HeaderId = 0;
|
||||
private readonly string SerialNumber = RobotConfiguration.SerialNumber;
|
||||
|
||||
private WatchTimerAsync<RobotStates>? UpdateStateTimer;
|
||||
private const int UpdateStateInterval = 1000;
|
||||
|
|
@ -42,7 +41,7 @@ public class RobotStates(RobotConfiguration RobotConfiguration,
|
|||
return new StateMsg
|
||||
{
|
||||
HeaderId = HeaderId++,
|
||||
SerialNumber = SerialNumber,
|
||||
SerialNumber = RobotConfiguration.SerialNumber,
|
||||
Maps = [],
|
||||
OrderId = OrderManager.OrderId,
|
||||
OrderUpdateId = OrderManager.OrderUpdateId,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ namespace RobotApp.Services.Robot;
|
|||
|
||||
public class RobotVisualization(ILocalization Localization, INavigation Navigation, RobotConfiguration RobotConfiguration, RobotConnection RobotConnection, Logger<RobotVisualization> Logger) : BackgroundService
|
||||
{
|
||||
public string SerialNumber = RobotConfiguration.SerialNumber;
|
||||
private uint HeaderId;
|
||||
|
||||
private WatchTimerAsync<RobotVisualization>? UpdateTimer;
|
||||
|
|
@ -17,7 +16,7 @@ public class RobotVisualization(ILocalization Localization, INavigation Navigati
|
|||
return new VisualizationMsg()
|
||||
{
|
||||
HeaderId = HeaderId++,
|
||||
SerialNumber = SerialNumber,
|
||||
SerialNumber = RobotConfiguration.SerialNumber,
|
||||
MapId = Localization.CurrentActiveMap,
|
||||
MapDescription = string.Empty,
|
||||
AgvPosition = new AgvPosition()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user