123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package main
- import (
- "cicv-data-closedloop/pjisuv_msgs"
- "fmt"
- "math"
- "sync"
- )
- func Topic() string {
- return "/tpperception"
- }
- // 禁止存在下划线_
- func Label() string {
- return "CCFtap"
- }
- func Rule(shareVars *sync.Map, data *pjisuv_msgs.PerceptionObjects) string {
- defer func() {
- if r := recover(); r != nil {
- fmt.Println("Recovered from panic:", r)
- }
- }()
- OutsideWorkshopFlag, ok3 := shareVars.Load("OutsideWorkshopFlag")
- PositionXOfCicvLocation, ok2 := shareVars.Load("PositionXOfCicvLocation")
- PositionYOfCicvLocation, ok1 := shareVars.Load("PositionYOfCicvLocation")
- LeftCurveFlag, ok := shareVars.Load("LeftCurveFlag")
- if ok && ok1 && ok2 && ok3 && OutsideWorkshopFlag.(bool) && LeftCurveFlag.(bool) == true {
- for _, obj := range data.Objs {
- if obj.Type == 2 || obj.Type == 3 {
- Distance := math.Sqrt(math.Pow(PositionXOfCicvLocation.(float64)-obj.Xabs, 2) + math.Pow(PositionYOfCicvLocation.(float64)-obj.Yabs, 2))
- absspeed := math.Sqrt(math.Pow(float64(obj.Vxabs), 2) + math.Pow(float64(obj.Vyabs), 2))
- //fmt.Println("Distance:", Distance)
- if obj.X >= 2.0 && obj.X <= 30.0 && (math.Abs(float64(obj.Y)) <= 4.0 || Distance <= 35.0) && absspeed > 1.5 {
- event_lable := "CCFtap"
- fmt.Println(event_lable)
- return Label()
- }
- }
- }
- }
- return ""
- }
|