设计时序算子
classDiagramclass Operator {+Operator(params)+MatchResult match(context, bag, frames, fields)}class MatchResult {+bool is_match+dict details}Operator --> MatchResult
故障诊断规则链
graph TDsubgraph "故障诊断链"Node1["诊断节点 1"]Node2["诊断节点 2"]Node3["诊断节点 3"]endNode1 -- topic, fields, algo --> Node2Node2 -- topic, fields, algo --> Node3Node1 -- action(return/continue), info(match_result), update --> Node2Node2 -- action(return/continue), info(match_result), update --> Node3
调试器执行流程
sequenceDiagramparticipant Debuggerparticipant ROSBagparticipant Node1participant Node2participant Node3Debugger->>ROSBag: 读取所有 topic 的 framesDebugger->>Node1: 执行 match(context, frames, fields)alt 匹配成功Node1->>Debugger: 返回 match_resultDebugger->>Node1: 执行 actionNode1->>Debugger: 更新 frames 范围else 匹配失败Node1->>Debugger: 执行 action 反操作endDebugger->>Node2: 处理 Node1 过滤后的 framesalt Node2 匹配成功Node2->>Debugger: 执行 action 并更新 frameselseNode2->>Debugger: 执行 action 反操作endDebugger->>Node3: 处理 Node2 过滤后的 framesalt Node3 匹配成功Node3->>Debugger: 执行 action 并更新 frameselseNode3->>Debugger: 执行 action 反操作end
文字描述
步骤一,设计针对rosbag时序数据的算子,算子的构造函数指定各种超参数,算子的match方法支持传入context ,bag,frames,fields,返回MatchResult。
步骤二,设计故障诊断链配置,由一组链式诊断节点组成,每个节点配置topic,fields,algo,action(return/continue),info(match_result),update
步骤三,调试器加载rosbag数据,加载故障诊断链配置,先批量获取所有topic的frames,然后链式执行调试节点的match,每次执行如果匹配就执行action,不匹配就执行action的反操作,主要是决定继续还是结束。每个节点结束还要根据update过滤frames的范围和topic,每个节点只处理自己的topic,每个节点会限制后续节点处理的frames时间范围。