LingxinMeng 9 месяцев назад
Родитель
Сommit
059486ef24

+ 291 - 256
aarch64/pjibot_delivery/master/package/service/produce_window.go

@@ -29,290 +29,325 @@ func PrepareTimeWindowProducerQueue() {
 	subscribersTimeMutexes := make([]sync.Mutex, len(commonConfig.SubscribeTopics))
 	subscribersMutexes := make([]sync.Mutex, len(commonConfig.SubscribeTopics))
 	for i, topic := range commonConfig.SubscribeTopics {
-		c_log.GlobalLogger.Info("创建订阅者订阅话题:" + topic)
-		// 1
-		if topic == masterConfig.TopicOfDiagnostics && len(masterConfig.RuleOfDiagnostics) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *diagnostic_msgs.DiagnosticArray) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfDiagnostics {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+		for {
+			create := false // 判断是否创建成功,用于打印日志
+			// 1
+			if topic == masterConfig.TopicOfDiagnostics && len(masterConfig.RuleOfDiagnostics) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *diagnostic_msgs.DiagnosticArray) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfDiagnostics {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		// 2
-		if topic == masterConfig.TopicOfImu && len(masterConfig.RuleOfImu) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *sensor_msgs.Imu) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfImu {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 2
+			if topic == masterConfig.TopicOfImu && len(masterConfig.RuleOfImu) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *sensor_msgs.Imu) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfImu {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		// 3
-		if topic == masterConfig.TopicOfLocateInfo && len(masterConfig.RuleOfLocateInfo) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *pjibot_delivery_msgs.LocateInfo) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfLocateInfo {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 3
+			if topic == masterConfig.TopicOfLocateInfo && len(masterConfig.RuleOfLocateInfo) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *pjibot_delivery_msgs.LocateInfo) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfLocateInfo {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		// 4
-		if topic == masterConfig.TopicOfObstacleDetection && len(masterConfig.RuleOfObstacleDetection) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *std_msgs.UInt8) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfObstacleDetection {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 4
+			if topic == masterConfig.TopicOfObstacleDetection && len(masterConfig.RuleOfObstacleDetection) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *std_msgs.UInt8) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfObstacleDetection {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		// 5
-		if topic == masterConfig.TopicOfOdom && len(masterConfig.RuleOfOdom) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *nav_msgs.Odometry) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfOdom {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 5
+			if topic == masterConfig.TopicOfOdom && len(masterConfig.RuleOfOdom) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *nav_msgs.Odometry) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfOdom {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		// 6
-		if topic == masterConfig.TopicOfSysInfo && len(masterConfig.RuleOfSysInfo) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *pjibot_delivery_msgs.SysInfo) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfSysInfo {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 6
+			if topic == masterConfig.TopicOfSysInfo && len(masterConfig.RuleOfSysInfo) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *pjibot_delivery_msgs.SysInfo) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfSysInfo {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		// 7
-		if topic == masterConfig.TopicOfRobotPose && len(masterConfig.RuleOfRobotPose) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *geometry_msgs.PoseStamped) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfRobotPose {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 7
+			if topic == masterConfig.TopicOfRobotPose && len(masterConfig.RuleOfRobotPose) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *geometry_msgs.PoseStamped) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfRobotPose {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		// 8
-		if topic == masterConfig.TopicOfTaskFeedbackInfo && len(masterConfig.RuleOfTaskFeedbackInfo) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *pjibot_delivery_msgs.TaskFeedbackInfo) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfTaskFeedbackInfo {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 8
+			if topic == masterConfig.TopicOfTaskFeedbackInfo && len(masterConfig.RuleOfTaskFeedbackInfo) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *pjibot_delivery_msgs.TaskFeedbackInfo) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfTaskFeedbackInfo {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		// 9
-		if topic == masterConfig.TopicOfWheelOdom && len(masterConfig.RuleOfWheelOdom) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *nav_msgs.Odometry) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfWheelOdom {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 9
+			if topic == masterConfig.TopicOfWheelOdom && len(masterConfig.RuleOfWheelOdom) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *nav_msgs.Odometry) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfWheelOdom {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
 
-		if err != nil {
-			c_log.GlobalLogger.Info("创建订阅者", masterConfig.TopicOfObstacleDetection, "发生故障:", err)
-			continue
+			if err != nil {
+				c_log.GlobalLogger.Infof("创建订阅者报错,可能由于节点未启动,再次尝试【%v】", err)
+				time.Sleep(time.Duration(2) * time.Second)
+				continue
+			} else {
+				if create {
+					c_log.GlobalLogger.Infof("创建订阅者订阅话题【%v】", topic)
+				}
+				break
+			}
 		}
 	}
 

+ 321 - 32
aarch64/pjibot_patrol/master/package/service/produce_window.go

@@ -8,8 +8,13 @@ import (
 	"cicv-data-closedloop/common/entity"
 	"cicv-data-closedloop/common/util"
 	commonUtil "cicv-data-closedloop/common/util"
+	"cicv-data-closedloop/pjibot_patrol_msgs"
 	"encoding/json"
 	"github.com/bluenviron/goroslib/v2"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/geometry_msgs"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/nav_msgs"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/sensor_msgs"
 	"github.com/bluenviron/goroslib/v2/pkg/msgs/std_msgs"
 	"sync"
 	"time"
@@ -24,41 +29,325 @@ func PrepareTimeWindowProducerQueue() {
 	subscribersTimeMutexes := make([]sync.Mutex, len(commonConfig.SubscribeTopics))
 	subscribersMutexes := make([]sync.Mutex, len(commonConfig.SubscribeTopics))
 	for i, topic := range commonConfig.SubscribeTopics {
-		c_log.GlobalLogger.Info("创建订阅者订阅话题:" + topic)
-		if topic == masterConfig.TopicOfObstacleDetection && len(masterConfig.RuleOfObstacleDetection) > 0 {
-			subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
-				Node:  commonConfig.RosNode,
-				Topic: topic,
-				Callback: func(data *std_msgs.UInt8) {
-					subscribersTimeMutexes[i].Lock()
-					if time.Since(subscribersTimes[i]).Seconds() > 1 {
-						subscribersMutexes[i].Lock()
-						faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
-						lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
-						var faultLabel string
-						for _, f := range masterConfig.RuleOfObstacleDetection {
-							faultLabel = f(data)
-							if faultLabel != "" {
-								if canCollect() {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
-									saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-									subscribersTimes[i] = time.Now()
-									break
-								} else {
-									c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+		for {
+			create := false // 判断是否创建成功,用于打印日志
+			// 1
+			if topic == masterConfig.TopicOfDiagnostics && len(masterConfig.RuleOfDiagnostics) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *diagnostic_msgs.DiagnosticArray) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfDiagnostics {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
 								}
 							}
+							subscribersMutexes[i].Unlock()
 						}
-						subscribersMutexes[i].Unlock()
-					}
-					subscribersTimeMutexes[i].Unlock()
-				},
-			})
-		}
-		if err != nil {
-			c_log.GlobalLogger.Info("创建订阅者", masterConfig.TopicOfObstacleDetection, "发生故障:", err)
-			//TODO 如何回传日志
-			continue
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 2
+			if topic == masterConfig.TopicOfImu && len(masterConfig.RuleOfImu) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *sensor_msgs.Imu) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfImu {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
+								}
+							}
+							subscribersMutexes[i].Unlock()
+						}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 3
+			if topic == masterConfig.TopicOfLocateInfo && len(masterConfig.RuleOfLocateInfo) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *pjibot_patrol_msgs.LocateInfo) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfLocateInfo {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
+								}
+							}
+							subscribersMutexes[i].Unlock()
+						}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 4
+			if topic == masterConfig.TopicOfObstacleDetection && len(masterConfig.RuleOfObstacleDetection) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *std_msgs.UInt8) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfObstacleDetection {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
+								}
+							}
+							subscribersMutexes[i].Unlock()
+						}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 5
+			if topic == masterConfig.TopicOfOdom && len(masterConfig.RuleOfOdom) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *nav_msgs.Odometry) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfOdom {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
+								}
+							}
+							subscribersMutexes[i].Unlock()
+						}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 6
+			if topic == masterConfig.TopicOfSysInfo && len(masterConfig.RuleOfSysInfo) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *pjibot_patrol_msgs.SysInfo) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfSysInfo {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
+								}
+							}
+							subscribersMutexes[i].Unlock()
+						}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 7
+			if topic == masterConfig.TopicOfRobotPose && len(masterConfig.RuleOfRobotPose) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *geometry_msgs.PoseStamped) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfRobotPose {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
+								}
+							}
+							subscribersMutexes[i].Unlock()
+						}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 8
+			if topic == masterConfig.TopicOfTaskFeedbackInfo && len(masterConfig.RuleOfTaskFeedbackInfo) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *pjibot_patrol_msgs.TaskFeedbackInfo) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfTaskFeedbackInfo {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
+								}
+							}
+							subscribersMutexes[i].Unlock()
+						}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+			// 9
+			if topic == masterConfig.TopicOfWheelOdom && len(masterConfig.RuleOfWheelOdom) > 0 {
+				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
+					Node:  commonConfig.RosNode,
+					Topic: topic,
+					Callback: func(data *nav_msgs.Odometry) {
+						subscribersTimeMutexes[i].Lock()
+						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+							subscribersMutexes[i].Lock()
+							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
+							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
+							var faultLabel string
+							for _, f := range masterConfig.RuleOfWheelOdom {
+								faultLabel = f(data)
+								if faultLabel != "" {
+									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
+										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
+										subscribersTimes[i] = time.Now()
+										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
+									}
+								}
+							}
+							subscribersMutexes[i].Unlock()
+						}
+						subscribersTimeMutexes[i].Unlock()
+					},
+				})
+				if err == nil {
+					create = true
+				}
+			}
+
+			if err != nil {
+				c_log.GlobalLogger.Infof("创建订阅者报错,可能由于节点未启动,再次尝试【%v】", err)
+				time.Sleep(time.Duration(2) * time.Second)
+				continue
+			} else {
+				if create {
+					c_log.GlobalLogger.Infof("创建订阅者订阅话题【%v】", topic)
+				}
+				break
+			}
 		}
 	}
 

