|
@@ -183,7 +183,7 @@ var (
|
|
|
func InitTriggerConfig() {
|
|
|
c_log.GlobalLogger.Info("主节点加载触发器插件 - 开始。")
|
|
|
var triggerLocalPaths []string
|
|
|
- if config.CloudConfig.TriggersOnline {
|
|
|
+ if config.CloudConfig.TriggersOnline { // 在线方案
|
|
|
for _, trigger := range config.PlatformConfig.TaskTriggers {
|
|
|
triggerLocalPath := config.CloudConfig.TriggersDir + trigger.TriggerScriptPath
|
|
|
_ = util.CreateParentDir(triggerLocalPath)
|
|
@@ -197,16 +197,19 @@ func InitTriggerConfig() {
|
|
|
c_log.GlobalLogger.Info("下载触发器插件从 ", trigger.TriggerScriptPath, " 到 ", triggerLocalPath)
|
|
|
triggerLocalPaths = append(triggerLocalPaths, triggerLocalPath)
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else { // 离线方案
|
|
|
triggerLocalPaths = util.GetSoFilePaths(config.CloudConfig.TriggersDir)
|
|
|
+ // 绑定 triggerId 和 triggerLabel
|
|
|
for _, path := range triggerLocalPaths {
|
|
|
- LabelMapTriggerId.Store(util.get, strconv.Itoa(trigger.TriggerId))
|
|
|
+ name1 := util.GetFileNameWithoutExtension(path)
|
|
|
+ for _, trigger := range config.PlatformConfig.TaskTriggers {
|
|
|
+ name2 := util.GetFileNameWithoutExtension(config.CloudConfig.TriggersDir + trigger.TriggerScriptPath)
|
|
|
+ if name1 == name2 {
|
|
|
+ LabelMapTriggerId.Store(name1, strconv.Itoa(trigger.TriggerId))
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- for _, trigger := range config.PlatformConfig.TaskTriggers {
|
|
|
- LabelMapTriggerId.Store(labelString, strconv.Itoa(trigger.TriggerId))
|
|
|
- c_log.GlobalLogger.Info("主节点加载触发器插件:【ros topic】=", topic2, ",【触发器label】=", labelString, "【触发器ID】=", trigger.TriggerId)
|
|
|
- }
|
|
|
// 下载所有触发器的文件
|
|
|
for _, triggerLocalPath := range triggerLocalPaths {
|
|
|
// 载入插件到数组
|