孟令鑫 hai 1 ano
pai
achega
13c905149e

+ 1 - 1
aarch64/plugin-compile/main/main.go

@@ -15,7 +15,7 @@ const servicePort = 12340
 const serviceName = "plugin-compile"
 
 func init() {
-	c_log.InitLog(serviceName)
+	c_log.InitLog("./log/", serviceName)
 	c_oss.InitOss(false)
 	c_nacos.InitService(true, serviceName, servicePort, map[string]string{
 		"开发者":  "孟令鑫",

+ 1 - 1
amd64/kubernetes-scheduler/main/main.go

@@ -35,7 +35,7 @@ func init() {
 		fmt.Println("解析 JSON 时出错:", err)
 		return
 	}
-	c_log.InitLog(KubernetesSchedulerConfig.Service.Name)
+	c_log.InitLog("./log/", KubernetesSchedulerConfig.Service.Name)
 	c_oss.InitOss(false)
 	c_nacos.InitService(false, KubernetesSchedulerConfig.Service.Name, KubernetesSchedulerConfig.Service.Port, map[string]string{
 		"开发者":  "孟令鑫",

+ 19 - 19
amd64/kubernetes-scheduler/package/entity/vehicle.go

@@ -6,26 +6,26 @@ type VehicleModel struct {
 
 // VehicleDynamics 动力学配置
 type VehicleDynamics struct {
-	DynamicsMaxspeed              float64 `json:"dynamics_maxspeed"`
-	DynamicsEnginepower           float64 `json:"dynamics_enginepower"`
-	DynamicsMaxdecel              float64 `json:"dynamics_maxdecel"`
-	DynamicsMaxsteering           float64 `json:"dynamics_maxsteering"`
-	DynamicsMass                  float64 `json:"dynamics_mass"`
-	DynamicsFrontsurfaceeffective float64 `json:"dynamics_frontsurfaceeffective"`
-	DynamicsAirdragcoefficient    float64 `json:"dynamics_airdragcoefficient"`
-	DynamicsRollingresistance     float64 `json:"dynamics_rollingresistance"`
-	DynamicsWheeldiameter         float64 `json:"dynamics_wheeldiameter"`
-	DynamicsWheeldrive            string  `json:"dynamics_wheeldrive"`
-	DynamicsOverallefficiency     float64 `json:"dynamics_overallefficiency"`
-	DynamicsDistfront             float64 `json:"dynamics_distfront"`
-	DynamicsDistrear              float64 `json:"dynamics_distrear"`
-	DynamicsDistleft              float64 `json:"dynamics_distleft"`
-	DynamicsDistright             float64 `json:"dynamics_distright"`
-	DynamicsDistheight            float64 `json:"dynamics_distheight"`
-	DynamicsWheelbase             float64 `json:"dynamics_wheelbase"`
+	DynamicsMaxspeed              float64 `json:"dynamics_maxspeed"`              // 最大速度(千米/小时)
+	DynamicsEnginepower           float64 `json:"dynamics_enginepower"`           // 发动机功率(千瓦)
+	DynamicsMaxdecel              float64 `json:"dynamics_maxdecel"`              // 最大减速度(米/秒2)
+	DynamicsMaxsteering           float64 `json:"dynamics_maxsteering"`           // 最大减速度(米/秒2)
+	DynamicsMass                  float64 `json:"dynamics_mass"`                  // 质量(千克)
+	DynamicsFrontsurfaceeffective float64 `json:"dynamics_frontsurfaceeffective"` // 前表面有效面积(平方米)
+	DynamicsAirdragcoefficient    float64 `json:"dynamics_airdragcoefficient"`    // 空气阻力系数
+	DynamicsRollingresistance     float64 `json:"dynamics_rollingresistance"`     // 滚动阻力系数
+	DynamicsWheeldiameter         float64 `json:"dynamics_wheeldiameter"`         // 车轮直径(米)
+	DynamicsWheeldrive            string  `json:"dynamics_wheeldrive"`            // 驱动方式
+	DynamicsOverallefficiency     float64 `json:"dynamics_overallefficiency"`     // 总效率
+	DynamicsDistfront             float64 `json:"dynamics_distfront"`             // 车前距(米)
+	DynamicsDistrear              float64 `json:"dynamics_distrear"`              // 车后距(米)
+	DynamicsDistleft              float64 `json:"dynamics_distleft"`              // 车左距(米)
+	DynamicsDistright             float64 `json:"dynamics_distright"`             // 车右距(米)
+	DynamicsDistheight            float64 `json:"dynamics_distheight"`            // 车高(米)
+	DynamicsWheelbase             float64 `json:"dynamics_wheelbase"`             // 轴距(米)
 }
 
 type VehicleSensors struct {
-	camera []SensorCamera
-	OGT    []SensorOgt
+	Camera []SensorCamera `json:"camera"`
+	OGT    []SensorOgt    `json:"OGT"`
 }

+ 0 - 7
amd64/oss-config/main/main.go

@@ -1,7 +0,0 @@
-package main
-
-import "cicv-data-closedloop/common/config/c_log"
-
-func init() {
-	c_log.InitLog("oss-config")
-}

+ 2 - 2
common/config/c_log/log_config.go

@@ -13,10 +13,10 @@ import (
 var GlobalLogger *logrus.Logger
 
 // InitLog 初始化日志配置
-func InitLog(prefix string) {
+func InitLog(logDir string, prefix string) {
 	time.Sleep(time.Duration(1) * time.Second)
 	// 创建、追加、读写,777,所有权限
-	logPath := "./log/" + prefix + "-" + time.Now().Format("2006-01-02-15-04-05") + ".log"
+	logPath := logDir + prefix + "-" + time.Now().Format("2006-01-02-15-04-05") + ".log"
 	err := util.CreateParentDir(logPath)
 	if err != nil {
 		os.Exit(-1)

+ 1 - 1
pji/control/main/control.go

@@ -15,7 +15,7 @@ import (
 func init() {
 	runtime.GOMAXPROCS(1)
 	// 初始化日志配置
-	c_log.InitLog("pji-control")
+	c_log.InitLog("/root/rosbag-handle/log/", "pji-control")
 	// 初始化本地配置文件(第1处配置,在本地文件)
 	commonConfig.InitLocalConfig()
 	// 初始化Oss连接信息

+ 1 - 1
pji/master/main/master.go

@@ -14,7 +14,7 @@ import (
 func init() {
 	runtime.GOMAXPROCS(1)
 	// 初始化日志配置
-	c_log.InitLog("pji-master")
+	c_log.InitLog("/root/rosbag-handle/log/", "pji-master")
 	commonInit.Init()
 	masterConfig.InitTriggerConfig()
 	commonConfig.InitKillSignalListener(commonConfig.CloudConfig.Hosts[0].Ip)

+ 28 - 23
test/main/main.go

@@ -8,7 +8,7 @@ import (
 
 func main() {
 
-	jsonData, _ := json.Marshal(
+	jsonData, _ := json.MarshalIndent(
 		&entity.Project{
 			ProjectId:          "项目ID",
 			AlgorithmObjectKey: "算法在阿里云的存储路径",
@@ -48,34 +48,39 @@ func main() {
 							DynamicsDistheight:            0,
 							DynamicsWheelbase:             0,
 						},
-						Sensors: entity.VehicleSensors{OGT: []entity.SensorOgt{
-							{
-								Sensor:           entity.Sensor{},
-								SensorForHLeft:   0,
-								SensorForHRight:  0,
-								SensorForHTop:    0,
-								SensorForHBottom: 0,
-								SensorFilter:     "0,5,6",
-								SensorDisplay:    false,
-								SensorMaxObjects: 0,
-								SensorPort:       0,
-							}, {
-								Sensor:           entity.Sensor{},
-								SensorForHLeft:   0,
-								SensorForHRight:  0,
-								SensorForHTop:    0,
-								SensorForHBottom: 0,
-								SensorFilter:     "1,2,3,4",
-								SensorDisplay:    false,
-								SensorMaxObjects: 0,
-								SensorPort:       0,
+						Sensors: entity.VehicleSensors{
+							Camera: []entity.SensorCamera{
+								{},
+							},
+							OGT: []entity.SensorOgt{
+								{
+									Sensor:           entity.Sensor{},
+									SensorForHLeft:   0,
+									SensorForHRight:  0,
+									SensorForHTop:    0,
+									SensorForHBottom: 0,
+									SensorFilter:     "0,5,6",
+									SensorDisplay:    false,
+									SensorMaxObjects: 0,
+									SensorPort:       0,
+								}, {
+									Sensor:           entity.Sensor{},
+									SensorForHLeft:   0,
+									SensorForHRight:  0,
+									SensorForHTop:    0,
+									SensorForHBottom: 0,
+									SensorFilter:     "1,2,3,4",
+									SensorDisplay:    false,
+									SensorMaxObjects: 0,
+									SensorPort:       0,
+								},
 							},
-						},
 						},
 					},
 				},
 			},
 		},
+		"", " ",
 	)
 	fmt.Println(string(jsonData))
 }