JunctionOverspeed.go 892 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package main
  2. import (
  3. "cicv-data-closedloop/pjisuv_msgs"
  4. "fmt"
  5. "sync"
  6. )
  7. type Point struct {
  8. Latitude float64
  9. Longitude float64
  10. }
  11. var (
  12. threshold float64 = 5
  13. )
  14. func Topic() string {
  15. return "/cicv_location"
  16. }
  17. // 禁止存在下划线_
  18. func Label() string {
  19. return "JunctionOverspeed"
  20. }
  21. func Rule(shareVars *sync.Map, data *pjisuv_msgs.PerceptionLocalization) string {
  22. defer func() {
  23. if r := recover(); r != nil {
  24. fmt.Println("Recovered from panic:", r)
  25. }
  26. }()
  27. Automode, _ := shareVars.Load("AutomodeOfPjVehicleFdbPub")
  28. Automode = Automode.(int16)
  29. EnterJunctionFlag, ok1 := shareVars.Load("EnterJunctionFlag")
  30. if ok1 && Automode == 1 && EnterJunctionFlag.(bool) == true {
  31. absspeed, ok := shareVars.Load("AbsSpeed")
  32. if ok && absspeed.(float64) >= threshold {
  33. eventLabel := "JunctionOverspeed"
  34. fmt.Println(eventLabel)
  35. return Label()
  36. }
  37. }
  38. return ""
  39. }