1 Introduction

Due to the improvement of vehicle perception technology, the ability of vehicles to obtain the surrounding environment information in complex scenarios is far more than human drivers, so the current auxiliary driving system is considered to be an effective way to improve the driving efficiency and driving safety of vehicles. For driving environment perception, many methods have been proposed, Oh et al. [1] proposed a fast occupancy grid filtering method using a grid state diagram, and estimated the occupancy probability of each cell by Bayesian filtering method. Sivaraman et al. [2] used lidar and front camera to obtain 360-degree environment information of vehicles, and a grid model is proposed to represent the driving environment. Yang et al. [3] proposed Video-based spatial distribution data of vehicles to generate fine-grained fusion methods.

In the actual driving process of automatic vehicles, a decision-making system plays an important role in automatic driving when facing the complex external environment and changing traffic state. Therefore, scholars from all walks of life have proposed a variety of methods to solve the problem of autonomous decision-making of automatic vehicles, based on the current research results, it can be argued that the behavioural decision-making techniques for autonomous vehicles fall into two main directions: rule-based decision-making and learning-based decisions. Decision-making models based on learning statistics are able to take full account of the possible uncertainties of autonomous vehicle driving in complex environments. Yuan et al. [4] proposed a pre-processing method with specified time-frequency rules is proposed for more efficient traffic control. Wang et al. [5] used integration of travel speed, traffic flow and rainfall intensity through the proposed deep belief-radial basis function network to predict travel speedFor example, Markov model is a predictive control model, which can take some uncertain factors into account, it is often used to improve the accuracy of automatic vehicle behavior decisions [6]. Wei et al. used Markov model to consider perceptual constraints and surrounding vehicle behavior as attributes to make decisions, which improved the stability of automatic vehicles in a single lane [7]. Brechtel et al. combined the continuous state hierarchical Bayesian transition model with Markov Decision Process (MDP) model to realize that the automatic vehicle can make reasonable decisions in the multi-lane scene [8]. Brechtel et al. took driving decision as a method to solve continuous state Partially Observable Markov Decision Process (POMDP) [9]. In addition, much progress has been made in research work on deep reinforcement learning-based decision models, the driving behavior decision system developed by the NVIDIA company uses an end-to-end neural network [10]. Intel company uses the existing control data training network, taking into account the vehicle straight, left turn, right turn and other control commands, realizes the execution of vehicle behavior such as turning while maintaining the lane [11]. Wang et al. [12] used the successful prediction of traffic flows for heavy, medium and small vehicles contributes to safer and more efficient travel. However, autonomous vehicle decision-making needs to be real-time and accurate in complex traffic scenarios [13]. rule-based decision models are real-time in nature and more focused on achieving functional, each behavior of vehicle can correspond to a state, so many researchers establish some rules to help automatic vehicles make decisions, this method is in line with the logical thinking of the driver, at the same time, it can meet the traffic rules, omit the cumbersome calculation process, and ensure real-time decision-making [14, 15]. Yang et al. [16] used an improved reinforcement learning method to find the best road trajectory. Zhao et al. designed a decision-making system using traffic rules and part of the map information from the knowledge base to make real-time decisions at intersections [17]. In addition, hierarchical finite state machines are an excellent method and are often used to assist in vehicle decision making because of their unique hierarchical judgement structure, which can be transferred to pre-set sub-states. Montemerlo [18] subdivided the vehicle behavior and established a limited state mechanism into decision-making system, in which the states include: initial state, forward driving, vehicle following, obstacle avoidance, and so on. This expands the application scope of the finite state machine and makes the system clearer. Therefore, more scholars applied vehicle behavior as a sub-state in the finite state machine to form a hierarchical state machine [19]. In addition, the layered finite state machine is used to assist vehicle decision-making. Gindele [20] divided the state machine into three layers, wherein the concurrent layered state machine online selection is used to select the operation needed to complete the task. Although the Hierarchical finite state machine can adapt to most scenarios, due to the inevitable uncertainty in the real traffic scenarios, the state transfer between layers is very important and can be further improved [21]. While, few papers put driving efficiency, driving safety, Lane idle rate and other factors into the condition of state transition, so we consider a variety of evaluation indexes combined with a hierarchical state machine to make the autonomous vehicle and make safe and effective decisions on the real road.

