|
@@ -70,6 +70,26 @@ var (
|
|
|
|
|
|
// InitCloudConfig 初始化业务配置
|
|
|
func InitCloudConfig() {
|
|
|
+ // history20240401:朴津机器人额外加一个获取sn码
|
|
|
+ var snCode string
|
|
|
+ for {
|
|
|
+ time.Sleep(time.Duration(2) * time.Second)
|
|
|
+ var command []string
|
|
|
+ command = append(command, "get")
|
|
|
+ command = append(command, "sn")
|
|
|
+ _, snOutput, err := util.ExecuteSync(LocalConfig.RosparamPath, command...)
|
|
|
+ if err != nil {
|
|
|
+ c_log.GlobalLogger.Error("执行获取sn码命令", command, "出错:", err)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ c_log.GlobalLogger.Error("执行获取sn码命令", command, "成功,结果为:", snOutput)
|
|
|
+ snCode = strings.Replace(strings.Replace(snOutput, " ", "", -1), "\n", "", -1)
|
|
|
+ LocalConfig.SecretKey = snCode
|
|
|
+ LocalConfig.EquipmentNo = "pjibot-" + snCode
|
|
|
+ break
|
|
|
+ }
|
|
|
+ c_log.GlobalLogger.Info("本地机器人sn码为:", snCode)
|
|
|
+
|
|
|
c_log.GlobalLogger.Info("初始化OSS配置文件 - 开始。")
|
|
|
// 获取文件的目录
|
|
|
_ = util.CreateParentDir(LocalConfig.CloudConfigLocalPath)
|
|
@@ -156,24 +176,6 @@ func refreshCloudConfig() {
|
|
|
util.CreateDir(CloudConfig.BagDataDir)
|
|
|
util.CreateDir(CloudConfig.BagCopyDir)
|
|
|
|
|
|
- // history20240401:朴津机器人额外加一个获取sn码
|
|
|
- var snCode string
|
|
|
- for {
|
|
|
- time.Sleep(time.Duration(2) * time.Second)
|
|
|
- var command []string
|
|
|
- command = append(command, "get")
|
|
|
- command = append(command, "sn")
|
|
|
- _, snOutput, err := util.ExecuteWithEnvSync(RosbagEnvs, "/opt/ros/melodic/bin/rosparam", command...)
|
|
|
- if err != nil {
|
|
|
- c_log.GlobalLogger.Error("执行获取sn码命令", command, "出错:", err)
|
|
|
- continue
|
|
|
- }
|
|
|
- snCode = strings.Replace(strings.Replace(snOutput, " ", "", -1), "\n", "", -1)
|
|
|
- LocalConfig.SecretKey = snCode
|
|
|
- LocalConfig.EquipmentNo = "pjibot-" + snCode
|
|
|
- break
|
|
|
- }
|
|
|
- c_log.GlobalLogger.Info("本地机器人sn码为:", snCode)
|
|
|
}
|
|
|
|
|
|
// RefreshCloudConfig 轮询oss上的配置文件更新到本地
|