diff --git a/README.md b/README.md
index 19f2c0f..f13d16b 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,5 @@
# RobotApp
+docker build -t robotics.doc/robotnet/robotapp_dde:2.7 .
+docker save -o robotapp-dde.2.7.tar robotics.doc/robotnet/robotapp_dde:2.7
+scp .\robotapp-dde.2.7.tar robotics@172.20.235.176:~/DDE
\ No newline at end of file
diff --git a/RobotApp.Client/Pages/Order/NodesPanel.razor b/RobotApp.Client/Pages/Order/NodesPanel.razor
index 28a0500..837178c 100644
--- a/RobotApp.Client/Pages/Order/NodesPanel.razor
+++ b/RobotApp.Client/Pages/Order/NodesPanel.razor
@@ -21,13 +21,11 @@
+ OnClick="@(() => EditNodeAsync(node))" />
+ OnClick="@(() => RemoveNodeAsync(node))" />
@@ -78,22 +76,22 @@
Label="Y" />
-
+ @*
-
+ *@
-
+ @*
-
+ *@
-
+ @*
-
+ *@
diff --git a/RobotApp.Client/Pages/Order/OrderMess.razor b/RobotApp.Client/Pages/Order/OrderMess.razor
index 28b8bfa..4531596 100644
--- a/RobotApp.Client/Pages/Order/OrderMess.razor
+++ b/RobotApp.Client/Pages/Order/OrderMess.razor
@@ -84,7 +84,7 @@
new JsonSerializerOptions
{
WriteIndented = true,
- DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
});
}
private async Task OpenImportDialog()
@@ -220,7 +220,12 @@
try
{
- var orderMsg = JsonSerializer.Deserialize(OrderJson);
+ var orderMsg = JsonSerializer.Deserialize(OrderJson,
+ new JsonSerializerOptions
+ {
+ WriteIndented = true,
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
+ });
if (orderMsg is null)
{
Snackbar.Add("Unable to convert JSON to Order", Severity.Warning);
@@ -251,20 +256,17 @@
}
}
- var response = await Http.PostAsJsonAsync(
- "/api/order",
- JsonSerializer.Deserialize(OrderJson)
- );
+ var response = await Http.PostAsJsonAsync("/api/order",orderMsg);
sendSuccess = response.IsSuccessStatusCode;
-
}
catch(JsonException jsonEx)
{
Snackbar.Add($"Json to Order failed: {jsonEx.Message}", Severity.Warning);
}
- catch
+ catch (Exception ex)
{
+ Snackbar.Add($"Send Order failed: {ex.Message}", Severity.Warning);
sendSuccess = false;
}
diff --git a/RobotApp.Client/Services/UiEdge.cs b/RobotApp.Client/Services/UiEdge.cs
index 41bab21..e54dd1c 100644
--- a/RobotApp.Client/Services/UiEdge.cs
+++ b/RobotApp.Client/Services/UiEdge.cs
@@ -127,11 +127,11 @@ public static class QuarterGeometry
public class OrderMessage
{
public int HeaderId { get; set; }
- public string Timestamp { get; set; } = "";
- public string Version { get; set; } = "v1";
- public string Manufacturer { get; set; } = "PNKX";
- public string SerialNumber { get; set; } = "T800-002";
- public string OrderId { get; set; }
+ public string Timestamp { get; set; } = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
+ public string Version { get; set; } = "2.1.0";
+ public string Manufacturer { get; set; } = "PhenikaaX";
+ public string SerialNumber { get; set; } = "T800-003";
+ public string OrderId { get; set; } = "";
public int OrderUpdateId { get; set; }
public string? ZoneSetId { get; set; }
@@ -411,9 +411,7 @@ public class OrderMessage
{
HeaderId = (uint)HeaderId++,
- Timestamp = string.IsNullOrWhiteSpace(Timestamp)
- ? DateTime.UtcNow.ToString("O")
- : Timestamp,
+ Timestamp = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),
Version = Version,
Manufacturer = Manufacturer,
diff --git a/RobotApp.VDA5050/Order/Edge.cs b/RobotApp.VDA5050/Order/Edge.cs
index ca9c5ee..d6f9d9f 100644
--- a/RobotApp.VDA5050/Order/Edge.cs
+++ b/RobotApp.VDA5050/Order/Edge.cs
@@ -2,7 +2,6 @@
namespace RobotApp.VDA5050.Order;
-#nullable disable
public class Edge
{
@@ -26,7 +25,7 @@ public class Edge
public bool RotationAllowed { get; set; }
public double MaxRotationSpeed { get; set; }
public double Length { get; set; }
- public Trajectory Trajectory { get; set; }
+ public Trajectory? Trajectory { get; set; }
public Corridor Corridor { get; set; } = new();
[Required]
public InstantAction.Action[] Actions { get; set; } = [];
diff --git a/RobotApp.VDA5050/Type/ActionType.cs b/RobotApp.VDA5050/Type/ActionType.cs
index b1e1acc..2922f8e 100644
--- a/RobotApp.VDA5050/Type/ActionType.cs
+++ b/RobotApp.VDA5050/Type/ActionType.cs
@@ -21,7 +21,7 @@ public enum ActionType
//liftUp,
//liftDown,
//liftRotate,
- //rotate,
+ rotate,
//rotateKeepLift,
//mutedBaseOn,
//mutedBaseOff,
diff --git a/RobotApp/Services/Robot/RobotActionStorage.cs b/RobotApp/Services/Robot/RobotActionStorage.cs
index 738ae65..778dc81 100644
--- a/RobotApp/Services/Robot/RobotActionStorage.cs
+++ b/RobotApp/Services/Robot/RobotActionStorage.cs
@@ -21,7 +21,7 @@ public class RobotActionStorage(IServiceProvider ServiceProvider)
ActionType.drop => new RobotDropAction(ServiceProvider),
ActionType.pick => new RobotPickAction(ServiceProvider),
//ActionType.liftRotate => new RobotLiftRotateAction(ServiceProvider),
- //ActionType.rotate => new RobotRotateAction(ServiceProvider),
+ ActionType.rotate => new RobotRotateAction(ServiceProvider),
//ActionType.rotateKeepLift => new RobotRotateKeepLift(ServiceProvider),
//ActionType.mutedBaseOn => new RobotMutedBaseOnAction(ServiceProvider),
//ActionType.mutedBaseOff => new RobotMutedBaseOffAction(ServiceProvider),
diff --git a/RobotApp/Services/Robot/RobotConnection.cs b/RobotApp/Services/Robot/RobotConnection.cs
index c3f6abd..440778e 100644
--- a/RobotApp/Services/Robot/RobotConnection.cs
+++ b/RobotApp/Services/Robot/RobotConnection.cs
@@ -26,12 +26,16 @@ public class RobotConnection(RobotConfiguration RobotConfiguration,
{
//Logger.Debug($"Nhận Order: {data}");
var msg = JsonSerializer.Deserialize(data, JsonOptionExtends.Read);
- if (msg is null || string.IsNullOrEmpty(msg.SerialNumber) || msg.SerialNumber != RobotConfiguration.SerialNumber) return;
+ if (msg is null || string.IsNullOrEmpty(msg.SerialNumber) || msg.SerialNumber != RobotConfiguration.SerialNumber)
+ {
+ Logger.Warning($"SerialNumber cuả order không hợp lệ: message SerialNumber {msg?.SerialNumber}");
+ return;
+ }
OrderUpdated?.Invoke(msg);
}
catch (Exception ex)
{
- Logger.Warning($"Nhận Order xảy ra lỗi: {ex.Message} - {ex.StackTrace}");
+ Logger.Warning($"Nhận Order xảy ra lỗi: {ex.Message}");
}
}
@@ -41,12 +45,16 @@ public class RobotConnection(RobotConfiguration RobotConfiguration,
{
//Logger.Debug($"Nhận InstanceActions: {data}");
var msg = JsonSerializer.Deserialize(data, JsonOptionExtends.Read);
- if (msg is null || string.IsNullOrEmpty(msg.SerialNumber) || msg.SerialNumber != RobotConfiguration.SerialNumber) return;
+ if (msg is null || string.IsNullOrEmpty(msg.SerialNumber) || msg.SerialNumber != RobotConfiguration.SerialNumber)
+ {
+ Logger.Warning($"SerialNumber của action không hợp lệ: message SerialNumber {msg?.SerialNumber}");
+ return;
+ }
ActionUpdated?.Invoke(msg);
}
catch (Exception ex)
{
- Logger.Warning($"Nhận InstanceActions xảy ra lỗi: {ex.Message} - {ex.StackTrace}");
+ Logger.Warning($"Nhận InstanceActions xảy ra lỗi: {ex.Message}");
}
}
diff --git a/RobotApp/Services/Robot/RobotFactsheet.cs b/RobotApp/Services/Robot/RobotFactsheet.cs
index eecbc43..f7db1f6 100644
--- a/RobotApp/Services/Robot/RobotFactsheet.cs
+++ b/RobotApp/Services/Robot/RobotFactsheet.cs
@@ -25,7 +25,7 @@ public class RobotFactsheet(RobotConnection RobotConnection, RobotConfiguration
{ ActionType.pick, Pick},
{ ActionType.drop, Drop},
//{ ActionType.liftRotate, LiftRotate},
- //{ ActionType.rotate, Rotate},
+ { ActionType.rotate, Rotate},
//{ ActionType.rotateKeepLift, RotateKeepLift},
//{ ActionType.mutedBaseOn, MutedBaseOn},
//{ ActionType.mutedBaseOff, MutedBaseOff},
@@ -224,22 +224,22 @@ public class RobotFactsheet(RobotConnection RobotConnection, RobotConfiguration
// BlockingTypes = [BlockingType.HARD.ToString()],
//};
- //public readonly static AgvAction Rotate = new()
- //{
- // ActionType = ActionType.rotate.ToString(),
- // ActionDescription = "Xoay robot tại chỗ.",
- // ActionScopes = [ActionScopes.INSTANT.ToString(), ActionScopes.NODE.ToString()],
- // ActionParameters = [
- // new()
- // {
- // Key = "angle",
- // Description = "Góc xoay của robot. (rad)",
- // ValueDataType = ValueDataType.FLOAT.ToString(),
- // IsOptional = false,
- // }],
- // ResultDescription = "Robot đã xoay tại chỗ.",
- // BlockingTypes = [BlockingType.HARD.ToString()],
- //};
+ public readonly static AgvAction Rotate = new()
+ {
+ ActionType = ActionType.rotate.ToString(),
+ ActionDescription = "Xoay robot tại chỗ.",
+ ActionScopes = [ActionScopes.INSTANT.ToString(), ActionScopes.NODE.ToString()],
+ ActionParameters = [
+ new()
+ {
+ Key = "angle",
+ Description = "Góc xoay của robot. (rad)",
+ ValueDataType = ValueDataType.FLOAT.ToString(),
+ IsOptional = false,
+ }],
+ ResultDescription = "Robot đã xoay tại chỗ.",
+ BlockingTypes = [BlockingType.HARD.ToString()],
+ };
//public readonly static AgvAction RotateKeepLift = new()
//{
diff --git a/RobotApp/Services/Robot/RobotLoads.cs b/RobotApp/Services/Robot/RobotLoads.cs
index 4272429..5ca1b5c 100644
--- a/RobotApp/Services/Robot/RobotLoads.cs
+++ b/RobotApp/Services/Robot/RobotLoads.cs
@@ -3,7 +3,7 @@ using RobotApp.VDA5050.State;
namespace RobotApp.Services.Robot;
-public class RobotLoads(IPeripheral PeriperalManager) : ILoad
+public class RobotLoads() : ILoad
{
//public Load[] Load => PeriperalManager.HasLoad ? [GetLoad()] : [];
public Load[] Load { get; private set; } = [];
diff --git a/RobotApp/Services/Robot/RobotLocalization.cs b/RobotApp/Services/Robot/RobotLocalization.cs
index d839bdc..5ed0a40 100644
--- a/RobotApp/Services/Robot/RobotLocalization.cs
+++ b/RobotApp/Services/Robot/RobotLocalization.cs
@@ -274,32 +274,37 @@ public class RobotLocalization(RobotConfiguration RobotConfiguration, Simulation
{
try
{
- var xyzw = QuaternionToXYZW(0, 0, theta);
- var response = XlocClient.SetInitialPose(new SetInitialPoseRequest()
- {
- InitialPose = new Pose()
- {
- Position = new Point()
- {
- X = x,
- Y = y,
- Z = 0,
- },
- Orientation = new Quaternion()
- {
- X = xyzw.x,
- Y = xyzw.y,
- Z = xyzw.z,
- W = xyzw.w
- }
- }
- });
- if (response.Status.Code == StatusResponse.Types.StatusCode.Ok) return new(true);
+ if (IsSimulation) SimVisualization.LocalizationInitialize(x, y, theta);
else
{
- Logger.Warning("Khởi tạo vị trí cho robot thất bại. Kết quả trả về: {response.Status.Code} - {response.Status.Message}");
- return new(false, "Khởi tạo vị trí cho robot thất bại");
+ var xyzw = QuaternionToXYZW(0, 0, theta);
+ var response = XlocClient.SetInitialPose(new SetInitialPoseRequest()
+ {
+ InitialPose = new Pose()
+ {
+ Position = new Point()
+ {
+ X = x,
+ Y = y,
+ Z = 0,
+ },
+ Orientation = new Quaternion()
+ {
+ X = xyzw.x,
+ Y = xyzw.y,
+ Z = xyzw.z,
+ W = xyzw.w
+ }
+ }
+ });
+ if (response.Status.Code == StatusResponse.Types.StatusCode.Ok) return new(true);
+ else
+ {
+ Logger.Warning("Khởi tạo vị trí cho robot thất bại. Kết quả trả về: {response.Status.Code} - {response.Status.Message}");
+ return new(false, "Khởi tạo vị trí cho robot thất bại");
+ }
}
+ return new(true);
}
catch (Exception ex)
{