The research focus of this paper is to design an automatic driving decision framework including driving safety and driving efficiency based on the existing vehicle perception information and the actual road conditions. We propose a hierarchical finite state machine model with a top-down structure of three-layer of vehicle behavior decisions. Firstly, the traffic state of autonomous vehicles interacting with other vehicles in urban roads is divided into 30 sub-scenes. These scenes are regarded as substates of the top layer of the state machine. The top layer is used to judge the scene of automatic vehicles, and the state transition condition is judged according to the distribution of surrounding vehicles, the middle layer is used to evaluate the possible behaviors of automatic vehicles in the current scene. Here, we divide the behaviors of vehicles in any sub-scene into four categories: lane changing to the left, lane changing to the right, accelerating forward, and decelerating forward, using the improved energy efficiency function, the energy efficiency value of each vehicle behavior is calculated from the three aspects of safety, efficiency, and lane idleness. The state machine set of the lower layer is composed of four kinds of vehicle behaviors, and the vehicle state evolution prediction matrix is introduced, Predict and judge the most reasonable vehicle behavior in the next state, and execute the vehicle behavior. In summary, the main contributions of this work are:

  • Proposed a hierarchical finite state machine decision framework with three-layer;

  • Proposed an improved multi-indicator energy efficiency function;

  • The feasibility of the proposed method is demonstrated through simulation experiments;

The organizational structure of this paper is as follows: Section 2 introduces the research status of vehicle behavior decision-making and the innovation of research methods. In Section 3, the vehicle behavior decision model based on a hierarchical finite state machine is designed for different scenarios. Section 4 introduces the construction of the simulation environment and the test of the decision model and then analyzes and evaluates the results. Section 5 summarizes the thesis.

2 Methodology

The realization of autonomous decision-making for autonomous vehicles is based on three decision layers [22]. This paper proposes a decision-making method for autonomous vehicles performance based on finite state machines (FSM), which enables intelligent decision-making during driving and allows planning the next behavior to be performed by the vehicle based on real-time traffic dynamics.

The implementation of the autonomous driving task planning relies on the simulation of each traffic participating unit in a real traffic scenario, and then a three-layer decision model is used to complete the final behavior planning for each autonomous vehicle. The main problem of planning is to determine the rules for driving decisions and the methods for implementing the decision process.

2.1 Vehicle model establishment

To establish an autonomous driving working condition model and abstract a real autonomous vehicle, the basic features and behavior attributes used to describe the basic behavioral capabilities of the vehicle are extracted, and all the basic features and attributes about the entity are described based on the vehicle dynamics structure, and its actions can also be considered as some rules used to change the properties of the entity. The basic actions of the entity can be divided into two most basic driving behaviors, following and lane changing.

2.2 FSM mission planning model

The FSM model is established for autonomous vehicles in straight lanes and the decisions of the state machine are divided into three layers. Such a decision framework is expressed through collaboration between the three layers, and depending on the actual traffic situation and vehicle state, a decision is made as to which specific vehicle action to perform next, and all tasks are completed only when the decisions at each tier are completed. The FSM model hierarchy is shown in Fig. 1.

Fig. 1
figure 1

Task network diagram

The above behavior planning is a decision-making method based on a finite state machine model to decide which specific task to perform in the task framework. The three task layers can be specifically represented as a scenario decision, an energy efficiency assessment decision and an execution action decision layer, which can make intelligent decisions when performing the task and can match the actual driving situation.

