Professional Documents
Culture Documents
A Real-Time Motion Planner With Trajectory Optimization For Autonomous Vehicles
A Real-Time Motion Planner With Trajectory Optimization For Autonomous Vehicles
A Real-Time Motion Planner With Trajectory Optimization For Autonomous Vehicles
Autonomous Vehicles
Wenda Xu, Junqing Wei, John M. Dolan, Huijing Zhao and Hongbin Zha
Abstract— In this paper, an efficient real-time autonomous were designed aggressively to win the race, rather than being
driving motion planner with trajectory optimization is pro- focused on the trajectory’s quality and human acceptance.
posed. The planner first discretizes the plan space and searches In recent years, commercial driving safety assistance sys-
for the best trajectory based on a set of cost functions. Then
an iterative optimization is applied to both the path and speed tems such as adaptive cruise control and lane assist systems
of the resultant trajectory. The post-optimization is of low have been widely used in high-end volume-produced cars.
computational complexity and is able to converge to a higher- These systems are helpful in reducing accidents caused by
quality solution within a few iterations. Compared with the distractions, drowsiness or driver error. However, they cannot
planner without optimization, this framework can reduce the perform complex driving behavior such as dealing with
planning time by 52% and improve the trajectory quality. The
proposed motion planner is implemented and tested both in merging vehicles, circumventing other cars, or responding
simulation and on a real autonomous vehicle in three different intelligently to unexpected dynamic obstacles. Also, these
scenarios. Experiments show that the planner outputs high- systems still need constant human supervision.
quality trajectories and performs intelligent driving behaviors. Trajectory generation: Trajectory generation for au-
tonomous vehicles in road scenarios needs to consider
three constraints: kinematic, dynamic, and road shape. More
I. I NTRODUCTION
specifically, the rate of change of curvature and acceleration
A. Background should be continuous in the commanded trajectory to make
In the last few decades, researchers have put considerable sure the car can execute it. The paths should also conform
effort into autonomous driving. Autonomous vehicles have to the road shape.
great potential to improve the performance and safety of the Kelly and Nagy ([3], [4]) propose an inverse path genera-
transportation system. They can also free people from the tion method, using curvature polynomials to ensure continu-
task of driving, which could save commuters considerable ous rate of change of curvature. Based on Kelly and Nagy’s
time daily. To achieve this objective without affecting exist- method, McNaughton et al. ([5], [6]) present a planner that
ing human drivers on the road, autonomous vehicles need first samples endpoints along the road and then connects
to have human-acceptable driving performance. The planner them using curvature polynomials to make all paths conform
also needs to meet strict real-time requirements to react fast to the road shape. After that, a set of trajectories is generated
enough in emergency situations. In summary, it is important, by specifying different acceleration profiles for each path.
but difficult, to develop a practical high-performance real- Paths generated in [6] can be tracked very well by an
time motion planner for on-road driving. autonomous vehicle. But because the acceleration profile is
not continuous, it is hard for the vehicle to follow the profile
B. Related work accurately and smoothly.
Werling et al. [7] deal with this problem using an alterna-
Autonomous driving Systems: The NAVLAB project at
tive method. They generate the lateral and longitudinal tra-
Carnegie Mellon University (CMU) has built a series of
jectory using quintic polynomials versus time, which ensures
experimental platforms which are able to run autonomously
continuous acceleration. In addition, they use a Frenet Frame
on freeways [1]. In 2007, the DARPA Urban Challenge
referenced to the road center line to combine lateral and
provided researchers a practical scenario in which to test the
longitudinal motion. This makes the trajectory longitudinal
latest sensors, computer technologies and artificial intelli-
coincide with the road shape. However, the curvature of
gence algorithms [2]. Basic interaction between autonomous
every point on each trajectory needs to be computed and
vehicles and human-driven vehicles was proven in low-
verified, which is computationally expensive. Additionally,
density, low-speed traffic. Most planners in the competition
although the curvature is continuous, the sign of the first
This work was supported by NSF Grant CNS1035813 and NSFC Grants derivative of curvature (moving direction of the steering
No.90920304 and No.60975061. wheel) changes very frequently, which leads to jerky steering
Wenda Xu, Huijing and Hongbin Zha are with School of Electronics wheel movement.
Engineering and Computer Science, Peking University, Beijing, China
{xuwenda, zhaohj, zha}@cis.pku.edu.cn Search algorithm: After trajectories are generated, search
Junqing Wei is with the Department of Electrical and Computer algorithms are often applied to find the optimal result.
Engineering, Carnegie Mellon University, Pittsburgh, PA 15213, USA Searches in state lattice planners are usually based on
junqingw@cmu.edu
John M. Dolan is with the Robotics Institute, Carnegie Mellon University, heuristics (e.g. A* and ARA* [8]) or sampling (e.g. RRT
Pittsburgh, PA 15213, USA jmd@cs.cmu.edu [9]). For heuristic-based algorithms, a good estimate of cost
evaluated in Section II-C and Section II-D. Implementation
Cost Function
details of the motion planner in a real autonomous vehicle
Path Set
are given in Section III. Section IV focuses on motion
Trajectory Set
The Best planner performance evaluation in both simulation and on-
Trajectory road testing.
Velocity Set
II. A LGORITHM F RAMEWORK
The framework of the proposed real-time motion planner
Path Optimization Speed Optimization is shown in Fig. 1. It consists of two parts, trajectory planning
and trajectory optimization. In the first step, the path edges
are generated using the method described in [3]. Speed sets
Fig. 1: Two-part trajectory planning framework. are then generated for each path edge. After that, a set of cost
functions is applied to each trajectory and the best trajectory
from any vertex to the goal is essential. But the planning is selected. The resultant trajectory is then passed to the
problem for autonomous driving is complicated. Especially optimization module, where the path and speed are iteratively
when there are dynamic obstacles, it is very difficult to find optimized using a randomly-oriented simplex optimization
an appropriate heuristic that is suitable for all scenarios. algorithm [13].
Some incremental replanning algorithms (e.g. D* Lite
A. Trajectory generation
[10]) are widely used in robotics navigation, but they only
work for typical planning problems with one fixed goal, Path and speed edges are generated separately. Then, by
while in on-road scenarios the goal is changing all the time. combining the path edges with the speed edges, a trajectory
For sampling-based methods (e.g. RRT [9]) the results are set is obtained.
often not smooth enough for the car to execute. 1) Path generation: Paths are generated by connecting
In addition, because of the existence of dynamic obstacles, sampled endpoints using different kinds of curvature poly-
time needs to be included in the search state space as an addi- nomials. The sampling method in our planner is the same
tional dimension. This makes the search space exponentially as that in [5]. However, instead of cubic, quartic curvature
increase, which leads to a low efficiency of the search-based polynomials are used to ensure that the curvature change rate
algorithm. Therefore, in this paper we apply a discretization at the start point of each planning cycle is continuous.
of the state space, then simply apply a straightforward and a) Endpoint sampling: To generate the vertices (end-
fast exhaustive search. points) for each path, a sampling mechanism is implemented.
Optimization method for planning: Dolgov et al. [11] The function for the road center line is given as:
present a conjugate gradient method to smooth the prior ~r(`) = [xr (`) yr (`) θr (`) κr (`)] (1)
result, which is the path. However, the speed of the vehicle
is not planned or optimized. Therefore, this algorithm does In (1), ` is the longitudinal offset, also called station.
not work well in on-road environments, where speed is We can define a point p~(`, d) away from the road center
very important for driving, especially dealing with dynamic at a given longitudinal offset ` and lateral offset d as
obstacles. Zucker et al. [12] propose a gradient optimization p~(`, d) = [xp (`, d) yp (`, d) θp (`, d) κp (`, d)], where
method for motion planning to better avoid static obstacles.
xp (`, d) = xr (`) + d cos(θr (`) + π2 )
However, their method also does not take the time dimension
or speed into account. yp (`, d) = yr (`) + d sin(θr (`) + π2 )
(2)
θp (`, d) = θr (`)
C. Contribution
κp (`, d) = (κr (`)−1 − d)−1
Based on related work, a practical real-time motion plan-
ner is proposed in this paper. The planner has the following Using (2), for each layer we sample Npath endpoints per-
features: trajectories generated by the planner are smooth pendicular to the center line.
and continuous, and therefore kinematically feasible for the b) Path model: Paths are generated by connecting: 1)
vehicle to execute; the search for an optimal trajectory is pairs of sampled endpoints; 2) endpoints and the current
accelerated by efficient path and speed discretization; the vehicle pose. There are two kinds of path models used by
performance sacrificed by discretization is compensated by this motion planner: cubic and quartic curvature polynomials.
a post-optimization process; the real-time performance is For cubic curvature polynomials, the curvature of the path is
improved by iteratively optimizating in both path and speed a cubic polynomial function of arc length.
space. k(s) = γ0 + γ1 s + γ2 s2 + γ3 s3 (3)
The algorithm framework is introduced in Section II. Sec-
tion II-A describes the trajectory generation method. A set of So the problem becomes to find the parameters satisfying the
cost functions that leads the planner to perform reasonable endpoint constraints. There are 5 parameters in the function:
and good driving behavior is introduced in Section II-B. The γ0 , γ1 , γ2 , γ3 , and s. The corresponding five constraints are
iterative trajectory optimization mechanism is described and relative x,y motion and orientation difference from the start
12
10
speed (m/s)
6
−2
0 5 10 15 20 25 30
s (m)
Fig. 2: Path set. The blue vehicle represents the current Fig. 4: Speed set. The green points are sampled speeds, the
vehicle pose, and grey vehicles represent sampled endpoints. red curves are beyond the acceleration limit, and the grey
The red paths are quartic curvature polynomials and the curves are valid ones.
green paths are cubic ones.
the vertex constraints. Our method is also different from
point to the end point, the start point curvature and the end
the inverse method proposed in [15] and [7], which use
point curvature. Following [3], we use a gradient descent
polynomial functions of time to generate speed profiles.
algorithm to solve this problem.
In the implementation, we use polynomial functions of arc
In the previous work [5], only cubic curvature polynomials
length, which is more consistent with our path generation
are used for common scenarios. This method works well
method. The polynomial equation is:
in any individual planning cycle, where the rate of change
of curvature is always continuous. However, a discontinuity v(s) = ρ0 + ρ1 s + ρ2 s2 + ρ3 s3 (4)
may occur at the junction point of two plan cycles. The
motion planner is replanning at a very high frequency. As a Speed state is defined as Q = (s, v, a), where s is arc
result, the curvature of the actual planning result may be far length, v is speed, and a is acceleration. For each path,
from smooth. Fig. 3 shows that a typical result using quartic we choose the start speed state Qinit = (s0 , v0 , a0 ) from
curvature polynomials (red solid line) is much smoother than the start point of the path, and end speed state Qgoal =
that using cubic polynomials (blue dashed line). (s1 , v1 , a1 ) from the end point of the path. In (4), there
Hence, for the paths between the current vehicle pose are four unknown parameters ρ0 , ρ1 , ρ2 and ρ3 , and the
and endpoints, a new constraint needs to be added, i.e., corresponding four constraints are v0 , a0 , v1 and a1 . For
the first derivative of curvature at the current vehicle pose all vertices, v0 and v1 are from corresponding discretized
point. To satisfy this additional constraint, the polynomial vertices, and a0 and a1 are set to 0. The vehicle current state
needs to be quartic rather than cubic. This improvement (v0 , a0 ) is special in that it is obtained from real vehicle
leads to a smooth path even when we are doing frequent sensors. Denoting maximum and minimum speed as vmax
replanning as shown in Fig. 2, in which red paths represent and vmin , respectively, and the number of discretized speeds
quartic curvature polynomials and green paths are cubic as Nspeed , the discretized speeds can be found as follows:
ones. However, quartic polynomials take longer to generate. vmax − vmin
Therefore, to limit computation time, quartic polynomials are vi = vmin + i, i = 0, 1, . . . , nv − 1 (5)
Nspeed − 1
only used for trajectory segments starting from the current
vehicle pose. By setting s0 = 0, the parameters can be obtained:
2) Speed generation: After the path edges are generated,
ρ 0 = v0
candidate speed profiles are built for each individual path.
Unlike many previous works, such as [5] and [14], that ρ1 = a0
use a forward method to generate speed profiles, our work 2a0 a1 3v0 3v1
ρ2 = − − − 2 + 2 (6)
uses an inverse method. That is, the speed space is first s1 s1 s1 s1
discretized, and then a polynomial is generated to satisfy a0 a1 2v0 2v1
ρ3 = 2 + 2 + 3 − 3
s1 s1 s1 s1
0.04
The discretization of speed and candidate speed profiles is
0.03
curvature (m−1)
6.5
#1 0 7 5 1.000 85.60
#2 0 11 5 0.949 233.00
6
original speed #3 0 7 9 0.997 301.05
optimized speed
#4 0 11 9 0.937 888.20
5.5
#5 1 7 5 0.988 92.33
5 #6 2 7 5 0.856 108.21
0 5 10 15 20 25 30
s (m) #7 3 7 5 0.853 112.08
#8 4 7 5 0.853 136.13
Fig. 7: Result for speed optimization.
#9 non-iterative 7 5 0.867 162.00
6.5 6.5
6 6
speed (m/s)
speed (m/s)
5.5 5.5
5 5
4.5 4.5
4 4
3.5 3.5
30 40 50 60 70 80 90 100 110 120 130 30 40 50 60 70 80 90 100 110 120 130
s (m) s (m)
(b) (b)
Fig. 8: Result for lane driving. Fig. 9: Result for lane driving with static obstacles.
state. When the planner is running, the vehicle executes a ner was tested both in simulation for all three scenarios, and
trajectory from the last plan cycle. on the real vehicle except for dynamic obstacle scenario.
Based on [18], a queue in ascending order of arc length
is implemented to preserve the trajectory from the last plan A. Lane driving
cycle. For every cycle, first a point Pclose with arc length
The lane driving test was performed on an S-shaped
sc which is closest to the vehicle’s position is found in the
curved road. This test was implemented to verify the motion
queue. Then the planner looks for point Pf uture with arc
planner’s ability to deal with sinuous driving, where human
length sf in the queue which is at a later position compared
drivers are often able to select a shorter and smoother route.
to Pclose . The equation to calculate sf is:
The result is shown in Fig. 8. The autonomous vehicle
sf = sc + vcurr tspan + 12 amax t2span (10) moves on the inner part of the road to get a shorter path
length, and it slows down when entering and speeds up when
where vcurr is the vehicle’s current speed, amax is the exiting curves. This lane driving test was also implemented
maximum acceleration the vehicle can reach, and tspan is on the real vehicle running on the exact same map. The
the basic time span between the current time and the start autonomous vehicle was able to track the trajectory generated
time of next replan, which should be longer than the replan by the planner with an average cross track error less than
interval. This equation ensures the planning is finished before 10cm, maximum tracking error of around 40cm and average
its result is needed. Finally, the planner replans from Pf uture speed error around 0.5m/s. The road test verifies that the
and updates the trajectory queue using the latest planned performance of the whole autonomous driving system. It also
trajectory. shows that the trajectory generated by the planner is feasible
A special case is that when the vehicle is in manual driving for the car to execute.
mode, instead of planning from a future position Pf uture ,
it replans from its current state (position and speed). This B. Static obstacles
ensures that the vehicle always has a feasible trajectory
In a road environment, autonomous drivers need to deal
to execute when switching from manual to autonomous
with multiple static obstacles, including curbs, parked cars,
mode, even when the vehicle is moving. The smoothness
and road blockages. In this planner, undrivable areas on
of transition between autonomous and manual mode is also
the road, e.g. broken pavement, are also modeled as static
satisfactory in real-world tests.
obstacles. Here we test the planner’s performance of dealing
with a curved road and multiple static obstacles together.
IV. E XPERIMENTAL R ESULTS
The result is shown in Fig. 9, and the red points are static
To test the performance of the motion planner, we im- obstacles. To avoid the static obstacles, instead of doing
plemented three different test categories: lane driving, static short-cuts on curves, the autonomous vehicle selected a
obstacles and dynamic obstacles. The proposed motion plan- longer, but still smooth, path.
C. Dynamic obstacles
For autonomous vehicles, dynamic obstacles are usually
moving obstacles such as cars, pedestrians, bicyclists or
motorcyclists. As shown in Fig. 10, in this test the vehicle
encounters a slower car in its preferred (upper) lane. Because
the slower vehicle in front of it limits the autonomous
vehicles progress, the planner selects a lane change trajectory
to circumvent it. The autonomous vehicle speeds up at the
beginning of the pass, then keeps approximately uniform (a)
speed while passing the slower car, and speeds up after
8
the pass. Because of the lateral distance cost, when it is
7.5
overtaking the slower car, it also tends to keep in the center
7
of the circumventing lane, which is reasonable.
speed (m/s)
6.5
V. C ONCLUSION 6