Keywords

1 Introduction

Autonomous driving refers to self-driving vehicles that sense the environment and make decisions by their own without the involvement of a human driver. Autonomous driving has been one of the keen areas of research for the past few decades due to its ability to enhance the safety and efficiency of transportation system.

Trajectory planning has a critical role in autonomous driving technology, and it is one of the major challenges that must be addressed. In the real-world scenario, the autonomous vehicles must navigate autonomously and take intelligent decisions. The vehicle must determine a path for travel from the data it collected from the static and dynamic environments. Then, the trajectory planning is done to obtain an optimal path for the smooth movement from the source to destination achieving certain constraints. It is really important and hard to generate a path that is optimal at the same time meet the real-time requirements. Path planning involves searching and computation of optimal collision-free paths. The feasible path of the autonomous vehicle is generated considering the vehicle geometry, its surroundings, kinematic controls, etc.

The central idea of this chapter is to design a trajectory planning technique that can automatically generate an optimal path from the start to the goal position. Figure 1 shows the lane-changing process by autonomous vehicle, say ego vehicle, while avoiding obstacle. The obstacle avoidance trajectory must consider the safety criteria, mainly the longitudinal and lateral distances with the obstacles. To generate the optimal path, this chapter proposes a meta-heuristic Dragonfly Algorithm (DA). It is based on swarming behaviours of the natural dragonflies [1, 2]. Several researches have been done in trajectory planning for autonomous vehicles, and most of them are based on the searching techniques [3, 4]. But, these techniques have failed in considering obstacle avoidance behaviour.

Fig. 1
figure 1

Lane-change scenario

2 Related Works

The lane-changing behaviour is essential to perform different driving activities such as road merging, entry and exit to a highway, vehicle overtaking, etc. [2]. Several studies have been done to meet the trajectory planning problem for the lane changing in different areas. The major challenge in generating a trajectory is to ensure the feasibility while considering the different constraints. Different optimization algorithms have been applied to trajectory planning problem in recent years. The commonly used algorithms are Ant Colony Optimization [5], Genetic Algorithms [6], Particle Swarm Optimization [7], etc.

In global planning approach, a path is generated from the initial position to the end position from the prior information about the environment. Several methods have been used for global planning such as A* algorithm [8], RRT algorithm [9] and Dijkstra’s algorithm [10]. Major drawback of these algorithms is that the whole trajectory calculation process is very time consuming. Therefore, these algorithms are not suitable for trajectory planning of real-time applications such as autonomous vehicles where the obstacles are mainly dynamic.

Local trajectory planning techniques are widely used in most of the real-time applications. These approaches calculate the trajectories for a limited time window, which considers the environment conditions. Several geometric algorithms are used for the local trajectory planning such as splines [11], Bezier curves [12], Clothoid curves [13, 14], etc. These methods generate smooth trajectories by connecting the waypoints for the navigation of the vehicles. But, these methods also suffer from long computation time. Sigmoid curve–based approach is used in [15] for local trajectory planning for obstacle avoidance behaviour. The safe space between the autonomous vehicle and the obstacles is also taken into consideration.

A collision-free trajectory planning method using B spline and RRT-based method is used to improve the robustness of motion planning in autonomous vehicles [16]. Still there exists a timeout possibility. A non-linear Model Predictive Control approach for vehicle navigation is suggested, which considers collision-free trajectory [13]. It generates a dynamic obstacle avoiding trajectory planning with certain constraints. It failed to study the random movement of moving obstacles. The real-time motion planner is proposed in [17, 18]. A number of vision-based approaches are also applied to path planning problems [19, 20].

In this chapter, Dragonfly algorithm is proposed for optimizing the vehicle trajectory. It is a new approach that has powerful capabilities to solve different optimization problems. Studies have shown that DA performs better compared to PSO and gains several multimodal test functions [21]. This approach has several advantages, which makes it suitable for real-world applications:

  1. 1.

    Convergence is guaranteed during optimization since the weights are changed adaptively.

  2. 2.

    It always converges to the global optimum.

  3. 3.

    Randomness can be added to the algorithm.

3 Proposed Method

