Fast Motion Model of Road Vehicles with Artiﬁcial Neural Networks

: Nonlinear optimization-based motion planning algorithms have been successfully used for dynamically feasible trajectory planning of road vehicles. However, the main drawback of these methods is their signiﬁcant computational effort and thus high runtime, which makes real-time application a complex problem. Addressing this ﬁeld, this paper proposes an algorithm for fast simulation of road vehicle motion based on artiﬁcial neural networks that can be used in optimization-based trajectory planners. The neural networks are trained with supervised learning techniques to predict the future state of the vehicle based on its current state and driving inputs. Learning data is provided for a wide variety of randomly generated driving scenarios by simulation of a dynamic vehicle model. The realistic random driving maneuvers are created on the basis of piecewise linear travel velocity and road curvature proﬁles that are used for the planning of public roads. The trained neural networks are then used in a feedback loop with several variables being calculated by additional numerical integration to provide all the outputs of the original dynamic model. The presented model can be capable of short-term vehicle motion simulation with sufﬁcient precision while having a considerably faster runtime than the original dynamic model.


Literature Outlook
Automation of road transportation is expected to provide several benefits for society. Autonomous vehicles are expected to be more energy-efficient and environmentally friendly [1], while automated road traffic is predicted to improve average travel time significantly and traffic flow capacity [2], with the information provided by various sensors, communications and HD maps [3]. One of the most exciting research fields regarding autonomous driving is motion planning. Nonlinear optimization-based techniques have been used successfully to plan dynamically feasible trajectories for systems with nonholonomic dynamics. Optimization-based constrained trajectory generation algorithms are used for robot-assisted surgeries [4], machining equipment [5], and multi-purpose robots [6] as well as for road vehicles. One of the fundamental works on motion planning for wheeled vehicles is [7], where authors define an optimization framework suitable for driving a planetary robot on rough terrain. The winning team of the DARPA Urban Challenge at Carnegie Mellon University later used a similar nonlinear optimization-based trajectory planning and tracking algorithm [8]. In [9], the authors present a real-time fast and robust motion planning framework for urban conditions by combining a hybrid A*-based search with model predictive approaches to enable continuous re-planning based on current measurements. An optimization-based maneuver planning and tracking framework is proposed in [10] for low-speed and restricted-space environments using kinematic equations to describe the motion of cars, trucks, and semi-trailers. The authors of this paper propose a real-time trajectory planning algorithm in [11], where the dynamical feasibility of the motion is ensured by model-based simulation of the vehicle. The main difficulty in the case of all online optimization-based motion planning approaches is that the applied dynamical models have to be simulated numerous times as the cost and constraint functions need to be evaluated iteratively during the optimization loop. This means that considering an online optimization loop of approximately 100-200 ms, the available time for one vehicle simulation is in the range of 5 ms. Accordingly, there is an elementary need for fast and accurate short term vehicle simulation techniques in the field of optimal motion planning.
Numerous efficient simulation approaches have been developed for other time-critical applications such as computer graphics as well. In most cases, computer graphics functions require real-time performance for visualization, which means that the time available for the simulation of dynamic systems can often fall below even 1 ms. Position-Based Dynamics (PBD) directly computes the position-like dynamical quantities instead of time integration of equations of motions derived from Newton's second law [12,13]. Subspace simulation methods are used to reduce the complexity of dynamic models by projecting the equations of motion into a reduced subspace with the help of, e.g., Principal Component Analysis (PCA) for a more efficient solution [14,15]. Data-driven physical simulations use data precomputed offline by accurate dynamic simulation techniques to approximate and/or accelerate online simulations. Artificial neural network-based data-driven models are an attractive opportunity for time-critical simulations because they enable faster run-times at the price of offline pre-calculations and higher memory usage [16,17]. Researchers at Ubisoft and McGill University are combining subspace simulation techniques with supervised learning in a computer graphics application where the computation time available for one object is in the range of 10-100 microseconds to simulate deformation effects, collisions of objects, and external forces [18].
Artificial neural networks are already used in vehicle simulation and control applications as well. In [19], authors are using artificial neural networks for modeling the main combustion metrics of diesel engines as an alternative for parameter tuning of dynamical models. Authors in [20] are simulating vertical tire and suspension dynamics while traversing road irregularities with recurrent neural networks. Another worthy example is [21], where deep feedforward networks are used to model and simulate a hovercraft. A robust neural network-based lateral control method is proposed in [22], which aims to resolve high-frequency oscillation issues of classical Sliding Mode Control (SMC) with the application of Radial Basis Function Neural Networks (RBFNN). Similarly, authors of [23] combine Model Predictive Control (MPC) with RBFNN to robustly handle the nonlinear characteristics of the steering system. A reinforcement-learning-based integrated planning and control method is proposed for automated parking applications in [24], which can simultaneously coordinate the longitudinal and lateral motions to park in a smaller parking space in one maneuver. Reinforcement learning is also used for high velocity lane change maneuvering in [25], where a Deep Deterministic Policy Gradient (DDPG) agent is utilized in an end-to-end method using lidar data. The authors of this paper are also actively researching this field. In [26], a hybrid motion planning approach is presented that unites classical optimization with neural networks for the more efficient solution of the planning problem. A reinforcement-learning-based lane keeping planning algorithm is developed in [27], where the machine learning agents are applied to support the Monte Carlo Tree Search (MCTS)-based planning in order to provide real-time performance.
As shown, artificial neural networks have been successfully utilized for physical simulations in numerous different research fields to enhance simulation speeds or replace physical models with many parameters.

