Local NMPC on Global Optimised Path for Autonomous Racing

by   Dvij Kalaria, et al.

The paper presents a strategy for the control of anautonomous racing car on a pre-mapped track. Using a dynamic model of the vehicle, the optimal racing line is computed, taking track boundaries into account. With the optimal racing line as areference, a local nonlinear model predictive controller (NMPC) is proposed, which takes into account multiple local objectives like making more progress along the race line, avoiding collision with opponent vehicles, and use of drafting to achieve more progress.



There are no comments yet.



Autonomous Head-to-Head Racing in the Indy Autonomous Challenge Simulation Race

This paper describes Ariel Team's autonomous racing controller for the I...

Robust Model Predictive Control for Autonomous Vehicles/Self Driving Cars

A robust Model Predictive Control (MPC) approach for controlling front s...

Computing the racing line using Bayesian optimization

A good racing strategy and in particular the racing line is decisive to ...

Track based Offline Policy Learning for Overtaking Maneuvers with Autonomous Racecars

The rising popularity of driver-less cars has led to the research and de...

A Sequential Two-Step Algorithm for Fast Generation of Vehicle Racing Trajectories

The problem of maneuvering a vehicle through a race course in minimum ti...

Optimization-Based Hierarchical Motion Planning for Autonomous Racing

In this paper we propose a hierarchical controller for autonomous racing...

On sensing-aware model predictive path-following control for a reversing general 2-trailer with a car-like tractor

The design of reliable path-following controllers is a key ingredient fo...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

I Introduction

Autonomous driving is an active field of research that poses challenges in various fields, including Motion Planning, Controls, and Perception. The task can be as simple as lane following and goal-reaching or complex as multi-agent driving scenarios. Finding optimal trajectories that are feasible is a key challenge associated with this field. However, for low-speed autonomous driving, these challenges can be solved relatively easily, and there is extensive work on the same. On the other hand, high-speed autonomous driving, although discussed in many works, is not heavily researched due to the challenging experimental setups and safety aspects of high-speed driving. With the advent of various competitions like Roborace and the ongoing Indy Autonomous Challenge (IAC), the field of high-speed autonomous racing is bound to attract a lot more attention. Various small-scale setups are also established for experimental work in this field which can help standardize this field for future research. This paper describes the design and implementation details of an optimization based planning and control algorithm used for autonomous racing in a pre-mapped environment as a 2 stage process. We first approximate the global optimal trajectory and then use it for local Nonlinear Model Predictive Control (NMPC) with multiple objectives, including inter vehicle collision avoidance. This work was carried out as a part of the Indy Autonomous Challenge (IAC). All algorithms described in this paper were simulated and tested using ANSYS VRXPERIENCE simulator with the vehicle models and scenarios provided by the IAC team. This paper does not concern itself with localization and perception in high speed scenarios and assumes the availability of the accurate position of the ego vehicle and the opponent vehicles within a certain range admissible for the RADAR or LIDAR sensors to detect. The paper makes the following novel contributions

  1. Use of optimal racing line as a reference for NMPC as opposed to the conventional use of center line

  2. Dynamically modelling the tire forces at high speeds using a modified Pacejka model.

  3. Incorporating a drafting effect model within the control scheme for overtaking scenarios.

  4. The proposal to merge with the reference line at turns which gets more progress along the track

Ii Related works

Modelling vehicle dynamics using kinematic bicycle models for Model Predictive Control was studied by [Kinematic_and_dynamic_vehicle_models], a dynamic bicycle model with nonlinear tire forces was studied by [kabzan2019amz]. Tire forces are generally modelled by the Pacejka tire model [Pacejka1991THEMF], however most previous works [kabzan2019amz] use a simplified model and do not consider the dynamic nature of the model at higher speeds. The presence of a pre-mapped environment allows us to use an optimised reference line instead of simply using the centerline. Obtaining a minimum time race-line has been studied by [doi:10.1080/00423114.2019.1704804] where they solve a global optimization problem to obtain the race-line.

The algorithms used for local motion planning in the context of autonomous racing can be divided into three classes: 1) Sampling-based approaches 2) Graph-based approaches 3) Numerical optimization based approaches. Sampling based/incremental search approaches finds their strength under unstructured or unknown environment [Karaman2010OptimalKM]