This chapter proposes a trajectory planning method that generates an optimal collision avoidance trajectory for the autonomous vehicle using Dragonfly Algorithm (DA). Dragonfly algorithm is an optimization technique, which was proposed by Seyedali Mirjalili in 2015. It is based on the static and dynamic grouping behaviour of biological dragonflies, which mimics the different phases of optimization and can be employed to solve a wide range of optimization problems [21]. Dragonflies are small insects that hunt and eat other small creatures like butterflies, bees etc. [22]. Dragonflies have a unique swarming behaviour. They form groups only for two reasons: hunting and migration [23].The swarm formed for hunting is known as static (feeding) swarm and the swarm formed for relocation is known as dynamic swarm. The static and dynamic swarms [21] are illustrated in Fig. 2.

Fig. 2
figure 2

Dynamic and static dragonfly swarms

In static swarm, small groups of dragonflies move forward and backward to hunt other flying insects. A swarm is dynamic where a huge number of dragonflies are grouped to move in a single direction over a long distance. These dynamic and static swarms compose the exploitation and exploration stages of DA. These two behaviours are in accordance with the meta-heuristic stages [21].

The dragonfly individuals exhibit five primitive behaviours which can be used to model the swarm behaviour. The dragonflies exhibit five properties, which are shown in Fig. 3 [21]. Each of the behaviour of the dragon flies are modelled as follows [21]:

  1. 1.

    Separation (Si ) represents the operation to avoid collisions that the individuals follow with other individuals in the region. It is calculated as [21]:

Fig. 3
figure 3

Behaviour of dragonflies

$$ Si=-\sum_{j=1}^NX-Xj $$
(1)

where X is the location of the dragonfly, Xj is the location of jth nearest individual, and N is the number of nearby individuals.

  1. 2.

    Alignment (Ai) represents the dragonfly’s velocity which matches with the other nearby dragonflies of the same group. It is calculated as [21]:

$$ Ai=\frac{\sum_{j=1}^N Vj}{N} $$
(2)

where V j represents the velocity of the jth dragonfly.

  1. 3.

    Cohesion (Ci) is the tendency of the individual to move towards the centre of the group. It can be calculated as [5]:

$$ Ci=\frac{\sum_{j=1}^N Xj}{N}-X $$
(3)
  1. 4.

    Attraction (Fi) represents the attraction towards food source and can be represented as [5] :

$$ Fi={X}^{+}-X $$
(4)

where F i represents the food source of the ith individual.

  1. 5.

    Distraction (Ei) is the distraction from enemies and is represented as [5]:

$$ Ei={X}^{-}-X $$
(5)

where E i denotes the location of the enemy of the ith dragonfly

The step vector ∆X and the position X can be used to update the location of the dragonflies in the search domain. The update is done as follows [21]:

$$ \Delta {X}_i^{t+1}=\left(s{S}_i+a{A}_i+c{C}_i+f{F}_i+e{E}_i\right)+\omega \Delta {X}_i^t $$
(6)

where s, a and c represent the weights for separation, alignment and cohesion, respectively. F is the food factor, e is the enemy factor, ω is the inertia weight and t is the iteration vector. The location of the ith dragonfly at (t + 1) is revised as [21]:

$$ {X}_i^{t+1}={X}_i^t+\Delta {X}_i^{t+1} $$
(7)

The radius of the neighbouring space increases as the algorithm progresses. If the dragonfly has no neighbours, then the position and velocity are updated using Levy flight technique, which is a variation of the random walk process to apply randomness to the position and velocity of dragonflies. The update can be performed as [5]:

$$ {X}_i^{t+1}={X}_i^t+\mathrm{levy}(d)\times {X}_i^t $$
(8)

3.1 Modelling of Objective Functions for Path Planning

The main objective considered in this chapter is to navigate the autonomous vehicle in a road with different obstacles. The vehicle should sense the surroundings for obstacles and avoid them while reaching the destination with optimal smooth trajectory.

The problem of trajectory planning is considered as a minimization problem and two objective functions are considered in this chapter. The first function helps the vehicle to traverse to the destination avoiding the obstacles and second enables it to obtain a short smooth trajectory. The algorithm chooses the best path from the several paths for the vehicle to travel.

