This commit is contained in:
Đăng Nguyễn
2025-09-15 17:39:02 +07:00
parent cf309cccba
commit 0d97684f70
69 changed files with 1363 additions and 412 deletions

View File

@@ -2,8 +2,6 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public enum ValueDataType
{
BOOL,
@@ -17,9 +15,9 @@ public enum ValueDataType
public class ActionParameters
{
[Required]
public string Key { get; set; }
public string Key { get; set; } = string.Empty;
[Required]
public string ValueDataType { get; set; }
public string Description { get; set; }
public string ValueDataType { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public bool IsOptional { get; set; }
}

View File

@@ -2,7 +2,6 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public enum ActionScopes
{
@@ -13,11 +12,11 @@ public enum ActionScopes
public class AgvActions
{
[Required]
public string ActionType { get; set; }
public string ActionDescription { get; set; }
public string ActionType { get; set; } = string.Empty;
public string ActionDescription { get; set; } = string.Empty;
[Required]
public string[] ActionScopes { get; set; }
public ActionParameters[] ActionParameters { get; set; }
public string ResultDescription { get; set; }
public string[] BlockingTypes { get; set; }
public string[] ActionScopes { get; set; } = [];
public ActionParameters[] ActionParameters { get; set; } = [];
public string ResultDescription { get; set; } = string.Empty;
public string[] BlockingTypes { get; set; } = [];
}

View File

@@ -2,11 +2,10 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public class AgvGeometry
{
public WheelDefinitions[] WheelDefinitions { get; set; }
public Envelopes2d[] Envelopes2d { get; set; }
public Envelopes3d[] Envelopes3d { get; set; }
public WheelDefinitions[] WheelDefinitions { get; set; } = [];
public Envelopes2d[] Envelopes2d { get; set; } = [];
public Envelopes3d[] Envelopes3d { get; set; } = [];
}

View File

@@ -2,8 +2,6 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public class PolygonPoints
{
[Required]
@@ -14,8 +12,8 @@ public class PolygonPoints
public class Envelopes2d
{
[Required]
public string Set { get; set; }
public string Set { get; set; } = string.Empty;
[Required]
public PolygonPoints[] PolygonPoints { get; set; }
public string Description { get; set; }
public PolygonPoints[] PolygonPoints { get; set; } = [];
public string Description { get; set; } = string.Empty;
}

View File

@@ -2,15 +2,13 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public class Envelopes3d
{
[Required]
public string Set { get; set; }
public string Set { get; set; } = string.Empty;
[Required]
public string Format { get; set; }
public object Data { get; set; }
public string Url { get; set; }
public string Description { get; set; }
public string Format { get; set; } = string.Empty;
public object Data { get; set; } = string.Empty;
public string Url { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}

View File

@@ -2,29 +2,27 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public class FactSheetMsg
{
public uint HeaderId { get; set; }
public string Timestamp { get; set; }
public uint HeaderId { get; set; } = 1;
public string Timestamp { get; set; } = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
[Required]
public string Version { get; set; }
public string Version { get; set; } = "1.0.0";
[Required]
public string Manufacturer { get; set; }
public string Manufacturer { get; set; } = "PhenikaaX";
[Required]
public string SerialNumber { get; set; }
public string SerialNumber { get; set; } = string.Empty;
[Required]
public TypeSpecification TypeSpecification { get; set; }
public TypeSpecification TypeSpecification { get; set; } = new();
[Required]
public PhysicalParameters PhysicalParameters { get; set; }
public PhysicalParameters PhysicalParameters { get; set; } = new();
[Required]
public ProtocolLimits ProtocolLimits { get; set; }
public ProtocolLimits ProtocolLimits { get; set; } = new();
[Required]
public ProtocolFeatures ProtocolFeatures { get; set; }
public ProtocolFeatures ProtocolFeatures { get; set; } = new();
[Required]
public AgvGeometry AgvGeometry { get; set; }
public AgvGeometry AgvGeometry { get; set; } = new();
[Required]
public LoadSpecification LoadSpecification { get; set; }
//public LocalizationParameter LocalizationParameters { get; set; }
public LoadSpecification LoadSpecification { get; set; } = new();
}

View File

@@ -1,14 +1,12 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public class LoadSets
{
public string SetName { get; set; }
public string LoadType { get; set; }
public string[] LoadPositions { get; set; }
public BoundingBoxReference BoundingBoxReference { get; set; }
public LoadDimensions LoadDimensions { get; set; }
public string SetName { get; set; } = string.Empty;
public string LoadType { get; set; } = string.Empty;
public string[] LoadPositions { get; set; } = [];
public BoundingBoxReference BoundingBoxReference { get; set; } = new();
public LoadDimensions LoadDimensions { get; set; } = new();
public double MaxWeigth { get; set; }
public double MinLoadhandlingHeight { get; set; }
public double MaxLoadhandlingHeight { get; set; }
@@ -21,6 +19,6 @@ public class LoadSets
public double AgvDecelerationLimit { get; set; }
public double PickTime { get; set; }
public double DropTime { get; set; }
public string Description { get; set; }
public string Description { get; set; } = string.Empty;
}

View File

@@ -1,9 +1,8 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public class LoadSpecification
{
public string[] LoadPositions { get; set; }
public LoadSets[] LoadSets { get; set; }
public string[] LoadPositions { get; set; } = [];
public LoadSets[] LoadSets { get; set; } = [];
}

View File

@@ -2,7 +2,6 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public enum Support
{
@@ -12,8 +11,8 @@ public enum Support
public class OptionalParameters
{
[Required]
public string Parameter { get; set; }
public string Parameter { get; set; } = string.Empty;
[Required]
public string Support { get; set; }
public string Description { get; set; }
public string Support { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}

View File

@@ -2,12 +2,11 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public class ProtocolFeatures
{
[Required]
public OptionalParameters[] OptionalParameters { get; set; }
public OptionalParameters[] OptionalParameters { get; set; } = [];
[Required]
public AgvActions[] AgvActions { get; set; }
public AgvActions[] AgvActions { get; set; } = [];
}

View File

@@ -2,13 +2,12 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public class ProtocolLimits
{
[Required]
public MaxStringLens MaxStringLens { get; set; }
public MaxStringLens MaxStringLens { get; set; } = new();
[Required]
public MaxArrayLens MaxArrayLens { get; set; }
public MaxArrayLens MaxArrayLens { get; set; } = new();
[Required]
public Timing Timing { get; set; }
public Timing Timing { get; set; } = new();
}

View File

@@ -2,8 +2,6 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public enum AgvKinematic
{
DIFF,
@@ -35,12 +33,12 @@ public enum NavigationTypes
public class TypeSpecification
{
[Required]
public string SeriesName { get; set; }
public string SeriesDescription { get; set; }
public string SeriesName { get; set; } = string.Empty;
public string SeriesDescription { get; set; } = string.Empty;
[Required]
public string AgvKinematic { get; set; }
public string AgvKinematic { get; set; } = string.Empty;
[Required]
public string AgvClass { get; set; }
public string AgvClass { get; set; } = string.Empty;
[Required]
public double MaxLoadMass { get; set; }
[Required]

View File

@@ -2,8 +2,6 @@
namespace RobotApp.VDA5050.Factsheet;
#nullable disable
public enum WheelDefinitionsType
{
DRIVE,
@@ -11,6 +9,7 @@ public enum WheelDefinitionsType
FIXED,
MECANUM,
}
public class WheelDefinitionsPosition
{
[Required]
@@ -23,17 +22,17 @@ public class WheelDefinitionsPosition
public class WheelDefinitions
{
[Required]
public string Type { get; set; }
public string Type { get; set; } = string.Empty;
[Required]
public bool IsActiveDriven { get; set; }
[Required]
public bool IsActiveSteered { get; set; }
[Required]
public WheelDefinitionsPosition Position { get; set; }
public WheelDefinitionsPosition Position { get; set; } = new();
[Required]
public double Diameter { get; set; }
[Required]
public double Width { get; set; }
public double CenterDisplacement { get; set; }
public string Constraints { get; set; }
public string Constraints { get; set; } = string.Empty;
}

View File

@@ -1,9 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class Battery
{
public uint Battery_low { get; set; }
public uint Battery_normal { get; set; }
public uint Battery_good { get; set; }
public uint Battery_full { get; set; }
}

View File

@@ -1,11 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public enum BatteryThreshold
{
LOW,
NORMAL,
MIDDLE,
GOOD,
FULL,
NONE
}

View File

@@ -1,31 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class CameraSafety
{
public double Pass_through_x_min { get; set; }
public double Pass_through_x_max { get; set; }
public double Pass_through_y_min { get; set; }
public double Pass_through_y_max { get; set; }
public double Pass_through_z_min { get; set; }
public double Pass_through_z_max { get; set; }
public uint Ground_seg_max_iterations { get; set; }
public double Ground_seg_distance_threshold { get; set; }
public double Warn_z1 { get; set; }
public double Protect_z1 { get; set; }
public double Warn_z2 { get; set; }
public double Protect_z2 { get; set; }
public double Warn_z3 { get; set; }
public double Protect_z3 { get; set; }
public double Warn_z4 { get; set; }
public double Protect_z4 { get; set; }
public double Warn_z5 { get; set; }
public double Protect_z5 { get; set; }
public double Warn_z6 { get; set; }
public double Protect_z6 { get; set; }
public uint Min_cluster_warn_size { get; set; }
public uint Min_cluster_protect_size { get; set; }
public uint Min_cluster_detect_size { get; set; }
public uint Min_consecutive_warn_count { get; set; }
public uint Min_consecutive_protect_count { get; set; }
public uint Min_consecutive_detect_count { get; set; }
}

View File

@@ -1,9 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
#nullable disable
public class ChargerParam
{
public string Charger_ip { get; set; }
public uint Charger_port { get; set; }
}

View File

@@ -1,19 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
#nullable disable
public class FactsheetExtendMsg
{
public uint HeaderId { get; set; }
public DateTime Timestamp { get; set; }
public string Version { get; set; }
public string Manufacturer { get; set; }
public string SerialNumber { get; set; }
public ServerParam Server_param { get; set; }
public RobotParam Robot_param { get; set; }
public Localization Localization { get; set; }
public Navigation Navigation { get; set; }
public Safety Safety { get; set; }
public ChargerParam Charger_param { get; set; }
}

View File

@@ -1,9 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class ForkSafety
{
public double Muted_field_size { get; set; }
public double Protected_field_size { get; set; }
public double Warning_field_size { get; set; }
public double Detect_field_size { get; set; }
}

View File

@@ -1,9 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class Initpose
{
public bool Use_manual_initpose { get; set; }
public double Initpose_x { get; set; }
public double Initpose_y { get; set; }
public double Initpose_yaw { get; set; }
}

View File

@@ -1,10 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class LineSegment
{
public double Least_thresh { get; set; }
public double Min_line_length { get; set; }
public double Predict_distance { get; set; }
public uint Seed_line_points { get; set; }
public uint Min_line_points { get; set; }
}

View File

@@ -1,14 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
#nullable disable
public class Localization
{
public uint Threshold_quality_loc { get; set; }
public bool Use_localization_marker { get; set; }
public bool Use_pallet_detection { get; set; }
public Initpose Initpose { get; set; }
public Xloc Xloc { get; set; }
public VlMarker Vl_marker { get; set; }
}

View File

@@ -1,9 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class Motor
{
public double OdomEncSteeringAngleOffset { get; set; }
public double Steering_fix_wheel_distance_x { get; set; }
public double Steering_fix_wheel_distance_y { get; set; }
public double WheelAcceleration { get; set; }
}

View File

@@ -1,11 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
#nullable disable
public class Navigation
{
public bool Using_control_safety { get; set; }
public uint Control_rate { get; set; }
public Rotate Rotate { get; set; }
public PTA Pta { get; set; }
public PPA Ppa { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class PPA
{
public double Ppa_accuracy_goal { get; set; }
public double Ppa_distance_reduce { get; set; }
}

View File

@@ -1,15 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class PTA
{
public double Pta_linear_vel_max { get; set; }
public double Pta_linear_vel_min { get; set; }
public double Pta_accuracy_goal { get; set; }
public double Pta_distance_reduce { get; set; }
public double Pta_acceleration { get; set; }
public double Pta_lm_front { get; set; }
public double Pta_lm_back { get; set; }
public double Pta_phi_max { get; set; }
public double Pta_amplitude_max { get; set; }
public uint Pta_w_option { get; set; }
}

View File

@@ -1,12 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class RobotParam
{
public bool Use_dynamic_parameter { get; set; } // (Default: True) Declare whether to use dynamic parameters or not
public string? Ethernet_name { get; set; } // The name of Ethernet port which connects to wifi client (e.g eno1, lo, enp3s0)
public double Speed_max_backward { get; set; } // (Default: True) Declare whether to use dynamic parameters or not
public uint Num_day_logger { get; set; } // The name of Ethernet port which connects to wifi client (e.g eno1, lo, enp3s0)
public Motor Motor { get; set; } = new();
public Battery Battery { get; set; } = new();
}

View File

@@ -1,9 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class Rotate
{
public double Angular_vel_max { get; set; }
public double Angular_vel_min { get; set; }
public double Acceleration_rotate { get; set; }
public double Tolerances_rotate { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class Safety
{
public bool Use_camera_safety { get; set; }
public CameraSafety Camera_safety { get; set; } = new();
public ForkSafety Fork_safety { get; set; } = new();
}

View File

@@ -1,14 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
#nullable disable
public class ServerParam
{
public string Server_ip { get; set; }
public string Server_port { get; set; }
public string Keepalive { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Client_protocol { get; set; }
public string Client_id { get; set; }
}

View File

@@ -1,21 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class VlMarker
{
public bool Use_odometry { get; set; }
public uint V_angle { get; set; }
public double Length_v { get; set; }
public double Length_l { get; set; }
public double X_laser { get; set; }
public double Y_laser { get; set; }
public bool Flip_laser { get; set; }
public double Rotate_laser { get; set; }
public uint Frequence_control { get; set; }
public double Angle_min { get; set; }
public double Angle_max { get; set; }
public double Max_init_x { get; set; }
public double Max_init_y { get; set; }
public double Max_init_yaw { get; set; }
public LineSegment Line_segment { get; set; } = new();
}

View File

@@ -1,16 +0,0 @@
namespace RobotApp.VDA5050.FactsheetExtend;
public class Xloc
{
public double Front_vls_width { get; set; }
public double Front_vls_pose_x { get; set; }
public double Front_vls_pose_y { get; set; }
public double Front_vls_pose_yaw { get; set; }
public uint Front_vls_source_id { get; set; }
public double Rear_vls_width { get; set; }
public double Rear_vls_pose_x { get; set; }
public double Rear_vls_pose_y { get; set; }
public double Rear_vls_pose_yaw { get; set; }
public uint Rear_vls_source_id { get; set; }
}

View File

@@ -2,14 +2,13 @@
namespace RobotApp.VDA5050.InstantAction;
#nullable disable
public enum BlockingType
{
NONE,
SOFT,
HARD
}
public class Action
{
[Required]

View File

@@ -2,7 +2,6 @@
namespace RobotApp.VDA5050.InstantAction;
#nullable disable
public class ActionParameter
{
[Required]

View File

@@ -1,7 +1,5 @@
namespace RobotApp.VDA5050.InstantAction;
#nullable disable
public class InstantActionsMsg
{
public uint HeaderId { get; set; }

View File

@@ -2,34 +2,16 @@
public enum ActionType
{
startPause, // No actionParameters
stopPause, // No actionParameters
startCharging, // ActionParameters {CHARGER_IP, CHARGER_PORT, X, Y, THETA}
stopCharging, // ActionParameters {X, Y, THETA}
initPosition, // ActionParameters {X, Y, THETA, MAP_ID, LAST_NODE_ID}
stateRequest, // No actionParameters
logReport, // No actionParameters
pick, // No actionParameters
drop, // No actionParameters
detectObject, // No actionParameters
finePositioning, // ActionParameters {X, Y, THETA, MAP_ID, LAST_NODE_ID}
waitForTrigger, // No actionParameters
cancelOrder, // No actionParameters
factsheetRequest, // No actionParameters
setDynparam, // ActionParameters {PARAM_NAME, PARAM_TYPE, PARAM_VALUE}
saveDynparamRuntime, // No actionParameters
loadDynparamRuntime, // No actionParameters
loadDynparamDefault, // No actionParameters
getDynparamRuntime, // No actionParameters
controlLight, // ActionParameters {LIGHT_TYPE, CONTROL_TYPE}
controlFan, // ActionParameters {CONTROL_TYPE}
controlSpeaker, // ActionParameters {SONG_NUMBER, CONTROL_TYPE}
controlSafetyField, // ActionParameters {FIELD_TYPE, CONTROL_TYPE}
startInPallet, // ActionParameters {X, Y, THETA}
startOutPallet, // ActionParameters {X, Y, THETA}
rotate, // ActionParameters {THETA}
setMap, // ActionParameter {MAP_ID}
START_PAUSE,
STOP_PAUSE,
START_CHARGING,
STOP_CHARGING,
INITIALIZATION_POSITION,
PICK,
DROP,
CANCEL_ORDER,
ROTATE,
REQUEST_FACTSHEET,
REQUEST_VISUALIZATION,
REQUEST_STATE,
}

View File

@@ -1,29 +0,0 @@
using RobotApp.VDA5050.State;
using System.Text;
namespace RobotApp.VDA5050;
public class VDA5050Helper
{
public static string ConvertErrorDetail(IEnumerable<Error> errors)
{
string errorsType = "";
foreach (var error in errors)
{
if (error == errors.Last()) errorsType += $"{error.ErrorType}";
else errorsType += $"{error.ErrorType}, ";
}
StringBuilder errorStr = new($"Robot có lỗi: [{errorsType}]\n");
foreach (var error in errors)
{
string errorDes = $"- {error.ErrorType}: {error.ErrorDescription}\n";
errorStr.Append(errorDes.PadLeft(errorDes.Length + 3));
foreach (var refer in error.ErrorReferences)
{
string errorRefer = $"+ {refer.ReferenceKey}: {refer.ReferenceValue}\n";
errorStr.Append(errorRefer.PadLeft(errorRefer.Length + 9));
}
}
return !errors.Any() ? "" : errorStr.ToString();
}
}

View File

@@ -1,19 +1,12 @@
namespace RobotApp.VDA5050;
#nullable disable
public class VDA5050Setting
{
public bool ServerEnable { get; set; }
public string HostServer { get; set; }
public int Port { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string Manufacturer { get; set; }
public string Version { get; set; }
public int Repeat { get; set; }
public int ConnectionTimeoutSeconds { get; set; }
public int ConnectionBacklog { set; get; }
public int KeepAliveInterval { get; set; }
public int CheckingRobotMsgTimout { get; set; }
public string HostServer { get; set; } = string.Empty;
public int Port { get; set; } = 1883;
public string UserName { get; set; } = "robotics";
public string Password { get; set; } = "robotics";
public string Manufacturer { get; set; } = "PhenikaaX";
public string Version { get; set; } = "0.0.1";
public int PublishRepeat { get; set; } = 2;
}

View File

@@ -1,12 +1,46 @@
namespace RobotApp.VDA5050;
public static class VDA5050Topic
public enum VDA5050Topic
{
public const string Connection = "connection";
public const string Order = "order";
public const string InstantActions = "instantActions";
public const string State = "state";
public const string Visualization = "visualization";
public const string Factsheet = "factsheet";
public const string FactsheetExtend = "factsheetExtend"; // custom by TungNV
CONNECTION,
ORDER,
INSTANTACTIONS,
STATE,
VISUALIZATION,
FACTSHEET
}
public static class EnumExtensions
{
private static readonly Dictionary<VDA5050Topic, string> TopicToStringMap = new()
{
{ VDA5050Topic.CONNECTION, "connection" },
{ VDA5050Topic.ORDER, "order" },
{ VDA5050Topic.INSTANTACTIONS, "instantActions" },
{ VDA5050Topic.STATE, "state" },
{ VDA5050Topic.VISUALIZATION, "visualization" },
{ VDA5050Topic.FACTSHEET, "factsheet" }
};
private static readonly Dictionary<string, VDA5050Topic> StringToTopicMap = new(StringComparer.OrdinalIgnoreCase)
{
{ "connection", VDA5050Topic.CONNECTION },
{ "order", VDA5050Topic.ORDER },
{ "instantActions", VDA5050Topic.INSTANTACTIONS },
{ "state", VDA5050Topic.STATE },
{ "visualization", VDA5050Topic.VISUALIZATION },
{ "factsheet", VDA5050Topic.FACTSHEET }
};
public static string ToTopicString(this VDA5050Topic type)
{
if (TopicToStringMap.TryGetValue(type, out var value)) return value;
throw new ArgumentException($"Invalid VDA5050Topic: {type}");
}
public static VDA5050Topic ToTopic(string value)
{
if (StringToTopicMap.TryGetValue(value, out var result)) return result;
throw new ArgumentException($"No VDA5050Topic with string value '{value}' found.");
}
}