Deep-Neural-Network-Based Modelling of Longitudinal-Lateral Dynamics to Predict the Vehicle States for Autonomous Driving

Multibody models built in commercial software packages, e.g., ADAMS, can be used for accurate vehicle dynamics, but computational efficiency and numerical stability are very challenging in complex driving environments. These issues can be addressed by using data-driven models, owing to their robust generalization and computational speed. In this study, we develop a deep neural network (DNN) based model to predict longitudinal-lateral dynamics of an autonomous vehicle. Dynamic simulations of the autonomous vehicle are performed based on a semirecursive multibody method for data acquisition. The data are used to train and test the DNN model. The DNN inputs include the torque applied on wheels and the vehicle’s initial speed that imitates a double lane change maneuver. The DNN outputs include the longitudinal driving distance, the lateral driving distance, the final longitudinal velocities, the final lateral velocities, and the yaw angle. The predicted vehicle states based on the DNN model are compared with the multibody model results. The accuracy of the DNN model is investigated in detail in terms of error functions. The DNN model is verified within the framework of a commercial software package CarSim. The results demonstrate that the DNN model predicts accurate vehicle states in real time. It can be used for real-time simulation and preview control in autonomous vehicles for enhanced transportation safety.


Introduction
Recent advances on neural networks have led to dramatic progress in solving many complex engineering problems, and demand for such solutions is increasing with time. A wide range of topics starting from dynamics modelling, intelligent control to transportation research is being handled by neural networks [1][2][3]. This technique has naturally found substantial applications in autonomous vehicles, with vehicle lateral and longitudinal dynamics modelling and control being typical applications [4][5][6]. The advent of autonomous vehicles has the potential to drastically change society and the way we understand, plan and design cities and regions [7][8][9]. It will make transportation smoother, but the question is whether it will make it safer [10,11]. For preview control of autonomous vehicles in terms of accuracy and safety, it is critical to investigate the coupling between lateral and longitudinal dynamics for accurate data acquisition, which is necessary for deep learning modelling [12][13][14]. This process requires highly detailed vehicle models or large sets of raw data to properly take into account.
In recent years, a number of contributions have been reported in the field of vehicle coupling dynamics modelling and control by using neural networks. Kumarawadu et al. proposed a neural network adaptive control approach for longitudinal-lateral dynamics of vehicles for highway applications. The results in the face of parameter uncertainties indicated the stability and robustness of the control algorithm [15]. Melzi et al. presented a layered neural network method that uses dynamic parameters acquired from sensors to estimate the sideslip angle. The results showed good consistency between the measured and estimated sideslip angles [16]. Ji et al. developed a lateral motion control strategy by using an adaptive neural network approximator and a robust steering controller. The results suggested that the strategy can track the path and maintain yaw stability at the physical limits of tire friction [17]. Devineau et al. analyzed the capability of deep neural networks (DNNs) to capture vehicle characteristics and the ability to perform longitudinallateral control [18]. Acosta et al. integrated feedforward neural networks into a model predictive controller to achieve vehicle autonomous drifting along a wide range of road radii [19]. Taghavifar et al. developed a probabilistic estimation method by hybridization of least-square backpropagation neural networks and optimal robust control. The approach improved vehicle handling and stability [20]. Kim et al. introduced a sideslip angle estimation scheme by combining DNNs and nonlinear Kalman filters. The scheme was verified by both simulation and experimental results [21]. Tork et al. performed longitudinal-lateral dynamics control in an autonomous vehicle system. An adaptive neural network that is capable of producing nonlinear and complex mappings was designed [22]. Šabanovič developed a road type classification solution to improve vehicle dynamics control via the anti-lock braking system by estimating friction coefficient using video data and DNN algorithms [23].
The literature survey indicates that DNNs can be efficiently applied in vehicle dynamics modelling and control [24]. In most cases, longitudinal-lateral modelling problems were investigated in a decoupled way. The precise modelling of longitudinal-lateral coupling involves complex and nonlinear relations between vehicle state variables, and using the resulting vehicle model is too costly for real-time applications. For this reason, most studies in the field of preview control mainly focus on simplified or few-degree-of-freedom models, which are constrained to avoid highly coupled dynamics [25,26]. However, the simultaneous inclusion of longitudinal and lateral control becomes unavoidable to improve vehicle performance in a wide range of operations especially for autonomous vehicles [27,28]. The major difficulty of DNN-based methods for longitudinal-lateral dynamics is the number of driving situations required for building a representative training dataset. The direct estimation of vehicle characteristics is sometimes unavailable since numerous road tests of vehicles are needed. Vehicle dynamic simulations within the framework of commercial software packages are also time-consuming because real-time simulations are very challenging in low-cost hardware [29,30].
To address these issues, a data-driven modelling method based on real-time data acquisition and DNNs provides an efficient solution. In this study, a DNN model for predicting longitudinal-lateral dynamics of a vehicle is presented. An efficient semirecursive multibody method that performs real-time simulations is used to capture vehicle key characteristics. The highlights of this study lies in two aspects. The first aspect consists of the use of an efficient semirecursive multibody formulation to acquire training and testing data. The multibody model can deal with the nonlinearities of vehicle systems more accurately than the simplified or decoupled models. The second aspect consists of a DNN modelling approach to predict longitudinal-lateral dynamics of a vehicle. Different applied torques and initial speeds over a wide range are used to imitate various kinds of on-road driving situations. The DNN model is verified by using the results obtained from a commercial software package CarSim. Further, the DNN models with different hidden layers and sample size are investigated in terms of accuracy and efficiency. The widely used backpropagation neural network and radical basis function neural network are employed as references to tell the advantages of the DNN model used to predict the vehicle states.
The rest of the study is organized as follows. In Section 2, an efficient semirecursive multibody method is introduced to develop a vehicle model and collect the vehicle data for DNN modelling. A DNN model with multiple inputs and outputs for predicting the lateral-longitudinal dynamics of an autonomous vehicle is developed. In Section 3, the results of the DNN model are comprehensively investigated in accuracy and efficiency, and the effectiveness of the DNN model is verified within the framework of a commercial software CarSim. Finally, in Section 4, we conclude our work.