+ 122 - 5
aarch64/pjisuv/master/service/produce_window.go

@@ -87,10 +87,7 @@ func ProduceWindow() {
 					}
 				}()
 			}
-
-			// 其他常规监听器
-			c_log.GlobalLogger.Info("创建订阅者订阅话题:" + topic)
-
+			create := false // 判断是否创建成功,用于打印日志
 			// 1
 			if topic == masterConfig.TopicOfAmrPose && (len(masterConfig.RuleOfAmrPose1) > 0 || len(masterConfig.RuleOfAmrPose3) > 0) {
 				subscribers[i], err = goroslib.NewSubscriber(goroslib.SubscriberConf{
@@ -129,6 +126,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 2
@@ -171,6 +171,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 3
@@ -214,6 +217,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 4
@@ -257,6 +263,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 5
@@ -300,6 +309,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 6
@@ -343,6 +355,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 7
@@ -386,6 +401,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 8
@@ -429,6 +447,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 9
@@ -471,6 +492,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 10
@@ -514,6 +538,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 11 有共享变量的订阅者必须被创建
@@ -561,6 +588,9 @@ func ProduceWindow() {
 						shareVars.Store("DecisionType", data.Trajectoryinfo.DecisionType)
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 12 有共享变量的订阅者必须被创建
@@ -624,6 +654,9 @@ func ProduceWindow() {
 						}
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 13
@@ -668,6 +701,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 14
@@ -711,6 +747,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 15
@@ -755,6 +794,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 16
@@ -799,6 +841,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 17
@@ -842,6 +887,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 18
@@ -885,6 +933,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 19
@@ -928,6 +979,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 20
@@ -972,6 +1026,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 21
@@ -1015,6 +1072,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 22 有共享变量的订阅者必须被创建
@@ -1067,6 +1127,9 @@ func ProduceWindow() {
 						shareVars.Store("EgoThrottleCmdOfPjControlPub", egoThrottleCmdOfPjControlPub)
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 23
@@ -1110,6 +1173,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 24
@@ -1153,6 +1219,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 25
@@ -1196,6 +1265,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 26
@@ -1239,6 +1311,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 27
@@ -1282,6 +1357,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 28
@@ -1325,6 +1403,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 29
@@ -1368,6 +1449,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 30 有共享变量的订阅者必须被创建
@@ -1430,6 +1514,9 @@ func ProduceWindow() {
 						shareVars.Store("ObjSpeedDicOfTpperception", objSpeedDicOfTpperception)
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 31
@@ -1473,6 +1560,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 32
@@ -1516,6 +1606,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 33
@@ -1559,6 +1652,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 34
@@ -1602,6 +1698,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 35
@@ -1646,6 +1745,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 36 有共享变量的订阅者必须被创建
@@ -1698,6 +1800,9 @@ func ProduceWindow() {
 						shareVars.Store("ActStrWhAngOfDataRead", data.ActStrWhAng)
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 			// 37
 			if topic == masterConfig.TopicOfPjiGps &&
@@ -1740,6 +1845,9 @@ func ProduceWindow() {
 						subscribersTimeMutexes[i].Unlock()
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 
 			// 39 有共享变量的订阅者必须被创建
@@ -1783,6 +1891,9 @@ func ProduceWindow() {
 						shareVars.Store("AutomodeOfPjVehicleFdbPub", data.Automode)
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 			// 40 有共享变量的订阅者必须被创建
 			if topic == masterConfig.TopicOfEndPointMessage {
@@ -1827,12 +1938,18 @@ func ProduceWindow() {
 						shareVars.Store("EndPointY", data.Y)
 					},
 				})
+				if err == nil {
+					create = true
+				}
 			}
 			if err != nil {
-				c_log.GlobalLogger.Info("创建订阅者报错,可能由于节点未启动,再次尝试:", err)
+				c_log.GlobalLogger.Infof("创建订阅者报错,可能由于节点未启动,再次尝试【%v】", err)
 				time.Sleep(time.Duration(2) * time.Second)
 				continue
 			} else {
+				if create {
+					c_log.GlobalLogger.Infof("创建订阅者订阅话题【%v】", topic)
+				}
 				break
 			}
 		}