'''
-------------------------------------------------------------------------------------------------
This code accompanies the paper titled "Human injury-based safety decision of automated vehicles"
Author: <NAME>, <NAME>, <NAME>, <NAME>
Corresponding author: <NAME> (<EMAIL>)
-------------------------------------------------------------------------------------------------
'''


import torch
import numpy as np
from torch import nn
from torch.nn.utils import weight_norm


__author__ = "<NAME>"


def Collision_cond(veh_striking_list, V1_v, V2_v, delta_angle, veh_param):
    ''' Estimate the collision condition. '''

    (veh_l, veh_w, veh_cgf, veh_cgs, veh_k, veh_m) = veh_param

    delta_angle_2 = np.arccos(np.abs(np.cos(delta_angle)))
    if -1e-6 < delta_angle_2 < 1e-6:
        delta_angle_2 = 1e-6

    delta_v1_list = []
    delta_v2_list = []

    # Estimate the collision condition (delat-v) according to the principal impact direction.
    for veh_striking in veh_striking_list:
        if veh_striking[0] == 1:
            veh_ca = 
np.arctan(veh_cgf[0] / veh_cgs[0])