A key issue in behavior planning is how to decide on the next behavior based on the actual traffic situation and the change of its own vehicle state, to achieve the purpose of decision making and reasoning. The different states in the above decision framework are regarded as different situations of the autonomous vehicle in the actual traffic scenario, and are expressed in the specific decision method of the state machine: the first layer judges the scenario of the vehicle in the straight-line section by the distribution of the surrounding vehicles perceived by the autonomous vehicle, the second layer evaluates and judges the potential vehicle behavior according to the divided scenario and its own vehicle state, and the third layer manifests itself in the form of specific behavior planning. This allows for real-time adjustments to be made based on the traffic situation and the state of the vehicle itself, thus enabling consistent control and planning of the autonomous vehicle in straight sections. The quintet is defined as follows to build a finite state machine decision model at each task level:

$$ M\left(S,\sum, f,{S}_0,F\right). $$
(1)

Here, S means the set of states, in this paper, it can be expressed as a set of task points of all layers, at any certain moment, the FSM can only be in a certain state. Σ means the set of input events or all situations, the FSM can only receive a certain input at any certain behavior. f means a mapping from S × Σ to Σ, in a certain state, the FSM will switch to a new state determined by the state transition function after a given input, such as f(S, R) = S means that the current mission is S, when the situation changed to R, the mission will transfer to the next mission S. S0 is the initial state and F is the final state.

2.3 Top layer scenario decision

All task modes in the task network represent different finite states in a finite state machine. In the execution of the task, to complete the decision, the traffic situation in different scenarios needs to be judged and the energy efficiency values of different vehicle behaviors during the driving process are evaluated by the corresponding indicators in different autonomous driving scenarios to finally plan and predict the vehicle behaviors, thus establishing the state transition table of the FSM. Figure 2 below shows the typical scenario division decision of the top-layer state machine on the distribution of vehicles around the perception of the self-driving vehicle. According to the distribution of vehicles around the perception of the self-driving vehicle, all scenarios are divided into three categories: no vehicle in front, no vehicle on the side, and vehicle on the side, and subdivided into sub-scenarios again on this basis.

Fig. 2
figure 2

Scenario decision of top state machine

2.4 Middle layer energy efficiency assessment

The traffic situation evaluation is performed after the completion of the first layer of tasks. The evaluation results are calculated by collecting the relevant attributes and execution of itself and the surrounding vehicles. By analyzing all sub-scenarios, the energy efficiency values for different potential behavior planning are calculated, taking into account the safety, efficiency and lane availability of the scenario the vehicle is in, and the vehicle behavior with the highest energy efficiency value is selected by conditional judgement.

The driving state of the vehicle can be divided into 3 kinds: the free driving state with the desired speed as the target, the lane change driving state under different acceleration, and the following driving state. Three driving states are required to meet the vehicle driving stability conditions and the lane change, and the following driving state are required to meet the collision safety restriction conditions. Vehicle lane change process, the current lane change vehicle and the target lane vehicle travel trajectory in time and space close to each other, there will be a collision. Therefore, it is a very important part to establish a reasonable collision safety distance model to study the relative states of two vehicles on their respective trajectories from the moment they start lane changing to the moment they finish lane changing. Based on the relative speed of the lane change vehicle and the target lane vehicle as well as the relative distance between the two vehicles and other parameters, the collision safety distance model is established by calculating the minimum safety distance at the critical collision point.

When the automatic vehicle performs the lane change behavior, it is assumed that the adjacent vehicle travels along trajectory 1 and the host vehicle travels along trajectory 2 in Fig. 3. Among them, trajectory 1 is a straight-line driving, and trajectory 2 is selected as a polynomial lane change trajectory model [23]. The body lengths of the two vehicles are also taken into account, and the collision occurs when the two vehicles travel to the position in the figure. Let point A be the collision point, by studying the relationship between the position of two vehicles from the moment of starting lane change to the moment of collision, we can establish the minimum safe distance model.

Fig. 3
figure 3

Scene of vehicle lane changing

According to the relationship between the positions of the two vehicles in Fig. 3, we can establish the safety distance condition to avoid the collision:

