LingxinMeng пре 1 година
родитељ
комит
77a0f39c74
55 измењених фајлова са 3673 додато и 0 уклоњено
  1. 1 0
      trigger/pji/README.md
  2. 68 0
      trigger/pji/diagnostics/errorcode_2_21030601/main/main.go
  3. 68 0
      trigger/pji/diagnostics/errorcode_2_21030701/main/main.go
  4. 68 0
      trigger/pji/diagnostics/errorcode_2_21030702/main/main.go
  5. 68 0
      trigger/pji/diagnostics/errorcode_2_21030801/main/main.go
  6. 68 0
      trigger/pji/diagnostics/errorcode_2_21030802/main/main.go
  7. 68 0
      trigger/pji/diagnostics/errorcode_2_21031001/main/main.go
  8. 68 0
      trigger/pji/diagnostics/errorcode_2_21031101/main/main.go
  9. 68 0
      trigger/pji/diagnostics/errorcode_2_21031201/main/main.go
  10. 68 0
      trigger/pji/diagnostics/errorcode_2_21031403/main/main.go
  11. 68 0
      trigger/pji/diagnostics/errorcode_2_21031404/main/main.go
  12. 68 0
      trigger/pji/diagnostics/errorcode_2_21040803/main/main.go
  13. 68 0
      trigger/pji/diagnostics/errorcode_2_21041001/main/main.go
  14. 68 0
      trigger/pji/diagnostics/errorcode_2_21041102/main/main.go
  15. 68 0
      trigger/pji/diagnostics/errorcode_2_21050701/main/main.go
  16. 68 0
      trigger/pji/diagnostics/errorcode_2_21050703/main/main.go
  17. 68 0
      trigger/pji/diagnostics/errorcode_2_21050801/main/main.go
  18. 68 0
      trigger/pji/diagnostics/errorcode_2_21051401/main/main.go
  19. 68 0
      trigger/pji/diagnostics/errorcode_2_21051402/main/main.go
  20. 68 0
      trigger/pji/diagnostics/errorcode_4_21050101/main/main.go
  21. 68 0
      trigger/pji/diagnostics/errorcode_4_21050201/main/main.go
  22. 68 0
      trigger/pji/diagnostics/errorcode_4_21050202/main/main.go
  23. 68 0
      trigger/pji/diagnostics/errorcode_4_21050301/main/main.go
  24. 68 0
      trigger/pji/diagnostics/errorcode_5_21030907/main/main.go
  25. 68 0
      trigger/pji/diagnostics/errorcode_5_21030908/main/main.go
  26. 68 0
      trigger/pji/diagnostics/errorcode_5_21031511/main/main.go
  27. 68 0
      trigger/pji/diagnostics/errorcode_5_21031512/main/main.go
  28. 68 0
      trigger/pji/diagnostics/errorcode_5_21031513/main/main.go
  29. 68 0
      trigger/pji/diagnostics/errorcode_5_21031514/main/main.go
  30. 68 0
      trigger/pji/diagnostics/errorcode_5_21031603/main/main.go
  31. 68 0
      trigger/pji/diagnostics/errorcode_5_21031604/main/main.go
  32. 68 0
      trigger/pji/diagnostics/errorcode_5_21031605/main/main.go
  33. 68 0
      trigger/pji/diagnostics/errorcode_5_21041501/main/main.go
  34. 68 0
      trigger/pji/diagnostics/errorcode_5_21041502/main/main.go
  35. 68 0
      trigger/pji/diagnostics/errorcode_5_21041503/main/main.go
  36. 68 0
      trigger/pji/diagnostics/errorcode_5_21041504/main/main.go
  37. 68 0
      trigger/pji/diagnostics/errorcode_5_21041505/main/main.go
  38. 68 0
      trigger/pji/diagnostics/errorcode_5_21041506/main/main.go
  39. 68 0
      trigger/pji/diagnostics/errorcode_5_21041507/main/main.go
  40. 68 0
      trigger/pji/diagnostics/errorcode_5_21041508/main/main.go
  41. 68 0
      trigger/pji/diagnostics/errorcode_5_21041510/main/main.go
  42. 68 0
      trigger/pji/diagnostics/errorcode_5_21041601/main/main.go
  43. 68 0
      trigger/pji/diagnostics/errorcode_5_21041602/main/main.go
  44. 68 0
      trigger/pji/diagnostics/errorcode_5_21041606/main/main.go
  45. 68 0
      trigger/pji/diagnostics/errorcode_5_21050901/main/main.go
  46. 68 0
      trigger/pji/diagnostics/errorcode_5_21050902/main/main.go
  47. 68 0
      trigger/pji/diagnostics/errorcode_5_21050904/main/main.go
  48. 68 0
      trigger/pji/diagnostics/errorcode_5_21050905/main/main.go
  49. 68 0
      trigger/pji/diagnostics/errorcode_5_21050906/main/main.go
  50. 68 0
      trigger/pji/diagnostics/errorcode_5_21051509/main/main.go
  51. 68 0
      trigger/pji/diagnostics/errorcode_5_21051704/main/main.go
  52. 68 0
      trigger/pji/diagnostics/errorcode_5_21051705/main/main.go
  53. 68 0
      trigger/pji/diagnostics/errorcode_5_21051706/main/main.go
  54. 68 0
      trigger/pji/diagnostics/errorcode_5_21051707/main/main.go
  55. 68 0
      trigger/pji/diagnostics/errorcode_5_21051708/main/main.go

+ 1 - 0
trigger/pji/README.md

