Motion Planning for Autonomous Vehicles in Unanticipated Obstacle Scenarios at Intersections Based on Artificial Potential Field

Featured Application: This work designed a motion planning algorithm for autonomous vehicles in unanticipated obstacle scenarios. In standard driving scenarios, the proposed motion planning algorithm plans a trajectory that complies with intersection regulations, including lane-marking, recommended turning lane, traffic light, right-of-way, and no-parking rules. In unanticipated obstacle scenarios, after the necessity of obstacle avoidance is identified, the ego vehicle would break the rules temporarily to ensure the safety and mobility of autonomous vehicles. Abstract: In unanticipated obstacle scenarios at intersections, the safety and mobility of autonomous vehicles (AVs) are negatively impacted due to the conflict between traffic law compliance and obstacle avoidance. To solve this problem, an obstacle avoidance motion planning algorithm based on artificial potential field (APF) is proposed. An APF-switching logic is utilized to design the motion planning framework. Collision risk and travel delay are quantified as the switching triggers. The intersection traffic laws are digitalized and classified to construct compliance-oriented potential fields. A potential violation cost index (PVCI) is designed according to theories of autonomous driving ethics. The compliance-oriented potential fields are reconfigured according to the PVCI, forming violation cost potential fields. A cost function is designed based on compliance-oriented and violation cost potential fields, integrated with model predictive control (MPC) for trajectory optimization and tracking. The effectiveness of the proposed algorithm is verified through simulation experiments comparing diverse traffic law constraint strategies. The results indicate that the algorithm can help AVs avoid obstacles safely in unanticipated obstacle scenarios at intersections.


Introduction
Autonomous vehicles (AVs) have developed rapidly in recent years.For a foreseeable period, autonomous driving will coexist with human drivers on the roads [1].Differences in behavioral rules between them will lead to mutual misunderstanding and mistrust [2], which can cause suspicion, confusion, and even lead to danger.Consequently, AVs should be regulated by the same traffic regulations as human drivers.
Road traffic laws establish good driving behaviors that vehicles should follow, but the regulatory factors are sometimes broken by other factors such as moral factors and contingency [3,4].The uncontrollable behaviors of other traffic participants cause them to become unanticipated obstacles that negatively impact the safe passage of the surrounding vehicles [5], making it necessary for surrounding vehicles to take illegal actions to avoid obstacles [6].Rigidly obeying traffic laws will not optimally achieve the ultimate goal of integrating AVs into the road traffic system [7].
In 2021, German legislation acknowledged that human drivers occasionally need to violate specific traffic laws to meet other driving requirements [8].The European Union Horizon Commission Expert Group recognized that pursuing greater road safety sometimes necessitates non-compliance behaviors.The group recommended that AVs can decide to violate traffic laws if they can provide explanations, leaving the justice system to determine if the violation was reasonable [9].In the context of Level 4 and above-level autonomous vehicles, a human driver is not required to take charge when faced with some specific driving scenarios.Addressing unanticipated obstacle scenarios necessitates trajectory planning that incorporates regulatory factors for both extrication and obstacle avoidance.This imperative ensures the continuous regulatory awareness of autonomous vehicles across diverse driving environments, posing a significant challenge in the practical realization of autonomous driving systems.This paper primarily investigates the development of a trajectory planning framework to address the aforementioned functionalities, integrating regulatory considerations into both general and obstacle avoidance trajectory planning.

Related Works
The existing traffic laws compliance motion planning approaches can be broadly divided into AI-based, rule-based, and optimization-based approaches.Most AI-based approaches represent traffic laws as constraints or reward functions.Constrained Markov decision processes are employed to train decision strategies, including methods based on Lagrange multipliers [10,11] and constraint strategy optimization [12].These methods can effectively handle straightforward traffic laws.Moreover, considering penalties for violating traffic laws in the reward function is also a common approach [13].However, due to the black-box nature inherent in AI-based approaches, their ability to meet the stringent reliability requirements of autonomous driving systems necessitates further research.Compared to AI-based approaches, rule-based approaches offer superior controllability and interpretability.Rule-based approaches incorporate traffic laws into motion planning and have already found several successful applications.These predominantly encompass discrete input space planning based on collision detection [14], finite state machine [15], constraint optimization [16], and reachable sets [17].Lu et al. [18] utilized static traffic laws as the foundation for generating a set of candidate behaviors.It comprehensively considers factors such as efficiency and safety, allowing vehicles to determine the optimal decision while complying with traffic laws and having high consistency with manual decision results.Ma et al. [19] combined rule-based approaches with optimization-based approaches, formulating strategies for compliance state transitions.The constraints and references in motion planning are modified based on predictions of non-compliant behaviors, enabling AVs to obey traffic laws on the highway.However, most rule-based approaches need typical hand-crafted rule design, which adds a degree of difficulty to devising decision-making solutions in complex scenarios, especially for some unforeseen scenarios.
Optimization-based approaches integrate multiple optimization objectives into a cost function, adjusting weights accordingly, thus prioritizing diverse driving goals [20,21].Maurer et al. incorporate traffic laws into the cost function, while obstacle avoidance serves as the constraint in motion planning [22,23].Wang et al. [24], Bae et al. [25], and Liu et al. [26] utilized the artificial potential field (APF) to represent traffic laws and integrate them into the cost function.This approach allows for the successful execution of the driving task while considering various factors.These methods consider traffic laws as high-cost factors, particularly in the context of prohibited regulations, such as solid line and stop line adherence.Esterle et al. [27] utilized game theory to optimize multi-objective interactive behaviors, considering collision and violation in a reward function.Vosahlik et al. [28] proposed a minimum violation planning framework that assigns higher weights to collision avoidance and lower weights to traffic law compliance in the cost function.This permits AVs to breach traffic laws to ensure safety.However, assigning lower weights to traffic law compliance potentially leads to violations, even in non-conflict scenarios.For example, the vehicle could have evaded the collision by abruptly braking within the lane but instead opted for a trajectory that transgressed the solid line.
Table 1 lists recent trajectory planning research, offering an analysis of the factors taken into account by each method.To summarize, most of the research regards traffic laws as strong constraints or high-cost factors and does not account for behaviors that extend beyond traffic rules, thereby reducing the effectiveness of decision-making in conflict scenarios.Additionally, a limited number of methods address the intricate balance required between compliance and other driving requirements when confronted with specific scenarios, and also neglect to investigate the regulatory factors pertinent to obstacle avoidance behavior in this scenario.