Vehicle Multibody Method for Data Acquisition
In this section, we used an efficient semirecursive multibody method to develop a vehicle dynamics model. The equations of motion of the closed-loop vehicle systems can be formulated in terms of independent relative (joint) coordinates. They can be expressed as [31,32]: where, R d and R z denote the first and second velocity transformation matrices, which describe the Cartesian velocities and accelerations by means of independent relative velocities and accelerations. The superscript T denotes the transpose operation.M denotes the composite mass matrix of the multibody system. M Σ and Q Σ contain the accumulated generalized mass matrix and external forces, respectively. T denotes the path matrix, representing the system recursive connectivity.ż i andz i contain the independent relative (joint) velocities and accelerations, respectively. This formulation is called the double-step semirecursive multibody formulation, which was proposed by Javier García de Jalón and his coworkers [33,34]. Although Equation (1) is more complicated than other multibody formulations, it uses a small set of independent relative accelerationsz i , which leads to higher computational efficiency. The ordinary differential form of the equations of motion enables the stable simulation of vehicle systems via various numerical integrators [35,36]. Low-order integrators are very suitable for efficient vehicle simulations. However, the solution accuracy is unable to satisfy the requirement as the numerical error accumulates over time. The Adams-Bashforth-Moulton integrator and the 4th-order Runge-Kutta integrator are typical high-order integrators that are often used in real-time simulations with longer simulation times.
The training and testing sets of vehicle dynamics data can be obtained in real time based on the semirecursive multibody formulation. Thus, we aim to collect historical data that include the torque applied on wheels, the vehicle's initial speed, the longitudinal driving distance, the lateral driving distance, the final longitudinal velocities, the final lateral velocities, and the yaw angle to build a lateral-longitudinal dynamics model by using a DNN approach. The capacity of the DNN modelling approach to capture the key vehicle states is explored, and verified based on the results obtained from a commercial software package CarSim. The data-driven vehicle model is developed offline via DNN approach and used online for preview control in autonomous vehicles. The computational burden of the data-driven model is much smaller than that of the vehicle multibody models, e.g., ADAMS model, CarSim model, and semirecursive multibody model. Furthermore, the data-driven model avoids the numerical integration process of vehicle multibody models, and it leads to robust generation of the vehicle states.