. Graph-based approaches span a spatial or spatio-temporal hierarchical tree along the drivable area. Commonly each node in the graph holds a cost calculated based on a heuristic. Using graph-search algorithms, the optimal path is chosen. These approaches discretize the action or spatial space in some way and choose the optimal track after exhaustively exploring all options by building a tree. They have proven to be effective in autonomous driving scenarios

[Stahl2019MultilayerGT] [Li2017DevelopmentOA] [Hu2018DynamicPP], but however one of the key issues that they face in the case of racing is the precise and sensitive application of controls to achieve which, the level of discretization has to be increased leading to high computation time. The third class is the optimization based methods which are mostly dedicated to Model Predictive Control (MPC) [Gao2010PredictiveCO] [kabzan2019amz]. They primarily focus on optimizing an objective to get the control commands. They have achieved good results in the context of autonomous racing, but is an active research topic both in terms of computation time and achieving more optimal results. Optimization based approaches for control of autonomous racing vehicles like NMPC and MPCC have been explored by [Liniger_2014], which further incorporate obstacle avoidance with the controller. However, all of these methods use the center line of the race track as a reference. We believe that using the optimal racing line in the case of pre-mapped environment can be advantageous. [Stahl2019MultilayerGT] uses optimal racing line as a reference although it is a graph based approach, we propose to use the same for optimization based methods.

Iii Vehicle Model

Modelling a race car is a challenging task due to nonlinear behavior at high speeds. Our vehicle model has three sub-models, a dynamic model which predicts the next state given the current state and control commands, a tire model which models the forces on the tires in high speed scenarios, and a drafting model which takes into account the changes in vehicle dynamics due to drafting.

Iii-a Dynamic model

Our base model has been adapted from [kabzan2019amz] and acts under the similar assumptions

  • The vehicle drives on a flat surface

  • Load transfer can be neglected

  • The longitudinal drive-train forces act on the center of gravity.

The equation of motion can be described using


where the car has a mass and an inertia , and represent the distance form the center of gravity to the rear and the front wheel respectively,  is the aerodynamic drag exerted on the race car, is the coefficient introduced due to drafting (refer to Section III-C), is air density, is the area of the race car and is the drag coefficient of the car.  and are the lateral tire forces of the rear/front wheel, is the combined force produced by the drive-train. The state of the model , consists of and the position and heading in a global coordinate system, as well as the the longitudinal and lateral velocities, and the yaw rate. The control input consists of the steering angle and the driving command. The driving command replicates the pedals of a driver where corresponds to full throttle and to full braking. and are the normal forces exerted on the front and rear tires of the vehicle when static. Further we consider the effect of the lift force exerted on the race car. Considering , the coefficients of lift for front and rear, , air density, and , the effective contact area of the race car, we can model and , the vertical loads on front and rear tires at velocity . The forces described given slip angle are modelled using functions and for front and rear tires which represent the interaction between tires and track surface calculated using the tire model in Section III-B.

Iii-B Tire model

The Tire-Road Interaction has been modelled using the Pacejka model [Pacejka1991THEMF]. Due to the design of race-cars, tire load increases at high speeds due to a negative coefficient of lift. Race-cars work in high speed scenarios for a large part of their operation, therefore it is essential to consider these load dependent changes. For this we have used a dynamic load dependent Magic Formula which models coefficients as a function of tire load [magic_formula]

. The steady state tire characteristic function

calculates the lateral force on the tire and is based on , the vertical load and the wheel slip angle is defined in Equation 2. Using these quantities we can now model a dynamic Pacejka model as follows:


where, , , , , , , , , , , , are characteristic constants specific to the tire material and the road surface and are assumed to be known. represents the fractional change in tire load with respect to the reference tire load, , and represent offsets to the slip and lateral force in the force-slip function. is the lateral load-dependent friction coefficient. is a small number inserted to prevent division by zero as approaches zero.

Iii-C Drafting model

