package main

import (
	"cicv-data-closedloop/pjisuv_msgs"
	"fmt"
	"math"
)

func Topic() string {
	return "/cicv_location"
}

func Label() string {
	return "OverSpeed"
}

func Rule(data *pjisuv_msgs.PerceptionLocalization) string {
	defer func() {
		if r := recover(); r != nil {
			fmt.Println("Recovered from panic:", r)
		}
	}()
	//threshold := 65.0
	threshold := 9999.0
	if math.Pow(math.Pow(data.VelocityX, 2)+math.Pow(data.VelocityY, 2), 0.5)*3.6 >= threshold {
		return "OverSpeed"
	} else {
		return ""
	}
}