DNN Structure of the Vehicle Dynamics
DNNs can learn and store relationships between the input and output neurons. Mathematical theory has proved that DNNs can approach any nonlinear continuous functions with high precision. A general DNN framework is described in Figure 1.   The DNN training process is composed of forward propagation of inputs and backpropagation of errors. The input matrix, the weight matrices, and the bias matrices in forward propagation are described as: where, Z 1 denotes the input matrix, W n and B n denote the weight matrix and bias matrix of the n-th layer, respectively. m denotes the sample size in the training set, and n denotes the number of hidden layers and input layer, The forward propagation steps are expressed as: where, Z i and A i denote the input and output of the i-th layer, respectively, and f i denotes the i-th activation function. Note that A n+1 contains the results of the DNN model. There are various types of activation functions to help the DNN model fit the linear and nonlinear functions. The mean square error (MSE) was selected as the loss function to measure the differences between the DNN results and sample results before backpropagation. By implementing backpropagation, the weight matrices and bias matrices were updated to minimize the loss function. In this study, L2 regularization was used to calculate the loss function to avoid overfitting. The MSE, the L2 regularization, and the loss function are expressed as [37]: where, e denotes the network's cost, Y denotes the value of samples, and λ denotes the regularization coefficient. The adaptive moment estimation optimization (Adam) algorithm was used in the backpropagation process. It can be regarded as a combination of the root mean square prop (RMSProp) algorithm and adaptive gradient (AdaGrad) algorithm [38]. The main parameters of AdaGrad and RMSProp are expressed as: where, dW n and dB n , respectively, denote the partial differential of the weight matrices and the bias matrices with respect to the loss function. v dwn , v dbn , s dwn , and s dbn denote the AdaGrad and RMSProp parameters in each training iteration for weight matrices and bias matrices, respectively. Because the moving exponential weighted average causes relatively large errors to the initial value at the beginning of the iteration, the AdaGrad and RMSProp parameters were updated by using the following expressions: These parameters were corrected in each training iteration. The weight matrices and bias matrices, in turn, were updated based on the Adam algorithm: where, ε denotes a smoothing parameter. It equals 10 −8 in this vehicle example. α denotes the learning rate. It needs to be minutely updated in the DNN training process.

