OverSwing.go 879 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package main
  2. import (
  3. "cicv-data-closedloop/pjisuv_msgs"
  4. "fmt"
  5. "math"
  6. )
  7. /*
  8. def callback_cicv_location(data):
  9. global angular_velocity_z
  10. global Ego_position_x
  11. global Ego_position_y
  12. global Ego_yaw
  13. Ego_position_x=data.position_x
  14. Ego_position_y=data.position_y
  15. Ego_yaw=data.yaw
  16. #print(Ego_yaw)
  17. angular_velocity_z=data.angular_velocity_z
  18. #print(angular_velocity_z)
  19. if abs(angular_velocity_z)>=27:
  20. event_label='overswing' #横摆角速度过大
  21. print(event_label)
  22. */
  23. func Topic() string {
  24. return "/cicv_location"
  25. }
  26. func Label() string {
  27. return "OverSwing"
  28. }
  29. func Rule(data *pjisuv_msgs.PerceptionLocalization) string {
  30. defer func() {
  31. if r := recover(); r != nil {
  32. fmt.Println("Recovered from panic:", r)
  33. }
  34. }()
  35. if math.Abs(data.AngularVelocityZ) >= 27.0 {
  36. return "OverSwing"
  37. } else {
  38. return ""
  39. }
  40. }