package main import ( "cicv-data-closedloop/pjisuv_msgs" "fmt" "sync" ) type Point struct { Latitude float64 Longitude float64 } var ( threshold float64 = 5 ) func Topic() string { return "/cicv_location" } // 禁止存在下划线_ func Label() string { return "JunctionOverspeed" } func Rule(shareVars *sync.Map, data *pjisuv_msgs.PerceptionLocalization) string { defer func() { if r := recover(); r != nil { fmt.Println("Recovered from panic:", r) } }() Automode, _ := shareVars.Load("AutomodeOfPjVehicleFdbPub") Automode = Automode.(int16) EnterJunctionFlag, ok1 := shareVars.Load("EnterJunctionFlag") if ok1 && Automode == 1 && EnterJunctionFlag.(bool) == true { absspeed, ok := shareVars.Load("AbsSpeed") if ok && absspeed.(float64) >= threshold { eventLabel := "JunctionOverspeed" fmt.Println(eventLabel) return Label() } } return "" }