Drafting or slip streaming is an aerodynamic technique where two vehicles or other moving objects are caused to align in a close group, reducing the overall effect of drag on the preceding vehicle due to exploiting the lead object’s slipstream. The effects of drafting on vehicle dynamics in the context of autonomous racing has been studied in [en13195183] We use similar formulation to express the draft forces as a reduction of the aerodynamic drag forces. In the Fig. 1 if the preceding vehicle which is vehicle B in this case, is in the “area of application” of the vehicle A, a “draft force” is applied on vehicle B. As in Section III-A, “normal drag” slows the car and is applied in , the “drafting-induced drag force” should be applied in . Mathematically we express drafting by multiplying a coefficient to the normal drag force ( in Equation 1f) experienced by the vehicle.

Fig. 1: Area of application for drafting

Iv Methodology

Assuming that we have a pre-mapped track with accurate lane boundaries and static obstacles, if any, we propose to divide the problem into two parts: 1) generating the optimal racing line using the known lane boundaries and well defined track and 2) using local MPC with the optimal racing line and sensor data as input for considering opponent vehicle collision avoidance and other objectives. We propose an objective function for the local MPC, which uses optimal racing line to estimate the optimal step towards lap completion and other strategies like leveraging the use of drafting and constraints such as staying within the lane limits and collision avoidance with opponents’ vehicles.

Iv-a Calculating global racing line

The first step in planning is to get the optimal global racing line. We need to get the time optimal trajectory as described in [doi:10.1080/00423114.2019.1704804] following the optimization problem described in Equation 4, where is the state, is the action command, and is the increase in progress along the center line for the time step . is the start state which can be kept as the start condition within the admissible states , and is the vehicle model function described in Section III. This ultimately maximizes the distance travelled along the center reference line and thus minimizing time. The admissible set encapsulates the lane boundaries and static obstacles, if any. We have used the Global Race Trajectory Optimization package provided by TUMFTM. To this package, we gave the following inputs: track information, lateral and longitudinal accelerations limit due to friction and the model parameters. The output of this package is an approximate time optimal racing line on the given race track in from which we use an array in where is the number of points depends on the stepsize and track length. The 4 columns are structured as follows: X-coordinate, Y-coordinate, target velocity , and target velocity for a point.


Iv-B Local planner using NMPC

We propose to formulate a Nonlinear Model Predictive Control with the optimal trajectory, local obstacles, and opponent vehicle positions as input. Further, we consider the twin motives of making maximum progress along the track while avoiding collisions with other vehicles and at the same time leveraging the advantages of local factors like drafting (Section III-C) to gain speed due to spatially local region created with reduced air resistance. However, most of the works have proposed a two level solution to this with a high-level planner that outputs a traversable trajectory and a low-level controller to track that trajectory as described under previous works (Section II). We propose a single-step solution that merges both the steps, i.e., it plans a trajectory by solving an optimization problem and taking the first planned control command as output. For solving the nonlinear problem, we use Interior Point Optimization (IPOPT).

Iv-B1 Overtaking strategy

The primary condition for the optimality of non-linear MPC is the convexity of the loss function. However, in the case of overtaking, the optimization problem becomes non-convex as there exists multiple minima due to existence of multiple sides to overtake against the target vehicle. The local minima obtained by interior point optimization (IPOPT) depends on the side of the initial trajectory chosen. Also, with more number of opponents or local obstacles, the decision becomes combinatorial in nature. The situation is well depicted in Fig.

2. One solution to this problem is to use some heuristic to determine the topology or use a Dynamic Programming solution as depicted in [Liniger_2014] to get the optimal combination. However, we propose a more straightforward approximate solution by using the planned trajectory from the previous step to determine the class. If the distance with an opponent vehicle is less than a certain threshold , we choose two combinations for the initial trajectory, one from the left of the target vehicle and the other from the right. We optimize both initial trajectories separately using the NMPC problem described later. This approach can be fully parallelized on a multi-core system. The same solution can be extended based on the amount of computation and parallel cores available to include even more classes. For getting the initial trajectories, we use the pursuit algorithm [follow_the_carrot] with target positions as and where is the position of the target vehicle at time step and

is the displacement vector with directions perpendicular to the target vehicle, and length can be chosen proportionately as per the vehicle dimensions. These initial trajectories are then used for further optimization.

Fig. 2: Combinatorial nature of the overtaking problem, as it is possible to overtake each opponent on the left or the right side [Liniger_2014]

Iv-B2 Cost functions

