initial commit

This commit is contained in:
robotics_x1
2026-10-12 15:24:08 +07:00
commit 55228b3772
367 changed files with 162893 additions and 0 deletions

134
Lab505.Sim/ApiModels.cs Normal file
View File

@@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
namespace Lab505.Sim;
#region API Models
/// <summary>
/// Base API result
/// </summary>
public class ApiResult
{
public bool IsSuccess { get; set; }
public string Message { get; set; } = string.Empty;
}
/// <summary>
/// Robot state result
/// </summary>
public class RobotStateResult : ApiResult
{
public RobotStateData? Data { get; set; }
}
/// <summary>
/// Robot state data
/// </summary>
public class RobotStateData
{
public string RobotId { get; set; } = string.Empty;
public Guid MapId { get; set; }
public bool IsOnline { get; set; }
public string State { get; set; } = string.Empty;
public VdaStateMsg StateMsg { get; set; } = new();
public VdaVisualizationMsg VisualizationMsg { get; set; } = new();
}
/// <summary>
/// VDA5050 State message
/// </summary>
public class VdaStateMsg
{
public uint HeaderId { get; set; }
public string? Timestamp { get; set; }
public string? Version { get; set; }
public string? Manufacturer { get; set; }
public string? SerialNumber { get; set; }
public string? OrderId { get; set; }
public int OrderUpdateId { get; set; }
public string? LastNodeId { get; set; }
public int LastNodeSequenceId { get; set; }
public bool Driving { get; set; }
public bool Paused { get; set; }
public bool NewBaseRequest { get; set; }
public double DistanceSinceLastNode { get; set; }
public string? OperatingMode { get; set; }
public VdaAgvPosition AgvPosition { get; set; } = new();
public VdaActionState[] ActionStates { get; set; } = [];
public VdaError[] Errors { get; set; } = [];
}
/// <summary>
/// VDA5050 Visualization message
/// </summary>
public class VdaVisualizationMsg
{
public uint HeaderId { get; set; }
public string? Timestamp { get; set; }
public string? Version { get; set; }
public string? Manufacturer { get; set; }
public string? SerialNumber { get; set; }
public VdaAgvPosition AgvPosition { get; set; } = new();
}
/// <summary>
/// AGV Position
/// </summary>
public class VdaAgvPosition
{
public double X { get; set; }
public double Y { get; set; }
public double Theta { get; set; }
public string? MapId { get; set; }
public bool PositionInitialized { get; set; }
}
/// <summary>
/// Action state
/// </summary>
public class VdaActionState
{
// VDA5050 field name là "actionId" (camelCase) — robot báo về với key này.
[JsonPropertyName("actionId")]
public string ActionID { get; set; } = string.Empty;
public string ActionType { get; set; } = string.Empty;
public string? ActionDescription { get; set; }
public string ActionStatus { get; set; } = string.Empty; // WAITING, INITIALIZING, RUNNING, FINISHED, FAILED, PAUSED
}
/// <summary>
/// VDA Error
/// </summary>
public class VdaError
{
public string ErrorType { get; set; } = string.Empty;
public string? ErrorDescription { get; set; }
public string ErrorLevel { get; set; } = string.Empty; // WARNING, FATAL
}
/// <summary>
/// Instant action request
/// </summary>
public class VdaInstantAction
{
public string ActionId { get; set; } = string.Empty;
public string ActionType { get; set; } = string.Empty;
public string ActionDescription { get; set; } = string.Empty;
public string BlockingType { get; set; } = "NONE";
public List<VdaActionParameter> ActionParameters { get; set; } = [];
}
/// <summary>
/// Action parameter
/// </summary>
public class VdaActionParameter
{
public string Key { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
}
#endregion