1234567891011121314151617181920212223242526272829303132333435363738 |
- package main
- import (
- "cicv-data-closedloop/pjisuv_msgs"
- "fmt"
- "math"
- "sync"
- )
- func Topic() string {
- return "/tpperception"
- }
- func Label() string {
- return "TargetTooClose"
- }
- func Rule(shareVars *sync.Map, data *pjisuv_msgs.PerceptionObjects) string {
- defer func() {
- if r := recover(); r != nil {
- fmt.Println("Recovered from panic:", r)
- }
- }()
- velocityXOfCicvLocation, ok1 := shareVars.Load("VelocityXOfCicvLocation")
- angularVelocityZOfCicvLocation, ok2 := shareVars.Load("AngularVelocityZOfCicvLocation")
- OutsideWorkshopFlag, ok3 := shareVars.Load("OutsideWorkshopFlag")
- OutsideWorkshopFlag = OutsideWorkshopFlag.(bool)
- if ok1 && ok2 && ok3 {
- for _, obj := range data.Objs {
- value1 := velocityXOfCicvLocation.(float64)
- value2 := angularVelocityZOfCicvLocation.(float64)
- if math.Abs(float64(obj.Y)) <= 1.5 && obj.X >= 0 && obj.X <= 6 && value1 < 5.5 && math.Abs(value2) >= 0.5 && OutsideWorkshopFlag == true {
- return Label()
- }
- }
- }
- return ""
- }
|