When the vehicle reaches the obstacle, the sensors detect it and the range of the obstacle is calculated. Dragonfly algorithm is then initiated to avoid the collision. It will find the best next position avoiding the obstacle while reaching the goal. The food source gives the optimal path for the ego vehicle to move. The position of the ego vehicle is updated as Eq. (6). The best approximations are stored and retrieved by an archive. The food source of the dragonfly is chosen from the archive. Therefore, the food source is always a good candidate solution. Therefore, the quality of the food source is proportional to the optimal path length. The next position of the ego vehicle always depends on the distance between food source and goal and the obstacle. The important factors considered here are obstacle avoidance behaviour and goal-finding behaviour.

The collision avoidance is modelled using obstacle avoidance behaviour. The position of the food source is selected as the global best path, which satisfies the safety criteria of the system by maintaining the maximum distance between the ego vehicle and the obstacle. The objective function can be calculated as the Euclidean distance between the best position and the obstacle in the environment [23].

$$ {\mathrm{Distance}}_{ob j-F}=\sqrt{{\left({X}_{ob}-{X}_{Fi}\right)}^2+{\left({Y}_{ob}-{Y}_{Fi}\right)}^2} $$
(9)

where (X ob, Y ob) gives the position of the obstacle and (X Fi, Y Fi) gives the location of the food source.

The nearest obstacle to the vehicle is calculated as [23]:

$$ {\mathrm{Distance}}_{Obj-V}=\sqrt{{\left({X}_{ob}-{X}_V\right)}^2+{\left({Y}_{ob}-{Y}_V\right)}^2} $$
(10)

The food source must be kept at the minimum distance from the goal. The food source gives the global best position. The goal-finding behaviour can be calculated as the Euclidean distance between the food source and the goal. It can be represented as [23]:

$$ {\mathrm{Distance}}_{G-F}=\sqrt{{\left({X}_G-{X}_{Fi}\right)}^2+{\left({Y}_G-{Y}_{Fi}\right)}^2}\kern0.75em $$
(11)

These two behaviours can be combined to find the objective function of the system. It can be represented as [23] :

$$ \mathrm{Objective}\ \mathrm{function}=C1.1/\left(\min \left({\mathrm{Distance}}_{OB-F}\right)\right)+c2.{\mathrm{Distance}}_{G-F} $$
(12)

where C1 and C2 are the fitting parameters, and they have a huge influence on the optimal trajectory.

3.2 Algorithm

The pseudo-code for the trajectory planning is given in Algorithm 1.

4 Simulation Results

The proposed TP_Dragonfly algorithm for trajectory planning is simulated using Matlab. The lane-changing scenario is evaluated using the real data from the NGSIM (Next Generation Simulation) dataset. Next Generation Simulation (NGSIM) program is the project by US Federal Highway Administration and is collected by detailed vehicle trajectory data on southbound US 101 and Lankershim Boulevard in Los Angeles. The data from the NGSIM dataset provides real traffic information such as vehicle velocity, position, acceleration, lane, etc. This data is used for studying the features of lane-changing process and for validating the lane-changing models.

In the simulation, the positions, velocities and accelerations of ego vehicle and other vehicles including the obstacles are obtained from NGSIM dataset, and the optimal trajectory is generated by the proposed model. For each time step, the proposed method plans the trajectory of the ego vehicle dynamically. Figure 4 shows the trajectory planning using the proposed TP_Dragonfly algorithm.

Fig. 4
figure 4

Schematic diagram showing activation of TP_Dragonfly Algorithm

This proposed method can be applied for both static and dynamic obstacles. When the ego vehicle senses a static obstacle, it starts changing the lane considering the safety criteria. But for the dynamic obstacles, when the speed of the ego vehicle is greater than the speed of the dynamic obstacle in front, then the ego vehicle starts the lane change. The ego vehicle follows the reference path until it senses the obstacle. When the vehicle detects the obstacle, then the TP_Dragonfly algorithm is activated to find an optimal path that avoids the obstacle. TP_Dragonfly algorithm calculates the next best position based on the objective functions and move forward avoiding the obstacle and reaches the destination.

