Order.cs
10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
using System.Numerics;
using System.Text.Json.Serialization;
using Rcs.Domain.Extensions;
using Rcs.Domain.ValueObjects;
namespace Rcs.Domain.Models.VDA5050
{
/// <summary>
/// VDA 5050 Order消息 - 用于向AGV发送任务指令
/// </summary>
[ProtocolInfo("Default","2.0.0", nameof(Order))]
public class Order : VDA5050_Header
{
public Order()
{
}
/// <summary>
/// 订单ID
/// </summary>
[JsonPropertyName("orderId")]
public string OrderId { get; set; } = string.Empty;
/// <summary>
/// 订单更新ID
/// </summary>
[JsonPropertyName("orderUpdateId")]
public int OrderUpdateId { get; set; }
/// <summary>
/// 区域编号
/// </summary>
[JsonPropertyName("zoneSetId")]
public string? ZoneSetId { get; set; }
/// <summary>
/// 节点列表
/// </summary>
[JsonPropertyName("nodes")]
public List<Node> Nodes { get; set; } = new();
/// <summary>
/// 边列表
/// </summary>
[JsonPropertyName("edges")]
public List<Edge> Edges { get; set; } = new();
}
/// <summary>
/// 节点信息
/// </summary>
public class Node
{
/// <summary>
/// 节点ID
/// </summary>
[JsonPropertyName("nodeId")]
public string NodeId { get; set; } = string.Empty;
/// <summary>
/// 序列ID
/// </summary>
[JsonPropertyName("sequenceId")]
public int SequenceId { get; set; }
/// <summary>
/// 节点说明
/// </summary>
[JsonPropertyName("nodeDescription")]
public string? NodeDescription { get; set; }
/// <summary>
/// 是否释放
/// </summary>
[JsonPropertyName("released")]
public bool Released { get; set; } = false;
/// <summary>
/// 节点位置
/// </summary>
[JsonPropertyName("nodePosition")]
public NodePosition? NodePosition { get; set; }
/// <summary>
/// 动作列表
/// </summary>
[JsonPropertyName("actions")]
public List<Action>? Actions { get; set; }
}
/// <summary>
/// 节点位置
/// </summary>
public class NodePosition
{
/// <summary>
/// X坐标
/// </summary>
[JsonPropertyName("x")]
public double X { get; set; }
/// <summary>
/// Y坐标
/// </summary>
[JsonPropertyName("y")]
public double Y { get; set; }
/// <summary>
/// 角度 (弧度)
/// </summary>
[JsonPropertyName("theta")]
public double? Theta { get; set; }
/// <summary>
/// 坐标偏差范围
/// </summary>
[JsonPropertyName("allowedDeviationXY")]
public double AllowedDeviationXY { get; set; } = PositionConstants.AllowedDeviationPosition;
/// <summary>
/// 角度 (弧度)偏差范围 // 默认15度
/// </summary>
[JsonPropertyName("allowedDeviationTheta")]
public double AllowedDeviationTheta { get; set; } = AngleConstants.AllowedDeviationTheta;
/// <summary>
/// 地图ID
/// </summary>
[JsonPropertyName("mapId")]
public string MapId { get; set; } = string.Empty;
/// <summary>
/// 地图描述
/// </summary>
[JsonPropertyName("mapDescription")]
public string? MapDesription { get; set; }
}
/// <summary>
/// 边信息
/// </summary>
public class Edge
{
/// <summary>
/// 边ID
/// </summary>
[JsonPropertyName("edgeId")]
public string EdgeId { get; set; } = string.Empty;
/// <summary>
/// 序列ID
/// </summary>
[JsonPropertyName("sequenceId")]
public int SequenceId { get; set; }
/// <summary>
/// 边描述
/// </summary>
[JsonPropertyName("edgeDescription")]
public string? EdgeDescription { get; set; }
/// <summary>
/// 是否释放
/// </summary>
[JsonPropertyName("released")]
public bool Released { get; set; } = false;
/// <summary>
/// 起始节点ID
/// </summary>
[JsonPropertyName("startNodeId")]
public string StartNodeId { get; set; } = string.Empty;
/// <summary>
/// 结束节点ID
/// </summary>
[JsonPropertyName("endNodeId")]
public string EndNodeId { get; set; } = string.Empty;
/// <summary>
/// 最大速度 m/s
/// </summary>
[JsonPropertyName("maxSpeed")]
public double? MaxSpeed { get; set; }
/// <summary>
/// 最大高度 m
/// </summary>
[JsonPropertyName("maxHeight")]
public double? MaxHeight { get; set; }
/// <summary>
/// 最小高度 m
/// </summary>
[JsonPropertyName("minHeight")]
public double? MinHeight { get; set; }
/// <summary>
/// 方向
/// </summary>
[JsonPropertyName("orientation")]
public double? Orientation { get; set; }
/// <summary>
/// 方向类型
/// GLOBAL-允许全局方向
/// TANGENTIAL-与边相切
/// </summary>
[JsonPropertyName("orientationType")]
public string OrientationType { get; set; } = "TANGENTIAL";
/// <summary>
/// 为线导或线缆引导车辆设定交叉路口方向
/// </summary>
[JsonPropertyName("direction")]
public string? Direction { get; set; }
/// <summary>
/// 是否允许旋转
/// </summary>
[JsonPropertyName("rotationAllowed")]
public bool RotationAllowed { get; set; }
/// <summary>
/// 最大转速
/// </summary>
[JsonPropertyName("maxRotationSpeed")]
public double? MaxRotationSpeed { get; set; }
/// <summary>
/// 轨迹
/// </summary>
[JsonPropertyName("trajectory")]
public Trajectory? Trajectory { get; set; }
/// <summary>
/// 起点到终点的长度
/// </summary>
[JsonPropertyName("length")]
public double? Length { get; set; }
/// <summary>
/// 通道参数
/// </summary>
[JsonPropertyName("corridor")]
public Corridor? Corridor { get; set; }
/// <summary>
/// 动作列表
/// </summary>
[JsonPropertyName("actions")]
public List<Action>? Actions { get; set; }
}
/// <summary>
/// 动作信息
/// </summary>
public class Action
{
public Action() { }
public Action(string actionType, List<(string, string?, bool?, object)> par, out string actionId, string blockingType = "HARD")
{
actionId = Guid.NewGuid().ToString();
ActionId = actionId;
ActionType = actionType;
BlockingType = blockingType;
if (par != null && par.Count > 0)
{
var actions = new List<ActionParameter>();
//循环par添加到actions
foreach (var kvp in par)
{
actions.Add(new ActionParameter
{
Key = kvp.Item1,
ValueDataType = kvp.Item2,
IsOptional = kvp.Item3,
Value = kvp.Item4
});
}
ActionParameters = actions;
}
}
/// <summary>
/// 动作ID
/// </summary>
[JsonPropertyName("actionId")]
public string ActionId { get; set; } = System.Guid.NewGuid().ToString();
/// <summary>
/// 动作类型
/// </summary>
[JsonPropertyName("actionType")]
public string ActionType { get; set; } = string.Empty;
/// <summary>
/// 动作描述
/// </summary>
[JsonPropertyName("actionDescription")]
public string ActionDescription { get; set; } = string.Empty;
/// <summary>
/// 动作参数
/// </summary>
[JsonPropertyName("actionParameters")]
public List<ActionParameter> ActionParameters { get; set; } = new();
/// <summary>
/// 是否阻塞
/// NONE-允许移动和其他动作
/// SOFT-不允许移动,允许其他动作
/// HARD-不允许移动和其他动作
/// </summary>
[JsonPropertyName("blockingType")]
public string BlockingType { get; set; } = "HARD";
}
public class ActionParameter
{
public ActionParameter() { }
public ActionParameter(string key, object value)
{
Key = key;
Value = value;
}
[JsonPropertyName("key")]
public string Key { get; set; } = string.Empty;
[JsonPropertyName("value")]
public object Value { get; set; }
[JsonPropertyName("valueDataType")]
public string? ValueDataType { get; set; }
[JsonPropertyName("isOptional")]
public bool? IsOptional { get; set; }
}
public class Trajectory {
/// <summary>
/// 曲线的度数
/// </summary>
[JsonPropertyName("degree")]
public double Degree { get; set; }
/// <summary>
/// 曲线的节点向量数组 范围0.0-1.0
/// </summary>
[JsonPropertyName("knotVector")]
public List<double> KnotVector { get; set; } = new();
/// <summary>
/// 定义NURBS控制点的控点对象阵列,包括起始点和终点。
/// </summary>
[JsonPropertyName("controlPoints")]
public List<ControlPoint> ControlPoints { get; set; } = new();
}
public class ControlPoint {
/// <summary>
/// X坐标
/// </summary>
[JsonPropertyName("x")]
public double X { get; set; }
/// <summary>
/// Y坐标
/// </summary>
[JsonPropertyName("y")]
public double Y { get; set; }
/// <summary>
/// 权重
/// </summary>
[JsonPropertyName("weight")]
public double? Weight { get; set; }
}
public class Corridor
{
/// <summary>
/// 左侧走廊宽度
/// </summary>
[JsonPropertyName("leftWidth")]
public double LeftWidth { get; set; }
/// <summary>
/// 右侧走廊宽度
/// </summary>
[JsonPropertyName("rightWidth")]
public double RightWidth { get; set; }
/// <summary>
/// 边界定义
/// KINEMATICCENTER-车体轮廓
/// CONTOUR-运动学中心
/// </summary>
[JsonPropertyName("corridorRefPoint")]
public string? CorridorRefPoint { get; set; }
}
}