package main

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

/*
def callback_cicv_location(data):
    global angular_velocity_z
    global Ego_position_x
    global Ego_position_y
    global Ego_yaw


    Ego_position_x=data.position_x
    Ego_position_y=data.position_y
    Ego_yaw=data.yaw
    #print(Ego_yaw)
    angular_velocity_z=data.angular_velocity_z
    #print(angular_velocity_z)
    if abs(angular_velocity_z)>=27:
        event_label='overswing' #横摆角速度过大
        print(event_label)

*/

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

func Label() string {
	return "OverSwing"
}

func Rule(data *pjisuv_msgs.PerceptionLocalization) string {
	if math.Abs(data.AngularVelocityZ) >= 27.0 {
		return "OverSwing"
	} else {
		return ""
	}
}
