{'fraction_non_alphanumeric': 0.023608133261079564, 'fraction_numerical': 0.007563084607591358, 'mean_word_length': 4.839845899834892, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Post-Impact Motion Planning and Tracking Control for Autonomous Vehicles

There is an increasing awareness of the need to reduce traffic accidents and fatality due to vehicle collision. Postimpact hazards can be more serious as the driver may fail to maintain effective control after collisions. To avoid subsequent crash events and to stabilize the vehicle, this paper proposes a post-impact motion planning and stability control method for autonomous vehicles. An enabling motion planning method is proposed for post-impact situations by combining the polynomial curve and artificial potential field while considering obstacle avoidance. A hierarchical controller that consists of an upper and a lower controller is then developed to track the planned motion. In the upper controller, a time-varying linear quadratic regulator is presented to calculate the desired generalized forces. In the lower controller, a nonlinear-optimization-based torque allocation algorithm is proposed to optimally coordinate the actuators to realize the desired generalized forces. The proposed scheme is verified under comprehensive driving scenarios through hardware-in-loop tests.


Introduction
Vehicle collision is a major cause that can lead to more severe spinning and drifting and even out of control of vehicle [1]. Vehicle dynamics control after a collision is of great importance to enhance vehicle dynamics safety and reduce casualties [2,3]. Statistics from the National Highway Traffic Safety Administration (NHTSA) showed that 6.45 million vehicle crashes were reported in 2017 in the United States, resulting in 34560 fatalities [4]. Similarly, there were 247646 traffic accidents in 2019 in China, resulting in 62763 fatalities and 256101 injuries [5]. In particular, multi-impact crashes account for more than 30% of all the fatal accidents [6]. Due to the panic after an initial vehicle impact, the driver may fail to make appropriate response within a limited timeline [7]. A secondary impact may happen and bring about more serious consequence to the vehicle and its occupants. Thus, it is essential to effectually address vehicle stability control after an initial impact. A vehicle collision model is first needed to analyze the impact process and to evaluate the impact impulse. Two types of collision modelling methods have been developed in the literature, including the structural analysis and the momentum conservation method. The structural analysis method usually constructs a numerical model in a finite element analysis software such as LS-DYNA [8] and PAM-CRASH [9]. To improve modelling accuracy, Calspan Corporation developed a dedicated program for NHTSA [10]. The structural analysis method can provide deeper insights into the collision process; however, it relies heavily on large sets of component and materials property configurations. In contrast, the momentum conservation method puts more emphasis on vehicle kinematic state change due to vehicle collisions, which makes it easier to implement. On this regard, Brach et al. treated vehicle as a rigid body with three degrees of freedom and defined the recovery and the friction coefficient [11]. Zhou et al. further took vehicle roll motion and tire forces into consideration and verified its superiority [12].

Open Access
Chinese Journal of Mechanical Engineering *Correspondence: lei_zhang@bit.edu.cn These studies cast new light on impact impulse magnitude calculation and motion prediction under different driving conditions and lay the foundation for designing collision mitigation controllers [13]. Early efforts towards secondary collision damage reduction has been directed to improving occupants protection using passive safety systems such as air bag [14] and safety belt [15]. In order to restore vehicle stability after an initial impact, researchers also resorted to active safety systems, and these can be divided into single actuator control and multiple actuators coordination control.
Single actuator control can further be classified into post-impact braking control (PIBC) and post-impact steering control (PISC). PIBC can reduce the harm of secondary collisions through dissipating vehicle kinetic energy. For instance, a PIBC modified from autonomous emergency braking is proved to be effective in 21% of post-impact cases [16], while BOSCH Co. Ltd. coordinated the airbag and electronic stability program (ESP) to achieve secondary collision mitigation [17]. Furthermore, Shotaro et al. [18] established an adaptive braking intensity control strategy for PIBC and improved its adaptiveness to different scenarios. Different from PIBC, PISC can improve post-impact stability in a more direct manner by adjusting lateral tire forces. Chan et al. developed a look-ahead controller for front steering angle adjustment to narrow lateral deviation [19]. Similarly, Cao et al. utilized model predictive control (MPC) to construct a PISC scheme [20]. Both PIBC and PISC controllers are proved to be effective in light collision cases. However, the efficacy may be largely compromised under severe drifting and large side slip angle after high-intensity impacts [21].
Multiple actuators coordination control has been proposed to better regulate vehicle motion after initial collisions. Benefiting from more control freedoms, better control performance can be achieved. According to different control objectives, the existing coordination control can be divided into system stability control and trajectory optimization. System stability control focuses on simultaneously regulating undesired postimpact motions including drifting, over-spinning and rollover. For example, Zhou et al. presented a sliding mode controller and an optimal allocator to coordinate the front steering and the differential braking to regulate sideslip angle and yaw rate [22]. Another MPC controller is also developed to mitigate the rollover risk [23]. Although the undesired motions were suppressed, the trajectory safety during stabilization control is not explicitly addressed. Trajectory optimization has also been studied to navigate second collision hazards. For instance, a trajectory optimization scheme was developed to minimize the maximum lateral path deviation using differential braking based on a quasi-linear optimal controller [24]. Furthermore, Kim et al. combined the desired final yaw angle with the lateral path deviation minimization based on linear time-varying MPC to avoid secondary collisions [25]. To avoid complex modeling, Yin et al. trained a multi-layer perception as a deterministic control policy to achieve self-learning drifting motion control for post-impact automated vehicles [26].
Previous studies have described various methods for post-impact stability control. However, challenges still remain in motion planning and stability control while achieving obstacle avoidance to prevent secondary collisions. In this study, a post-impact motion planning method combining the polynomial curve and artificial potential field (APF) is developed to restore vehicle stability when the vehicle falls into over-spinning and drifting. Different from traditional polynomial curve methods, three polynomial curves are respectively adopted to represent the longitudinal, lateral and yaw movements in the ground coordinate system. As such, the vehicle motion can be fully described without nonholonomic constraints. In addition, a time-varying linear quadratic regulator (TVLQR) is proposed to calculate the desired generalized forces based on the error dynamics model. By making full use of the instinct multi-objective optimization associated with LQR, the planned multi-dimensional motions can be simultaneously tracked. Furthermore, a nonlinear-optimization allocation (NOA) algorithm is designed to realize the desired generalized forces when tire forces are saturated. The schematic of the proposed scheme is illustrated as shown in Figure 1.
The remainder of this paper is organized as follows: Section 2 introduces the motion planning method by combining the polynomial curve and post-impact APF. Section 3 elaborates on the TVLQR controller to track the planned motion. Section 4 introduces the NOA algorithm to realize the desired generalized force/ moment. Section 5 offers verification based on comprehensive hardware-in-loop (HIL) tests, followed by the key conclusions summarized in Section 6.

Post-impact Motion Planning By Combining the Polynomial Curve and APF
Previous vehicle path and trajectory planning schemes focus on the topology and the velocity planning [27]. These are achieved by assuming that the vehicle is driving stably without severe sideslip or over-spinning. Thus, the desired vehicle yaw motion can be determined by the velocity and the route curvature through nonholonomic constraints formulation [28]. However, the vehicle may tend to become unstable with significant drifting and over-spinning due to large collision impulse, and the stable driving assumption becomes invalid. This study aims to provide a motion planning method to simultaneously regulate the vehicle trajectory and yaw motion. Traditional planning methods mainly include the A* heuristic search, visibility graph method, generalized Voronoi diagram and artificial potential field, etc [29,30]. Considering the continuity and smoothness of vehicle motion under extreme conditions, the combination of the quintic polynomial and artificial potential field is utilized to solve the motion optimization problem. In order to fully depict vehicle motions, multiple coordinate systems are established as shown in Figure 2. The inertial ground coordinate system X-Y, the chassis coordinate system x-y and the tire coordinate system are appropriately defined. The X-axis is parallel to the road with the x-axis pointing to the vehicle-forward direction. Three different coordinate systems are associated through the yaw angle ψ and the front steering angle δ. It should be noted that the single-track vehicle dynamics model is utilized during motion planning, as the desired tire lateral forces can be directly deduced from parameterized vehicle motion through the single-track model, so that the dynamics constraints can be easily imposed on the polynomial curve.
The motion to be planned after impacts can be described with the coordinate in the inertial ground coordinate system (X, Y) and the yaw angle ψ, which are represented by a group of polynomial functions of the planning time τ as indicated in Eq. (1). It is worth noted that both the cubic and quartic curves can satisfy the smoothness requirement, but their corresponding thirdderivative functions are constant and linear, respectively. It means that the inherent implicit boundary constrains would be applied to the corresponding jerks that are equivalent to control output gradients. To balance the planning freedom and problem formulation complexity, the quintic curve is adopted as a compromise. By taking the first and the second derivative of the quintic polynomial curves with respect to τ, the velocity ( Ẋ ,Ẏ ,ψ ) and the acceleration state ( Ẍ ,Ÿ ,ψ ) can be obtained in the planned time interval as where τ 0 is the starting time of motion planning, and k is the order of the corresponding items in the quintic curves varying from 0 to 5. Then, the problem can be transformed to derive the quintic polynomial curve parameters a k , b k and c k . With known vehicle states, the parameters a 0 , b 0 , c 0 , a 1 , b 1 and c 1 can be directly obtained according to initial vehicle states while the motion planning begins with [31,32] There are twelve parameters to be determined, which are capsulated in a vector p as Then the optimal solution is pursued to design the motion for obstacle avoidance and stability restoration considering vehicle dynamics constraints.
The obstacle locations can be obtained via environmental perception [33,34]. In order to describe the safety of the post-impact obstacle avoidance trajectory, the artificial potential field method is utilized to  construct the objective function. For describing the impact of the obstacles ahead with the coordinate (X b , Y b ), the exponential potential function is employed with a safety radius D r given as Based on the exponential function characteristics, it can be deduced that the punishment effect would be amplified exponentially once the relative distance is smaller than D r so as to force the vehicle away from the obstacles. Thus, the determination of D r should cover both the vehicle and obstacle contours and the safety margin. The exponential potential function for the road boundaries is defined as U 2 , in which D s , Y max and Y min are the safety distance and the upper and lower road boundaries, respectively. Similarly, the choice of D s should cover the vehicle contour and the safety margin.
A 3-D map of the potential field that displays the threats around the vehicle at a particular instant is illustrated in Figure 3. The final field function for a specified trajectory U is set to maximize the weighted sum of U 1 and U 2 within the planning time interval as shown in Eq. (6), where τ f and k 1 and k 2 are the ending time and the weighting factors, respectively. Since the collisions with obstacles or road boundaries should be treated equally, k 1 and k 2 are set to be the same. It should be noted that it is expected to punish the most dangerous position of a trajectory. Thus, the maximum of the combined function within the planning time interval [τ 0 , τ f ] is adopted as the final field function given as Considering that the vehicle may endure over-spinning and drifting after light impacts and that one primary goal is to restore vehicle stability, another objective function V for the approaching stability is designed based on the average vehicle sideslip angle. The vehicle sideslip angle is calculated as the difference between the heading angle and the yaw angle in the ground coordinate system. The objective function V can be given by The final objective function S is composed of the final field function U and the stability approaching function V through the weighting factors k 3 and k 4 , which is given by There is no uniform rule for choosing k 3 and k 4 , which need to be calibrated through massive tests. Based on our calibration experience, it is recommended to keep them approximately the same.
Some linear and nonlinear constraints need to be given to rationalize the optimization problem. The linear constraints are constructed according to the requirements on the terminal vehicle states. It would be ideal that the final lateral velocity Ẏ (τ f ) and yaw rate ψ (τ f ) can drop to zero. Also, the lateral displacement Y (τ f ) and yaw angle ψ(τ f ) of the vehicle should satisfy the road conditions. After substituting the parameters in Eq. (2), the known terminal states above and the ending time τ f into Eq. (1), Eq. (9) can be derived. The polynomial equation of the left side can be seen as a linear combination of the optimization variables given in Eq. (3). The items in the right side are all known. Thus, Eq. (9) constitutes the linear constraints on the motion planning problem, which is given by The nonlinear constraint is constructed according to vehicle dynamics. First, the maximum acceleration is confined by road adhesion. The resultant acceleration a(τ) at the planning time τ for a specified trajectory can be calculated by where Ẍ (τ ) andŸ (τ ) are the longitudinal and lateral accelerations in the ground coordinate system determined by the polynomial curves. Then, the maximum acceleration can be given by where μ and g are the road friction coefficient and the gravitational acceleration, respectively.
The vehicle dynamics restrictions on the coordination of the vehicle lateral force and yaw moment are also considered. According to the D' Alembert principle, every acceleration movement can be equivalent to a D' Alembert inertia force or moment. Thus, the vehicle dynamics problem can be reformulated into a pseudostatic one. The D' Alembert lateral force F ′ y (τ ) and yaw moment M ′ z (τ ) determined by the polynomial at time step τ can be given as where m and I z are the vehicle mass and yaw moment of inertia. The static moment equilibrium about the front tire can be calculated as where L f and L r are the distances from the center of gravity (CG) to the front and the rear axle, respectively; F yr (τ) is the lateral force at the rear tires required by a specified trajectory. It can be regrouped as The absolute value of F yr should be well below the rearaxis adhesion limitation, and then the second nonlinear constraint is constructed as The optimization-based motion planning can be summarized into finding the polynomial parameter p with the lowest value of the combined index S, while satisfying the linear and the nonlinear constraints, which is given by It should be noted that a numerical solution instead of the analytical solution is computed. The optimization problem is solved using the fmincon toolbox in MAT-LAB. Once the parameters p is derived, the motion planning is completed.

Motion Tracking Control Based on the TVLQR
The reference coordinates (X d , Y d ) and the yaw angle ψ d at time step t can be obtained by calculating the polynomial values. In order to achieve the desired motions and positions derived from Section 2 against unknown disturbances, a motion tracking controller is designed based on the TVLQR approach.
High-order continuity and differentiability are achieved by using the quintic polynomial curves in motion planning. Thus, the desired motion ( Ẋ d , Ẏ d , ψ d ) and acceleration ( Ẍ d , Ÿ d , ψ d ) in the ground coordinate system at time step t can be attained by calculating the first and the second derivative, respectively. The desired motion in the vehicle coordinate system including the longitudinal velocity U xd , lateral velocity U yd and yaw rate r d can be given by where T co is the coordinate transformation matrix from the ground to the vehicle coordinate, which is given by Similarly, the open-loop reference control inputs including the longitudinal force F xr , lateral force F yr and yaw moment M r can be reformulated in the same way, which is given by The open-loop control can be deduced in an ideal case, but the actual implementation performance is subject to undesired disturbances such as error accumulation and parameter uncertainties. Thus, a closed-loop correction based on the TVLQR method is introduced.
The vehicle dynamics equations are introduced as where U x , U y and r are the longitudinal velocity, lateral velocity and yaw rate; F xo , F yo and M zo are the objective longitudinal force, lateral force and yaw moment. And the vehicle kinematic equations are given as Obviously, the dynamics and kinematic equations constitute a nonlinear system, which is modified by local linearization. Then, its linear state-space form with the system state vector x and the system input vector u can be given as where A is the Jacobian matrix for local linearization and B is the input matrix, and they are given as (19)  Linear quadratic regulator (LQR) is a kind of closedloop optimal control method for linear systems to achieve quadratic minimization of the objective function [35]. Considering computational efficiency and multiobjective optimization, the LQR controller is adopted to achieve closed-loop motion tracking. The discrete linear model for LQR has been established in Eq. (29). The assumption of full state accessibility makes the application of LQR possible. Time-varying state transition matrix A dk would replace the traditional constant state transition matrix at each time step, thus forming the TVLQR control problem. The quadratic cost function is given by where Q=Q T and R=R T are the positive definite weighting coefficient matrices that are used to penalize the states error and control input correction, respectively. Then, the control correction Δu k to minimize the cost function is given by where K k is the gain matrix given by where X is the solution to the Riccati equation, which is expressed as Finally, solving the Riccati equation is accomplished with the MATLAB function dare. The solving process is executed at each time step to account for the time-varying system model. After obtaining the control correction, the overall control input can be derived as The derived outcome is used in the allocation algorithm presented in the following section.

Nonlinear-Optimization-Based Allocation Algorithm under Extreme Conditions
The objective resultant forces (F xo , F yo ) and yaw moment M zo are derived in the previous section. It is essential to coordinate multiple chassis actuators including the propulsion, braking and steering actuators to achieve the desired resultant forces and moment. Active safety control systems such as ESP and direct yaw-moment control (DYC) often adopt direct control allocation [36], quadratic programming allocation [37] and daisy chain allocation [38] to achieve coordination control. To simplify the allocation problem, these traditional allocation methods often impose constraints on the longitudinal tire forces to keep the tires working in the linear region to neglect the coupling relationship between the longitudinal and the lateral tire forces [39]. Nevertheless, this limits the control performance and may introduce large deviations especially in extreme conditions where the vehicle may endure severe spinning and/or drifting due to external impacts. In this study, a nonlinear-optimization allocation algorithm that is competent under tire force saturation in extreme conditions is developed.
Different from the single-track dynamics model used in motion planning, a four-wheel vehicle dynamics model is developed to determine each actuator's output as shown in Figure 4. To fully verify the effectiveness of the proposed control scheme, a four-wheelindependent-drive electric vehicle (FWID EV) is used as the research object. It should be noted that the proposed scheme is also suitable for conventional vehicles equipped with ESP by modifying the constrains. In fact, combining 4-wheel-drive (4WD) and ESP can achieve similar effects.
The primary goal of the allocation algorithm is to obtain proper control commands for the steering, propulsion and braking chassis subsystems, which is given by where F xi and F yi are the longitudinal and lateral forces of each tire with the subscript i= (1, 2, 3, 4) representing the front-left, front-right, rear-left and rear-right tires, respectively. According to the force analysis, the resultant forces (F x , F y ) and yaw moment M z produced by the steering angle and tire forces can be calculated as (38)  where D b is the track width. In order to make the resultant forces and yaw moment approach their target values, an objective function V o is set as ε 1 , ε 2 and ε 3 are the weighting coefficients for adjusting tracking priorities among the longitudinal force, lateral force and yaw moment of the vehicle. Considering that obstacle avoidance is feasible only when the violent overspinning motion is suppressed in the early stage to a certain extent, the yaw moment bears more importance and should be given higher priority. Thus, ε 3 is recommended to be slightly larger than the other two.
To ensure that the optimization problem can be solved within a feasible timeline, the constraints are analyzed. The tire forces are strongly associated with the cornering velocities, vertical forces at each tire and road friction coefficient. Assuming that the vehicle velocities (U x , U y ) and yaw rate r can be attained in real-time, the vehicle longitudinal and lateral velocities (v xi , v yi ) at the i-th tire center can be calculated as The sign in Eq. (41) is set to be positive for the right wheels while negative for the left. The sign in Eq. (42) is set to be positive for the front wheels while negative for the rear. Then, the side-slip angle of the i-th tire can be calculated by It should be noted that the roll dynamics of the sprung mass can influence the vertical tire forces. The vehicle roll dynamics and state estimation have been investigated in our previous studies [31], which can provide precise vertical forces. In this study, a simplified quasi-static calculation method is utilized for simplification. The vertical forces at different corners F zi can be approximatively calculated according to the longitudinal acceleration a x and the lateral acceleration a y by (40) where h is the height of CG and L is the wheelbase given by It is difficult to precisely capture the tires forces due to its nonlinear characteristics and the coupling relationship between the longitudinal and the lateral force [40]. In order to simplify the tire force constraints, a combination of the lateral force Magic Formula and the elliptical formula is utilized to represent the nonlinear characteristics and coupling relationship in this study.
The lateral Magic Formula under pure sideslip conditions can be expressed as where B y , C y , D y and E y are the stiffness, shape, peak and curvature coefficients, which can be calculated by where b 1 -b 8 in the Magic Formula are identified by fitting the bench test data obtained from CARSIM. The road friction coefficient corresponding to the test data is set to be 1. The fitting is conducted offline through the Curve Fitting Tool in MATLAB and the results are listed in Table 1.
The Magic Formula model only avails for a certain road friction condition. In order to extend its feasibility on various road surfaces, a method called friction similarity is used [41]. It predicts the change in the limit shear force while maintaining the linear behavior for light slip. Given the road friction coefficient μ 0 for tire measurements and the road friction coefficient μ for simulation, the modified lateral force with no longitudinal tire force is given by (44) F ymf = D y sin(C y arctan(B y α − E y (B y α − arctan(B y α)))), Table 1 The offline fitted lateral Magic Formula parameters The lateral force would decline as the longitudinal tire force increases. Instead of adjusting the tire force based on the slip rate and sideslip angle in the traditional Magic Formula, the ellipse formula is utilized to depict the coupling relationship as shown in Eq. (49). The correction coefficient ξ is utilized to adapt to the longitudinal tire force attenuation due to the transition from rolling to sliding while the slip rate is approaching its limit, and it is set to be 0.95. The comparison between the combination tire model and the test data from CARSIM Tire Tester is shown in Fig. 5. Different from the adhesion ellipse formula induced by anisotropy, the ellipse formula used here can depict the working point of tire force under a specified sideslip condition. The error is small when α is 8° and is relatively larger when α is 3°. Considering the extreme conditions after collisions, the tire sideslip is severe in most of the time and the error is within an acceptable range. Also, it should be noted that the lateral force and sideslip angle should always be at the same side, which is given by Also, the magnitude and changing rate boundaries of the front steering wheel angle and each driving/braking torque are formulated into the constraints as where δ min and δ max are the lower and upper boundaries for the steering wheel angle; T wmin and T wmax are the lower and upper torque limits for each wheel; �δ max and T wmax are their respective maximum changing-rates; r w is the effective rolling radius with its variation neglected.
The optimal allocation problem can be summarized into finding the optimum control input x c to minimize the objective function V o while satisfying the tire force and actuator output constraints. It can be expressed as The nonlinear optimization problem is then solved using the fmincon toolbox in MATLAB. In order to improve the computing efficiency, the warm booting technique is utilized, which adopts the solution of the previous time step as the initial value at the current time step. After obtaining the optimal longitudinal tire forces, the single wheel dynamics model is established to calculate the wheel torque T wi by where J w , T fi and ω i are the rotational inertia, rolling resistance and angular velocity of the i-th wheel, respectively. A positive value for T wi represents a drive torque while a negative one corresponds to a brake torque. With the rolling resistance and rotational inertia ignored, the propulsion or braking torque can be calculated as

HIL Test Results and Discussions
The proposed scheme is examined based on the HIL tests against the disturbances of signal delays, computing power limitation and communication errors. The control area network (CAN) is used to connect different subsystems. The HIL test rig mainly includes the Simulink Realtime system, ZLG CAN bus monitor system and ETAS LABCAR system. The Simulink Real-Time is an embedded kernel that helps create real-time applications from Simulink models and serves as the rapid control prototyping (RCP) in this study. After configuring the drivers (52) T wi − F xi r w − T fi = J wωi , (53) T wi = F xi r w . Wheel rolling radius r w (m) 0.347 wheel rotational inertia w (kg*m 2 ) 0.9 and Vector CAN Interface Support from the Vehicle Network Toolbox, the Simulink Real-Time can receive and transmit CAN signals through a specified CAN card. In this study, the RCP of the Simulink Real-Time runs on a computer with a CPU of AMD 3700 and a RAM of 32 GB. The ETAS LABCAR can carry the predefined vehicle model in CARSIM and serves as the controlled plant. The vehicle model together with the input and output ports is compiled first and then downloaded to LABCAR through RJ45. The LABCAR system receives control commands from the Simulink Real-time and broadcasts vehicle states through the CAN network. In addition, another ZLG CAN card with an upper computer is connected to the CAN network for signals monitoring. The overall HIL system is shown in Figure 6.
A medium SUV from the CARSIM database is used to verify the effectiveness of the proposed scheme with its detailed specifications listed in Table 2. The original drive system is replaced with an independent in-wheel drive system at each wheel to simulate the characteristic of an FWIA EV [42]. The torque commands are directly applied to four wheels.
The actual collision scenarios could be complicated since the impact directions and strengths can be diverse.
The theorem of momentum is used to depict an impact process, and the impact on vehicle is simplified to an impulse (P x , P y , P z ) on a reference point (X p , Y p , Z p ) in the vehicle coordinate. Although CARSIM cannot deal with the impact process, it can provide a user-defined external force acting on a specified point of the vehicle, which is utilized to load the impact impulse. The phase plane analysis in Ref. [43] showed that the post-impact instability mainly results from the large yaw rate followed by the sharply increased vehicle sideslip angle. Thus, the lateralrear offset impact is adopted to examine the performance of the proposed control scheme in such an extreme condition and the lateral impulse P y is imposed as shown in Figure 7. According to the crash test data, the impact impulse can be represented by the haversine, sine, square and triangular pulses with a duration of 0.1-0.15 s [44]. In this study, a triangular pulse of 0.1 s is adopted.
The overall control scheme is constructed in the Simulink Real-time. The motion planning module is activated once the impact impulse ends, followed by the tracking and the allocation controller working with a sampling time of 0.02 s. It should be noted that solving the nonlinear optimization problem using the fmincon toolbox is time-consuming. In order to improve computing efficiency, some modifications are made to the fmincon toolbox configuration. The sqp optimization algorithm is chosen and the maximum iteration is set to be 40. The overall controller parameters are well calibrated through massive tests and are given as

Motion Planning Test in Complicated Environments
In this section, the proposed scheme is examined under the scenario, in which the vehicle is forced to execute a leftward lane change to avoid the obstacles ahead while suppressing the instability after an initial impact. A road with two lanes of 4 m width is established and a normal road surface with the road friction coefficient of 0.9 is adopted. The vehicle is driving straightly at an initial speed of 108 km/h and the lateral-rear offset impact impulse is set to be 2400 N•s, referring to the collision scene configuration in Ref. [22]. The reference impact point is set to (−3.7, −0.9, 0.65). Also, two obstacles are assigned on two lanes, which are 30 and 40 m ahead of the collision location as shown in Figure 8. The safety distances for the road boundaries and obstacles are set to be 1 and 1.7 m. The terminal constraints for motion planning are chosen as Y (τ f ) = 4 , Ẏ (τ f ) = 0 , ψ(τ f ) = 0 and ψ (τ f ) = 0 while the terminal time τ f is set to be 3.6 s.
(55) Figure 8 shows the planned vehicle motion and trajectory at different time and the contour map of the potential function. It can be seen that the planned motion can lead the vehicle back to stability while avoiding a second collision with the obstacles and road boundaries after the initial impact. A similar leftward lane change trajectory is successfully given, and the vehicle would safely drive onto the other lane with an attitude similar to drifting. Figure 9(a) and (b) show the evolutions of the planned acceleration and of the rear tire lateral forces, both of which are within their respective limits as described in Equations (11) and (16). It means that the motion planning results are reasonable while satisfying the vehicle dynamics constraints. It should be noted that the result is a locally optimal solution due to the nonconvexity of the optimization problem and the adopted gradientbased method. In most cases, the locally optimal solution is effective and sufficient.

Control Performance Comparison and Analysis
In order to prove the superiority of the NOA algorithm under extreme conditions over the existing allocation methods, the quadratic programming allocation (QPA) method is used as the baseline for comparison [45,46]. It simplified the tire force coupling relationship to form a quadratic programming problem and considered the tire workload usage as the optimization objective. It optimizes the four longitudinal tire forces to realize the desired vehicle longitudinal force and direct yaw moment, while the four lateral tire forces are left as the constraints. For simplicity, the quadratic programming problem is formulated into Eq. (56), where ρ=0.1, ξ 1 =1 and ξ 2 =1 are the weighting coefficients for adjusting the priorities among the tire workload usage and the vehicle longitudinal force and direct yaw moment. The direct yaw moment M * zo is calculated by removing the yaw moment produced by lateral tire forces from the desired overall yaw moment. The steering angle is set to zero. Then the QPA problem can be solved by the quadprog toolbox. For fare comparison, the same desired resultant vehicle forces and yaw moment from the TVLQR and vehicle states are provided for the NOA and QPA in the following analysis.
First, the motion tracking performance is analyzed. Figure 10(a)-(c) demonstrate the motions and trajectories after a left-rear impact under the proposed control scheme, AFS control and no control. Partial ghosts trail from CARSIM VS Visualizer is also used, where two traffic barrels are configured on the road to represent obstacles. It can be seen that the post-impact vehicles under the proposed and the AFS controller can both return back to stability, but their trajectories exhibit considerable deviations. The vehicle under the proposed scheme can closely track the planned motion while avoiding the barriers and road boundaries. The vehicle with the AFS controller is closer to the road boundaries due to larger tracking errors. The vehicle no control falls into rapid spinning and drifting, resulting in a secondary collision.
To be more specific, the trajectories under the TVLQR and the AFS are compared quantitatively as shown in Figure 11(a) together with the trajectory planned in Section 5.1. It can be seen that the TVLQR can closely follow the planned trajectory throughout the maneuver with a maximum error of about 0.2 m. However, a large deviation of up to 0.8 m can be observed for that under the AFS controller, which results from the system inertia and oscillation after the initial impact.
The β −β phase plane analysis is also provided in Figure 11(b), which is widely used as a stability assessment criterion. Three phase paths corresponding to the TVLQR, AFS and without control are compared. It can (56) be seen that all the three phase paths are compelled to the point A from the initial stable point O with the sideslip angular rates increasing sharply. This results from the large, sudden yaw rate change due to the lateral-rear offset impact, which indicates that the point A is also the impact ending time. The phase path of the vehicle without control moves in the direction of increasing sideslip angle while both the TVLQR and AFS can control the vehicle back to the initial stable point O. Also, it can be seen that the AFS controller can more efficiently suppress the sideslip motion before the intersection point B, with a maximum sideslip angle of 45° compared with 60° under the TVLQR. Since the TVLQR has to produce large longitudinal force to achieve obstacle avoidance during the drifting process as shown in Figure 13(a), the stabilizing effect is partially sacrificed. After the intersection point B, the TVLQR stabilizes the vehicle quickly while the AFS experiences sustained oscillations. The simulation results in the time domain are also provided to verify the TVLQR's superior tracking performance. In particular, Figure 12(a) shows the vehicle longitudinal and lateral velocities with the planned motion extracted from the polynomial curve as the reference. It can be seen that both the vehicle longitudinal and lateral velocities can closely track their references. Similarly, the vehicle yaw angle and yaw rate can also accurately follow the planned motion throughout the maneuver as shown in Figure 12(b). The excellent motion tracking the foundation for obstacle-avoidance and stability control.
Second, the control allocation performance of the NOA and QPA are compared as shown in Figure 13.  and model linearization. The lateral tire force has nearly exhausted the tire adhesion force for a drifting or spinning vehicle, and there is no room to adjust the longitudinal tire force. It can be seen in Figure 13(e) that the tire workload usages under the QPA and NOA are both close to 1, meaning saturated tire forces. Thus, the QPA only avails with unsaturated tire forces while the NOA can extend the optimization boundary to tire force saturation scenarios to obtain superior performance. Moreover, no active steering angle adjustment fails to fully capitalize on the potential of chassis coordinated control and only makes the lateral force a passive variable. On top of this, the QPA exhibits considerable lateral force allocation error as shown in Figure 13(b). Instead, the steering angle is well optimized by the NOA algorithm as shown in Figure 13(d) and is restricted between δ min and δ max . For example, the counter-steering process is observed at the initial stage to restrain over-spinning similar to vehicle drifting maneuver.
The optimization derivation time can be controlled within the HIL sampling time of 20 ms despite of the existence of packet loss as shown in Figure 13(f ). Figure 14, the desired tire forces from the presented NOA allocator and from the actual ones exported from the Labcar model are consistent in most of the time albeit there are slight delays and lateral force deviation. The delays may result from ignoring the rotational inertia of wheel in the wheel dynamics model, while the lateral force deviation can be ascribed to the errors of the proposed combined tire force model. But the delays and deviation are still within acceptable ranges and have little influence on the overall control performance.

As shown in
In a nutshell, the traditional path planning and steering control cannot deal with the complicated scenarios of obstacle avoidance after an initial external impact. The impact breaks the nonholonomic constraints of vehicle dynamics and thus cause the AFS lose trajectory tracking ability. Simultaneously, large overshoot and oscillations exist in the approaching process to the stability point. Moreover, the existing QPA algorithm cannot efficiently allocate the desired control commands in drifting or over-spinning conditions. In contrast, the proposed scheme can effectively restrain the post-impact  over-spinning and restore vehicle stability while keeping high-accuracy tracking of the planned trajectory for obstacle avoidance.

Conclusions
Traditional path planning and motion control need be executed under normal conditions with the assumption of a quasi-steady state, in which the vehicle sideslip angle and tire lateral forces are small. However, the assumption may become invalid under extreme conditions especially after an external impact. This paper presents an enabling scheme for automated vehicles to achieve obstacle avoidance and stability restoration after initial impacts. First, a motion planning method based on the polynomial is developed to regulate the vehicle trajectory and yaw motion at the same time. Then, a discrete time-varying vehicle dynamics model is established and a time-varying linear quadratic regulator is proposed to track the desired motions. Finally, a nonlinear-optimization allocation algorithm based on a combined tire model is designed to coordinate multiple chassis actuators to achieve the desired resultant forces and yaw moment. The complete scheme is examined under critical driving conditions based on the HIL tests. The results verify the feasibility and effectiveness of the proposed control scheme to restore vehicle stability while realizing obstacle avoidance after initial collisions under extreme scenarios.