LingxinMeng 9 tháng trước cách đây
mục cha
commit
34918692be

+ 20 - 18
aarch64/pjibot_delivery/master/package/service/produce_window.go

@@ -20,6 +20,8 @@ import (
 	"time"
 )
 
+var triggerInterval = 3.0 // 每个触发器3秒触发一次
+
 // PrepareTimeWindowProducerQueue 负责监听所有主题并修改时间窗口
 func PrepareTimeWindowProducerQueue() {
 
@@ -38,7 +40,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *diagnostic_msgs.DiagnosticArray) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -46,10 +48,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfDiagnostics {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -72,7 +74,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *sensor_msgs.Imu) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -80,10 +82,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfImu {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -106,7 +108,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *pjibot_delivery_msgs.LocateInfo) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -114,10 +116,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfLocateInfo {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -140,7 +142,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *std_msgs.UInt8) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -148,10 +150,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfObstacleDetection {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -174,7 +176,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *nav_msgs.Odometry) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -182,10 +184,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfOdom {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -208,7 +210,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *pjibot_delivery_msgs.SysInfo) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -216,10 +218,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfSysInfo {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -242,7 +244,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *geometry_msgs.PoseStamped) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -250,10 +252,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfRobotPose {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -276,7 +278,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *pjibot_delivery_msgs.TaskFeedbackInfo) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -284,10 +286,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfTaskFeedbackInfo {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -310,7 +312,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *nav_msgs.Odometry) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -318,10 +320,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfWheelOdom {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)

+ 7 - 3
aarch64/pjibot_guide/master/package/service/produce_window.go

@@ -15,7 +15,8 @@ import (
 	"time"
 )
 
-// PrepareTimeWindowProducerQueue 负责监听所有主题并修改时间窗口
+var triggerInterval = 3.0 // 每个触发器3秒触发一次
+// 负责监听所有主题并修改时间窗口
 func PrepareTimeWindowProducerQueue() {
 
 	var err error
@@ -32,7 +33,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *std_msgs.UInt8) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -40,10 +41,13 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfObstacleDetection {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
+									} else {
+										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
 									}
 								}
 							}

+ 20 - 19
aarch64/pjibot_patrol/master/package/service/produce_window.go

@@ -20,7 +20,8 @@ import (
 	"time"
 )
 
-// PrepareTimeWindowProducerQueue 负责监听所有主题并修改时间窗口
+var triggerInterval = 3.0 // 每个触发器3秒触发一次
+// 负责监听所有主题并修改时间窗口
 func PrepareTimeWindowProducerQueue() {
 
 	var err error
@@ -38,7 +39,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *diagnostic_msgs.DiagnosticArray) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -46,10 +47,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfDiagnostics {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -72,7 +73,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *sensor_msgs.Imu) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -80,10 +81,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfImu {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -106,7 +107,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *pjibot_patrol_msgs.LocateInfo) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -114,10 +115,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfLocateInfo {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -140,7 +141,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *std_msgs.UInt8) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -148,10 +149,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfObstacleDetection {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -174,7 +175,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *nav_msgs.Odometry) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -182,10 +183,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfOdom {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -208,7 +209,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *pjibot_patrol_msgs.SysInfo) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -216,10 +217,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfSysInfo {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -242,7 +243,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *geometry_msgs.PoseStamped) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -250,10 +251,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfRobotPose {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -276,7 +277,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *pjibot_patrol_msgs.TaskFeedbackInfo) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -284,10 +285,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfTaskFeedbackInfo {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)
@@ -310,7 +311,7 @@ func PrepareTimeWindowProducerQueue() {
 					Topic: topic,
 					Callback: func(data *nav_msgs.Odometry) {
 						subscribersTimeMutexes[i].Lock()
-						if time.Since(subscribersTimes[i]).Seconds() > 1 {
+						if time.Since(subscribersTimes[i]).Seconds() > triggerInterval {
 							subscribersMutexes[i].Lock()
 							faultHappenTime := commonUtil.GetNowTimeCustom() // 获取当前故障发生时间
 							lastTimeWindow := entity.GetLastTimeWindow()     // 获取最后一个时间窗口
@@ -318,10 +319,10 @@ func PrepareTimeWindowProducerQueue() {
 							for _, f := range masterConfig.RuleOfWheelOdom {
 								faultLabel = f(data)
 								if faultLabel != "" {
+									subscribersTimes[i] = time.Now()
 									if canCollect() {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,开始采集。", faultLabel)
 										saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
-										subscribersTimes[i] = time.Now()
 										break
 									} else {
 										c_log.GlobalLogger.Errorf("触发事件【%v】,但当前周期内采集数量已超限额,不再采集。", faultLabel)