12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- package main
- import (
- "cicv-data-closedloop/pjisuv_msgs"
- "fmt"
- "math"
- "sync"
- )
- var (
- Framenum int64 = 0
- YawofCicvLocation any
- ObjDicOfTpperception any
- AngularVelocityZOfCicvLocation any
- AngularVelocity float64
- AngularVelocityZOfCicvLocation1 any
- AngularVelocity1 float64
- objDic = make(map[uint32][][]float32)
- yaw float64
- ok1 bool
- ok2 bool
- )
- func isCuttingOut(shareVars *sync.Map, ObjectList [][]float32) bool {
- for i := 0; i < len(ObjectList[0]); i++ {
- xi := ObjectList[0][i]
- yi := math.Abs(float64(ObjectList[1][i]))
- Type := ObjectList[6][0]
- AngularVelocityZOfCicvLocation, ok1 := shareVars.Load("AngularVelocityZOfCicvLocation")
- if !ok1 {
- return false
- }
- AngularVelocity = AngularVelocityZOfCicvLocation.(float64)
- if xi >= 0 && yi <= 0.7 && math.Abs(AngularVelocity) <= 0.6 && (Type != 100.0) { //简化条件
- //if xi >= 0 && yi <= 0.7 && math.Abs(param.AngularVelocityZOfCicvLocation) <= 0.6 && (Type == 2.0 || Type == 3.0) {//理论条件
- for j := 0; j < len(ObjectList[0])-i-1; j++ {
- xj := ObjectList[0][j]
- yj := math.Abs(float64(ObjectList[1][j]))
- if xj >= 0 && yj >= 2.0 && math.Abs(AngularVelocity) <= 0.6 {
- return true
- }
- }
- }
- }
- return false
- }
- func Topic() string {
- return "/tpperception"
- }
- // 禁止存在下划线_
- func Label() string {
- return "CCRH"
- }
- func Rule(shareVars *sync.Map, data *pjisuv_msgs.PerceptionObjects) string {
- defer func() {
- if r := recover(); r != nil {
- fmt.Println("Recovered from panic:", r)
- }
- }()
- YawofCicvLocation, ok2 = shareVars.Load("YawOfCicvLocation")
- if !ok1 {
- return ""
- }
- yaw = YawofCicvLocation.(float64)
- Framenum += 1
- ObjDicOfTpperception, ok2 = shareVars.Load("ObjDicOfTpperception")
- if !ok2 {
- return ""
- }
- objDic = ObjDicOfTpperception.(map[uint32][][]float32)
- for _, objValue := range objDic {
- if len(objValue[0]) <= 10 || !isCuttingOut(shareVars, objValue) {
- continue
- }
- return Label()
- }
- return ""
- }
|