The parameters used for simulation are shown in Table 1.

Table 1 Parameter values selected for TP_Dragonfly

The efficiency of the proposed TP_Dragonfly algorithm relies on the accuracy of approximations of the parameters.

The proposed method can be validated using different lane-changing behaviours existing in the real world. The overtaking behaviour can be shown from the data given in the NGSIM dataset. This NGSIM data can be used to verify the efficiency of the proposed approach.

When the ego vehicle senses a static obstacle, it changes the lane to avoid collision. It initiates TP_Dragonfly algorithm to obtain the optimal path. Figure 5a and b shows the lane-changing behaviour of ego vehicle when a static obstacle is encountered.

Fig. 5
figure 5

Lane-change scenario for static obstacle

When the speed of the ego vehicle is higher than that of the vehicle in front, the ego vehicle slowly changes the lane just before it approaches the vehicle in front. This vehicle is identified as a dynamic obstacle by the ego vehicle sensors, and it starts choosing a lane-change process by initiating TP_Dragonfly algorithm to generate an optimal path. Figure 6a shows the lane-changing behaviour of ego vehicle when it senses a dynamic obstacle.

Fig. 6
figure 6figure 6

(a) Lane-change scenario for dynamic obstacle. (b) Lane-changing scenario for dynamic obstacle. (c) Lane-change scenario for dynamic obstacle. (d) Lane-change scenario for dynamic obstacle

Figure 6b shows the overtake scenario for the vehicle from the NGSIM dataset. The change of the speed of ego vehicle shows that the lane change adjusts the speed dynamically to adapt the change in the velocity of other vehicles.

The lateral positions and lateral velocity of the ego vehicle while changing the lane when sensing a dynamic obstacle are shown in Figs. 6c and d.

Figure 7 shows the lane-change trajectories generated by the proposed method and by the NGSIM data for the vehicle id 456 in NGSIM data. The vehicle detects a static obstacle, and it decides to change the lane. It is clear that the proposed method generates the optimal path.

Fig. 7
figure 7

Comparison of the trajectories generated for static obstacles

The Fig. 8 compares the lane-change trajectories for vehicle taken from the NGSIM data for the vehicle id 466 in NGSIM data, which changes the lane as a result of the presence of moving obstacle. The ego vehicle moves at a speed of 60 km/h, and the obstacle vehicle moves at a speed of 45 km/h. The trajectory generated by the proposed method shows that it outperforms the real trajectory.

Fig. 8
figure 8

Comparison of the trajectories generated for dynamic obstacles

The results show that the lane-change behaviour while sensing an obstacle in the current lane works well for the proposed TP_Dragonfly algorithm, which generates the optimal trajectory for lane change.

4.1 Influence of the Fitting Parameters on the Trajectory

Two fitting parameters C1 and C2 are used for the objective functions, and they have direct influence on the trajectory of the ego vehicle. The larger C1 value makes the vehicle move away from the obstacle and a smaller value makes it collide with the obstacle. The fitting parameter C2 decides the probability of the vehicle to reach the goal in optimal path. If C2 is large, there is high probability that the vehicle reaches the goal through an optimal path else it generates larger paths. The fitting parameters decide the convergence of the objective function, and the optimal values of these parameters eliminate the local minima. In this chapter, the fitting parameters are selected by trial and error. Figures 9 and 10 show the effect of C1 and C2 on the generated trajectory.

Fig. 9
figure 9

Effect on fitting parameter C1 on trajectory

Fig. 10
figure 10

Effect on fitting parameter C2 on trajectory

5 Conclusion

This chapter proposes an optimal trajectory planning technique for autonomous vehicles using a bio-inspired Dragonfly algorithm. The lane-change behaviour of the autonomous vehicles on approaching an obstacle is studied, and an optimal trajectory is generated for navigation to the goal for both static and dynamic obstacles. The simulation results show that this approach is feasible in the generation of optimal path for real-time data. The influence of fitting parameters on the trajectory is also investigated.