DNN Vehicle Model
In this section, we used the semirecursive multibody formulation described by Equation (1) to obtain longitudinal-lateral dynamics datasets. The vehicle system consists of McPherson suspensions in the front axles, multilink suspensions in the rear axles, and Pacejka tire models [36,39]. In dynamic simulations, vehicles move with different initial speeds and front-wheel driving torques to imitate acceleration and deceleration situations. The simulations last for 5 s. The steering angle is controlled to ensure the double-lane change maneuver, as described in We obtained critical vehicle states by introducing 500 different initial speeds and driving torques at defined steering angles. Those vehicle data, including the longitudinal distance and speed, the lateral distance and speed, and the yaw angle, denote the longitudinal-lateral dynamics of the autonomous vehicle. The range of the initial speed is 15 m/s to 45 m/s. The range of applied torque is −500 Nm to 500 Nm.
We randomly selected 500 samples and divided them into a training set with 450 samples and a testing set with 50 samples. The training and testing sets were used to train and test the DNN model. Furthermore, the training data were processed to eliminate the inconvenience caused by the magnitude of values. It can avoid small weight matrices, which may cause numerical instability during the integration. We used Z-score standardization to process the data, and the equation is described as: where, x * represents the standardization value, x represents the value of the samples, µ represents the mean of the samples, and σ represents the standard deviation of the samples. The mean value and standard deviation of the processed data are 0 and 1, respectively. There are two widely used methods to update the optimization parameters in DNNs. The first is batch gradient descent method that calculates all samples [40]. Its computational efficiency is low. The second is stochastic gradient descent method that computes the loss function of each sample and finds the updated parameters [41]. Its computational efficiency is high, but the convergence performance needs improvement. To overcome the drawbacks of these two methods, the minibatch gradient descent method was used in this work. This method divides the data into batches and updates the parameters in each batch. The data in a batch determines the direction of this gradient. It will not vanish easily when falling and will reduce the randomness. The batch size is set to 32 in this vehicle example.
By training the datasets, we built a DNN model to predict longitudinal-lateral dynamics of the autonomous vehicle. The DNN model for vehicle longitudinal-lateral dynamics is described in Figure 3. The inputs of the DNN model include the initial speed and applied torque of the vehicle, as described by v and M in Figure 3. The outputs include the longitudinal distance and speed, the lateral distance and speed, and the yaw angle. They are described by s x , v x , s y , v y , and z in Figure 3, respectively. The DNN model involves 4 hidden layers, and each layer has 28, 24, 20, and 15 neurons. The activation functions are rectified linear unit (ReLU) functions, which are expressed as: When the DNN training is completed, the testing set is used for model test and verification. The MSE (loss function) of the dataset needs to be calculated. The DNN model can be used for the prediction and preview control if the MSE is very small. The procedure of DNN modelling for vehicle's lateral-longitudinal dynamics is described in Figure 4.

DNN Model Results
In this section, the DNN model of the vehicle was developed. The DNN results were described and compared with the results of the multibody model. Figure 5 describes the result differences between the DNN model and the multibody model. Note that only part of the DNN results is shown in the figures for better visualization. We used box plots, described in Figures 6-10, to show the absolute percentage error between the results of the multibody model and the DNN model. The elements in the box plots generally include median, mean, upper quartile, lower quartile, upper limit, and lower limit. They can be used to clearly depict the data dispersion and bias of the dataset. They are not affected by outliers and can describe the discrete distribution of data in a relatively stable way. Different initial speeds and driving torques in a wide range were used to imitate various driving situations.  Two conclusions can be drawn based on the absolute percentage error analysis and results comparison. - The DNN results of the longitudinal distance and speed fit the multibody model results well. The median, mean, and maximum absolute percentage errors are less than 1%. - The lateral distance and speed, and yaw angle predicted by the DNN model fit the reference results (multibody model results) well. The median, mean, and maximum absolute percentage errors are less than 3%.