$$ \varDelta S+{L}_{\mathrm{H}}+{S}_{\mathrm{H}}\geqslant {S}_{\mathrm{A}}+{L}_{\mathrm{H}}\cos \theta +{W}_H\sin \theta, $$
(2)

where: ΔS is the initial longitudinal relative distance between the host vehicle and the adjacent vehicle at the start of the lane change; SH and SA are the longitudinal displacements of the host vehicle and the adjacent vehicle from the start of the lane change to the completion of the lane change, respectively; LH is the length of the host vehicle, WH is the width of the host vehicle, and θ is the angle between the body of the host vehicle and the horizontal direction at the time of lane change.

Here we consider that the automatic vehicle completes the lane change with a constant longitudinal acceleration, and considering the driving comfort [24], we set −2 m/s2 ≤ aM ≤ 2 m/s2, where the acceleration is zero and the automatic vehicle completes the lane change at a constant longitudinal speed, so Eq. (2) can be rewritten as follows:

$$ {\displaystyle \begin{array}{c}\varDelta S\geqslant {S}_{\mathrm{A}}-{S}_{\mathrm{H}}-{L}_{\mathrm{H}}+{L}_{\mathrm{H}}\cos \theta +{W}_H\sin \theta =\\ {}{V}_{\mathrm{A}}t-{V}_{\mathrm{H}}t-0.5{a}_H{t}^2-{L}_{\mathrm{H}}+{L}_{\mathrm{H}}\cos \theta +{W}_H\sin \theta .\end{array}} $$
(3)

From Eqs. (2) and (3), we can get the critical minimum safety distance between two vehicles without collision when lane change occurs, which we name as MincS1 ), that is, at the initial moment of lane change, the relative distance ΔS between two vehicles satisfies the following equation, and the two vehicles can avoid collision during lane change.

$$ {\mathit{\operatorname{Min}}}_c\left(\ {S}_1\ \right)=\mathit{\operatorname{Max}}\left[{V}_At-{V}_Ht-{L}_H+\left.{L}_H\mathit{\cos}\theta +{W}_H\mathit{\sin}\theta \right]\right.. $$
(4)

Vehicles in the process of changing lanes, the minimum safe distance on the formula (3) as a judgment of the risk of collision between the two vehicles is not reasonable, in the actual driving process will be dangerous, therefore, we set aside a certain safe workshop distance for the automatic vehicle after changing lanes. When the host vehicle changes to the target lane, as the two vehicles follow the driving at a smaller relative speed, we consider here that the distance between the two vehicles is linearly related to the speed of the lane-changing vehicle, thus establishing the safe distance model after lane changing:

$$ {\mathit{\operatorname{Min}}}_c\left({S}_2\right)={V}_A{t}_d+{D}_0. $$
(5)

Where: Minc(S2) is the safety distance after lane change; td is the braking delay time of FA vehicle, generally take 1.2~2 s; D0 is the psychological safety distance of the front vehicle completely stop, generally take 2~5m.

The minimum safety distance model established by the integrated vehicle lane change critical collision point and the post-lane change safety distance model is used to obtain the minimum safety distance model required for safe lane change:

$$ {\mathit{\operatorname{Min}}}_c(S)={\mathit{\operatorname{Min}}}_c\left({S}_1\right)+{\mathit{\operatorname{Min}}}_c\left({S}_2\right). $$
(6)

In the case where the automatic vehicle maintains the lane without changing lanes (the vehicle performs the following behavior), we establish the following model, and the automatic vehicle needs to maintain a safe following distance with the vehicle ahead, and the distance between the two vehicles should be greater than the minimum safe distance of the vehicle ahead under normal braking and emergency braking. Normal braking distance refers to the braking distance of the vehicle ahead under non-emergency conditions in the following process. Emergency braking distance refers to the displacement of the vehicle in front of you when you need to brake urgently. The safe distance for a vehicle to follow the vehicle ahead to avoid collision can be defined as:

$$ {\operatorname{Min}}_f(S)={V}_A^2/\left(2{a}_m\right)-{V}_H^2/\left(2{a}_m\right)+T{V}_A+{L}_{\mathrm{M}}. $$
(7)