Contributions
To solve the above issues, this paper focuses on the unanticipated obstacle scenarios at intersections, utilizing APF-switching logic to design the motion planning framework.Time to Collision (TTC) and obstructed delay time are quantified as switching triggers.The intersection traffic laws are digitized and classified to extract basic violation propositions.Compliance constraints are proposed according to the types of these propositions, including lane line constraints, stop line constraints and speed constraints.Compliance-oriented potential fields are constructed to accomplish the constraint tasks.According to theories of autonomous driving ethics, the potential violation cost index (PVCI) is designed, which includes the consideration of collision risk, violation degree, and violation penalties.Violation cost potential fields are constructed by truncating the compliance-oriented potential field according to the PVCI.A cost function is designed based on compliance-oriented and violation cost potential fields, integrated with model predictive control (MPC) for trajectory optimization and tracking.The main contributions of this paper are summarized below.
Compliance constraints are generated based on the standardized mathematical description process, which digitizes natural language traffic laws into mathematical logic language.To incorporate traffic law compliance into motion planning, compliance-oriented potential fields are designed according to compliance constraints and relevant traffic laws.
This paper proposes a potential violation cost index to assess the impact of necessary violations.Then, the high-cost compliance-oriented potential field is truncated according to the PVCI, forming a lower-cost violation cost potential field.This allows the vehicle to plan an effective obstacle avoidance path in unanticipated obstacle scenarios with lower violation costs.

Paper Organization
The remainder of this paper is structured as follows.An unanticipated obstacle scenario is illustrated and the obstacle avoidance principle in this scenario is proposed in Section 2. The obstacle avoidance motion planning framework is designed in Section 3. The obstacle avoidance motion planning method based on APF is proposed in Section 4. The proposed algorithm is validated in Section 5. Finally, this study is concluded in Section 6.

Unanticipated Obstacle Scenario
Figure 1 illustrates a realistic and common unanticipated obstacle scenario at the intersection inlet lane.The global path planning for the ego vehicle is to turn left.According to the road sign requirements, the vehicle enters the left-turn guidance lane delineated by a solid white line on its right side and a double solid yellow line on its left side, as shown in Figure 1a.Since the traffic light is red at this point and there are already other vehicles waiting in the lane, the ego vehicle queues up, as shown in Figure 1b.When the traffic light turns green, vehicles enter the intersection in order.At this moment, the vehicle in front of the ego vehicle suddenly breaks down and cannot move.It becomes a road obstacle that blocks the passage of the ego vehicle, as shown in Figure 1c.
nario is illustrated and the obstacle avoidance principle in this scenario is proposed in Section 2. The obstacle avoidance motion planning framework is designed in Section 3. The obstacle avoidance motion planning method based on APF is proposed in Section 4. The proposed algorithm is validated in Section 5. Finally, this study is concluded in Section 6.

Unanticipated Obstacle Scenario
Figure 1 illustrates a realistic and common unanticipated obstacle scenario at the intersection inlet lane.The global path planning for the ego vehicle is to turn left.According to the road sign requirements, the vehicle enters the left-turn guidance lane delineated by a solid white line on its right side and a double solid yellow line on its left side, as shown in Figure 1a.Since the traffic light is red at this point and there are already other vehicles waiting in the lane, the ego vehicle queues up, as shown in Figure 1b.When the traffic light turns green, vehicles enter the intersection in order.At this moment, the vehicle in front of the ego vehicle suddenly breaks down and cannot move.It becomes a road obstacle that blocks the passage of the ego vehicle, as shown in Figure 1c.This scenario involves multiple driving requirements, including safety, mobility, and traffic law compliance.Different decision priorities lead to different behaviors.One engineering design option is to program the ego vehicle to prioritize the ability to obey traffic laws.This means continuous waiting behind the obstacle vehicle, which negatively impacts the mobility and safety of surrounding vehicles.Another approach is to program the vehicle to prioritize the ability to continue moving.This means entering adjacent lanes This scenario involves multiple driving requirements, including safety, mobility, and traffic law compliance.Different decision priorities lead to different behaviors.One engineering design option is to program the ego vehicle to prioritize the ability to obey traffic laws.This means continuous waiting behind the obstacle vehicle, which negatively impacts the mobility and safety of surrounding vehicles.Another approach is to program the vehicle to prioritize the ability to continue moving.This means entering adjacent lanes and proceeding around obstacles while remaining safe.This action will cause the ego vehicle to briefly violate the lane marking rules.Unanticipated obstacles could lead to a conflict between traffic law compliance and obstacle avoidance.AVs have to weigh the tension between safety, mobility, and traffic law compliance in this scenario [29].

Obstacle Avoidance Principle
For AVs, the dual primary objectives of obstacle avoidance are to guarantee vehicle safety and fulfill transportation tasks successfully.The factors that need to be considered in motion planning for AVs in unanticipated obstacle scenarios include: 1.
Driving safety: Safety takes precedence when carrying out any driving task, especially when obstacle avoidance involves a violation.It is critical to avoid collision caused by the violation.

