package main

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

/*
def callback_pj_vehicle_fdb_pub(data):
    global pre_Automode_stat_flag
    if data.Automode==0 and pre_Automode_stat_flag==1:
        event_label='DriverTakeOver'    #人工接管
        print(event_label)
    pre_Automode_stat_flag=data.Automode


*/

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

func Label() string {
	return "DriverTakeOver"
}

func Rule(data *pjisuv_msgs.VehicleFdb, param *pjisuv_param.PjisuvParam) string {
	label := ""
	if data.Automode == 0 && param.AutomodeOfPjVehicleFdbPub == 1 {
		label = "DriverTakeOver"
	}
	fmt.Println("当前自动驾驶状态为：", data.Automode, "上一个自动驾驶状态为：", param.AutomodeOfPjVehicleFdbPub)
	param.AutomodeOfPjVehicleFdbPub = data.Automode
	return label
}