Model Accuracy and Efficiency
In this section, the accuracy of the DNN model was evaluated quantifiably by error functions. We also investigated its computational efficiency. The accuracy evaluation metrics include the mean absolute error (MAE), the mean absolute percentage error (MAPE), the maximum absolute error (ME), the root mean square error (RMSE), and R 2 . R 2 represents the coefficient of determination. It is a statistical indicator that can be used to reflect the regression model to illustrate the reliability of the variable change. These error functions are described as: where, y i denotes the i-th value of the reference results,ŷ i denotes the i-th value of the DNN results,ȳ i denotes the i-th mean value of the DNN results, and n denotes the number of groups, which equals 7701 in this study. The five evaluation metrics were used to quantify model accuracy. The smaller the first four metrics are, the more accurate the DNN model is. However, for R 2 , if its value is closer to 1, the DNN model fits well. The results of accuracy analysis are described in Table 1. It can be see from Table 1 that the MAE, MAPE, ME, and RMSE of the vehicle states are relatively small, while R 2 is very close to 1. This indicates that the DNN model has high accuracy in predicting longitudinal-lateral dynamics of the vehicle. Furthermore, the prediction of longitudinal dynamics is slightly more accurate than the prediction of lateral dynamics. To better visualize the high accuracy of the proposed DNN modelling method, the widely used backpropagation (BP) neural network and radical basis function (RBF) neural network were used as references for comparison. The solution accuracy was investigated in term of evaluation metrics, e.g., ME, MAE, MAPE, RSME, and R 2 . The comparative results, taking yaw angle as an example, are described in Table 2. As presented in Table 2, the ME, MAE, MAPE, RSME of the DNN method are smaller than those of the BP and RBF methods, and R 2 of the DNN method is much closer to 1. It can be concluded that the DNN model is more accurate than the widely used BP and RBF models. To investigate the computational efficiency of the DNN model, the CPU time of DNNs with different numbers of hidden layers were compared. The simulation times of the multibody model with different time-steps were measured for references. The results are shown in detail in Table 3. Note that the CPU time is the average time of ten random driving situations. It is easy to observe in Table 3 that the CPU time for predicting longitudinal-lateral dynamics is approximately 1 ms with 2, 3, and 4 hidden layers. The computational efficiency is almost the same in these cases, which is very high and can be used for faster-than-realtime simulation. The CPU times of the multibody model to run a 5 s dynamic simulation are 3971 ms, 383 ms, and 38.1 ms, corresponding to the time-steps of 1 ms, 10 ms, and 100 ms, respectively. It can be seen that the DNN model is much faster than the multibody model for predicting the vehicle states.
Furthermore, to investigate the effects of dataset size on the accuracy of DNN model, different numbers of samples were used to train the DNN model. The MAPE was calculated to investigate how large the data size can predict the longitudinal-lateral dynamics effectively. It can be seen from Table 4

Model Verification and Discussion
In this section, the results obtained from the commercial software package CarSim were used to verify the effectiveness of the DNN model. It is noteworthy that vehicle simulations with the same parameters were performed in CarSim. Figures 11-13 describe the comparative results when the −300 Nm and 300 Nm driving torques are imposed. The detailed views in these figures show the maximum differences between the DNN results and the CarSim results.   As presented in above figures, the predicted results via DNNs coincide with the numerical results of the software package CarSim. The DNN results also are consistent with the multibody model results. The driving situations imitate the vehicle's decelerations and accelerations during a double-lane change maneuver with a wide range of initial speeds. As a result, the effectiveness of the DNN model to predict the vehicle's longitudinal-lateral dynamics was verified. The DNN model can be trained offline according to a large quantity of vehicle data and used for the preview control in vehicles to improve the handling, performance, and road safety. This DNN model is particularly very useful for the preview control in autonomous vehicles for enhanced transportation safety. Note that the DNN model was developed for a specific vehicle system. Useful DNN models of different vehicle systems can be developed based on a similar modelling procedure.

Conclusions
In this study, a DNN model to predict the longitudinal-lateral dynamics of an autonomous vehicle was developed. A semirecursive multibody formulation was used to capture the vehicle characteristics. An algorithm to obtain the data of longitudinal-lateral dynamics and a DNN modelling approach were presented. It is significant that massive parallel computations can be performed by using GPUs that are especially suitable for the large volumes of data in autonomous vehicles. To verify the DNN model, the testing data were randomly selected for accuracy evaluation. Error functions also were used to quantifiably analyze the model accuracy. The computational efficiency and accuracy were investigated for neural networks with different structures. Finally, the results from a commercial software package CarSim were used to validate the proposed DNN model. The results indicated that the DNN model can predict the vehicle's lateral-longitudinal dynamics accurately and efficiently. The DNN model used for modelling lateral, longitudinal, and vertical coupling dynamics will be investigated in the future. Overall, a DNN-based methodology was presented to predict the vehicle's lateral-longitudinal dynamics in real time. It is suitable for the preview control of autonomous vehicles in complex environment to enhance the transportation safety.