2.
Impact on the transportation environment: Indefinite standstills can lead to traffic congestion and negatively impact traffic flow.Violations undertaken to address conflicts can impact the normal operation of surrounding vehicles.The extent of violations should be minimized.

3.
Legal liability: Violations will result in appropriate penalties that are closely related to traffic safety.Less penalized violations should be prioritized to accomplish obstacle avoidance.
Maurer [22] incorporates ethical considerations into motion planning and control.Traffic law compliance and obstacle avoidance represent two crucial aspects of autonomous vehicles (AVs), corresponding to consequentialism and deontology, respectively.Based on this idea, the obstacle avoidance principle in unanticipated scenarios is proposed.First of all, it is essential to ensure the safety of AVs.Secondly, the impact on the traffic environment is taken into account.Finally, the legal liability associated with AVs should be considered.
The same principle is equally applicable to the vehicles that play different social roles, taking an on-duty ambulance as an illustrative example.While the ambulance has the discretion to deviate from traffic laws, it does not imply that reckless driving is permissible.Ensuring safety remains imperative.Moreover, its actions should consider the potential implications on the traffic ecosystem, which indirectly influences its safety and efficiency.

Obstacle Avoidance Motion Planning Framework
The planning framework is shown in Figure 2. It consists of a model predictive controller and an APF-switching trigger.The compliance-oriented potential fields and the violation cost potential fields are integrated with the cost function of the MPC.TTC and obstructed delay time are quantified as the APF-switching triggers.In normal driving scenarios, the compliance-oriented potential fields are constructed based on environmental information for compliance motion planning.When obstacle avoidance becomes necessary, the system transitions from compliance-oriented potential fields to violation cost potential fields for obstacle avoidance motion planning.Collision risk arises from violations or aggressive driving behaviors of other vehicles.In this study, TTC is utilized as the indicator for assessing collision risk.The trajectories of the ego vehicle and surrounding vehicles are obtained from the predictive information.An obstacle avoidance is necessary when the TTC is smaller than a certain threshold.The judgment is based on: where tsafe denotes the minimum safe time and is set to 1.6 s according to [30].The accumulation of obstructed delay time begins when the vehicle decelerates due to interference from other traffic participants and continues until it resumes normal driving.The obstructed delay time is determined according to the pseudocode Algorithm 1 provided.Collision risk arises from violations or aggressive driving behaviors of other vehicles.In this study, TTC is utilized as the indicator for assessing collision risk.The trajectories of the ego vehicle and surrounding vehicles are obtained from the predictive information.An obstacle avoidance is necessary when the TTC is smaller than a certain threshold.The judgment is based on: TTC < t safe (1) where t safe denotes the minimum safe time and is set to 1.6 s according to [30].
The accumulation of obstructed delay time begins when the vehicle decelerates due to interference from other traffic participants and continues until it resumes normal driving.The obstructed delay time is determined according to the pseudocode Algorithm 1 provided.where TrafficLight denotes the traffic light state, and G denotes the green light.Ego and Tgt f denote the ego vehicle and the other vehicle in front.v ego and v tgtf denote the speed of the Ego and Tgtf, respectively.t now and t stop denote the current time and the time at which the vehicle first stops because an obstacle vehicle is in front.The judgment is based on: where t obs and t con denote the obstructed delay time and the threshold of congestion.In this study, t con is set to 55 s according to China's related requirements, namely, the Evaluation Methods for Road Traffic Congestion Levels [31].
The above two conditions are related to the safety and mobility of vehicles, respectively.The logical formula for potential field switching is designed as: where U law represents the potential fields associated with traffic laws involved in motion planning.U com and U vio represent the compliance-oriented and violation cost potential fields, respectively.

Obstacle Avoidance Motion Planning Method Based on APF 4.1. Vehicle Dynamic Model
A bicycle model is employed for modeling vehicle dynamics.The corresponding equations of the vehicle dynamic model are as follows: . . .
where u and v are the longitudinal velocity and lateral velocity.r is the yaw rate at the center of gravity (CG); X and Y are the longitudinal position and lateral position in the global coordinate; θ is the heading angle of the vehicle; m is the mass of the vehicle; I z is the moment of inertia of the vehicle around its vertical axis; l f and l r are the distances from the front axle to CG and from the rear axle to CG, respectively; F x T is the total longitudinal force of the tires; F y f and F y r are the total lateral force of the front and rear tires, which are defined as: where C f and C r are the cornering stiffness values of the front and rear tires; α f and α r are the sideslip angles of the front and rear tires; δ is the front wheel steering angle.By linearizing Equations ( 4)-( 9) around the vehicle's operating point, the vehicle linear dynamics can be written in state space form as follows: .
where x is the state vector; u c is the input vector; A and B are the state matrix and input matrix, respectively.The model is discretized by the zero-order hold method, to be utilized as the model of the model predictive path planning controller.

Compliance-Oriented Potential Field
Passing through intersections involves multiple traffic laws.Although specific provisions in the traffic laws differ across countries and regions, a significant degree of consistency in fundamental principles is shared.Through analysis, seven common types of violations at intersections are categorized: speeding, failure to stop, failure to yield, improper turn, marked lane violation, illegal stopping, and illegal reversing.Based on the standardized mathematical description process proposed in the previous work [32], the traffic laws involved at intersections are digitized to form logical propositions for violation judgments.The basic violation propositions of common violations are extracted.The expressions are shown in Table 2.Where ego denotes the ego vehicle; the atomic proposition crdn(obj) denotes the geometric center coordinates of the traffic participant obj; mfrntp(obj) denotes the coordinates of the midpoint of obj's front end; vx(obj) denotes the longitudinal velocity of obj; vx upper and vx lower denote the upper and lower bounds of the speed limit, respectively; area(obj) denotes the area structure that includes the vertex coordinate structure of obj; line(p 1 , p 2 ) denotes the line between points p 1 and p 2 ; overlap(r 1 , r 2 ) judges the overlap status of areas r 1 and r 2 ; stopline and laneline denote stop line and lane line, respectively.
Three basic violation propositions are constrained by three types of complianceoriented potential fields: lane-marking potential field, stop-line potential field, and speedlimit potential field.In this study, the design of the compliance-oriented potential field is based on China's traffic law, specifically, the Regulation on the Implementation of the Law of the People's Republic of China on Road Traffic Safety [33] and the Road traffic signs and markings-Part 3: Road traffic markings [34].The overall compliance-oriented potential field is the sum of the compliance-oriented potential functions (PF): where U laneline , U stopline , and U speed are lane marking potential PF, stop line PF, and speed limit PF; i, j, and m denote the index of the U laneline , U stopline , and U speed , respectively.

