update
This commit is contained in:
63
RobotApp.Client/Pages/Components/Config/RobotConfig.razor
Normal file
63
RobotApp.Client/Pages/Components/Config/RobotConfig.razor
Normal file
@@ -0,0 +1,63 @@
|
||||
<EditForm Model="@Config" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Navigation Type</label>
|
||||
<InputSelect class="form-select" @bind-Value="Config.NavigationType" TValue="NavigationType">
|
||||
@foreach (var t in NavigationTypes)
|
||||
{
|
||||
<option value="@t">@t</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col">
|
||||
<label class="form-label">Radius (wheel)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.RadiusWheel" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Width (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.Width" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col">
|
||||
<label class="form-label">Length (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.Length" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Height (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.Height" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Config.Description" />
|
||||
</div>
|
||||
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotConfigDto Config = new();
|
||||
private IEnumerable<NavigationType> NavigationTypes => Enum.GetValues(typeof(NavigationType)).Cast<NavigationType>();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Config = Model ?? new();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Config;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
50
RobotApp.Client/Pages/Components/Config/RobotPLCConfig.razor
Normal file
50
RobotApp.Client/Pages/Components/Config/RobotPLCConfig.razor
Normal file
@@ -0,0 +1,50 @@
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label">PLC Address</label>
|
||||
<InputText class="form-control" @bind-Value="Local.PLCAddress" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Port</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.PLCPort" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Unit Id</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.PLCUnitId" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotPlcConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotPlcConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotPlcConfigDto Local = new();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Local = Model is not null ? Model with { } : new RobotPlcConfigDto();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Very Slow (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedVerySlow" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Slow (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedSlow" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Normal (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedNormal" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Medium (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedMedium" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Optimal (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedOptimal" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Fast (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedFast" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Very Fast (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedVeryFast" />
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotSafetyConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotSafetyConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotSafetyConfigDto Local = new();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// Work on a shallow copy (record) so parent instance isn't mutated until submit
|
||||
Local = Model is not null ? Model with { } : new RobotSafetyConfigDto();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="form-check mb-2">
|
||||
<InputCheckbox class="form-check-input" @bind-Value="Local.EnableSimulation" />
|
||||
<label class="form-check-label">Enable Simulation</label>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Max Velocity (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationMaxVelocity" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Max Angular Velocity (rad/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationMaxAngularVelocity" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Acceleration (m/s²)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationAcceleration" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Deceleration (m/s²)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationDeceleration" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotSimulationConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotSimulationConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotSimulationConfigDto Local = new();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// Use record 'with' to create a shallow copy so parent isn't mutated until submit
|
||||
Local = Model is not null ? Model with { } : new RobotSimulationConfigDto();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Serial Number</label>
|
||||
<InputText class="form-control" @bind-Value="Local.SerialNumber" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Manufacturer</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050Manufacturer" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Host</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050HostServer" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Port</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.VDA5050Port" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Publish Repeat</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.VDA5050PublishRepeat" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Username</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050UserName" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Password</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050Password" type="password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Version</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050Version" />
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-2">
|
||||
<InputCheckbox class="form-check-input" @bind-Value="Local.VDA5050EnablePassword" />
|
||||
<label class="form-check-label">Enable Password</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-2">
|
||||
<InputCheckbox class="form-check-input" @bind-Value="Local.VDA5050EnableTls" />
|
||||
<label class="form-check-label">Enable TLS</label>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotVDA5050ConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotVDA5050ConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotVDA5050ConfigDto Local = new();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Local = Model is not null ? Model with { } : new RobotVDA5050ConfigDto();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,60 @@
|
||||
<div class="view">
|
||||
<h4>Infomations</h4>
|
||||
<h4 class="info-title">Informations</h4>
|
||||
|
||||
<div class="info-grid">
|
||||
<div class="info-col">
|
||||
<dl class="info-list">
|
||||
<dt class="info-term">X (m)</dt>
|
||||
<dd class="info-desc">@Localization.X.ToString("F3")</dd>
|
||||
|
||||
<dt class="info-term">Y (m)</dt>
|
||||
<dd class="info-desc">@Localization.Y.ToString("F3")</dd>
|
||||
|
||||
<dt class="info-term">Theta (rad)</dt>
|
||||
<dd class="info-desc">@Localization.Theta.ToString("F4")</dd>
|
||||
|
||||
<dt class="info-term">Theta (deg)</dt>
|
||||
<dd class="info-desc">@($"{Localization.Theta * 180.0 / Math.PI:F2}°")</dd>
|
||||
|
||||
<dt class="info-term">Ready</dt>
|
||||
<dd class="info-desc">@((Localization.IsReady) ? "Yes" : "No")</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="info-col">
|
||||
<dl class="info-list">
|
||||
<dt class="info-term">SlamState</dt>
|
||||
<dd class="info-desc">@Localization.SlamState</dd>
|
||||
|
||||
<dt class="info-term">SlamDetail</dt>
|
||||
<dd class="info-desc text-truncate" title="@Localization.SlamStateDetail">@Localization.SlamStateDetail</dd>
|
||||
|
||||
<dt class="info-term">Active Map</dt>
|
||||
<dd class="info-desc text-truncate" title="@Localization.CurrentActiveMap">@Localization.CurrentActiveMap</dd>
|
||||
|
||||
<dt class="info-term">Reliability</dt>
|
||||
<dd class="info-desc">@($"{Localization.Reliability:F1}%")</dd>
|
||||
|
||||
<dt class="info-term">MatchingScore</dt>
|
||||
<dd class="info-desc">@($"{Localization.MatchingScore:F1}%")</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private class LocalizationDto
|
||||
{
|
||||
public bool IsReady { get; set; }
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
public double Theta { get; set; }
|
||||
public string SlamState { get; set; } = "Localization";
|
||||
public string SlamStateDetail { get; set; } = "/r/n";
|
||||
public string CurrentActiveMap { get; set; } = "Localization";
|
||||
public double Reliability { get; set; }
|
||||
public double MatchingScore { get; set; }
|
||||
}
|
||||
|
||||
private LocalizationDto Localization = new();
|
||||
}
|
||||
|
||||
@@ -5,9 +5,117 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
background-color: var(--mud-palette-surface);
|
||||
border-radius: var(--mud-default-borderradius);
|
||||
background-color: var(--mud-palette-surface, #ffffff);
|
||||
border-radius: var(--mud-default-borderradius, 8px);
|
||||
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
||||
box-shadow: var(--mud-elevation-10);
|
||||
padding: 15px;
|
||||
box-shadow: var(--mud-elevation-10, 0 4px 12px rgba(0,0,0,0.08));
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(0,0,0,0.04);
|
||||
}
|
||||
|
||||
.view::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 6px;
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
background: linear-gradient(180deg, var(--mud-palette-primary, #1976d2), rgba(25,118,210,0.7));
|
||||
}
|
||||
|
||||
.info-title {
|
||||
margin: 0 0 10px 12px;
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
color: var(--mud-palette-primary, #1976d2);
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
align-items: flex-start;
|
||||
flex: 1 1 auto;
|
||||
overflow: hidden;
|
||||
padding: 1.5em;
|
||||
}
|
||||
|
||||
.info-col {
|
||||
flex: 1 1 50%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.info-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.info-list dt,
|
||||
.info-list dd {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 6px 0;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.info-term {
|
||||
width: 42%;
|
||||
text-align: right;
|
||||
padding-right: 12px;
|
||||
color: var(--mud-palette-text-secondary, rgba(0,0,0,0.6));
|
||||
font-weight: 600;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.info-desc {
|
||||
width: 58%;
|
||||
text-align: left;
|
||||
font-weight: 700;
|
||||
color: var(--mud-palette-text-primary, rgba(0,0,0,0.85));
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.text-truncate {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.info-list dt + dd {
|
||||
border-bottom: 1px dashed rgba(0,0,0,0.03);
|
||||
}
|
||||
|
||||
.ready-yes {
|
||||
color: var(--mud-palette-success, #2e7d32);
|
||||
}
|
||||
|
||||
.ready-no {
|
||||
color: var(--mud-palette-error, #d32f2f);
|
||||
}
|
||||
|
||||
.percent {
|
||||
color: var(--mud-palette-primary, #1976d2);
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.info-grid {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.info-term {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.info-desc {
|
||||
width: 55%;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user