OverSpeed.go 410 B

123456789101112131415161718192021222324
  1. package main
  2. import (
  3. "cicv-data-closedloop/pjisuv_msgs"
  4. "math"
  5. )
  6. func Topic() string {
  7. return "/cicv_location"
  8. }
  9. func Label() string {
  10. return "OverSpeed"
  11. }
  12. func Rule(data *pjisuv_msgs.PerceptionLocalization) string {
  13. //threshold := 65.0
  14. threshold := 9999.0
  15. if math.Pow(math.Pow(data.VelocityX, 2)+math.Pow(data.VelocityY, 2), 0.5)*3.6 >= threshold {
  16. return "OverSpeed"
  17. } else {
  18. return ""
  19. }
  20. }