1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package main
- import (
- "cicv-data-closedloop/common/entity"
- "cicv-data-closedloop/pjisuv_msgs"
- "math"
- )
- func Topic() string {
- return "/tpperception"
- }
- func Label() string {
- return "TTC"
- }
- func Rule(data *pjisuv_msgs.PerceptionObjects, param entity.PjisuvParam) string {
- for _, obj := range data.Objs {
- if math.Abs(float64(obj.Y)) <= 2 && obj.X >= 6 {
- ttc := -((float64(obj.X) - 4) / (float64(obj.Vxrel) + 0.001))
- if ttc >= 0 && ttc <= 3 {
- return "TTC"
- }
- }
- }
- return ""
- }
- func DegreesToRadians(degrees float64) float64 {
- return degrees * math.Pi / 180.0
- }
|