Lane-Marking Potential Field
Types of lane markings include solid lines, broken lines, and virtual lane lines.According to [34], solid lines are non-crossable, and broken lines allow vehicles to cross for short periods when appropriate.Virtual lane lines are used to guide vehicles along the optimal path during a turn at an intersection, according to [33].Optimal turning path information can be provided by high-definition maps [35,36].In order to handle the driving constraints of different types of lane markings in an autonomous driving system, a non-crossable potential field is used to model the solid line, and a crossable potential field is used to model the broken line and virtual lane line.
The non-crossable potential field ensures that the vehicle stays within the lane.The distance from the front tires to the solid line is used as the independent variable of the PF.The distance can be determined as: where (t + k, t) denotes the kth time step ahead of the current time t in the prediction horizon; "left" and "right" indicate the lane markings on the left and right of the vehicle; d fl and d fr are the lateral positions of the left and right front wheels, respectively; d NC,l and d NC,r are the lateral positions of the left and right non-crossable lane markings, respectively.When d L decreases to a certain extent, the cost should increase rapidly with the decreasing distance.Therefore, the inverse proportional function and power function are utilized to design the PFs for the non-crossable lane markings.The design of the non-crossable lane-marking potential field is based on the method proposed in [26].The PF of the non-crossable lane marking is as follows: where d m,NC and d in,NC are the minimal distance and the influence distance; a NC and b NC are the intensity and shape parameters of the PF.The smooth parameters guarantee the continuity of the PF value when d switches to another condition.The smooth parameter e s,NC and the maximum amplitude A NC are defined as: The visualization of the non-crossable lane-marking potential field is shown in Figure 3, where the minimal and influence distance is set to 0.1 m and 1.5 m, respectively.The intensity and shape parameters of the solid line PF are set to 0.2 and 2.0, respectively.
The visualization of the non-crossable lane-marking potential field is shown in Figure 3, where the minimal and influence distance is set to 0.1 m and 1.5 m, respectively.The intensity and shape parameters of the solid line PF are set to 0.2 and 2.0, respectively.The crossable lane-marking potential field is used to constrain the vehicle to travel within the lane and, at the same time, is crossable for the vehicle to change lanes.Therefore, the crossable lane-marking potential field is designed based on Gaussian-like functions.The PF of the crossable lane marking is as follows: where AC is the maximum amplitude of the crossable lane markings PF; dC is the lateral position of the lane markings; σ is the rate of rise that is related to the lane width.The visualization of the crossable lane-marking potential field is shown in Figure 4, where AC is set to 2 and σ is set to 0.3 times the lane width.The crossable lane-marking potential field is used to constrain the vehicle to travel within the lane and, at the same time, is crossable for the vehicle to change lanes.Therefore, the crossable lane-marking potential field is designed based on Gaussian-like functions.The PF of the crossable lane marking is as follows: where A C is the maximum amplitude of the crossable lane markings PF; d C is the lateral position of the lane markings; σ is the rate of rise that is related to the lane width.The visualization of the crossable lane-marking potential field is shown in Figure 4, where A C is set to 2 and σ is set to 0.3 times the lane width.

Stop-Line Potential Field
Types of stop lines include marked stop lines and virtual stop lines.The virtual stop line is adopted as the basis for the right-of-way yielding line and the safety following line.When the trajectory of the ego vehicle intersects with that of the vehicle possessing the right-of-way, a virtual yield line is created perpendicular to the ego vehicle's direction at the point of intersection.Subsequently, a potential field for the yield stop line is established based on this virtual line.
The distance between the foremost part of a vehicle and the stop line is used as the independent variable of the stop line PF, which is determined as: where sf and ss are the longitudinal position of the foremost part of the vehicle and the longitudinal position of the stop line, respectively.The stop-line potential field is also regarded as non-crossable.The inverse proportional function and power function are utilized.The stop line PF is designed as:

