@using MudBlazor @using RobotNet.VDA5050.State @using RobotNet.VDA5050.Type @using RobotNet10.FleetManager.Client.Components.RobotDetail @using RobotNet10.FleetManager.Client.Components.RobotMonitor @using RobotNet10.FleetManager.Client.Services @implements IDisposable @GetRobotName() ID: @RobotData.RobotId @if (RobotData.Model != null) { @RobotData.Model.ModelName } @if (RobotData.LastUpdateTime != default) { Last update: @RobotData.LastUpdateTime.ToLocalTime().ToString("HH:mm:ss") } @if (RobotData.Data != null) { Visualization X: @RobotData.Data.AgvPosition.X.ToString("F2") m Y: @RobotData.Data.AgvPosition.Y.ToString("F2") m Θ: @((RobotData.Data.AgvPosition.Theta * 180.0 / Math.PI).ToString("F1"))° Vx: @RobotData.Data.AgvVelocity.Vx.ToString("F2") m/s Vy: @RobotData.Data.AgvVelocity.Vy.ToString("F2") m/s Omega: @RobotData.Data.AgvVelocity.Omega.ToString("F2") rad/s Position Initialized: @(RobotData.Data.AgvPosition.PositionInitialized ? "Yes" : "No") @if (RobotData.Data.AgvPosition.LocalizationScore >= 0) { Localization Score: @RobotData.Data.AgvPosition.LocalizationScore.ToString("F2") } @if (RobotData.Data.AgvPosition.DeviationRange >= 0) { Deviation Range: @RobotData.Data.AgvPosition.DeviationRange.ToString("F2") m } } Battery State
Errors
@foreach (var error in Errors) { @error.ErrorType }
Notification
@foreach (var info in Information) { @info.InfoType }
@code { [Parameter] public RobotMonitorData RobotData { get; set; } = null!; [Parameter] public RobotMonitorState State { get; set; } = null!; private BatteryCard BatteryCardRef = default!; private Error[] Errors = []; private Information[] Information = []; protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); if (!firstRender) return; State.OnDataChanged += OnDataChanged; } private void OnDataChanged() { if (State.SelectedRobotId != null && State.Robots.TryGetValue(State.SelectedRobotId, out var robot)) { BatteryCardRef.Update(robot.Data?.Battery); Errors = robot.Data?.Errors ?? []; Information = robot.Data?.Infomations ?? []; RobotData = robot; StateHasChanged(); } } public void Dispose() { State.OnDataChanged -= OnDataChanged; } private string GetRobotName() { // Try to get robot name from AvailableRobots var robot = State.AvailableRobots.FirstOrDefault(r => r.RobotId == RobotData.RobotId); return robot?.Name ?? RobotData.RobotId; } }