@@ -0,0 +1 @@
+diagnostics中包名不能用#,但是Label用#号隔开了

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21030601/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+motor通讯严重丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21030601"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21030701/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+防跌落传感器通讯轻微丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21030701"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21030702/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+防跌落传感器数值异常
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21030702"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21030801/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+超声波传感器通讯轻微丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21030801"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21030802/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+超声波传感器数值异常
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21030802"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21031001/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+激光雷达通讯轻微丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21031001"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21031101/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+电驱通讯严重丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21031101"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21031201/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+红外数据返回超时
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21031201"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21031403/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+深度相机1数据轻微丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21031403"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21031404/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+深度相机2数据轻微丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21031404"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21040803/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+超声波数据返回超时
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21040803"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21041001/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+激光雷达通讯严重丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21041001"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21041102/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+电驱数据返回超时
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21041102"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21050701/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+防跌落传感器通讯严重丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21050701"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21050703/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+防跌落数据返回超时
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21050703"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21050801/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+超声波传感器通讯严重丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21050801"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21051401/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+深度相机1数据严重丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21051401"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_2_21051402/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+深度相机2数据严重丢失
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21051402"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_4_21050101/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+与云端通讯丢失
+*/
+
+var (
+	errorType       = "4"
+	errorCode       = "21050101"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_4_21050201/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+与计算平台网关通讯异常
+*/
+
+var (
+	errorType       = "4"
+	errorCode       = "21050201"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_4_21050202/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+4G卡号读不到
+*/
+
+var (
+	errorType       = "4"
+	errorCode       = "21050202"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_4_21050301/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+与计算平台MCU通讯丢失
+*/
+
+var (
+	errorType       = "4"
+	errorCode       = "21050301"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21030907/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+定位警告
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21030907"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21030908/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+定位状态未初始化
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21030908"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21031511/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+机器人进入不可行区域
+*/
+
+var (
+	errorType       = "2"
+	errorCode       = "21031511"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21031512/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+未得到局部规划路径
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21031512"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21031513/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+无法旋转至起点姿态
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21031513"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21031514/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+无法旋转至目标点姿态
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21031514"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21031603/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+cpu占用过高(高于90%)或内存占用过高(高于80%)
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21031603"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21031604/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+系统信息轻微超时
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21031604"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21031605/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+系统信息严重超时
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21031605"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041501/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+全局规划器构造失败
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041501"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041502/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+局部规划器构造失败
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041502"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041503/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+目标点四元数格式不合法
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041503"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041504/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+未得到全局规划路径
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041504"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041505/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+电驱通讯轻微丢失
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041505"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041506/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+未得到全局规划路径 - 目标点位被占据
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041506"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041507/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+未得到全局规划路径 - 地图上无可通行的通道
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041507"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041508/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+costmap的观察缓冲区不是最新的
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041508"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041510/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+全局规划路径碰撞
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041510"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041601/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+cartographer节点通讯中断(可去除)
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041601"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041602/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+	move_base节点中断
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041602"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21041606/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+自动充电节点通讯中断
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21041606"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21050901/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+定位丢失
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21050901"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21050902/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+定位失败
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21050902"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21050904/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+地图内丢定位
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21050904"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21050905/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+地图外丢定位
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21050905"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21050906/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+匹配点不够丢定位
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21050906"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21051509/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+全局路径转换失败
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21051509"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21051704/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+识别阶段未识别充电桩
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21051704"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21051705/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+靠近时未识别到充电桩,超时
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21051705"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21051706/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+旋转阶段超时
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21051706"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21051707/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+后退超时,未到充电桩
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21051707"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}

+ 68 - 0
trigger/pji/diagnostics/errorcode_5_21051708/main/main.go

@@ -0,0 +1,68 @@
+package main
+
+import (
+	"fmt"
+	"github.com/bluenviron/goroslib/v2/pkg/msgs/diagnostic_msgs"
+	"strconv"
+)
+
+/*
+后退时未识别到红外,超时
+*/
+
+var (
+	errorType       = "5"
+	errorCode       = "21051708"
+	code12          = "21"
+	hardwareIdIndex = map[string]string{
+		"batter":        "00",
+		"cloud":         "01",
+		"gateway":       "02",
+		"mcu":           "03",
+		"imu":           "04",
+		"odom":          "05",
+		"motor":         "06",
+		"preventFall":   "07",
+		"sonar":         "08",
+		"locate":        "09",
+		"laserLadar":    "10",
+		"electricDrive": "11",
+		"infrared":      "12",
+		"livoxLidar":    "13",
+		"camera":        "14",
+		"navigation":    "15",
+		"system":        "16",
+	}
+)
+
+func Topic() string {
+	return "/diagnostics"
+}
+
+func Label() string {
+	return "errorcode#" + errorType + "#" + errorCode
+}
+
+func Rule(data *diagnostic_msgs.DiagnosticArray) string {
+	if len(data.Status) == 0 {
+		return ""
+	}
+	for _, status := range data.Status {
+		if status.Level != 5 || len(status.Values) == 0 {
+			continue
+		}
+
+		code34 := fmt.Sprintf("%02d", status.Level)
+		code56 := hardwareIdIndex[status.HardwareId]
+		intVal, err := strconv.Atoi(status.Values[1].Value)
+		if err != nil {
+			fmt.Println("字段 【status.Values[1].Value】转整数报错:", err)
+			return ""
+		}
+		code78 := fmt.Sprintf("%02d", intVal)
+		if errorCode == code12+code34+code56+code78 {
+			return Label()
+		}
+	}
+	return ""
+}