Where T is the braking reaction time of the driver under the braking situation of the front vehicle, VA is the current speed of the automatic vehicle, VM is the speed of the nearest vehicle ahead, and am is the braking deceleration speed of the front vehicle. For the braking capacity of most vehicles, the maximum deceleration speed of the vehicle is generally 7.5 ∼ 8m/s2, and the ordinary braking deceleration speed is generally 3 ∼ 4m/s2. The ideal state of the vehicle after following the stable vehicle is that the front and rear vehicles keep a safe shop distance at all times.

In addition to the driving safety risks mentioned above, an actual vehicle behavior decision framework should also consider the following decision attributes in the context of safety: travel efficiency and lane occupancy. The travel efficiency is based on the comparison of the current travel speed of the autonomous vehicle with the desired travel speed of the vehicle. To achieve the optimal choice of automatic vehicle behavior under different vehicle interaction scenarios, this paper introduces an energy efficiency function U based on the evaluation of safety, efficiency and lane availability, where U1 reflects the assessment of vehicle driving safety risk, and U2 and U3 are judged from driving efficiency and lane occupancy. Through the analysis of the above three indicators, an assessment of the rationality of the automated vehicle behavior can be achieved, and we set:

$$ {U}_1=\left\{\begin{array}{cc}{V}_{\mathrm{H}}/{V}_{\mathrm{set}},& \mathrm{if}\ {V}_{\mathrm{H}}<{V}_{\mathrm{set}},\\ {}1,&\ \mathrm{if}\ {V}_{\mathrm{H}}\ge {V}_{\mathrm{set}}.\end{array}\right. $$
(8)

Where: VH indicates the actual speed of the vehicle and Vset indicates the set ideal speed of the automatic vehicle.

The closeness of the distance between the automatic vehicle and the target vehicle can reflect the degree of danger in the process of driving the vehicle, here, the safety distance model Min(s) is chosen as Minc(S) and Minf(S) respectively according to the vehicle behavior, lane-changing or lane-keeping.

$$ {U}_2=\left\{\begin{array}{cc}\frac{\mathit{\operatorname{Min}}(S)-\varDelta X,}{\varDelta X,}&\ \mathrm{if}\ \varDelta X<\mathit{\operatorname{Min}}(S),\\ {}1&\ \mathrm{if}\ \varDelta X\ge \mathit{\operatorname{Min}}(S).\end{array}\right. $$
(9)

Equipped with on-board GPS and front/rear/left/right radar and high-performance sensors, the autonomous vehicle can detect the driving speed of neighbouring vehicles within 360 degrees of the vehicle and the relative position information with its own vehicle. Using the sensing ability of the automatic vehicle, the external traffic environment information is extracted, combined with the lane line information to limit the effective travelling area, and the potential passing path is planned based on the virtual drawn cross grid, dividing the adjacent lane as well as its own lane into nine areas, which are left, right, front and rear, left front, right front, left rear and right rear eight potential driving directions of the automatic vehicle, under the premise of ensuring that each grid (called driving cell) obtained by equal division can accommodate the driving vehicles, the longitudinal length of the grid is set to 9 m and the transverse length is the lane width (3.5 m). Each cell obtained after the equipartition of the straight lane is shown in Fig. 4. Using the estimation method of cell probability, assuming that each vehicle can fall in a cell, two states of busy and idle are assigned to the cell according to whether the vehicle falls in the cell or not, and the busy/idle state of three cells of each lane is used to calculate the whole lane idle rate as follows:

$$ {U}_3=\Big\{{\displaystyle \begin{array}{cc}\frac{n}{3}&\ \mathrm{if}\ Lane\ is\ busy,\\ {}1&\ \mathrm{if}\ Lane\ is\ free.\end{array}}\operatorname{} $$
(10)
Fig. 4
figure 4

Situation distribution of lanes around vehicles

Here n is the number of free cells in the lane.

So far, energy efficiency functions based on efficiency, safety and lane availability have been constructed. In the process of solving multi-attribute decision problems, we use weight values to quantify the relative importance between attributes, which also allows both traffic safety and access efficiency considerations to be considered together to create a multi-dimensional evaluation method. The hierarchical analysis is a multi-objective decision analysis method that combines qualitative and quantitative analysis methods. The main idea of this method is that by decomposing a complex problem into several levels and factors, making a comparative judgement on the importance between two indicators, establishing a judgement matrix, and by calculating the maximum eigenvalue of the judgement matrix and the corresponding eigenvector, the weights of the importance of different solutions can be derived, providing a basis for the selection of the best solution [25], we used classical hierarchical analysis to determine the decision matrix, giving higher subjective weights to the safety indicators of the vehicle, In order to integrate the three indicators more intuitively, with a maximum energy efficiency value of 1 for each indicator, we multiplied the final weight value by a scale factor of 3 to obtain the coefficient ω = [0.6 1.68 0.72].

$$ U=\sum \limits_{i=1}^3\kern0.1em {\omega}_i{U}_i. $$
(11)

The energy efficiency function can be used to reflect the evaluation of each potential behavior of the automatic vehicle, and the energy efficiency values of the four potential behaviors are represented by UA , UBUC , UD respectively. By comparing the energy efficiency values of different vehicle behaviors, the current optimal driving decision can be judged in real-time.

2.5 Lower layer action decision

The following FSM state transfer table can be created based on the evaluation results of the mid-layer state machine and the potential behavior nodes in the subsequent stages. The table defines the rules for vehicle behavior transfer, i.e., all potential vehicle behaviors in the current state of the vehicle and the next state under different scenarios and different risk situations. To avoid confusion, the energy efficiency value U obtained from the evaluation of potential vehicle behaviors in the previous section is represented in this table by R. Each potential state corresponds to an evaluation value R. For example, a scenario is randomly selected to build a behavior transition table that contains three stages after the initial moment, each with four potential behavior nodes, as shown in Table 1.

Table 1 Static conversion table of FSM

Where S0 represents the initial behavior node, A1 , B1C1 , D1 represent the four potential behavior nodes in the first stage (t1) after the initial moment, A2 , B2C2 , D2 represent the four potential behavior nodes in the second stage (t2), etc. The specific behavior implementation is in the order of vehicle acceleration, right lane change, left lane change and deceleration. If the vehicle is currently in one of the identified nodes, the value of this node is set to 1 and the others are set to 0. For example, if A1 = 1, then the vehicle performs an acceleration behavior at the current moment and B1 = C1 = D1 = 0. R1, R2, R3 and R4 represent the results of the evaluation of the vehicle behavior in the next phase. If the highest energy efficiency value for the next phase is R2 according to the evaluation of the middle-layer state machine, then R2 = 1, R2 = R3 = R4 = 0, and the vehicle behavior performed is a right lane change.

The state transition table can be expressed by matrix. According to Table 1, the matrix can be expressed as follows:

$$ P=\left[\begin{array}{cccc}{A}_1& {B}_1& {C}_1& {D}_1\\ {}{A}_2& {B}_2& {C}_2& {D}_2\\ {}{A}_2& {B}_2& {C}_2& {D}_2\\ {}{A}_2& {B}_2& {C}_2& {D}_2\\ {}{A}_2& {B}_2& {C}_2& {D}_2\\ {}{A}_3& {B}_3& {C}_3& {D}_3\\ {}{A}_3& {B}_3& {C}_3& {D}_3\\ {}{A}_3& {B}_3& {C}_3& {D}_3\\ {}{A}_3& {B}_3& {C}_3& {D}_3\end{array}\right]. $$
(12)

Let the current state, i.e., the current behavior node, be S and the energy efficiency evaluation matrix be Ri. The next state S can be calculated by:

$$ S={S}^{\prime}\cdotp P\cdotp {R}_i^T. $$
(13)

For example, if the current task is at the second node of the first phase, i.e., C1, the current state can be expressed as:

$$ {S}^{\prime }=\left[0\ 0\ 0\ 1\ 0\ 0\ 0\ 0\ 0\ \right]. $$
(14)

And assume that the current scenario under the best risk assessment conforms to the R3, the situation can be expressed as:

$$ {R}_3=\left[0\ 0\ 1\ 0\right]. $$
(15)

So, the next task is:

$$ S={S}^{\prime}\cdotp P\cdotp {R}_3^T={C}_2. $$
(16)

We can see from the above that the next task is transferred to C2, which is the second node of the second layer. The specific planning task is to change the lane left at the next moment.

3 Simulation evaluation in typical scenarios

Prescan is used to build a simulation traffic scene, and a three-lane road with a width of 3.5 m and a length of 300 m is designed. At the same time, to increase the visual effect and the sensor authenticity of automatic driving vehicles in complex weather, trees and buildings elements are added on both sides of the road to make the scene more like the urban road environment. According to the four consecutive typical lane changing scenarios randomly selected in Fig. 2 above, eight dynamic and free driving automatic vehicles are placed in the traffic scene as the research vehicles, in which the prescan’s own vehicle dynamics model is added to all vehicles, in addition, sensors are added to the front of the simulation model to detect the position and speed of the vehicle in front.

Figure 5 is a total traffic scene composed of four continuous static sub-scenes. Due to the changes of surrounding vehicles, the scene of the research vehicle changes dynamically. Furthermore, to analyze the robustness of our proposed decision model in dynamic and complex scenes, we set up autonomous vehicles with different penetration rates, this can make the vehicle driving more random in the scene, and make the decision model better deal with the complex traffic scene.

Fig. 5
figure 5

Prescan simulation experiment scene

After the traffic scenario is built, a hierarchical finite state machine model can be constructed by running MATLAB/Simulink directly through prescan. The finite state machine is divided into three layers, the top layer, the middle layer and the bottom layer, the top layer state machine is used to judge the scene it is in, its state is the sub-scene divided above, the state transfer condition is judged according to the surrounding vehicle distribution, and this scene information is passed to the middle layer state machine as the output. The state transfer condition is determined according to the surrounding vehicle distribution, and this scene information is passed to the intermediate layer state machine as output. Each top-level state machine outputs a scene corresponding to an intermediate level state machine, which is used to filter out the vehicle potential behaviors with the highest energy efficiency value based on the energy efficiency value calculated from the relative speed and relative distance of the surrounding vehicles, and whose state is the best energy efficiency value of the vehicle potential behaviors for each sub-scene. The mid-layer state machine passes the filtering results as output to the behavior matrix derivation module. For the underlying state machine, the state information is straight ahead acceleration, straight-ahead deceleration, lane change to the left, lane change to the right, and the state transfer condition is the result of the state matrix deduction above, which is converted into a specific vehicle action after judgement, and finally, the decision information is output to the vehicle dynamics model. The self-driving vehicle behavior decision model is thus basically built, as shown in Fig. 6a of the decision framework execution process. The whole simulation model includes the traffic environment module, vehicle dynamics module, vehicle state output module, GPS inertial navigation radar module, control strategy execution module and speed control module. The simulation model framework shown in Fig. 6b is obtained.

Fig. 6
figure 6

Schematic diagram of the simulation establishment. a FSM model architecture. b Simulation model framework

According to the above-built simulation traffic scene, the driving results of the automatic vehicle based on the finite state machine decision are verified, as shown in Fig. 7 below. During the driving process, the vehicle ensures its own safety and stability through a series of decisions such as lane change, acceleration, deceleration, etc.

Fig. 7
figure 7

Simulation result of Vehicle behavioural decisions. a Automatic vehicle trajectory. b Automatic vehicle decision point

Two typical scenarios in Fig. 2 above are selected for analysis, and the simulation results shown in Figs. 8 and 9 are obtained, and mainly include: (a) Traffic scene of three lanes in the same direction; (b) The energy efficiency assessment chart of the ego vehicle under different accelerations in different lanes and the optimal point obtained by the decision method (d) Path-speed planning results based on the optimal point, c-1, c-2, c-3, c-4 are the lateral position, longitudinal position, speed and acceleration respectively.

Fig. 8
figure 8

Simulation result of normal driving scenario. a Road scene. b Energy efficiency assessment map. c Trajectory plan

Fig. 9
figure 9

Simulation result of normal driving scenario. a Road scene. b Energy efficiency assessment map. c Trajectory plan

Figure 8 shows that the main vehicle runs normally in three lanes in the same direction, and the initial speed is 21m/s. front vehicle a and right-front vehicle B drive at a constant speed of 18m/s without acceleration. Considering the large relative speed between the main vehicle and the vehicle in front, the main vehicle attempts to change the current state to ensure the expected speed of 23m/s. It can be seen from Fig. 6 that the vehicle generates decision point 1. According to the energy efficiency assessment diagram in Fig. 8b, the main vehicle can turn left to achieve the highest energy efficiency income. The planning results are shown in Fig. 8c, the host vehicle completes lane change with an acceleration of 2 m/s2. After lane change, the driving speed reaches 24.5m/s. The results of longitudinal displacement and transverse displacement are shown in the figure.

Figure 9 shows that the main vehicle runs normally in three lanes in the same direction, and the initial speed is 21m/s. vehicle A in front of the left, vehicle B in front and vehicle C in front of the right drive at a constant speed of 18m/s without acceleration signs. Considering the relative speed and relative position between the main vehicle and the vehicle in front, the main vehicle should change the current state to reduce risks and ensure safety. As can be seen from Fig. 7 above, the vehicle generates decision point 5. According to the energy efficiency assessment diagram in Fig. 9b, the main vehicle can achieve the maximum energy efficiency benefits by taking appropriate deceleration. The planning results are shown in Fig. 9c, the main vehicle decelerates and follows the vehicle with an acceleration of −2 m/s2. After the following behavior is completed, the driving speed reaches 18 m/s. The results of longitudinal displacement and transverse displacement are shown in the figure.

4 Conclusion

This paper presents an automatic decision-making systemetic framework for vehicle behaviour based on hierarchical finite state machines. The entire state machine decision framework is divided into three layers. The top layer state machine determines the scenario in which the main vehicle is located based on information about the surrounding vehicles. The middle layer state machine uses an improved energy efficiency function to evaluate the energy efficiency values of potential vehicle behaviour and determine the optimal energy efficiency value. The lower layer state machine combines the state transfer matrix to derive the optimal driving strategy for the autonomous vehicle at the next point in time. The decision framework proposed in this paper is based on autonomous vehicles equipped with high performance sensors that can flexibly adapt the vehicle driving strategy to the surrounding environment to cope with changing traffic conditions in real driving situations. The simulation results show that the proposed self driving vehicle behavior decision-making framework can achieve correct decision-making in complex road scenes, comprehensively consider driving safety and traffic efficiency, and select the best driving strategy. When the main vehicle is in the speed position with the surrounding vehicles to ensure safe driving and the main vehicle does not reach the expected passing speed, in our decision-making process, we can select the path and speed most in line with the expected speed. Compared with the decision-making considering only the safe distance, the transmission efficiency is improved by 16.7%. This paper focuses on the analysis of optimal decisions made by automated vehicles in the face of complex traffic situations, but the current approach has certain limitations that will be addressed in future work: 1) the specific trajectory and speed planning of vehicle lane changes are not analyzed and calculated; 2) the weight distribution of the indicators needs to be more reasonable. In future work, we will further study vehicle trajectory prediction as well as trajectory tracking, and more in-depth research on the weight selection of indicators, and consider using game theory to analyze each indicator to improve our decision and planning framework, so that the framework decision is more accurate, safe and efficient, and it is more in line with the thinking logic of drivers in actual driving.