123456789101112131415161718192021222324252627282930313233343536373839 |
- package main
- import (
- "cicv-data-closedloop/pjisuv_msgs"
- "fmt"
- "math"
- "sync"
- )
- func Topic() string {
- return "/cicv_location"
- }
- func Label() string {
- return "OverSpeed"
- }
- func Rule(shareVars *sync.Map, data *pjisuv_msgs.PerceptionLocalization) string {
- defer func() {
- if r := recover(); r != nil {
- fmt.Println("Recovered from panic:", r)
- }
- }()
- //threshold := 65.0
- //OutsideWorkshopFlag, _ := shareVars.Load("OutsideWorkshopFlag")
- //OutsideWorkshopFlag = OutsideWorkshopFlag.(bool)
- threshold := 40.0
- //if math.Pow(math.Pow(data.VelocityX, 2)+math.Pow(data.VelocityY, 2), 0.5) >= threshold && OutsideWorkshopFlag == true {
- // return "OverSpeed"
- //} else {
- // return ""
- //}
- if math.Pow(math.Pow(data.VelocityX, 2)+math.Pow(data.VelocityY, 2), 0.5) >= threshold {
- return "OverSpeed"
- } else {
- return ""
- }
- }
|