The objectives to be considered by NMPC are: 1) making locally maximum progress along the track using the global racing line as the reference, 2) avoiding collision with opponent vehicles and other local static or dynamic obstacles, 3) using drafting effect to increase chances of overtaking the vehicle ahead, and 4) avoiding longitudinal or lateral slipping of the vehicle or any other unsafe state and the constraint to stay within the lane boundaries.

There has been a substantial study into deriving a strategy to maximize progress along the reference line using local MPC. One such work is [Liniger_2014], which proposes a trade-off between tracking the reference trajectory by minimizing the contouring error, which they define as the perpendicular distance from the reference line, and the maximization of progress, which they define as distance along the trajectory from the corresponding perpendicular projection points from the start and end position of the locally planned trajectory. However, we argue that this fits well when the reference line is the center line as they have used. However, since we are using the globally optimal trajectory as the reference, we propose a novel cost term that incorporates both the tracking of the race line and what we believe as the optimal way to merge with the race line only at the time of turns to not interfere with the overtaking or obstacle avoidance objective. First, we define the projection function as defined in Equation 5 that finds the projection point on the reference line. However, this itself is an optimization problem; hence we find the approximate projection point by starting with the projection point along the X-axis with a reference frame located at the ego vehicle’s center position and optimizing with no. of iterations. Choosing gave empirically very close projection point. The cost term is as defined in Equation 6, where denotes the speed of the ego vehicle at time step , denotes the heading of the ego vehicle at time , denotes the parameter for perpendicular projection point on the approximate spline of the race line, and are the tangential angle and the radius of curvature at the perpendicular point. Thus, this term would put more weight on merging with race-line only during turns when the radius of curvature of the projection point is less. The comparison in the results when the contouring error cost term was used and when the new cost term was used has been carried out in Section V.

Fig. 3: The projection point on the optimal racing line

The second objective is to avoid collision and maintain a safe distance for opponent vehicles and static obstacles if any. This has been studied extensively in prior works. The method in [Gao2010PredictiveCO] sets up a cost term in the objective function to penalize coming close to the obstacle with a penalty inversely proportional to the distance from the obstacle and directly proportional to the speed. However, as we have dynamic obstacles, we replaced the speed of the vehicle with the relative velocity magnitude between the opponent vehicle and the ego vehicle, and instead of Euclidean distance, we use the distance scaled with different proportions along the and -axis proportionate to the opponent vehicle dimensions such that we have ellipsoidal equivalent region. The resultant cost term at time step , for target vehicle or obstacle and sensor , is described in Equation 7 where (,) denotes the position of the sensor with respect to the local coordinate frame of the target vehicle as shown in Fig. 4. denotes the relative velocity magnitude with the target vehicle detected at time step , and denote the length and width of the target vehicle respectively. and denote the number of target vehicles and sensors, respectively. The term is also multiplied with the sigmoid term to ensure non-overlap and smooth transition from the drafting objective to the obstacle avoidance objective. and are constants that determine the smoothness of the transition and the distance at which the transition must occur.

Fig. 4: The reference frame for  and  

The third objective is to use the drafting effect, which is the spatially local regions created behind the opponent vehicles where a reduced wind force is experienced. To consider this, we propose the cost term as described in Equation 8 where is the number of vehicles and (,) denotes the position of the ego vehicle with respect to the local coordinate frame of the target vehicle at time step . This objective term would attract the vehicle behind a certain vehicle and thus leverage the use of drafting. Also, the term is multiplied by an activation term with opposite activation to the obstacle avoidance term to smoothly transition back to the obstacle avoidance objective when the vehicle comes close to the target for overtaking. The path followed by the vehicle before and after the drafting term has been demonstrated in Section V.


For additional safety, we have used an extra penalty cost term adapted from [kabzan2019amz], which accounts for the lateral slip angles ( and ) going beyond a safe value () as described in Equation 9. Finally, we constrain the vehicle to remain within the lane boundaries, this gives us an admissible state space . This has been implemented by spline fitting on the local lane boundaries as observed from the camera or from the pre-mapped region if the localization is accurate and setting the constraint that the position () falls between the left and right boundary splines. The resultant optimization objective is described as below in Equation 10, where is the time step, and is the start state which is passed as the current state of the vehicle, is the no of time steps, and is the vehicle model function explained in Section III, , , , are the constants to scale the individual cost terms described above.