Stop-Line Potential Field
Types of stop lines include marked stop lines and virtual stop lines.The virtual stop line is adopted as the basis for the right-of-way yielding line and the safety following line.When the trajectory of the ego vehicle intersects with that of the vehicle possessing the right-of-way, a virtual yield line is created perpendicular to the ego vehicle's direction at the point of intersection.Subsequently, a potential field for the yield stop line is established based on this virtual line.
The distance between the foremost part of a vehicle and the stop line is used as the independent variable of the stop line PF, which is determined as: where s f and s s are the longitudinal position of the foremost part of the vehicle and the longitudinal position of the stop line, respectively.The stop-line potential field is also regarded as non-crossable.The inverse proportional function and power function are utilized.The stop line PF is designed as: where a SL and b SL are the intensity and shape parameters of the PF; s m,SL is the minimal distance and is set to 0.1 m; the influence distance s in,SL is defined according to the length of the guide lane.The smooth parameter e s,NC and the maximum amplitude A NC are defined as: The visualization of the stop-line potential field is shown in Figure 5, where the intensity and shape parameters of the stop line PF are set to 0.2 and 2.0, respectively.When driving in a queue sequence, it is necessary to maintain a safe following distance with the vehicle in front.The independent variable of the car-following PF is defined as: where sf is the longitudinal position of the foremost part of the ego vehicle; sm,CF is the longitudinal position of the safe following line.
The foundation of car-following PF is the Yukawa potential, with a slower rate of rise at a moderate distance.This property allows for a smoother transition between different driving regimes, such as free flow, synchronized flow, and congested flow.The car-following PF is defined as: where ACF and aCF are the maximum amplitude and the scale factor of the car-following PF.The obstacle PF employed in this study is based on [37].The visualization of the car and car-following potential field is shown in Figure 6, where ACF and aCF are set to 2.0 and 0.5, respectively.When driving in a queue sequence, it is necessary to maintain a safe following distance with the vehicle in front.The independent variable of the car-following PF is defined as: where s f is the longitudinal position of the foremost part of the ego vehicle; s m,CF is the longitudinal position of the safe following line.
The foundation of car-following PF is the Yukawa potential, with a slower rate of rise at a moderate distance.This property allows for a smoother transition between different driving regimes, such as free flow, synchronized flow, and congested flow.The car-following PF is defined as: where A CF and a CF are the maximum amplitude and the scale factor of the car-following PF.The obstacle PF employed in this study is based on [37].The visualization of the car and car-following potential field is shown in Figure 6, where A CF and a CF are set to 2.0 and 0.5, respectively.
where ACF and aCF are the maximum amplitude and the scale factor of the car-following PF.The obstacle PF employed in this study is based on [37].The visualization the car and car-following potential field is shown in Figure 6, where ACF and aCF are set to 2.0 and 0.5, respectively.

Speed-Limit Potential Field
For violations of exceeding the upper speed limit and falling below the lower speed limit at intersections, the speed-limit potential field is constructed using increasing and decreasing exponential functions, respectively.
Vehicle speed is used as the independent variable of the speed limit PF, which is defined as:

Speed-Limit Potential Field
For violations of exceeding the upper speed limit and falling below the lower speed limit at intersections, the speed-limit potential field is constructed using increasing and decreasing exponential functions, respectively.
Vehicle speed is used as the independent variable of the speed limit PF, which is defined as: where η is a scaling factor.v limit is the speed limit of the road.This function results in less impact on vehicle speed when it is under the speed limit.When exceeding the speed limit, there is a rapid escalation in the cost incurred.Moreover, no-parking zones and no-reversing zones are distinctly designated within crosswalks and intersections.The speed constraint PF in no-parking and no-reversing zones is defined as: where a and η are the base of the function and the scaling factor.In this study, a is set to 0.8.The value of the potential field increases as the vehicle approaches a stop.

Violation Cost Potential Field
The violation cost potential field aims to reduce the violation cost during obstacle avoidance under necessary violations.The compliance-oriented potential field of the corresponding traffic law is truncated according to the PVCI, forming the violation cost potential field, which is defined as: where PVCI laneline , PVCI stopline, and PVCI speed are the calculated PVCI values for the crossing lane line, crossing stop line, and speed violation; U vlaneline , U vstopline , and U vspeed are the violation cost potential field of the lane line, stop line, and vehicle speed; i, j, and m denote the index of the U vlaneline , U vstopline , and U vspeed , respectively; U vio is the overall violation cost potential field.In this way, the non-crossable compliance-oriented potential field is changed to a crossable violation cost potential field, allowing the vehicle to make effective obstacle avoidance motion planning in unanticipated obstacle scenarios.

Collision Risk
The predicted collision risk is determined based on TTC.The vehicle trajectory intersections are obtained by considering the current and predicted motion states of the ego vehicle and other traffic participants.The predicted collision risk R in PVCI is defined as: where TTC i is the collision time between the ego vehicle and the i th obstacle vehicle.TTC std is the standard collision time.The TTC std values are defined as 2.5 s, 3 s, and 3.5 s when the relative speed falls below 10 m/s, between 10-15 m/s, and exceeds 15 m/s, respectively [18].

Violation Degree
The degree of violation is quantified by measuring the states of vehicles that deviate from the compliance range.Data normalization of the degree of violation is performed to enable effective comparisons between different types and magnitudes of violations.The measurement methods for different types of violations are shown in Table 3.  Illegal stopping Where s(obj) and d(obj) denote the longitudinal and lateral coordinates of the object obj, respectively; l(obj) and w(obj) denote the geometrical length and width of the obj, respectively; tgt f denotes the other traffic participant located directly in front of the ego vehicle; d safe denotes the safe following distance.vstopline denotes the virtual stop line; laneline r and laneline l denote the right and left lane lines of the lane where the obj is located; vlaneline r and vlaneline l denote the right and left lane lines of the virtual lane where the obj is located; s reverse (obj) denotes the distance that the obj is reversing; noparking denotes the no-parking zone.