Motivation
The motivations to create a neural network based vehicle model are twofold. Firstly, one can train the neural network based on real vehicle measurement data. This would enable us to perform simulations that are completely tailored to the vehicle in question, without having to worry about the correct parametrization of a dynamic model with a high degree of freedom. Secondly, the neural network can also be trained based on simulated vehicle motion data using a dynamic model of arbitrary complexity. The goal and expected benefit here is to decrease computational effort and thus runtime of the simulations using the neural-network-based model. Fast vehicle motion simulations of several (≤10) s are extremely useful for the application in online optimization-based motion planner algorithms as the evaluation of cost and constraint functions inside the optimization loop requires predicting the vehicle's motion in case of numerous different values of the optimized variable [28]. This often means several hundreds of simulations that can be done faster with the neural-network-based model. The plausibility of the optimization results obtained this way can subsequently be supervised with a simulation of the original dynamic model. A single simulation does not cause runtime issues, even with a fairly complex vehicle model.
The contribution of this paper is accordingly a neural-network-based road vehicle model that is able to substitute a classic nonlinear single-track dynamical model in shortterm simulations, while being faster as well. The paper is organized as follows. First, Section 2 describes the original dynamic model of the vehicle. In Section 3, a random trajectory planning algorithm is shown that is used to generate learning data for the neuralnetwork-based approach. Then, in Section 4, the neural-network-based vehicle model is presented in details. Simulation results and performance evaluation of the proposed algorithm are described in Section 5. The limitation and potential issues of this study are later discussed in Section 6 . Finally, Section 7 contains concluding remarks and proposals for future research directions. Figure 1 shows the progress of the presented research from our motivation to create a neural-network-based vehicle model to the proof of concept of the developed method.

Nonlinear Single Track Vehicle Model
In this section, the applied planar nonlinear single-track vehicle model will be presented in detail. Planar single-track models are widely used for vehicle simulations and model-based calculations because they can offer sufficient precision in most driving scenarios on public roads while having a moderate complexity. Authors use the presented model in optimization-based motion planning algorithms as well, which makes it a good candidate for the proof of concept of the proposed neural-network-based model. The presented model combines literature sources, focusing on either chassis or wheel dynamics by using a sophisticated dynamic wheel slip model to increase the precision of simulations and also extends them with practical considerations that enable a stable and efficient numerical solution. Standard notations used for the equations of the vehicle model are the following. Superscripts differentiate between the same quantities in different coordinate systems. Specifically, superscript G stands for global inertial coordinate system NWU (North West Up), superscript V denotes the rotating vehicle-fixed coordinate system, and superscript W is applied for quantities in wheel-fixed coordinate systems. As numerous equations have to be calculated both for front and rear wheels the same way, subscript [ f /r] is used many times to indicate that by selecting subscript f or r for the whole equation, respectively, the equations are shown for both wheels. Similarly, subscript [x/y] is used when the calculations for longitudinal and lateral directions are equivalent.

Model Components
The presented nonlinear single-track vehicle model shown in Figure 2 is a planar rigid multi-body model. The term single-track means that the wheels at the front and rear axles are substituted by one wheel per axle. Single-track models are widely used for vehicle simulations and model-based calculations because they can offer sufficient precision in most driving scenarios while having a moderate complexity [29]. The multi-body model consists of 3 bodies; the vehicle chassis and the two wheels, which are connected rigidly. Our model is planar, which means that vertical translation and roll and pitch movements are completely neglected. The vehicle is subject to Earth's gravitational acceleration g. The center of gravity location of the vehicle is considered to be constant.  Wheel slips are modeled dynamically with respect to the elasticity of the tires. The longitudinal and lateral tire forces are nonlinear functions of corresponding wheel slips with respect to their simultaneous presence (superposition of forces is considered). Aligning torques on the wheels due to lateral slip is neglected. The vehicle has front-wheel steering, and the dynamics of steering actuation are considered. Driving inputs consist of total driving and braking torques as well as the steering wheel angle.
The presented model can precisely simulate driving scenarios even with high accelerations at the limit of adhesion and stability while having a moderate computational effort compared to full four-wheel 3D models. However, it cannot consider vertical dynamic effects such as road unevenness or load transitions due to road slope. Furthermore, scenarios where all four wheels' friction conditions play an important role, such as µ-split caseswhere the left and right side of the vehicle meets with different road surface-cannot be simulated.

