12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- 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))
- //fmt.Println("Distance:", Distance)
- if obj.X >= 2.0 && obj.X <= 30.0 && (math.Abs(float64(obj.Y)) <= 4.0 || Distance <= 35.0) {
- event_lable := "CCFtap"
- fmt.Println(event_lable)
- return Label()
- }
- }
- }
- }
- return ""
- }
|