Violation Penalty
The severity of a violation is closely related to the type of violation, and an intuitive indicator is the penalty that corresponds to the type of violation.To incorporate the violation penalty into autonomous driving motion planning, the basic violation propositions are validated in the first place.Then, the violation objects are identified to determine the specific violations.The consequences of different violations are specified according to the relevant penalty regulations.
This study consults the penalties for violations specified in the relevant Chinese laws, the Measures for the Administration of Points Assigned for Road Traffic Violations [38] and the Road Traffic Safety Violations, Codes, and Penalty Scoring Standards [39].The penalties for violations are cumulative.Certain violations do not result in the assignment of demerit points, instead resulting in warnings and monetary penalties.This study solely focuses on the deduction of driving license points.Specific violations and their penalties are listed in Table 4.
where N p is the prediction horizon, set to 20; N c is the control horizon, set to 5; ε k is the vector of slack variables at the kth step.The states are predicted through Equation (38), where A d and B d are the discrete state and input matrices by discretizing Equation (12).The tracking outputs are calculated by Equation (39), in which C and D are the output and feedforward matrices.The control inputs and their changes are constrained in Equations ( 40) and (41).u c_min and u c_max are the matrices of the lower and upper bounds of the control input; ∆u c_min and ∆u c_max are the matrices of the lower and upper bounds of the control input changes; Q, R, S, and P are weighting matrices.
In normal driving scenarios, Equation ( 36) is utilized as the cost function within the MPC for compliance motion planning.In unanticipated obstacle scenarios, Equation ( 37) is utilized for obstacle avoidance motion planning.The PFs integrated with the optimization problem are nonlinear and non-convex.The method proposed by Rasekhipour et al. [37] is employed to convert the optimization problem into an approximately quadratic convex.

Case Study
MATLAB/Simulink 2021a is used to code the motion planning algorithm.The computer used has an 11th Gen Intel(R) Core(TM) i7-11800H processor and 32 GB of memory (Intel Corporation, Santa Clara, CA, USA).The scenario illustrated in Section 2 and its extension are simulated.To verify the proposed algorithm, comparative tests are designed by changing the traffic law constraint strategy of the ego vehicle.The parameters relevant to the path planning controller for the ego vehicle are extracted from a Chevrolet Equinox model within the CarSim 2021.0 software, and the parameters are shown in Table 5.The geometry of the surrounding vehicles is the same as that of the ego vehicle.The speed of the ego vehicle entering the intersection is set to 20 km/h.The width of the lanes is 3.5 m.The traffic light signal stages of green, red and yellow light in the simulation are set to 26 s, 31 s, and 3 s, according to an actual recorded two-lane intersection in the SinD dataset [40].Software-in-the-loop (SIL) testing is conducted to verify if the C++ code corresponding to the controller model accurately executes identical control actions when subjected to equivalent stimuli.The hardware target of the C++ code generation is bound to ARM Cortex-M.A simple obstacle avoidance scenario is designed for SIL testing.An obstacle vehicle is stationary ahead of the ego vehicle in the same lane, with the road boundary on the left and a white dashed line on the right.The ego vehicle travels at a speed of 20 km/h on the road, navigating an avoidance path by considering obstacle and lane-marking potential fields in the MPC cost function.The SIL testing compares the MPC outputs, represented by vehicle speed and steering angle in this evaluation.Figure 7 depicts the state and error of the ego vehicle in both normal and SIL tests.It can be seen that the error is negligible.

Scenario 1: Unanticipated Obstacle Scenario at Intersection Inlet Road
Scenario 1 is the unanticipated obstacle scenario illustrated in Section 2, where the obstacle vehicle is located in the center of the lane 30 m in front of the ego vehicle, and the traffic light is red.The ego vehicle enters the left-turn lane marked by solid lines on both sides, comes to a stop behind the obstacle vehicle, and waits in the lane.The traffic light turns green at 20 s, and the front vehicle remains stationary.