Dynamics of the Chassis
The vehicle chassis is a rigid planar body with three degrees of freedom: longitudinal and lateral positions x G v and y G v and yaw angle ψ v in the global inertial coordinate system. The chassis' equations of motion represent the principles of conservation of linear and angular momentum (Newton's second law) and are expressed in the inertial global coordinate system as follows: where m v is the total mass of the vehicle, θ v,z is its the moment of inertia about the vertical axis, and horizontal distances of vehicle center of gravity to front and rear axles are noted by l v,[ f /r] . Aerodynamic drag forces are first calculated in the vehicle-fixed coordinate system as where A v, f is the frontal area and c v,d is the aerodynamic drag coefficient of the vehicle, while ρ A is the density of air [29]. The conversion of arbitrary dynamic quantity γ [x/y] in the rotating vehicle-fixed coordinate system to the global inertial one is done by Similarly, the conversion from the global inertial coordinate system to the vehicle-fixed is Accordingly, the aerodynamic drag forces calculated in Equations (4) and (5) are transformed to the inertial global coordinate system by Equations (6) and (7). As the model is planar (vertical movements are neglected), one can calculate the tire loads based on equilibrium of forces and moments in the vertical plane as where h v is the center of gravity height of the vehicle. Driving and braking torques are distributed ideally according to the load transfer above, which means the resulting longitudinal slips shall be equalized by torques calculated as with We are often interested in the inertial accelerations not only in the global coordinate system, but in the vehicle-fixed one as well. To calculate their valuesẍ V v,I ,ÿ V v,I , from global accelerationsẍ G v ,ÿ G v we can use Equations (8) and (9). Please note that these accelerations are not equal to the translational accelerations in the vehicle-fixed system, because the vehicle is rotating.

