State.cs
13.7 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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
using System.Text.Json.Serialization;
using Rcs.Domain.Extensions;
namespace Rcs.Domain.Models.VDA5050
{
/// <summary>
/// AGV状态消息(核心实体)
/// </summary>
[ProtocolInfo("Default", "2.0.0", nameof(State))]
public class State : VDA5050_Header
{
/// <summary>
/// 车载地图列表
/// </summary>
[JsonPropertyName("maps")]
public List<Map>? Maps { get; set; }
/// <summary>
/// 当前订单ID(无订单时为空字符串)
/// </summary>
[JsonPropertyName("orderId")]
public string OrderId { get; set; }
/// <summary>
/// 订单更新ID(无更新时为0)
/// </summary>
[JsonPropertyName("orderUpdateId")]
public uint OrderUpdateId { get; set; }
/// <summary>
/// 当前使用的区域集ID(可选)
/// </summary>
[JsonPropertyName("zoneSetId")]
public string? ZoneSetId { get; set; }
/// <summary>
/// 最后到达节点ID(无节点时为空字符串)
/// </summary>
[JsonPropertyName("lastNodeId")]
public string LastNodeId { get; set; }
/// <summary>
/// 最后到达节点的序列ID(无节点时为0)
/// </summary>
[JsonPropertyName("lastNodeSequenceId")]
public uint LastNodeSequenceId { get; set; }
/// <summary>
/// 待处理节点状态列表
/// </summary>
[JsonPropertyName("nodeStates")]
public List<NodeState> NodeStates { get; set; }
/// <summary>
/// 待处理边缘状态列表
/// </summary>
[JsonPropertyName("edgeStates")]
public List<EdgeState> EdgeStates { get; set; }
/// <summary>
/// AGV当前位置信息(线导AGV可选)
/// </summary>
[JsonPropertyName("agvPosition")]
public AgvPosition? AgvPosition { get; set; }
/// <summary>
/// AGV速度矢量(车辆坐标系)
/// </summary>
[JsonPropertyName("velocity")]
public Velocity? Velocity { get; set; }
/// <summary>
/// 当前负载列表(无负载时为空数组)
/// </summary>
[JsonPropertyName("loads")]
public List<Load>? Loads { get; set; }
/// <summary>
/// 行驶状态(true=移动/旋转中)
/// </summary>
[JsonPropertyName("driving")]
public bool Driving { get; set; }
/// <summary>
/// 暂停状态(true=被物理按钮或即时动作暂停)
/// </summary>
[JsonPropertyName("paused")]
public bool? Paused { get; set; }
/// <summary>
/// 新基础路径请求(true=即将到达路径末端需减速)
/// </summary>
[JsonPropertyName("newBaseRequest")]
public bool? NewBaseRequest { get; set; }
/// <summary>
/// 距上一节点距离(米,线导AGV使用)
/// </summary>
[JsonPropertyName("distanceSinceLastNode")]
public double? DistanceSinceLastNode { get; set; }
/// <summary>
/// 动作状态列表(包含订单和即时动作)
/// </summary>
[JsonPropertyName("actionStates")]
public List<ActionState> ActionStates { get; set; } = new();
/// <summary>
/// 电池状态信息
/// </summary>
[JsonPropertyName("batteryState")]
public BatteryState BatteryState { get; set; } = new();
/// <summary>
/// 运行模式
/// AUTOMATIC-自动
/// SEMIAUTOMATIC-半自动
/// MANUAL-手动
/// SERVICE-检修
/// TEACHIN-示教
/// </summary>
[JsonPropertyName("operatingMode")]
public string OperatingMode { get; set; }
/// <summary>
/// 错误列表(无错误时为空数组)
/// </summary>
[JsonPropertyName("errors")]
public List<Error> Errors { get; set; } = new();
/// <summary>
/// 信息列表(仅用于可视化/调试)
/// </summary>
[JsonPropertyName("information")]
public List<Information>? Information { get; set; }
/// <summary>
/// 安全状态信息
/// </summary>
[JsonPropertyName("safetyState")]
public SafetyState SafetyState { get; set; } = new();
}
/// <summary>
/// 地图信息
/// </summary>
public class Map
{
/// <summary>
/// 地图ID
/// </summary>
[JsonPropertyName("mapId")]
public string MapId { get; set; }
/// <summary>
/// 地图版本
/// </summary>
[JsonPropertyName("mapVersion")]
public string MapVersion { get; set; }
/// <summary>
/// 地图描述
/// </summary>
[JsonPropertyName("mapDescription")]
public string? MapDescription { get; set; }
/// <summary>
/// 地图状态(ENABLED/DISABLED)
/// </summary>
[JsonPropertyName("mapStatus")]
public string MapStatus { get; set; }
}
/// <summary>
/// 节点状态
/// </summary>
public class NodeState
{
[JsonPropertyName("nodeId")]
public string NodeId { get; set; }
[JsonPropertyName("sequenceId")]
public uint SequenceId { get; set; }
[JsonPropertyName("nodeDescription")]
public string? NodeDescription { get; set; }
/// <summary>
/// 释放状态(true=基础路径部分)
/// </summary>
[JsonPropertyName("released")]
public bool Released { get; set; }
[JsonPropertyName("nodePosition")]
public NodePosition? NodePosition { get; set; }
}
/// <summary>
/// 边缘状态
/// </summary>
public class EdgeState
{
[JsonPropertyName("edgeId")]
public string EdgeId { get; set; }
[JsonPropertyName("sequenceId")]
public uint SequenceId { get; set; }
[JsonPropertyName("edgeDescription")]
public string? EdgeDescription { get; set; }
/// <summary>
/// 释放状态(true=基础路径部分)
/// </summary>
[JsonPropertyName("released")]
public bool Released { get; set; }
/// <summary>
/// 轨迹信息(NURBS格式)
/// </summary>
[JsonPropertyName("trajectory")]
public Trajectory? Trajectory { get; set; }
}
/// <summary>
/// AGV位置信息
/// </summary>
public class AgvPosition
{
/// <summary>
/// 位置初始化状态
/// </summary>
[JsonPropertyName("positionInitialized")]
public bool PositionInitialized { get; set; }
/// <summary>
/// 定位质量评分(0.0-1.0)
/// </summary>
[JsonPropertyName("localizationScore")]
public double? LocalizationScore { get; set; }
/// <summary>
/// 位置偏差范围(米)
/// </summary>
[JsonPropertyName("deviationRange")]
public double? DeviationRange { get; set; }
[JsonPropertyName("x")]
public double X { get; set; }
[JsonPropertyName("y")]
public double Y { get; set; }
[JsonPropertyName("theta")]
public double Theta { get; set; }
[JsonPropertyName("mapId")]
public string MapId { get; set; }
[JsonPropertyName("mapDescription")]
public string? MapDescription { get; set; }
}
/// <summary>
/// 速度矢量
/// </summary>
public class Velocity
{
[JsonPropertyName("vx")]
public double Vx { get; set; } // X方向速度 (m/s)
[JsonPropertyName("vy")]
public double Vy { get; set; } // Y方向速度 (m/s)
[JsonPropertyName("omega")]
public double? Omega { get; set; } // 绕Z轴旋转速度 (rad/s)
}
/// <summary>
/// 负载信息
/// </summary>
public class Load
{
[JsonPropertyName("loadId")]
public string? LoadId { get; set; }
[JsonPropertyName("loadType")]
public string? LoadType { get; set; }
/// <summary>
/// 负载位置标识(如"front")
/// </summary>
[JsonPropertyName("loadPosition")]
public string? LoadPosition { get; set; }
[JsonPropertyName("boundingBoxReference")]
public BoundingBoxReference? BoundingBoxReference { get; set; }
[JsonPropertyName("loadDimensions")]
public LoadDimensions? LoadDimensions { get; set; }
[JsonPropertyName("weight")]
public double? Weight { get; set; } // 重量 (kg)
}
/// <summary>
/// 边界框参考点
/// </summary>
public class BoundingBoxReference
{
[JsonPropertyName("x")]
public double X { get; set; }
[JsonPropertyName("y")]
public double Y { get; set; }
[JsonPropertyName("z")]
public double Z { get; set; }
[JsonPropertyName("theta")]
public double? Theta { get; set; } // 边界框方向
}
/// <summary>
/// 负载尺寸
/// </summary>
public class LoadDimensions
{
[JsonPropertyName("length")]
public double Length { get; set; } // 长 (m)
[JsonPropertyName("width")]
public double Width { get; set; } // 宽 (m)
[JsonPropertyName("height")]
public double? Height { get; set; } // 高 (m)
}
/// <summary>
/// 动作状态
/// </summary>
public class ActionState
{
[JsonPropertyName("actionId")]
public string ActionId { get; set; }
/// <summary>
/// 动作类型(可选)
/// </summary>
[JsonPropertyName("actionType")]
public string? ActionType { get; set; }
[JsonPropertyName("actionDescription")]
public string? ActionDescription { get; set; }
/// <summary>
/// 动作状态
/// WAITING-等待中
/// INITIALIZING-初始化
/// RUNNING-执行中
/// PAUSED-暂停
/// FINISHED-结束
/// FAILED-失败
/// </summary>
[JsonPropertyName("actionStatus")]
public string ActionStatus { get; set; }
[JsonPropertyName("resultDescription")]
public string? ResultDescription { get; set; }
}
/// <summary>
/// 电池状态
/// </summary>
public class BatteryState
{
/// <summary>
/// 电量百分比
/// </summary>
[JsonPropertyName("batteryCharge")]
public double BatteryCharge { get; set; }
/// <summary>
/// 电压
/// </summary>
[JsonPropertyName("batteryVoltage")]
public double? BatteryVoltage { get; set; }
/// <summary>
/// 电池健康度(0-100%)
/// </summary>
[JsonPropertyName("batteryHealth")]
public int? BatteryHealth { get; set; }
/// <summary>
/// 充电状态
/// </summary>
[JsonPropertyName("charging")]
public bool Charging { get; set; }
/// <summary>
/// 预估续航(米)
/// </summary>
[JsonPropertyName("reach")]
public uint? Reach { get; set; }
}
/// <summary>
/// 错误信息
/// </summary>
public class Error
{
[JsonPropertyName("errorType")]
public string ErrorType { get; set; }
/// <summary>
/// 错误关联引用列表
/// </summary>
[JsonPropertyName("errorReferences")]
public List<ErrorReference>? ErrorReferences { get; set; }
[JsonPropertyName("errorDescription")]
public string? ErrorDescription { get; set; }
[JsonPropertyName("errorHint")]
public string? ErrorHint { get; set; }
/// <summary>
/// 错误级别(WARNING/FATAL)
/// </summary>
[JsonPropertyName("errorLevel")]
public string ErrorLevel { get; set; }
}
/// <summary>
/// 错误引用
/// </summary>
public class ErrorReference
{
/// <summary>
/// 引用键(如"nodeId")
/// </summary>
[JsonPropertyName("referenceKey")]
public string ReferenceKey { get; set; }
/// <summary>
/// 引用值(如具体节点ID)
/// </summary>
[JsonPropertyName("referenceValue")]
public string ReferenceValue { get; set; }
}
/// <summary>
/// 信息对象(调试用)
/// </summary>
public class Information
{
[JsonPropertyName("infoType")]
public string InfoType { get; set; }
[JsonPropertyName("infoReferences")]
public List<InfoReference>? InfoReferences { get; set; }
[JsonPropertyName("infoDescription")]
public string? InfoDescription { get; set; }
/// <summary>
/// 信息级别(DEBUG/INFO)
/// </summary>
[JsonPropertyName("infoLevel")]
public string InfoLevel { get; set; }
}
/// <summary>
/// 信息引用
/// </summary>
public class InfoReference
{
[JsonPropertyName("referenceKey")]
public string ReferenceKey { get; set; }
[JsonPropertyName("referenceValue")]
public string ReferenceValue { get; set; }
}
/// <summary>
/// 安全状态
/// </summary>
public class SafetyState
{
/// <summary>
/// 急停状态枚举(AUTOACK/MANUAL/REMOTE/NONE)
/// </summary>
[JsonPropertyName("eStop")]
public string EStop { get; set; }
/// <summary>
/// 安全区域违规状态
/// </summary>
[JsonPropertyName("fieldViolation")]
public bool FieldViolation { get; set; }
}
}