Scenario 1: Unanticipated Obstacle Scenario at Intersection Inlet Road
Scenario 1 is the unanticipated obstacle scenario illustrated in Section 2, where the obstacle vehicle is located in the center of the lane 30 m in front of the ego vehicle, and the traffic light is red.The ego vehicle enters the left-turn lane marked by solid lines on both sides, comes to a stop behind the obstacle vehicle, and waits in the lane.The traffic ligh turns green at 20 s, and the front vehicle remains stationary.
In the first comparison test, the ego vehicle is programmed to adhere to traffic laws strictly.The experiment's results are shown in Figure 8.The trajectories of ego (red) and obstacle (blue) vehicles are shown in Figure 8a.The speed and front wheel steering angles of the ego vehicle are shown in Figure 8b,c.The ego vehicle remains stationary and con tinues to wait due to the constraints of the solid-line potential field and the car-following potential field.The obstructed delay time continues to accumulate beyond the congestion threshold after two red light stages.This could lead to an infinite stop.In the first comparison test, the ego vehicle is programmed to adhere to traffic laws strictly.The experiment's results are shown in Figure 8.The trajectories of ego (red) and obstacle (blue) vehicles are shown in Figure 8a.The speed and front wheel steering angles of the ego vehicle are shown in Figure 8b,c.The ego vehicle remains stationary and continues to wait due to the constraints of the solid-line potential field and the car-following potential field.The obstructed delay time continues to accumulate beyond the congestion threshold after two red light stages.This could lead to an infinite stop.
In the second comparison test, the ego vehicle can identify the necessity of obstacle avoidance through programming, yet it completely ignores traffic laws during the obstacle avoidance process.The compliance-oriented potential field is set to zero.The simulation result is presented in Figure 9.The ego vehicle starts to overtake the obstacle vehicle when the obstructed delay time equals the congestion threshold.The vehicle only considers collision avoidance during the planning process and chooses to cross the double-solid yellow line.The maximum occupancy of the opposite-direction lane is 2.12 m.The obstructed delay time is 148.25 s.The behavior of crossing the double-solid yellow line not only has high violation penalties but also results in driving in the wrong direction, which has a serious impact on traffic environment.In the second comparison test, the ego vehicle can identify the necessity of obstacle avoidance through programming, yet it completely ignores traffic laws during the obstacle avoidance process.The compliance-oriented potential field is set to zero.The simulation result is presented in Figure 9.The ego vehicle starts to overtake the obstacle vehicle when the obstructed delay time equals the congestion threshold.The vehicle only considers collision avoidance during the planning process and chooses to cross the double-solid yellow line.The maximum occupancy of the opposite-direction lane is 2.12 m.The obstructed delay time is 148.25 s.The behavior of crossing the double-solid yellow line not only has high violation penalties but also results in driving in the wrong direction, which has a serious impact on traffic environment.In the second comparison test, the ego vehicle can identify the necessity of obstacle avoidance through programming, yet it completely ignores traffic laws during the obstacle avoidance process.The compliance-oriented potential field is set to zero.The simulation result is presented in Figure 9.The ego vehicle starts to overtake the obstacle vehicle when the obstructed delay time equals the congestion threshold.The vehicle only considers collision avoidance during the planning process and chooses to cross the double-solid yellow line.The maximum occupancy of the opposite-direction lane is 2.12 m.The obstructed delay time is 148.25 s.The behavior of crossing the double-solid yellow line not only has high violation penalties but also results in driving in the wrong direction, which has a serious impact on traffic environment.After implementing the proposed algorithm, the result is shown in Figure 10 according to the obstacle avoidance motion planning framework.The compliance-oriented potential fields in the cost function are replaced by the violation cost potential fields.Crossing double-solid yellow lines results in driving in the wrong direction; thereby, the initial value of the PVCI of the double-solid yellow line is higher.The ego vehicle crosses the After implementing the proposed algorithm, the result is shown in Figure 10 according to the obstacle avoidance motion planning framework.The compliance-oriented potential fields in the cost function are replaced by the violation cost potential fields.Crossing double-solid yellow lines results in driving in the wrong direction; thereby, the initial value of the PVCI of the double-solid yellow line is higher.The ego vehicle crosses the solid white line to pass the obstacle vehicle.As the vehicle crosses the line, the violation degree in PVCI increases as the distance by which the vehicle exceeds the compliant range increases.This prompts the ego vehicle to plan a trajectory that is closer to the original lane while maintaining safety.The maximum occupancy of the adjacent lane is 1.78 m.The obstructed delay time is 148.68 s.After obstacle avoidance is completed, the compliance-oriented potential fields are utilized in the cost function to plan a compliant trajectory.The detailed PVCI of the ego vehicle is shown in Figure 10d.
(c) After implementing the proposed algorithm, the result is shown in Figure 10 according to the obstacle avoidance motion planning framework.The compliance-oriented potential fields in the cost function are replaced by the violation cost potential fields.Crossing double-solid yellow lines results in driving in the wrong direction; thereby, the initial value of the PVCI of the double-solid yellow line is higher.The ego vehicle crosses the solid white line to pass the obstacle vehicle.As the vehicle crosses the line, the violation degree in PVCI increases as the distance by which the vehicle exceeds the compliant range increases.This prompts the ego vehicle to plan a trajectory that is closer to the original lane while maintaining safety.The maximum occupancy of the adjacent lane is 1.78 m.The obstructed delay time is 148.68 s.After obstacle avoidance is completed, the compliance-oriented potential fields are utilized in the cost function to plan a compliant trajectory.The detailed PVCI of the ego vehicle is shown in Figure 10d.

Scenario 2: Fast Approaching Vehicle Passed by During Obstacle Avoidance
Scenario 2 is an extension of scenario 1, and the setting of this scenario is shown in Figure 11.After the mobility of the vehicle is negatively impacted by the unanticipated obstacle vehicle, the compliance-oriented potential field in the cost function switches to the violation cost potential field for obstacle avoidance motion planning.The ego vehicle is about to cross the solid white line to overtake the obstacle vehicle.At this moment, there is another vehicle approaching at a speed of 30 km/h from the adjacent lane in the same direction.The results can be observed in Figure 12.Due to the predicted collision risk, the PVCI for the solid white line and the car following increases rapidly, and the violation cost potential field is elevated, leading the ego vehicle to halt its evasive maneuver.After the vehicle from the adjacent lane passes and is safe, the ego vehicle continues its obstacle

Scenario 2: Fast Approaching Vehicle Passed by During Obstacle Avoidance
Scenario 2 is an extension of scenario 1, and the setting of this scenario is shown in Figure 11.After the mobility of the vehicle is negatively impacted by the unanticipated obstacle vehicle, the compliance-oriented potential field in the cost function switches to the violation cost potential field for obstacle avoidance motion planning.The ego vehicle is about to cross the solid white line to overtake the obstacle vehicle.At this moment, there is another vehicle approaching at a speed of 30 km/h from the adjacent lane in the same direction.The results can be observed in Figure 12.Due to the predicted collision risk, the PVCI for the solid white line and the car following increases rapidly, and the violation cost potential field is elevated, leading the ego vehicle to halt its evasive maneuver.After the vehicle from the adjacent lane passes and is safe, the ego vehicle continues its obstacle avoidance.The maximum occupancy of the adjacent lane is 1.83 m.The obstructed delay time is 151.35 s.The detailed PVCI of the ego vehicle is shown in Figure 12d.

Scenario 2: Fast Approaching Vehicle Passed by During Obstacle Avoidance
Scenario 2 is an extension of scenario 1, and the setting of this scenario is shown in Figure 11.After the mobility of the vehicle is negatively impacted by the unanticipated obstacle vehicle, the compliance-oriented potential field in the cost function switches to the violation cost potential field for obstacle avoidance motion planning.The ego vehicle is about to cross the solid white line to overtake the obstacle vehicle.At this moment, there is another vehicle approaching at a speed of 30 km/h from the adjacent lane in the same direction.The results can be observed in Figure 12.Due to the predicted collision risk, the PVCI for the solid white line and the car following increases rapidly, and the violation cost potential field is elevated, leading the ego vehicle to halt its evasive maneuver.After the vehicle from the adjacent lane passes and is safe, the ego vehicle continues its obstacle avoidance.The maximum occupancy of the adjacent lane is 1.83 m.The obstructed delay time is 151.35 s.The detailed PVCI of the ego vehicle is shown in Figure 12d.

