package config import ( "cicv-data-closedloop/aarch64/pjisuv/common/config" "cicv-data-closedloop/common/config/c_log" "cicv-data-closedloop/common/util" "cicv-data-closedloop/pjisuv_msgs" entity "cicv-data-closedloop/pjisuv_param" "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/tf2_msgs" "github.com/bluenviron/goroslib/v2/pkg/msgs/visualization_msgs" "plugin" "slices" ) func InitTriggerConfig() { triggerLocalPathsMapTriggerId := make(map[string]string) c_log.GlobalLogger.Info("主节点加载触发器插件 - 开始。") // 1 获取数采任务的触发器列表 cloudTriggers := &config.PlatformConfig.TaskTriggers // 2 获取本地触发器列表(触发器目录的一级子目录为【触发器ID_触发器Label】) localTriggerIds := util.GetFirstLevelSubdirectories(config.CloudConfig.TriggersDir) // 3 对比触发器列表,本地没有的则下载 for _, trigger := range *cloudTriggers { id := util.ToString(trigger.TriggerId) hasIdDir := slices.Contains(localTriggerIds, id) // 改成了 slices 工具库 triggerLocalDir := config.CloudConfig.TriggersDir + id + "/" hasLabelSo, soPaths := util.CheckSoFilesInDirectory(triggerLocalDir) var triggerLocalPath string if hasIdDir && hasLabelSo { // 已存在的触发器需要判断是否大小一致 triggerLocalPath = soPaths[0] ossSize, _ := util.GetOSSFileSize(config.OssBucket, trigger.TriggerScriptPath) localSize, _ := util.GetFileSize(triggerLocalPath) if ossSize == localSize { c_log.GlobalLogger.Info("触发器插件 ", triggerLocalPath, " 存在且与云端触发器大小一致。") triggerLocalPathsMapTriggerId[triggerLocalPath] = id continue } } label := util.GetFileNameWithoutExtension(config.CloudConfig.TriggersDir + trigger.TriggerScriptPath) triggerLocalPath = config.CloudConfig.TriggersDir + id + "/" + label + ".so" c_log.GlobalLogger.Info("下载触发器插件从 ", trigger.TriggerScriptPath, " 到 ", triggerLocalPath) config.OssMutex.Lock() _ = util.CreateParentDir(triggerLocalPath) err := config.OssBucket.GetObjectToFile(trigger.TriggerScriptPath, triggerLocalPath) config.OssMutex.Unlock() if err != nil { c_log.GlobalLogger.Error("下载 OSS 上的触发器插件失败:", err) continue } triggerLocalPathsMapTriggerId[triggerLocalPath] = id } success := 0 // 加载所有触发器的文件 for triggerLocalPath, triggerId := range triggerLocalPathsMapTriggerId { // 载入插件到数组 open, err := plugin.Open(triggerLocalPath) if err != nil { c_log.GlobalLogger.Error("加载本地插件", triggerLocalPath, "失败。", err) continue } topic0, err := open.Lookup("Topic") if err != nil { c_log.GlobalLogger.Error("加载本地插件", triggerLocalPath, "中的Topic方法失败。", err) continue } topic1, ok := topic0.(func() string) if ok != true { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Topic方法必须是(func() string):", err) continue } topic2 := topic1() rule, err := open.Lookup("Rule") if err != nil { c_log.GlobalLogger.Error("加载本地插件", triggerLocalPath, "中的Rule方法失败。", err) continue } if TopicOfCicvExtend == topic2 { // 自定义扩展 f, ok := rule.(func(param entity.PjisuvParam) string) if ok != true { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Topic方法必须是(func(param entity.ExtendParam):", err) continue } RuleOfCicvExtend = append(RuleOfCicvExtend, f) } else if TopicOfAmrPose == topic2 { //1 f1, ok1 := rule.(func(data *visualization_msgs.MarkerArray) string) if ok1 { RuleOfAmrPose1 = append(RuleOfAmrPose1, f1) } else { f2, ok2 := rule.(func(data *visualization_msgs.MarkerArray, param *entity.PjisuvParam) string) if ok2 { RuleOfAmrPose2 = append(RuleOfAmrPose2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfBoundingBoxesFast == topic2 { //2 f1, ok1 := rule.(func(data *pjisuv_msgs.BoundingBoxArray) string) if ok1 { RuleOfBoundingBoxesFast1 = append(RuleOfBoundingBoxesFast1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.BoundingBoxArray, param *entity.PjisuvParam) string) if ok2 { RuleOfBoundingBoxesFast2 = append(RuleOfBoundingBoxesFast2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCameraFault == topic2 { //3 f1, ok1 := rule.(func(data *pjisuv_msgs.FaultVec) string) if ok1 { RuleOfCameraFault1 = append(RuleOfCameraFault1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.FaultVec, param *entity.PjisuvParam) string) if ok2 { RuleOfCameraFault2 = append(RuleOfCameraFault2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCanData == topic2 { //4 f1, ok1 := rule.(func(data *pjisuv_msgs.Frame) string) if ok1 { RuleOfCanData1 = append(RuleOfCanData1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.Frame, param *entity.PjisuvParam) string) if ok2 { RuleOfCanData2 = append(RuleOfCanData2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCh128x1LslidarPointCloud == topic2 { //5 f1, ok1 := rule.(func(data *sensor_msgs.PointCloud2) string) if ok1 { RuleOfCh128x1LslidarPointCloud1 = append(RuleOfCh128x1LslidarPointCloud1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.PointCloud2, param *entity.PjisuvParam) string) if ok2 { RuleOfCh128x1LslidarPointCloud2 = append(RuleOfCh128x1LslidarPointCloud2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCh64wLLslidarPointCloud == topic2 { //6 f1, ok1 := rule.(func(data *sensor_msgs.PointCloud2) string) if ok1 { RuleOfCh64wLLslidarPointCloud1 = append(RuleOfCh64wLLslidarPointCloud1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.PointCloud2, param *entity.PjisuvParam) string) if ok2 { RuleOfCh64wLLslidarPointCloud2 = append(RuleOfCh64wLLslidarPointCloud2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCh64wLScan == topic2 { //7 f1, ok1 := rule.(func(data *sensor_msgs.LaserScan) string) if ok1 { RuleOfCh64wLScan1 = append(RuleOfCh64wLScan1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.LaserScan, param *entity.PjisuvParam) string) if ok2 { RuleOfCh64wLScan2 = append(RuleOfCh64wLScan2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCh64wRLslidarPointCloud == topic2 { //8 f1, ok1 := rule.(func(data *sensor_msgs.PointCloud2) string) if ok1 { RuleOfCh64wRLslidarPointCloud1 = append(RuleOfCh64wRLslidarPointCloud1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.PointCloud2, param *entity.PjisuvParam) string) if ok2 { RuleOfCh64wRLslidarPointCloud2 = append(RuleOfCh64wRLslidarPointCloud2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCh64wRScan == topic2 { //9 f1, ok1 := rule.(func(data *sensor_msgs.LaserScan) string) if ok1 { RuleOfCh64wRScan1 = append(RuleOfCh64wRScan1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.LaserScan, param *entity.PjisuvParam) string) if ok2 { RuleOfCh64wRScan2 = append(RuleOfCh64wRScan2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCicvLidarclusterMovingObjects == topic2 { //10 f1, ok1 := rule.(func(data *pjisuv_msgs.PerceptionCicvMovingObjects) string) if ok1 { RuleOfCicvLidarclusterMovingObjects1 = append(RuleOfCicvLidarclusterMovingObjects1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.PerceptionCicvMovingObjects, param *entity.PjisuvParam) string) if ok2 { RuleOfCicvLidarclusterMovingObjects2 = append(RuleOfCicvLidarclusterMovingObjects2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCicvAmrTrajectory == topic2 { //11 f1, ok1 := rule.(func(data *pjisuv_msgs.Trajectory) string) if ok1 { RuleOfCicvAmrTrajectory1 = append(RuleOfCicvAmrTrajectory1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.Trajectory, param *entity.PjisuvParam) string) if ok2 { RuleOfCicvAmrTrajectory2 = append(RuleOfCicvAmrTrajectory2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCicvLocation == topic2 { //12 f1, ok1 := rule.(func(data *pjisuv_msgs.PerceptionLocalization) string) if ok1 { RuleOfCicvLocation1 = append(RuleOfCicvLocation1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.PerceptionLocalization, param *entity.PjisuvParam) string) if ok2 { RuleOfCicvLocation2 = append(RuleOfCicvLocation2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCloudClusters == topic2 { //13 f1, ok1 := rule.(func(data *pjisuv_msgs.AutowareCloudClusterArray) string) if ok1 { RuleOfCloudClusters1 = append(RuleOfCloudClusters1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.AutowareCloudClusterArray, param *entity.PjisuvParam) string) if ok2 { RuleOfCloudClusters2 = append(RuleOfCloudClusters2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfHeartbeatInfo == topic2 { //14 f1, ok1 := rule.(func(data *pjisuv_msgs.HeartBeatInfo) string) if ok1 { RuleOfHeartbeatInfo1 = append(RuleOfHeartbeatInfo1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.HeartBeatInfo, param *entity.PjisuvParam) string) if ok2 { RuleOfHeartbeatInfo2 = append(RuleOfHeartbeatInfo2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfLidarPretreatmentCost == topic2 { //15 f1, ok1 := rule.(func(data *geometry_msgs.Vector3Stamped) string) if ok1 { RuleOfLidarPretreatmentCost1 = append(RuleOfLidarPretreatmentCost1, f1) } else { f2, ok2 := rule.(func(data *geometry_msgs.Vector3Stamped, param *entity.PjisuvParam) string) if ok2 { RuleOfLidarPretreatmentCost2 = append(RuleOfLidarPretreatmentCost2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfLidarPretreatmentOdometry == topic2 { //16 f1, ok1 := rule.(func(data *nav_msgs.Odometry) string) if ok1 { RuleOfLidarPretreatmentOdometry1 = append(RuleOfLidarPretreatmentOdometry1, f1) } else { f2, ok2 := rule.(func(data *nav_msgs.Odometry, param *entity.PjisuvParam) string) if ok2 { RuleOfLidarPretreatmentOdometry2 = append(RuleOfLidarPretreatmentOdometry2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfLidarRoi == topic2 { //17 f1, ok1 := rule.(func(data *geometry_msgs.PolygonStamped) string) if ok1 { RuleOfLidarRoi1 = append(RuleOfLidarRoi1, f1) } else { f2, ok2 := rule.(func(data *geometry_msgs.PolygonStamped, param *entity.PjisuvParam) string) if ok2 { RuleOfLidarRoi2 = append(RuleOfLidarRoi2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfLine1 == topic2 { //18 f1, ok1 := rule.(func(data *nav_msgs.Path) string) if ok1 { RuleOfLine11 = append(RuleOfLine11, f1) } else { f2, ok2 := rule.(func(data *nav_msgs.Path, param *entity.PjisuvParam) string) if ok2 { RuleOfLine12 = append(RuleOfLine12, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfLine2 == topic2 { //19 f1, ok1 := rule.(func(data *nav_msgs.Path) string) if ok1 { RuleOfLine21 = append(RuleOfLine21, f1) } else { f2, ok2 := rule.(func(data *nav_msgs.Path, param *entity.PjisuvParam) string) if ok2 { RuleOfLine22 = append(RuleOfLine22, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfMapPolygon == topic2 { //20 f1, ok1 := rule.(func(data *pjisuv_msgs.PolygonStamped) string) if ok1 { RuleOfMapPolygon1 = append(RuleOfMapPolygon1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.PolygonStamped, param *entity.PjisuvParam) string) if ok2 { RuleOfMapPolygon2 = append(RuleOfMapPolygon2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfObstacleDisplay == topic2 { //21 f1, ok1 := rule.(func(data *visualization_msgs.MarkerArray) string) if ok1 { RuleOfObstacleDisplay1 = append(RuleOfObstacleDisplay1, f1) } else { f2, ok2 := rule.(func(data *visualization_msgs.MarkerArray, param *entity.PjisuvParam) string) if ok2 { RuleOfObstacleDisplay2 = append(RuleOfObstacleDisplay2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfPjControlPub == topic2 { //22 f1, ok1 := rule.(func(data *pjisuv_msgs.CommonVehicleCmd) string) if ok1 { RuleOfPjControlPub1 = append(RuleOfPjControlPub1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.CommonVehicleCmd, param *entity.PjisuvParam) string) if ok2 { RuleOfPjControlPub2 = append(RuleOfPjControlPub2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfPointsCluster == topic2 { //23 f1, ok1 := rule.(func(data *sensor_msgs.PointCloud2) string) if ok1 { RuleOfPointsCluster1 = append(RuleOfPointsCluster1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.PointCloud2, param *entity.PjisuvParam) string) if ok2 { RuleOfPointsCluster2 = append(RuleOfPointsCluster2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfPointsConcat == topic2 { //24 f1, ok1 := rule.(func(data *sensor_msgs.PointCloud2) string) if ok1 { RuleOfPointsConcat1 = append(RuleOfPointsConcat1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.PointCloud2, param *entity.PjisuvParam) string) if ok2 { RuleOfPointsConcat2 = append(RuleOfPointsConcat2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfReferenceDisplay == topic2 { //25 f1, ok1 := rule.(func(data *nav_msgs.Path) string) if ok1 { RuleOfReferenceDisplay1 = append(RuleOfReferenceDisplay1, f1) } else { f2, ok2 := rule.(func(data *nav_msgs.Path, param *entity.PjisuvParam) string) if ok2 { RuleOfReferenceDisplay2 = append(RuleOfReferenceDisplay2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfReferenceTrajectory == topic2 { //26 f1, ok1 := rule.(func(data *pjisuv_msgs.Trajectory) string) if ok1 { RuleOfReferenceTrajectory1 = append(RuleOfReferenceTrajectory1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.Trajectory, param *entity.PjisuvParam) string) if ok2 { RuleOfReferenceTrajectory2 = append(RuleOfReferenceTrajectory2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfRoiPoints == topic2 { //27 f1, ok1 := rule.(func(data *sensor_msgs.PointCloud2) string) if ok1 { RuleOfRoiPoints1 = append(RuleOfRoiPoints1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.PointCloud2, param *entity.PjisuvParam) string) if ok2 { RuleOfRoiPoints2 = append(RuleOfRoiPoints2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfRoiPolygon == topic2 { //28 f1, ok1 := rule.(func(data *nav_msgs.Path) string) if ok1 { RuleOfRoiPolygon1 = append(RuleOfRoiPolygon1, f1) } else { f2, ok2 := rule.(func(data *nav_msgs.Path, param *entity.PjisuvParam) string) if ok2 { RuleOfRoiPolygon2 = append(RuleOfRoiPolygon2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfTf == topic2 { //29 f1, ok1 := rule.(func(data *tf2_msgs.TFMessage) string) if ok1 { RuleOfTf1 = append(RuleOfTf1, f1) } else { f2, ok2 := rule.(func(data *tf2_msgs.TFMessage, param *entity.PjisuvParam) string) if ok2 { RuleOfTf2 = append(RuleOfTf2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfTpperception == topic2 { //30 f1, ok1 := rule.(func(data *pjisuv_msgs.PerceptionObjects) string) if ok1 { RuleOfTpperception1 = append(RuleOfTpperception1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.PerceptionObjects, param *entity.PjisuvParam) string) if ok2 { RuleOfTpperception2 = append(RuleOfTpperception2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfTpperceptionVis == topic2 { //31 f1, ok1 := rule.(func(data *visualization_msgs.MarkerArray) string) if ok1 { RuleOfTpperceptionVis1 = append(RuleOfTpperceptionVis1, f1) } else { f2, ok2 := rule.(func(data *visualization_msgs.MarkerArray, param *entity.PjisuvParam) string) if ok2 { RuleOfTpperceptionVis2 = append(RuleOfTpperceptionVis2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfTprouteplan == topic2 { //32 f1, ok1 := rule.(func(data *pjisuv_msgs.RoutePlan) string) if ok1 { RuleOfTprouteplan1 = append(RuleOfTprouteplan1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.RoutePlan, param *entity.PjisuvParam) string) if ok2 { RuleOfTprouteplan2 = append(RuleOfTprouteplan2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfTrajectoryDisplay == topic2 { //33 f1, ok1 := rule.(func(data *nav_msgs.Path) string) if ok1 { RuleOfTrajectoryDisplay1 = append(RuleOfTrajectoryDisplay1, f1) } else { f2, ok2 := rule.(func(data *nav_msgs.Path, param *entity.PjisuvParam) string) if ok2 { RuleOfTrajectoryDisplay2 = append(RuleOfTrajectoryDisplay2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfUngroundCloudpoints == topic2 { //34 f1, ok1 := rule.(func(data *sensor_msgs.PointCloud2) string) if ok1 { RuleOfUngroundCloudpoints1 = append(RuleOfUngroundCloudpoints1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.PointCloud2, param *entity.PjisuvParam) string) if ok2 { RuleOfUngroundCloudpoints2 = append(RuleOfUngroundCloudpoints2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfCameraImage == topic2 { //35 f1, ok1 := rule.(func(data *sensor_msgs.Image) string) if ok1 { RuleOfCameraImage1 = append(RuleOfCameraImage1, f1) } else { f2, ok2 := rule.(func(data *sensor_msgs.Image, param *entity.PjisuvParam) string) if ok2 { RuleOfCameraImage2 = append(RuleOfCameraImage2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfDataRead == topic2 { //36 f1, ok1 := rule.(func(data *pjisuv_msgs.Retrieval) string) if ok1 { RuleOfDataRead1 = append(RuleOfDataRead1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.Retrieval, param *entity.PjisuvParam) string) if ok2 { RuleOfDataRead2 = append(RuleOfDataRead2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else if TopicOfPjVehicleFdbPub == topic2 { //39 f1, ok1 := rule.(func(data *pjisuv_msgs.VehicleFdb) string) if ok1 { RuleOfPjVehicleFdbPub1 = append(RuleOfPjVehicleFdbPub1, f1) } else { f2, ok2 := rule.(func(data *pjisuv_msgs.VehicleFdb, param *entity.PjisuvParam) string) if ok2 { RuleOfPjVehicleFdbPub2 = append(RuleOfPjVehicleFdbPub2, f2) } else { c_log.GlobalLogger.Error("插件", triggerLocalPath, "中的Rule方法参数格式错误:", err) continue } } } else { c_log.GlobalLogger.Error("未知的topic:", topic2) continue } label, err := open.Lookup("Label") if err != nil { c_log.GlobalLogger.Error("加载本地插件 ", triggerLocalPath, " 中的 Label 方法失败。", err) continue } labelFunc := label.(func() string) labelString := labelFunc() LabelMapTriggerId.Store(labelString, triggerId) success++ } c_log.GlobalLogger.Info("一共应加载", len(config.PlatformConfig.TaskTriggers), "个触发器,实际加载 ", success, " 个触发器。") }