Dynamics of the Wheels
The front and rear virtual wheels have a single degree of freedom: rotation about their own axes ρ [ f /r] . Longitudinal and lateral wheel slips s [ f /r],[x/y] are calculated according to a dynamic model considering elasticity of the tires. The dynamic equations of the wheels are as follows:ρ where r [ f /r] are the radii and θ [ f /r] are the moments of inertia of the wheels. The rolling velocities of the wheels are calculated as The braking torque shall only be applied to the wheels if they are moving, calculated as where v ba = v ba,0 + k v ba |M [ f /r],b | is the rolling velocity at which braking torque damping should disappear. With this approach, the value of applied braking torque is gradually built down as the wheel stops, so that it can reach an oscillation-free standstill state. Rolling resistance torques are first calculated as where A rr , B rr , and C rr are parameters [31]. Tire loads are the same in the vehicle-fixed and in the wheel-fixed coordinate systems F W [ f /r],z = F V [ f /r],z due to the common vertical axis. Then, a damping technique similar to one applied to the acting braking torque is used to eliminate discontinuity at point v [ f /r],r = 0, so that the acting rolling resistance torques are built up gradually while the wheels are starting to move as follows: where v rra is the rolling velocity at which rolling resistance torque should be fully applied.
where µ [ [32]. To improve the low-speed behavior of the model especially when starting from or braking until standstill, the tire forces are calculated based on damped slip values [32], which are evaluated as with slip stiffness being The factor of slip damping is calculated with the usual cosine transition as where v sd is the rolling velocity at which slip damping should switch off and k [ f /r],x is the initial maximal factor of damping [32]. In case of pure longitudinal or lateral slip conditions, the tire forces are calculated simply by In case of the mutual presence of longitudinal and lateral wheel slips tire forces are calculated with respect to their superposition by the friction ellipse method, given as with being the combined slip value. Finally, the acting tire forces are given by where s da is the minimal value of wheel slips where superposition of forces shall be considered. This limit is important for the numerical calculations, as Equations (27) and (28) (6) and (7).
To be able to evaluate the dynamic equations of the wheel, slip-dependent acting relaxation lengths of tires have to be calculated as where l [ f /r],[x/y] and l [ f /r]m,[x/y] are the relaxation lengths at standstill and at wheel spin or lock, respectively [32]. Furthermore, the velocities of wheel center points are needed in wheel-fixed coordinate systems. To obtain these, the velocities of the vehicle center of gravity in the global inertial coordinate systemẋ G vẏ G v are first converted to the vehicle-fixed coordinate systemẋ V vẋ V v with Equations (8) and (9). Then, wheel center point velocities are calculated asẋ The wheel center point velocities finally have to be transformed to wheel-fixed coordinate systems. For the rear wheel, no real transformation is necessary asẋ W r =ẋ V r andẏ W r =ẏ V r . As the front wheel is steered, Equations (8) and (9) can be used with the substitution of yaw angle ψ v with steering angle δ f to get the valuesẋ W f andẏ W f .

Steering Actuation
The vehicle model uses a simple first-order transfer function to consider the steering actuator. The steering dynamics are given bẏ where δ sw is the steering wheel angle input, k s is the steering ratio, and T s is the settling time of the steering mechanism. The trajectory tracking behavior of the vehicle is much more realistic, even with this very simple actuation model, than with the direct application of steering angles calculated by the tracking controllers.

Closed Loop Control
In order to follow a selected reference trajectory, we need tracking controllers to drive the presented vehicle model with control inputs-driving and braking torques and steering wheel angle. Longitudinal speed tracking control is performed by a state feedback LQR (Linear Quadratic Regulator) controller according to where K v 1 and K v 2 are gain values and z v is the integral of velocity tracking error. The longitudinal controller computes a signed torque value which is then transformed to the non-negative driving inputs as Path tracking is realized by a Stanley controller. This is a nonlinear feedback control that ensures asymptotic tracking of the reference path. According to the control law, the wheel level steering angle of the front axle is calculated as where e ψ is the yaw angle offset between the path and the vehicle, e lat is the lateral distance of the front axle center-point from the path, and K st is a tunable gain parameter [33]. The reference point for tracking error calculation is the closest point of the path curve to the center of the front axle.

Simulation of Model
The motion of the presented dynamic nonlinear single-track vehicle model must be calculated numerically by an Ordinary Differential Equation (ODE) solver with an appropriate time resolution. As a solver, we recommend second (Heun) or fourth-order (RK4) explicit Rungke-Kutta methods as they provide stable and fast computations. For reproducibility and convenient manageability of simulation output, a fixed step-size is used. Due to the wheels' relatively fast and complex dynamics (especially in drive-off or brake-still scenarios), a relatively small step size ∆t v around 1 ms is required.

Random Trajectory Planning
Overall, the presented vehicle dynamics model has 15 states and five inputs, which have to be provided to the state equation to calculate state derivatives. With this number of variables, training sample generation by parameter sweeping is impossible. Considering only ten values for each input, the number of samples would reach 1.024 × 10 13 , which is very difficult to handle. Instead of the parameter sweeping, learning data are generated based on simulated scenarios. When defining the driving maneuvers, our goal is to create a wide variety of dynamic situations. Regarding longitudinal dynamics, sections with intensive acceleration and braking and smaller variations around a constant traveling velocity are necessary. Considering lateral dynamics, mild curves, as well as sharp turns, are essential to reach an extensive range of lateral acceleration. Combinations of curves with acceleration and braking are also desirable. Definition of these simulation maneuvers manually would be, on the one hand, a massive effort. On the other hand, it would probably also not provide the required diversity. Thus, a randomized motion planning approach is applied to generate the reference data for vehicle dynamics simulations.

Motion Planning Based on Piecewise Linear Curvature and Travel Velocity Functions
The idea of path planning based on a piecewise linear curvature function comes from the real world, as horizontal geometry (alignment) of public roads in most cases consists of straight segments and circular arcs, connected by clothoid curves for a smooth transition [34]. While straight segments have zero curvature, and circular arcs have a constant curvature, the clothoid's curvature is changing linearly with the arc length. Thus, road geometries in question can be defined by assigning a piecewise linear curvature profile as a function of the arc length along the path. Naturally, continuous derivative profiles could also be used, but their implementation would increase the complexity of the algorithm without giving a real benefit for the current application [35]. To get a driving trajectory, we also have to specify the traveling speed of the vehicle. This can be done simply and sufficiently by defining a piecewise linear speed profile as a function of time. Naturally, the curvature and speed profiles must be connected to provide a feasible trajectory-e.g., we have to slow down before high-curvature (low radius) sections.
Accordingly, the input of the trajectory planner is where σ i p are the arc length, κ i p are the curvature, andẋ i p are the traveling velocity knot points of the curvature and velocity profiles. The meaning of the input parametrization is that at arc length σ i p , the curvature of the path shall be κ i p and the travel velocity shall beẋ i p . Figure 3a (in blue) shows the input of the planning.  The time needed to travel along each path section can be calculated by The travel time at each knot point is then The constant longitudinal acceleration along each path section is given byẍ For any arc length such that σ p ∈ [σ i p , σ i+1 p ] the travel time can be expressed as Based on the time information, travel velocity is calculated aṡ By obtaining curvature with a simple interpolation yaw rate and centripetal acceleration arė To be able to evaluate path coordinates, yaw (heading) angle is first calculated as where ψ p,0 initial yaw angle is assumed for every trajectory. Then, longitudinal path coordinates can be calculated as and lateral path coordinates are evaluated as with the assumptions of x p,0 = 0 and y p,0 = 0. In practice Equations (40)-(42) are first calculated for each input knot points. Then, the total arc length domain is split with equidistant steps as where σ p,s (0.1 m) is a suitable step size and N j p = σ N i p p σ p,s . Equations (43)-(50) are then numerically calculated for the resulting arc length series. The output of the planner accordingly is and contains a series of path coordinates as well as yaw angle and yaw rate values along the trajectory that can be used as reference for vehicle dynamics control. The outputs of the trajectory planner can be seen on Figure 3b.

Random Planning
It is evident that we cannot just specify any input to the trajectory planner described in Section 3.1 to get a feasible trajectory. The calculations in the planner are solely geometric and are assuming that the traveling object is precisely following the given path and velocity. This means that the random trajectory planning must be constrained to provide a feasible reference to the vehicle simulation. The number of road sections N r (500) is chosen in advance (this means that number of profile knot points N i p will be 501). The planning is carried out as follows.

1.
The knot pointsẋ i p of the traveling velocity profile are chosen randomly between allowed lowerẋ p,min (10 m/s) and upperẋ p,max (30 m/s) limits.

2.
Minimal allowed radii are calculated for each section based on maximal allowed lateral accelerationÿ p,max (5 m/s 2 ). 3.
Radii r i p of each section are chosen randomly in such a way that the values are between r i p,min and m r min r i p,min . The factor m r min (10) is a planning parameter.

4.
Lengths ∆σ i p of each section are chosen randomly in such a way that the values are between p c min 2πr i p and p c max 2πr i p . The factors p c min (0.1) and p c max (0.2) are planning parameters.

5.
Curvature values κ i p = 1 r i p are calculated, and half of them are inverted to provide left and right turns with equal probability. 6.
A p s (0.35) proportion of the curvature values κ i p is nulled out to provide straight segments in a way that neighboring straight segments are not allowed. 7.
Transitions are calculated between each of the previous sections in such way that the proportion of their lengths to the segments lengths p t (0.4) is given. 8.
Arc length knot points σ i p are calculated by a cumulative sum of segment lengths ∆σ i p . 9.
The curvature and travel velocity profile calculated in 1-8 is then provided to the planner described in Section 3.1 to get the random reference trajectory.
Example trajectories designed with the algorithm detailed in this section are shown in Figure 4.

Neural Network Based Vehicle Model
In this section, the developed neural-network-based vehicle model will be presented in detail. Our main goal with the presented algorithm is to provide quick neural-networkbased vehicle simulations of maximally about 10 s, which can be obtained faster than the original dynamic model's solution to use them in the online optimization loop of motion planner algorithms. First, the input-output structure, as well as the method of learning sample generation, is explained. Then, the architecture of used neural networks as well as the training process is shown. Last, the algorithm for vehicle motion simulation based on the trained neural networks is presented. For the modeling and training of artificial neural networks, we use the Python programming language and its packages tensorflow, keras and scikit-learn. The training is performed on a desktop computer with an Intel ® Core™ i5-7600 CPU, 32 GB of RAM, 500 GB of NVME SSD storage, and an NVIDIA ® GeForce GTX 1050 Ti GPU.

Input-Output Concept
The first important aspect of artificial-neural-network-based vehicle modeling is the input-output structure of the model. On the one hand, the artificial neural network could be used to estimate the equations of motion of the vehicle Equations (1)-(3), (14)- (16). With this approach, the output of the neural network consists of the same translational and angular accelerations that the original dynamic equations provide and thus must still be integrated the same way with an ODE solver and 1ms time step. As explored in earlier stages of the research, this approach has two significant disadvantages. As described in Section 1.2, the main goal of the neural-network-based model would be to decrease runtime of motion predictions. Firstly, the computation time of recalling the neural network should be less than the computation time of the original state equation, which strongly restricts the number of neurons usable in the network. Secondly, the estimation errors of the neural network are amplified by the ODE solver, causing the solution to diverge quickly. Due to the mentioned drawbacks, this approach is not presented in the paper.
On the other hand, direct estimation of the solution of the equations of motion of the vehicle is also possible. The aim here is to predict the vehicle's state at time t + ∆t nv based on its state and input at time t, namely, to provide the solution of the ODEs for a time span of multiple 1 ms steps. Four different input-output variants were examined for this concept in the research, which are noted with V0, V1, V2, and V3, respectively. The input vector of the neural network consists of the inputs and a subset of state variables of the dynamic model at a given time t and is represented as The only difference in the input vectors of different variants is that yaw angle ψ v (t) is additionally provided for the V2-3 networks. The output vector of the neural network consists of the changes of a subset of vehicle state variables as time reaches t + ∆t nv , calculated as for a general state variable ξ, and is represented as The difference in the output vectors of different variants is that networks V1-3 directly estimate the heading angle difference ∆ψ v , and network V4 directly estimatwa the changes in position ∆x G v and ∆y G v as well.

Learning Sample Generation
As the first step of the learning sample generation, random reference trajectories are generated by the motion planner described in Section 3. For current work, an equivalent amount of 10 h (∼680 km) driving was generated for training and another 4 h (∼270 km) for testing purposes, which means a 70-30% train-test split, approximately. Then, vehicle simulation was performed with the model described in Section 2 with a sample time of ∆t v =1 ms. In order to provide the same amount of left and right turns to the learning process, data augmentation was used by mirroring (inverting the lateral motion components of) the simulated trajectories. Accordingly, an equivalent of 28 h of driving data were generated in total.
For the next step, the prediction time ∆t nv of the neural-network-based model has to be decided. On the one hand, the bigger this value is, the faster the motion prediction with the network will be. On the other hand, as the model is intended to be used in a motion planner algorithm, a certain resolution is necessary for reliable collision avoidance calculations. From the feasible set of prediction time values of 5, 10, 20, and 50 ms, ∆t nv =10 ms was chosen as it provides a sufficient trade-off between run-time and resolution. The complete matrices of training input and output samples are then where N tr v is the total number of training vehicle simulation samples. Testing input I tt nv and output O tt nv samples are generated in the same way from the corresponding vehicle simulation samples. Maximum absolute values are calculated for each input and output variables separately for scaling as commonly for training and testing samples. Both the input and output samples are then scaled in each variable (along each column) with these scales so that they only contain values in range of [−1, 1]. From the 28 h of driving data, approximately 70 million training samples as well as 28 million test samples were generated.
Since vehicle simulations are written in C++ for better performance and data preparation is mainly done in MATLAB, learning data must be written into files to be able to use them in Python for the training. Due to a large number of learning data (more than 16 GB), samples do not all fit into computer memory at once. For efficiency, learning input and output matrices I tr nv and I tt nv as well as O tr nv and O tt nv are written into multiple binary files in a column major order with one binary buffer containing 1024 batches of 8196 samples. The scaling vectors c X nv and c Y nv are also written to column major binary files for uniform data handling. Training metadata (number of inputs, outputs, samples, batch size, buffer size, variable names) are written to a JSON (JavaScript Object Notation) file for convenience.
To efficiently provide the learning data from the binary buffers, an own generator algorithm is necessary, which reads in the files only once per training epoch in a subsequent order. To achieve this, shuffling of learning data must be switched off in keras' Model.fit method so that the training algorithm asks for the samples in increasing order. By knowing the number of samples per binary file from the metadata, it is easy to decide if a new file must be loaded. The generator algorithm also takes care of the shuffling of samples per buffer file by creating random indices for samples.

Neural Network Architecture
The estimation of vehicle simulation output is a regression task. For this, fully connected feed-forward deep neural networks are used with three or four intermediate layers and 256 neurons in total. Trying networks with a total neuron count of 96, 128, and 384 shows that with fewer neurons, the fitting results are much worse, and with more neurons, the slight improvement in performance is not worth the increased computational effort. For each I/O variant V1-4, four different networks are trained with layouts shown in Table 1. As an activation function, ReLU (Rectified Linear Unit) is applied for each layer except for the output layer using linear activation. Experimenting with other activation functions such as sigmoid, hyperbolic tangent, or SELU (Scaled Exponential Linear Unit) shows worse performance without exception.

Training Process
To compute the loss during the training, a custom weighted mean squared error function is used as where n Y nv is the number of elements of the output vector, w i L nv are custom weighting factors for each output variable, and prediction of neural network is denoted withŶ nn . The rationale behind using this weighted loss instead of the standard mean squared error loss is that the precision of velocity and position predictions is more important than, for instance, the slip variables.
The Adam optimizer waschosen, which is a stochastic gradient descent method that is based on adaptive estimation of first-order and second-order moments. Adam optimizer is generally recommended as "computationally efficient, has little memory requirement, invariant to diagonal rescaling of gradients, and is well suited for problems that are large in terms of data/parameters" [36]. Learning rate multipliers 0.1, 0.3, 0.5, and 1 are applied to the default value of learning rate 0.001 to search for optimal training results.
Learning progress of the neural networks reaching the smallest final loss is shown in Figure 5. On the left side, the best results are shown for each topology in Table 1. On the right side, the results for the best network overall are shown. The number of training epochs is chosen as 100 for a balance between training time and performance. Batch size is selected for 8196 samples. The training time of a network with a single set of parameters is approximately 1 h due to the learning samples not fitting into memory at once. With the selected number of training epochs, no overfitting is visible. An increased number of 140 training epochs shows no real performance improvement.

Motion Prediction in Feedback Loop
As explained in Section 4.1, at a certain time t, the neural network is capable of predicting the changes in vehicle state variables and thus the new state of the vehicle at a ∆t nv = 10 ms later time. This is a nice result, but the final aim of the research is to predict several seconds of vehicle motion as stated in Section 1.2. To enable this, an iterative calculation is necessary, where the neural network acts in a feedback loop. In this loop, the estimation of the new state at t + ∆t nv is fed back to the input of the neural network to predict the new state at t + 2∆t nv , and this goes on for the whole period of the simulation. Depending on the I/O variant, it may also be necessary to compute the yaw angle ψ nv (for V0) as well as the position coordinates x G nv and y G nv (for V0-2) with numerical integration, as they are not estimated directly by the neural network. State derivatives of the original dynamic model also need to be calculated numerically for all network variants. Initially, total simulation time t nv is split into equidistant steps of ∆t nv , denoting the resulting time series as t j nv with j = 0 . . . t nv ∆t nv . The initial value of input vector X nv (t 0 nv ) is assembled from initial values of vehicle inputs and states. Then, simulation happens in the following loop:

1.
Input vector X nv (t j nv ) is applied to the neural network to compute output Y nv (t j nv ). In practice, input and output vectors must be scaled with the scaling vectors in Equations (59) and (60), but this is not reflected to in the equations for the sake of simplicity.

2.
Vehicle state variables for which estimations ∆ξ(t j nv ) are available in the neural network output Y nv (t j nv ) are calculated by for general state ξ.

3.
For variant V0, yaw angle is calculated by numerical integration as

4.
For variants V0-2, position coordinates are calculated by numerical integration as where velocitiesẋ G nv andẏ G nv are calculated fromẋ V nv andẏ V nv by a rotation with −ψ nv . 5.
Vehicle state derivative variables for which estimations ∆ξ(t j nv ) are available in the neural network output Y nv (t j nv ) are estimated directly with differenceṡ for general state ξ.

6.
Inertial accelerations in momentaneous vehicle frame are evaluated as to take the rotating frame of reference into account. 7.
Input vector of next step, X nv (t j+1 nv ) is assembled from vehicle inputs and results of Equation (62). 8.
Steps 1-7 are repeated until simulation is finished.
Accordingly, our neural-network-based vehicle model consists of the network itself, which can predict the state of the vehicle for 10 ms, and the feedback loop algorithm described above, which uses the network to provide simulation results for several seconds. The presented approach can provide all the outputs that are available when using the original dynamical model. It is important to mention that the results coming from the presented simulation loop differ from the output of the original dynamic model even when assuming that the neural network is providing a perfect regression fit. The reason for this difference is, on the one hand, that state variables in Equations (63)-(65) are calculated with the forward Euler method (compared to the more sophisticated ODE solution of the dynamic model) and also on a sub-sampled dataset. On the other hand, state-derivative variables in Equation (66) are estimated with numeric differences (instead of the dynamic equations) and on a sub-sampled dataset as well.

Simulation Results
This section presents the simulation results of the neural-network-based vehicle model described in Section 4. The evaluations and comparisons in this chapter were mainly made in MATLAB, which can utilize the trained neural networks from keras. First, an example of the regression fit of the standalone neural network is presented and analyzed. Then, a closed-loop vehicle motion simulation example is shown to give a picture of the performance of the proposed algorithm in terms of output signals. Finally, the performance of different variants is evaluated. Figure 6 shows the regression results of the trained neural network for a sequence of testing samples that are coming directly from the dynamic vehicle simulation without shuffling. The number of 10,000 samples is the equivalent of 10 s dynamic simulation with a sample rate of 1 ms. As the output of the neural network consists of the changes in states ∆ξ(t), these values are proportional to the derivative values of the corresponding statesξ(t).

Regression Fit
Please note that all outputs are normalized to the range of [−1, 1]. Accordingly, the selected sequence of samples contains a scenario with considerable acceleration and braking as well as moderate steering and has an intermediate complexity from a dynamics point of view. The estimation of the neural network fits well to the output samples. The estimation error is, in all cases, more than one order of magnitude smaller than the estimated signal itself. Overall variables are shown, the maximal estimation error is 0.0727, and the mean estimation error is 0.0196.  Table 2 shows the typical values of estimation errors for a trained neural network for the most important output variables. The notation E MAX stands for maximal absolute error, while MAE (Mean Absolute Error) is used conventionally. We can see the biggest estimation errors in the case of changes in wheel speeds and longitudinal slip values. This behavior is logical, since the piecewise linear travel velocity profile that is used for the input sample generation results in a square-shaped longitudinal acceleration (and wheel angular acceleration) signal with jumps (this can be seen in Figure 6 as well). Learning these jumps is complicated for the neural network. While E MAX values are very high for these variables, they are only reached for a minimal number of samples. As MAE values show, average estimation error remains very small even in these cases. In comparison, changes in lateral slip values are much slower since the clothoid transition segments between the circular arcs and straight sections enable lateral tire forces (and wheel slips) to build up gradually. Accordingly, corresponding E MAX values are much slower. In general, we can say that while the regression provided by the neural network is not perfect, it is sufficient to be used for short-term vehicle simulations presented in Section 5.2. Table 2. Regression fit error statistic of a typical trained neural network.  The selected scenario is a 10 s long part of the test dataset and has an average dynamical complexity with longitudinal acceleration reaching −4 m/s 2 and lateral acceleration exceeding 2 m/s 2 . The output of the neural network based model is able to nicely reproduce the output of the original dynamic model. The maximum error of position estimation is below 60 cm, and the maximal yaw (heading) angle estimation error remains under 2 • . Prediction error of longitudinal velocity does not exceed 0.03 m/s, while yaw rate prediction error is below 0.6 • /s. Inertial accelerations are also calculated with a maximal error of 0.2 m/s 2 . The biggest error can be observed in the case of lateral velocity, where the neural-network-based solution occasionally has a large offset of 0.05 m/s. However, the importance of this state variable from the motion planning point of view is not as high as that of the other ones listed above. The results show that with the application of appropriate safety boundaries applied to the position of the vehicle, the output of the neural-network-based model can be used for motion prediction in the online optimization loop of trajectory planner algorithms.

Evaluation of Input-Output Concept
It is also important to investigate the estimation errors for the whole test dataset to get a complete picture of the proposed method's performance. To find the best choice of variants V0-3, a comparison of these is also necessary. Figure 8 shows the E MAX (maximal absolute error) values calculated for the whole test dataset and all vehicle simulation output quantities in case of the different variants V0-3 considering a 3 s long simulation time. Figure 9 shows the same information considering 10 s long simulations. The values labeled with ODE represent the estimation error that is present even if we assume perfect neural network performance. For these data, the worst case, considering the V0 variant with the maximal number of variables obtained by numerical integration, is selected. Please note that a logarithmic scale is used for the axis of error values.
As expected, the magnitude of overall estimation error is growing with the simulation time. On one hand, the value of state variables that are available in the neural network output is calculated by a cumulative sum according to Equation (62). In this way, the estimation error of these values accumulates with the number of steps in the estimation loop. As this cumulative sum of previous network outputs is also used to calculate the input of the network, the error spreads further.  On the other hand, the error of numerical integration for state variables that are not part of the neural network output also increases with the number of integration steps. For the state derivative quantities, the estimation errors' speed of growth with simulation length is much less, as these are calculated directly from the neural network output.
From comparing the different variants, it is interesting to observe that direct position estimation with the V3 network massively underperforms the other variants with the numerically integrated position in the case of 3 s simulation time. Still, this performance gap disappears in the case of 10 s simulation, as the integration error grows faster. Besides this finding, there is no elementary difference between the performance of different variants. On average, variant V2 performs the best with direct yaw angle estimation and numerical position integration. The maximal position error remains under 1.5 m, and the maximal yaw angle error does not exceed 4 • for the complete test dataset. These results are not much worse than the guaranteed performance of fused GNSS (Global Navigation Satellite System), and INS (Inertial Navigation System) localization solutions for global positioning [37]. Naturally, the most significant deviations can be observed in the case of the scenarios that are the most dynamically demanding with the largest longitudinal and lateral accelerations. This meets expectations, since the behavior of the vehicle becomes strongly nonlinear while moving closer to the adhesion limits of the tire-road contact. This nonlinear behavior is then harder to estimate, also because the very high acceleration events are rare compared to the average situations in the simulated realistic driving scenarios. With appropriate safety margins on the position results, the neural-network-based model can be used for simulations of approximately 10 s. For feasibility supervision, the original dynamic model can be used at any time.
Another important aspect of our evaluation is runtime, since the main goal with the presented dynamic-model-based training is to provide faster simulations with the neural-network-based model than with the original one. Figure 10 shows the runtime of the dynamic model and the different neural-network-based variants as to how many times faster they are evaluated than real-time (a ratio of simulated time and runtime). Due to the same total neuron count, almost all variants have the same runtime. Small differences can be observed due to the different number of state variables that have to be calculated by numerical integration. The dynamic model provides better performance with longer simulations because the initialization overhead remains the same in all cases. With short simulation times, the neural network based model is more than two times faster than the original one. Still, the advantage is clearly visible for the total domain of intended usage.

Discussion
It is important to discuss the limitations and possible issues of the proposed model. The main use case for the presented method is short-term vehicle motion simulation, particularly for the application in optimization-based motion planning algorithms. Accordingly, the proposed model cannot provide accurate results for simulations longer than approximately 10 s, as the regression error of the neural network is propagated inside the simulation loop.
The learning dataset comes from vehicle dynamics simulations with a planar single track model, which we would like to replace with the neural network based model. This dynamic model provides plausible results in the overwhelming majority of driving scenarios that happen on public roads. However, it also has some important limitations. Vertical dynamic effects such as road unevenness or load transitions due to road slope are not considered. Furthermore, scenarios where the friction conditions are important at all four wheels, such as when the left and right side of the vehicle meets with different road surface, cannot be simulated. The neural-network-based model will accordingly inherit the same limitations.
The driving maneuvers that were used to generate learning data also restrict the capabilities of the trained neural network. Because of this, a great emphasis is put on the definition of realistic random scenarios, which involve calm constant velocity parts and dynamically demanding high acceleration sections as well. However, the training maneuvers do not include parts where the vehicle is sliding or drifting or where the wheels are spinning or locking completely. This means that the neural-network-based model also cannot be expected to provide sufficient precision in such scenarios. The number of learning data is selected in a sense that the length of the resulting training process is feasible for experimenting. To increase the robustness of the proposed model, a final training with even more learning data could be performed as well in the future.

Conclusions and Future Work
This paper presents a novel method for short-term (≤10 s) vehicle motion simulation with an artificial neural-network-based approach. Firstly, learning samples are generated based on a classical nonlinear vehicle model for a dynamically diverse set of driving maneuvers. Reference data of these driving maneuvers are created by a numerical motion planning algorithm based on the assignment of piecewise linear travel velocity and curvature profiles similar to public road designs. The input of the trajectory planner is computed randomly to ensure that the resulting motions are realistic and contain demanding high-acceleration cases. Supervised learning techniques are then used to train the fully connected deep neural network to estimate a future state of the vehicle on the basis of its current state and driver inputs. The state variables that are not present in the output of the neural network are subsequently calculated by numerical integration. This algorithm is later used in a feedback loop to simulate the motion of the vehicle over time, where the output of the network is used to calculate its input for the next time step. For short-term simulations, the resulting neural-network based vehicle simulation algorithm is capable of fully replacing the classical dynamic model while being considerably faster. This speed gain can be especially useful in the online optimization loop of dynamically feasible optimal motion planner algorithms, where the required duration of simulations is typically inside the range where the new approach delivers plausible results. In this application, supervision of the neural-network-based results is possible by a one-time execution of the dynamic model.
The proposed algorithms are naturally not perfect. Investigation of the usage of different neural network architectures like cascade neural networks or recurrent neural networks like LSTM (Long Short-Term Memory) to estimate future vehicle state(s) to reach better regression performance would enable longer simulation times; this is a natural extension of the presented work. Another interesting future direction could be the application of transfer learning to adapt the presented model to changing vehicle parameters and friction conditions. As a next step towards a measurement-based training, sensor noises and errors could also be added to the perfect simulation data to examine their effect on the performance of the model. Training the neural networks based on real vehicle measurements afterwards is also an exciting opportunity to provide even more realistic simulations.

Data Availability Statement:
The data and source is available at the authors.

Conflicts of Interest:
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Abbreviations
The following abbreviations and notations are used in this manuscript: Run time as factor to real-time speed