Scenario 2: Fast Approaching Vehicle Passed by During Obstacle Avoidance
Scenario 2 is an extension of scenario 1, and the setting of this scenario is shown in Figure 11.After the mobility of the vehicle is negatively impacted by the unanticipated obstacle vehicle, the compliance-oriented potential field in the cost function switches to the violation cost potential field for obstacle avoidance motion planning.The ego vehicle is about to cross the solid white line to overtake the obstacle vehicle.At this moment, there is another vehicle approaching at a speed of 30 km/h from the adjacent lane in the same direction.The results can be observed in Figure 12.Due to the predicted collision risk, the PVCI for the solid white line and the car following increases rapidly, and the violation cost potential field is elevated, leading the ego vehicle to halt its evasive maneuver.After the vehicle from the adjacent lane passes and is safe, the ego vehicle continues its obstacle avoidance.The maximum occupancy of the adjacent lane is 1.83 m.The obstructed delay time is 151.35 s.The detailed PVCI of the ego vehicle is shown in Figure 12d.

Effectiveness Analysis of the Designed Algorithm
In this section, the effectiveness of the algorithm is evaluated.The performances of the ego vehicle in simulation testing are shown in Table 6.With the proposed motion planning scheme, the ego vehicle maintains mobility instead of coming to an infinite stop in an unanticipated scenario.After the obstructed delay time reaches the congestion threshold, the compliance-oriented potential fields are truncated based on PVCI to transform

Effectiveness Analysis of the Designed Algorithm
In this section, the effectiveness of the algorithm is evaluated.The performances of the ego vehicle in simulation testing are shown in Table 6.With the proposed motion planning scheme, the ego vehicle maintains mobility instead of coming to an infinite stop in an unanticipated scenario.After the obstructed delay time reaches the congestion threshold, the compliance-oriented potential fields are truncated based on PVCI to transform into the violation cost potential fields.In the primary objective of ensuring safety, obstacle avoidance is accomplished.According to the profile report of the simulation, the optimization problem can be resolved within approximately 4.8 ms when the motion planning does not involve potential fields.However, the resolution time increases to about 6 ms when potential fields are integrated into the optimization problem.Therefore, the proposed potential fields do not impose a significant additional computational burden.The preceding matrix computations in the MPC module exhibited an average computation time of 0.37 ms.The MPC meets strict real-time requirements, especially in emergency situations.

Conclusions
To solve the problem that safety and mobility of AVs are negatively impacted due to the conflict between traffic law compliance and obstacle avoidance in unanticipated obstacle scenarios at intersections, an obstacle avoidance motion planning method based on APF is proposed in this study.The core of this method lies in the construction of complianceoriented potential fields and violation cost potential fields.Intersection traffic laws are digitalized and classified to construct compliance-oriented potential fields.The PVCI is designed according to theories of autonomous driving ethics.Violation cost potential fields are constructed by truncating compliance-oriented potential fields according to PVCI.A cost function is designed based on compliance-oriented and violation cost fields, integrated with MPC for trajectory optimization and tracking.Simulation tests are performed in the MATLAB/Simulink environment.Results indicate that, in unexpected obstacle scenarios, the proposed algorithm can plan trajectories with relatively lower penalties, achieving obstacle avoidance with a minimal degree of violation, thus ensuring both vehicle safety and mobility.

Figure 1 .
Figure 1.Unanticipated obstacle scenario at intersection inlet lane.(a) The ego vehicle approaches the intersection; (b) the ego vehicle waits in the lane; (c) the ego vehicle is blocked by the obstacle vehicle.

Figure 1 .
Figure 1.Unanticipated obstacle scenario at intersection inlet lane.(a) The ego vehicle approaches the intersection; (b) the ego vehicle waits in the lane; (c) the ego vehicle is blocked by the obstacle vehicle.

Figure 7 .
Figure 7. Vehicle state in normal and SIL testing.(a) Ego vehicle speed.(b) speed difference between normal and SIL testing.(c) ego vehicle steering angle.(d) angle difference between normal and SIL testing.

Figure 7 .
Figure 7. Vehicle state in normal and SIL testing.(a) Ego vehicle speed.(b) speed difference between normal and SIL testing.(c) ego vehicle steering angle.(d) angle difference between normal and SIL testing.

Figure 8 .
Figure 8. Vehicle state in the first comparison test for scenario 1.(a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle.

Figure 8 .
Figure 8. Vehicle state in the first comparison test for scenario 1.(a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle.

Figure 8 .
Figure 8. Vehicle state in the first comparison test for scenario 1.(a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle.

Figure 9 .
Figure 9. Vehicle state in the second comparison test for scenario 1.(a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle.

Figure 9 .
Figure 9. Vehicle state in the second comparison test for scenario 1.(a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle.

Figure 9 .
Figure 9. Vehicle state in the second comparison test for scenario 1.(a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle.

Figure 10 .
Figure 10.Vehicle states in algorithm testing for scenario 1.(a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle; (d) value of PVCI.

Figure 10 .
Figure 10.Vehicle states in algorithm testing for scenario 1.(a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle; (d) value of PVCI.

Figure 12 .
Figure 12.Vehicle states in algorithm testing for scenario 2. (a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle; (d) value of PVCI.

Figure 12 .
Figure 12.Vehicle states in algorithm testing for scenario 2. (a) Paths of ego and obstacle vehicles; (b) ego vehicle speed; (c) ego vehicle steering angle; (d) value of PVCI.

Algorithm 1
Determination of Obstructed Delay Time Input: TrafficLight, Ego, Tgt f , v ego , v tgtf , t now , t stop

Table 2 .
Basic violation propositions and their digital representations.

Table 3 .
Measurement methods of violation degree.

Table 5 .
Parameters of the ego vehicle.

Table 6 .
Vehicle performance in simulation testing.