Iv-C Algorithm

The final algorithm is briefly described in Algorithm 1. We maintain a list of active obstacles to be passed onto NMPC and also maintain the state for each of the dynamic obstacles where we store the previously decided direction for overtaking. This will avoid possible anomaly due to numeric errors when the conditions are symmetric, and the cost for overtaking from right or left is similar for the target vehicle. We take the planned steps from the previous NMPC step and check if, for them, the ego vehicle comes in the vicinity of any opponent vehicle. If so, the overtaking strategy described above (Section IV-B1) is used to decide the direction of overtaking, and the initial trajectory is set up accordingly to be passed to NMPC for optimization. The first step on the resultant trajectory is executed, and the process is repeated.

2:while TRUE do
3:     opp_detected all detectable opponents
4:     get current position and velocities
5:     function MpcCallBack
6:           -1 planned steps from the previous NMPC step are checked.
7:          if ego vehicle comes in vicinity to any opponent vehicle                    in opp_detected during any step. then
8:               target_index index of closest vehicle
9:               target_id opp_detected[target_index]
10:               pref_direction null
11:               if closest opponent same as closest opponent in                          previous iteration then
12:                    pref_direction state_opp[target_id]
13:               else
14:                    state_opp                
15:               traj_init
16:               state_opp[target_id]
17: Overtake Direction = right or left
18:          else
19:               traj_init
20:               state_opp           
21:          traj_init is optimised using IPOPT      
22:     send first control at the end of time slot.
Algorithm 1 Real-time NMPC algorithm

V Results

In order to support the argument that is using the new cost term for making more progress along the track using the optimal racing line, we compare the qualitative results using the new term with the contouring error term as used in [Liniger_2014] in Fig. 5. From the results, it can be empirically put that with the new cost term, as the merging happens at the time of turns, the net distance covered is less, and also, the term does not interfere with the overtaking objective during straight regions of the track.

Fig. 5: Dotted trajectory is the optimal racing line, hard lines are the lane boundaries Left : Local trajectory followed with contouring error formulation, Right: Local trajectory followed with new cost term. The color-bar represents the speeds in km/hr
Fig. 6: Left : Local trajectory followed without drafting cost term, Right: Local trajectory followed with drafting cost term. The color-bar represents the speeds in km/hr

Secondly, to demonstrate the effect of using drafting cost term in the presence of drafting, we compare the results with and without using drafting cost term as demonstrated in Fig. 6 using the coefficient values: = 0.805, = 0.003, = 0.0825 (refer to Section III-C). Finally, we attach a link to a video 333https://youtu.be/PhScm6MnrRM demonstrating a 5 lap run using the controller on a multi agent racing scenario which was recorded during the first practice round as part of IAC. However, the simulation is run synchronously such that the algorithm works at 25 FPS in simulation time. The simulation time is slower than real time by an average factor of 5. Hence, the algorithm works with a mean frame rate of 5 FPS in real time on Intel(R) Xeon(R) CPU E5-2690 v3@2.60GHz .

Vi Conclusion

In conclusion, the algorithm proposed can compete considering multiple objectives while racing and can use the optimal racing line for making decisions effectively. It uses numeric optimization on an initial decision path to consider multiple objectives like collision avoidance and effectively leverage the use of drafting for overtaking by staying behind the lead vehicle to gain more speed. The algorithm was tested on ANSYS VRXPERIENCE simulator, and it satisfactorily follows the objectives of the multi-agent head-to-head racing scenarios. However, the algorithm runs at 5 FPS in real-time with horizon length as 1s which is quite slow for real time deployment. Optimization takes longer using IPOPT as expected due to the non linear nature of the model. The computation time can be reduced considerably by linearizing the model at each time step to form an LTV system. This can be solved efficiently using dynamic programming based solutions like iterative LQR. This would drastically reduce the computation time for real time deployment which we leave as future work.


This work was done as part of the Indy Autonomous Challenge (IAC) under the collaborative IUPUI-IITKGP-USB team. Special thanks to all the team members, Adarsh Patnaik and Qin Lin for their support and guidance.