Real-Time Optimal Trajectory Planning for Autonomous Vehicles and Lap Time Simulation Using Machine Learning
11 Real-Time Optimal Trajectory Planning for Autonomous Vehicles and Lap Time Simulation Using Machine Learning
S. Garlick a and A. Bradley b* a Department of Computer Science, The University of Manchester, Manchester, M13 9PL, UK b Autonomous Driving Research Group, School of Engineering, Computing & Mathematics, Oxford Brookes University, Oxford, OX33 1HX, UK
Abstract
The widespread development of driverless vehicles has led to the formation of autonomous racing competitions, where the high speeds and fierce rivalry in motorsport provide a testbed to accelerate technology development. A particular challenge for an autonomous vehicle is that of identifying a target trajectory - or in the case of a racing car, the ideal racing line. Many existing approaches to identifying the racing line are either not the time-optimal solutions, or have solution times which are computationally expensive, thus rendering them unsuitable for real-time application using on-board processing hardware. This paper describes a machine learning approach to generating an accurate prediction of the racing line in real-time on desktop processing hardware. The proposed algorithm is a dense feed-forward neural network, trained using a dataset comprising racing lines for a large number of circuits calculated via a traditional optimal control lap time simulation. The network is capable of predicting the racing line with a mean absolute error of ± Keywords:
Autonomous racing vehicle, Lap time simulation, Optimal racing line, Trajectory planning, Neural network, Machine learning. * Corresponding author. E-mail: [email protected] a r X i v : . [ c s . R O ] F e b The widespread development of Autonomous Vehicles (AVs) has the potential to save many lives since the overwhelming majority of road accidents are caused by human error (NHTSA, 2015). This has led to the advent of autonomous racing, where the fierce competition in motorsport, coupled with the sandboxed environment of the racetrack provides the motivation and ideal testbed to rapidly test, develop and enhance new technology (Skeete, 2019). Of particular interest is the development of autonomous motorsport, where the vehicle may not have a human driver - indeed, it may not even be possible for a human to drive the vehicle (Betz et al. , 2019). For this application, the vehicle must be able to map out the environment, and plan the trajectory itself - thus it is essential for the vehicle to be capable of computing the target path which it will then follow. Lap time simulation is commonly employed in motorsport as a cost-effective, efficient tool to evaluate the effect that adjustments in vehicle setup will have upon the resulting lap performance and to use this information to run optimisations to find the ‘ideal’ setup with which to begin real-world testing. Unfortunately, differences in circuit speed profiles, corner radii and other conditions at different circuits result in the ‘ideal’ setup only being suited to a single track, and thus an individual optimisation of the vehicle parameters is required for each circuit. The majority of lap-time simulators in use by race teams are based around Quasi-Steady-State (QSS) approaches (Dal Bianco et al ., 2018) - where a vehicle model follows a target path (typically discretised into a series of curves of varying radii) at the highest possible speed, obtained through iteration. In more advanced cases this method can be further extended to incorporate transient vehicle behaviour (Völkl et al ., 2013). The QSS approach requires pre-existing knowledge of a target path, which is usually obtained from logged data of the line taken on the fastest lap driven by a professional racing driver (Colunga and Bradley, 2014) - however, this assumes that the driver took the correct line in the first place, and indeed that it is possible for a human to physically drive the vehicle on the circuit in advance of the race. Conversely, for an AV, it is essential for the control system to be able to plan the trajectory that the vehicle should take - ideally in real-time, such that the path can be planned without prior processing. This enables the AV to respond to varying traffic conditions - and in an autonomous racing vehicle, to plan a new trajectory for each subsequent lap, or in response to changing track conditions (Kapania et al. , 2016). This poses a significant challenge - the high speeds involved in racing demand that the trajectory must be planned rapidly, the impact of vehicle mass upon lap time (Patil et al. , 2016) and power requirements dictate that this must be done using the minimum possible computational hardware, and the planned trajectory must be the solution which accurately follows the circuit in the minimum possible time. Traditionally, the more rapid approaches to generating a target path tend to be purely based upon the geometry of the circuit, generating an approximation that does not offer any guarantee that it will be the time-optimal solution (Kapania et al., traditional lap time simulation applications, or as a precalculation for the more accurate and time-consuming optimisations. In other fields, model-based machine learning (ML) techniques are commonly used to expedite the process of solving a problem by using extensive training data to generate extremely rapid predictions of the solution, using a trained Artificial Neural Network (ANN). These approaches have been shown to solve difficult problems not only quickly, but with a high level of accuracy in the solution (AlQuraishi, 2019). Redmon and Farhadi (2018)’s YOLO object classification algorithm is commonly employed in autonomous racing vehicles, reducing the time taken to process a camera image to a few milliseconds, allowing accurate object identification in real-time at high frame rates - based upon a neural network trained upon several thousand manually labelled images (Culley et al., solving the problem, but rather of generating an accurate prediction of the solution to the problem, based upon previously having ‘seen’ ( i.e. been trained upon) many solutions to similar problems. However, there have been seldom few attempts to apply the potential speed and accuracy enhancements offered by ML techniques to the task of generating the target racing line. This paper presents an ANN approach to generating an accurate prediction of the ideal racing line, aimed at reducing the calculation time by several orders of magnitude. The network can be trained on data from any existing method of optimal trajectory generation (or a human driver), thus facilitating predictions based upon highly complex models to be made within milliseconds. This enables the target path to be calculated much more rapidly than with traditional methods - thus reducing computational burden for traditional lap time simulators, and easily facilitating real-time application in an autonomous racing vehicle on hardware that can be carried in the vehicle. This original approach provides an unprecedented reduction in the time taken to generate the ideal racing line, with minimal loss in accuracy of the solution - and represents a transformational contribution to lap time simulation and autonomous motorsport.
Simple approaches to finding a target path are commonly based around following the shortest path or the Minimum Curvature Path (MCP). Heilmeier et al . (2019) were able to calculate the MCP in around 18 seconds for the
Roborace autonomous racing car. However, whilst the MCP can be calculated rapidly, it merely offers an approximation of a racing line - it does not offer any guarantee that the proposed line will result in a fast lap time (Kapania et al., et al ., 2018) - thus resulting in a highly-accurate, vehicle-specific racing line. However, due to the complexity of solving a trajectory of the vehicle model for every discretisation point, the solution time for the OCP approach typically takes considerably longer than the lap time (Lenzo and Rossi, 2020) - with simulators comprising relatively simplistic vehicle models taking around 15 minutes to solve a lap (Brayshaw and Harrison, 2005; Perantoni and Limebeer, 2014). Lot and Dal Bianco (2015) solved a lap using a more complex model with 14 Degrees of Freedom (DoF) in approximately 28 minutes - though it should be noted that the accuracy of the model was not greatly improved over a simplified 10-DoF model - taking 16 minutes to solve. The free-trajectory element (required to find the racing line) means that most approaches take considerably longer to solve than a lap time simulator which follows a predetermined path (Veneri and Massaro, 2019). While OCP approaches offer accurate, time-optimal solutions to the racing line, the computation times typically render them unsuitable for use in real-time applications.
For application in an AV, it is necessary to perform these calculations in real-time or faster, on processing hardware that can be carried within the vehicle. Jain and Moraro (2020) addressed this problem using Bayesian optimisation, resulting in the calculation of a racing line in under 3 minutes. Though this enables rapid pre-computation of a new circuit after an initial sighting lap, it is not fast enough to calculate the subsequent lap whilst driving the previous at speed. Christ et al. (2019) modelled a varying tyre-road friction coefficient around the Berlin Formula E circuit for the autonomous
Roborace vehicle, simplifying the tyre model and using CasADi (Andersson et al ., 2019) to reduce simulation time to under 2 minutes - though this is again slower than the lap time. Kapania et al. (2016) achieves quasi ‘real-time’ path planning using an iterative, two-step process (using the MCP as a pre-calculation) to generate a target path for an autonomous racing car within 26 seconds - i.e. faster than the lap time. However, in order to achieve this rapid solution time the vehicle dynamic behaviour has been simplified to a bicycle model - thus resulting in an approximation of the racing line which (though generally accurate), exhibits several locations on the track where there is “a significant discrepancy on the order of several meters between the two-step algorithm’s trajectory and the other comparison trajectories” (Kapania et al. , 2016). Other studies have turned to machine learning to generate the racing line for use in a driving simulation. Cardamone (2010) employed a genetic evolution ML technique to search for the ideal line by iteratively refining the target path (defined by a series of waypoints) thus obtaining the optimal trajectory for a specific circuit. The simple vehicle model used limits the accuracy of the generated line, although it offers a considerable improvement over the MCP. A similar technique was employed by Vesel (2015) who added a ‘healing’ sub-process to improve performance. Salem et al. (2019) reported promising results by coupling evolutionary learning with a fuzzy-logic controller to refine the vehicle control inputs and racing line, resulting in a real-time controller which can drive the vehicle around the circuit based upon learnings from previous iterative experimentation. Balaji et al. (2020) used an end-to-end RL approach in real-world experiments to optimise the control inputs for a real (1/18th scale) vehicle from camera imagery. However, each of the approaches described above iteratively learns to drive a specific circuit - they are not designed to generate an ideal racing line for a new circuit upon which the algorithm has not been previously trained. For real-time application in previously-unseen territory, Fridman et al. (2019) trained an end-to-end autonomous driving algorithm using 4.2 million video frames acquired from a
Tesla - however, the majority of approaches for roadgoing applications are aimed at safely navigating the road environment, rather than generating a time-optimal path. In any case, end-to-end approaches typically generate the vehicle control inputs from camera footage (Tampuu et al.,
To facilitate extremely rapid generation of the racing line, this study employs a feed-forward ANN which has been pre-trained upon a dataset of racing lines for a variety of circuits. This enables racing lines to be generated for previously-unseen circuits, based upon the trajectories found in the training data. Typically, for an ANN to make accurate predictions, it must have been trained on a dataset that encompasses the entire range of features which may be found on the new, unseen problem. In order to achieve this, an extensive dataset was generated. Inner and outer boundaries were reconstructed for a large number of real circuits, which were then augmented to expand the dataset to contain over 6,000 circuits, which are split into 2.7 million individual track segments. An optimal racing line was generated for each circuit using an existing OCP approach to lap time simulation, thus completing the dataset. To prepare the dataset for use with the ANN, the circuit is split into smaller segments using the sliding window approach - thus enabling the network to learn the racing line for multiple sections of the track rather than an entire circuit. This enables the network to operate on circuits of any length, and generalise track sections across multiple circuits. Once segmented, data describing the vehicle’s optimum position on track, and the surrounding circuit geometry were extracted for various waypoints around the lap, and these ‘features’ are then used to train the network, using the majority (86%) of the dataset. Once trained, the ANN can then calculate the features for a new, previously-unseen circuit - thus creating a prediction of the racing line. The hyperparameters of the network were then tuned to improve the accuracy of the prediction, using a further 9% of the dataset. K-Fold analysis (Stone, 1974) was used for this purpose. Finally, the overall performance of the system is quantified by testing the generated racing lines against the remaining 5% of the dataset, which comprises circuits which have not previously been seen by the network. A complete description of the methodology is outlined in the following subsections, and results are presented in section 3.
In order for a neural network to generate a prediction, a large dataset is required to train the model. Since the objective of this study is to generate an ideal racing line when given information of the track boundaries, a training dataset is required which contains the inner and outer track boundaries, and the ideal racing line. A benefit of this technique is that there is no restriction on the method used to generate the optimal line used in the dataset - it could be taken from a detailed, high-order free-trajectory OCP method (such as that proposed by Lot and Dal Bianco (2015)), a human driver in a Driver-in-Loop simulator - in which case it would ‘learn’ the lines preferred by a particular driver) - or any other traditional method of acquiring the target racing line. Prior to the generation of the target line in the training data, it was first necessary to recreate a large number of circuits. Inner and outer boundaries were used for 82 real circuits from around the world, including several tracks from the Formula 1 calendar (60 manually generated, and 22 taken directly from TUMFTM (2020)). As is common practice in ML studies (Culley et al.,
To generate the optimal trajectory for each circuit in the dataset, the
Global Race Trajectory Optimisation tool (TUMFTM, 2019) developed by Christ et al . (2019) was selected, using the default parameters for the Roborace car vehicle. It was desirable to demonstrate the ability of the ANN to provide predictions of a racing line generated by an OCP simulator, and therefore this method was chosen as it provides a balance between the accuracy of the generated line, and the time taken to calculate optimal paths for each of the individual circuits in the dataset. To expedite the time-consuming process of generating thousands of racing lines in the dataset, the workload was split across multiple different PCs with multi-core processors. However, it would have taken approximately two weeks to calculate the optimal line for each circuit consecutively on a single processor thread. In order to further expand the training data (and provide several additional advantages), each circuit was split into a series of overlapping segments (or windows), meaning that the entire dataset contains over 2.7 million segments of different racetracks - complete with optimal racing lines for each segment. The rationale and process behind this segmentation is outlined in section 2.2. The total size of the dataset required for accurate prediction of the ideal racing line was established experimentally, based upon a similar methodology to Roh et al. (2019). All optimal trajectories were calculated assuming a vehicle width of zero - and thus the vehicle centre uses the full width of the track. This enables removal of the vehicle width parameter from the training data - instead later accounting for it when the network predicts the target path, and thus facilitating adjustment of the vehicle width after the network has been trained. The complete dataset comprising inner and outer circuit boundaries, and optimal racing lines was divided into subsets in accordance with Table 1.
Dataset
Real
Augmented
Total
Training Data Validation Data Testing Data (Unseen) Total Table 1. Number of circuits contained in each subset of the dataset
Several of the existing methods involve creating a series of lines segmenting the circuit and then calculating the location of ‘waypoints’ - or the position on these lines at which the vehicle trajectory intersects. The approach presented in this study divides the circuit with a series of lines (or Normals) perpendicular to the track centreline. Whilst it is common practice (Botta et al. , 2012; Casanova, 2000) to vary the spacing between the lines segmenting the circuit in order to reduce the resolution on straights (thereby reducing computational effort), the approach presented in this paper uses a fixed interval of 5 metres, which was found to provide a good representation of the racing line. Maintaining a constant interval between Normal lines is beneficial for the network as it eliminates an additional variable, thus further reducing the dimensionality of the input. In the event that two or more Normal lines intersect one another ( e.g. at a tight hairpin bend), the lines are modified slightly to become ‘Pseudo-Normals’ - where the angle between the Normal and the track centre line is adjusted away from 90 degrees until the lines no longer intersect (Fig. 1). This is encoded and fed into the network in section 2.3.
Fig.1. - a) Lines normal to the track centreline divide the circuit, b) Normals adjusted to become ‘pseudo-Normals’ at tight hairpins, c) Waypoint location identifies the intersection of the racing line
In the same way that a human driver looks ahead on the circuit, several other studies (Casanova, 2000; Weiss and Behl, 2020) use a forward-looking ‘preview’ to control the subsequent behaviour of the vehicle. However, the racing line at any given point on the circuit is influenced by the preceding curvature (thus resulting in the current vehicle position) and the upcoming curvature of the circuit. Therefore a performance improvement was found by introducing a bidirectional ‘Foresight’ - looking both fore and aft of the current position - thereby enabling the network to learn both how the vehicle arrived at the current position, and where the trajectory heads next. Therefore, rather than simply passing all the track Normals for an entire circuit to the neural network, the circuit is broken into a number of overlapping sections using the sliding window approach. Thus the circuit is described as a series of overlapping windows, each comprising a fixed number of Normal lines and subsequent waypoints. This approach has the following benefits; the network input is a fixed size, and therefore is capable of handling circuits of different length ( e.g.
Nordschleife (20.8km) and Brands Hatch GP (2.9km)); this teaches the network a larger number of windows of racetracks, enabling it to generalise across behaviour learned from multiple circuits with similar features; the sliding window approach vastly increases the quantity of data provided by each circuit, thereby reducing the number of circuits required in the training dataset. In order to represent this mathematically using the sliding window approach described above, each circuit is represented by a number of overlapping windows, containing information for each of the f Normal lines fore and aft of the central Normal line within the window.
For a given Foresight value ‘ f’ , the window ( t i ) is formed such that it contains the ordered set of track Normals surrounding and including the Normal line N i (N i-f , …, N i , ..., N i+f ) . The neural network ‘ g ’ is then trained upon these windows in order to predict where the waypoints lie upon a given track section, g(t i ) → w i , where w i is the waypoint location on the Normal N i . Tuning of the foresight value f is explained in section 2.4.2. The trajectory for an unseen track is later calculated by predicting the waypoints for each window of the new circuit using the fully trained network. In this study, the Foresight level is symmetric and tuned for the objective of minimising the prediction error for a circuit given to the network in its entirety. However, the windowed approach means that the trajectory is being repeatedly planned for the area immediately surrounding the vehicle - and thus the Foresight level could theoretically be linked to that of an AV’s perception sensors, making this technique suitable for rapid real-time trajectory planning in an autonomous road-going vehicle. Rather than learning the racing line for a complete circuit, the network is trained upon information about how the circuit and corresponding racing line flow through each of the windows described in section 2.2. This provides the ANN with sufficient data to infer important semantic information, in order to generalise a function that creates a target trajectory. It is necessary to encode this information about the circuit and racing line in a lossless manner. Therefore, features are extracted from the training data including; circuit width (or length of each Normal), the position of racing line upon track (or waypoint position upon the Normal), and information describing the curvature of the circuit at each Normal. Many existing lap time simulators use the target racing line described as a curvature profile, thus facilitating calculation of maximum cornering velocities (Colunga and Bradley, 2014; Dal Bianco et al. , 2019). However, as the circuit twists and turns, the radius of curvature varies in a highly nonlinear manner, reducing to a few metres at hairpins, and tending towards infinity on straights. In order to constrain these feature representations, the circuit is represented by variations between the Normal lines describing the structure of the circuit, rather than the curvature (Fig. 2).
Fig. 2.
Feature extraction: Track geometry (left) and waypoints describing the racing line (right).
The circuit geometry is described by encoding the features for each Normal as follows; length of the Normal l, angular change between Normals 𝛼 , and the offset angle θ between the Normal line and the true normal to the track centreline (which is always 90 degrees except in the case of an adjusted ‘pseudo-Normal’). These features are encoded into the network by allocating 3 dimensions each in the input space for each Normal within a given window (Fig. 3). Preserving the sign of each angle enables both left and right-hand bends to be encoded. The racing line is described by identifying the location of the waypoint along each Normal - denoted using the feature w . This value ranges between 0 and 1 representing the left and right of the Normal respectively. The network is then trained upon the w values for each window in the training data, thus enabling the network to predict a racing trajectory through a new circuit. The neural network selected for this study is a feed-forward dense ANN due to the complexity of the mapping from the geometry of the track within each encoded window to the target racing line, and the nature of this mapping being a regression task (Lathuilière et al ., 2019). This section outlines the structure of the network, and the tuning used to identify the optimal parameters.
The network structure contains four fully connected layers, with a Huber loss function (Huber, 2004) and the Nadam optimiser (Dozat, 2016) - which were selected following experimentation with the various hyperparameters of the network. The number of units within each layer was chosen using a grid search method - resulting in 450, 200 and 200 units on the first, second and third hidden layers respectively (Figure 3).
Fig.3.
Network structure (shown with sampling level s=1).
The network was found to perform best when activation functions of sigmoid and hard sigmoid (Gulcehre et al. , 2016) were used across the hidden and output layers respectively. The output dimensions are determined by the sampling level s (section 2.4.3) as shown in Fig. 3. The foresight parameter dictates the number of Normals considered within each window. From the network’s perspective, minimising the foresight value is beneficial, as it reduces the input size of the network, and thus dimensionality - thereby increasing the ability of the network to generalise. However, prediction of the racing line becomes increasingly accurate with more track coverage provided to the network - and thus an optimal value of the foresight was determined experimentally for the training data. One important consideration when using this method is that the foresight must be sufficient to cover the length of the longest straight in the dataset - otherwise, in a straight section (where there is no apparent curvature in the circuit) the network has no concept of whether the previous and upcoming bends are left or right-handed, and thus would be unable to infer the correct line for this section. In this case, the network has a tendency to follow the centreline of the straight, therefore resulting in larger prediction errors. The optimal value of foresight is therefore dependent upon the types of circuit contained within the dataset. For the dataset used in this study, a foresight level of 70 waypoints ( i.e.
Fig. 4.
Effect of foresight upon racing line prediction accuracy (based upon a subset of the validation dataset). Error bars denote the variance through the different K-Folds.
Minimising the output size of the network is beneficial, as it further reduces dimensionality, thus improving generalisation accuracy. Therefore, rather than predicting every waypoint within a window, a smaller number of waypoints are predicted and assembled with those sampled from the neighbouring windows - forming the predicted racing line for the complete lap. A prediction of the racing line could be made simply by assembling the central waypoint within each window. However, in this case, each predicted waypoint is being made independently of those either side - which can result in a slightly noisy racing line which does not flow smoothly from one waypoint to the next. Therefore, the network instead predicts multiple waypoints either side of the central Normal within each window and then averages across those sampled from the neighbouring windows. This provides a ‘moving average’ effect to each predicted waypoint, thus generating a smooth racing line. The sampling level ( s ) determines the number of pairs of surrounding waypoints that the network predicts, such that s = 0 (no averaging) dictates a network with one output and s = 2 requires a network with five outputs. Once each track segment has been passed through the network, each window contains
2s + 1 predictions estimating where the target path lies through that window. For each normal line, the set of estimations are then averaged to produce a smooth line. A sampling level of s=4 (9 network outputs), was found to provide the highest accuracy in the predicted racing line for the validation data used in this study (Fig. 5), generating a prediction of the racing line which flows smoothly from waypoint to waypoint without requiring computationally expensive filtering techniques of the nature employed by Heilmeier et al. (2019).
Fig 5.
Adjustment of the Sampling level provides a smoothing effect to the predicted line. In order to demonstrate the performance of the ANN, predictions were made for the previously unseen circuits in the testing data and compared against the racing lines found using the OCP method provided by TUMFTM (2019). Comparison was made for both accuracy of the generated line and solution time.
The racing line calculated is shown and compared against that of the OCP method for Brands Hatch GP (Fig. 6) and Nürburgring GP (Fig. 8) circuits are presented below.
Fig. 6.
Comparison of the racing line predicted by the ANN against that calculated via the OCP method for the previously unseen Brands Hatch GP circuit.
Fig. 7.
Lateral deviations from the track centreline predicted by the ANN and calculated via the OCP method for the previously unseen Brands Hatch GP circuit. Fig. 8.
Comparison of the racing line predicted by the ANN against that calculated via the OCP method for the previously unseen Nürburgring GP circuit.
Fig. 9.
Lateral deviations from the track centreline predicted by the ANN and calculated via the OCP method for the previously unseen Nürburgring GP circuit.
To enable improved visualisation of the accuracy of the prediction, Kapania et al. (2016)’s method is used to plot the racing lines as a lateral deviation from the track centreline, along with track boundaries (Fig. 7 & 9). The paths predicted by the ANN are qualitatively similar to those calculated using the OCP method, following near-identical paths on most apexes - outperforming Kapania et al. (2016)’s rapid 2-step method of generating the optimal line, and comparable in performance to Dal Bianco et al. (2019)’s indirect method of solving the nonlinear OCP. Maximum deviations between the ANN’s prediction and the OCP method tend to occur in areas with more complex and unusual features - e.g. the straight with a subtle bend prior to the upcoming corner at Nürburgring GP, and the complex combination of consecutive turns impacting upon each other (Fig. 8). The largest sustained deviations tend to occur during the straights - however, this behaviour is common to many methods of calculating the optimal line and is considered to be of lesser importance as a difference in vehicle position during a straight results in a minimal impact upon lap time (Dal Bianco et al., et al. , 2016). Quantitative analysis of the performance for the previously unseen real-world circuits in the testing data is provided in Table 2, demonstrating that the network is capable of generating accurate racing lines for a variety of different track lengths and layouts. The highest accuracy is achieved for circuits such as Brands Hatch GP and Hungaroring, which comprise features more commonly found in the training dataset such as constant radius turns at the end of a straight, moderate length straights, and average track width. This is demonstrated by the reduction in RMS error at Brands Hatch GP and Hungaroring. Circuits further from the ‘average’ track in the training dataset in some way ( e.g. particularly wide/narrow circuits, those containing very tight corners, combinations of multiple bends feeding into one another, very long straights, very short straights between turns, or complex corners with varying radius) may present ‘edge cases’ - features which are sparse in the training data, or the ANN has not previously seen. In these cases, the predicted line becomes a more generic approximation biased towards the centre of the dataset, and thus the accuracy of the prediction reduces. This is demonstrated by the increased prediction error at Paul Ricard (featuring 3 long straights, and two double-apex corners with varying radius), and the 20.8km Nordschleife (which features an abundance of complex corners, and an extremely long straight). To reduce the impact of this sample biasing (and thus reduce prediction error), the dataset should be centred around similar circuits and diversified. Thus, the average circuit in the training data should contain features similar to those for which predictions are required ( i.e. if a prediction is desired for a small kart track, training the ANN on a dataset featuring only F1-style circuits would result in increased prediction error) - and diversification should be achieved through the use of a greater selection of original circuits in the training data (rather than the large number of augmentations of a small number of circuits used in this study). Prediction accuracy Solution Times Circuit RMSE (m) MAE (m) OCP (s) ANN (s) Hungaroring
Nürburgring GP
Nordschleife
Paul Ricard (1C-V2)
Red Bull Ring GP
Spa
Brands Hatch GP
Monza
Catalunya GP
Average (circuits above) 0.390 0.289 534 0.0333
Table 2.
Accuracy of the racing line predicted by the ANN in comparison to the OCP method, with respective processing times for the 9 real-word circuits in the testing dataset. A quantitative analysis of the prediction error observed across the entire testing dataset is presented in Table 3, delivering a Mean Absolute Error (MAE) of ±0.27m (±0.38m RMSE) averaged across all circuits in the testing dataset - closely echoing the behaviour across the 9 real-world circuits. The distribution of the errors in each prediction closely approximates a Laplace distribution (giving a 50% Confidence Interval (CI) of just ±0.18m), with a mean very close to zero. It is the authors’ belief that the use of flipping and reversing each circuit in the training data (and thus training the ANN on an equal number of left and right-hand bends) has resulted in this symmetric distribution with zero offset.
RMS (m) MAE (m) Mean error (m) 50% CI (m) 95% CI (m)
Table 3.
Overall accuracy of the ANN predictions in comparison to the OCP method across the entire testing dataset
The error distribution provides a 95% Confidence Interval (CI) of ±0.83m - while Brayshaw and Harrison (2005) found that the lines taken by four professional racing drivers varied by more than ±1m. This implies that the ANN is capable of generating a prediction of a racing line which is more accurate than a human racing driver is able to follow an optimal path. These errors are quantitatively smaller than the change in optimal racing line caused by local variations in friction coefficient on the track surface (Christ et al ., 2019) or adjustments vehicle design parameters (Brayshaw and Harrison, 2005). In comparison to other methods of finding the optimal trajectory, the ANN is capable of predicting the racing line with equivalent or better accuracy than other traditional methods - the difference between the line predicted by the ANN and the OCP method compares favourably to the differences between Siegler et al. (2000)’s QSS and transient simulators, and Dal Bianco et al. (2019)’s considerably more computationally expensive direct and indirect methods of solving the OCP. However, it should be noted that several of the existing methods calculate the trajectory alongside a velocity trace and (depending upon the method) vehicle control inputs - which are currently beyond the scope of this study. From the perspective of AV control, the ANN’s prediction accuracy is similar to Andresen et al . (2020)’s accuracy of map generation in an autonomous racing vehicle at racing speed (±0.39m vs ±0.29m RMSE respectively). The accuracy is qualitatively similar to that achievable by a path-following driver model following a racing line at speed in an autonomous racing car (Culley et al. , 2020; Kapania, 2016), and a road-going vehicle in Wang et al . (2016). The typical solution time for generating a racing line for a previously unseen track via the neural network is 33 milliseconds on a 2.4 GHz Intel Core i9-9980HK processor - over 9,000 times faster than generating the line (for the majority of normal length circuits) via the more conventional OCP method. An interesting feature of the ANN approach is that the windows can be calculated simultaneously, while conventional approaches iteratively proceed around the circuit. Thus, solution times for a very long circuit such as the 20.8km Nordschleife (50ms vs
46 minutes for the OCP method) are barely increased from that of a shorter circuit - rendering the ANN approximately 50,000 times faster in generating a racing line for this particular circuit. The method proposed in this paper is also approximately 800 times faster than Kapania et al. (2016)’s 2-step approach - which (to the authors’ knowledge) was previously the fastest known method of generating a non-trivial racing line - whilst delivering a considerably more accurate solution. The ANN is ideally suited to GPU/TPU processing - thus performance could be further expedited on compatible hardware. The qualitative and quantitative comparisons presented in section 3.1 demonstrate that this radically different approach to finding the racing line results in accurate predictions which offer comparable or reduced error to; other traditional approaches for calculating the optimal trajectory; the ability of a human racing driver to follow an optimal path; the effect of small changes in grip level or vehicle parameters; an autonomous vehicle’s ability to map and track a target path. However, the real benefit of this approach to racing line generation lies not in the accuracy of the prediction, but in the speed and computational efficiency of obtaining an accurate solution. The approach presented in this paper delivers an incredibly rapid prediction of the racing line which represents a transformational reduction in solution time over traditional solutions, without sacrificing accuracy. This means that the technique is ideally suited for generation of the target path in real-time, thus not only making this approach suitable for offline generation of the racing line, but also for trajectory planning in an AV using minimal computation resources. The ‘windowed’ nature of the approach means that the trajectory is being simultaneously planned for all sections of the road ahead, and thus it would be possible adapt the technique for the rapid and efficient solution of dynamically changing road conditions - e.g. recovery after an unpredictable event, or adjustments in trajectory to avoid other road users (Erlien et al., all possible routes in real-time - raising the exciting possibility of applications in unexpected event recovery and accident avoidance systems. Due to the long computational times of many of the more accurate, time-optimal approaches to finding the optimal line, a simple MCP or QSS method is commonly employed as a starting point to expedite the process by constraining the problem (Kapania, 2016). Thus the method presented in this paper could be coupled with an OCP method to provide an exceptionally fast, accurate initial approximation for use as pre-calculation prior to fine-tuning with further ( e.g. minimum-time) optimisations.
This work has demonstrated the potential of the use of Machine Learning techniques to develop an extremely rapid prediction of the optimal trajectory around a previously-unseen circuit. A feed-forward dense ANN was selected, with Sigmoid and Hard Sigmoid activation functions (on the hidden intermediate layers and output layer respectively) found to deliver the best performance from the network. During training, a Huber loss function and Nadam optimiser were found to further improve prediction accuracy. This approach does not solve the problem per se , rather it rapidly generates an accurate prediction to the solution based upon prior training upon many solutions to a similar problem - and therefore thousands of circuits were used to train the network. This study used track boundaries for 82 real circuits, which were then expanded to 6058 tracks through various augmentations (including scaling / flipping / reversing etc). An existing Optimal Control method was employed to generate an optimal racing line for each circuit, and each circuit was split into sections via a sliding window approach, resulting in a dataset comprising a total of 2.7 million track segments. The ANN will accept training data from any existing method of generating the racing line and offer a prediction based upon that data. Thus, if a large number of circuits driven by a human driver in a DIL simulator (or a highly-complex and accurate method of calculating the line) were used - the ANN would ‘learn to drive like a particular driver (or simulator) in a particular car’. The calculation time is independent of the complexity of the model that was used for training purposes, and if a highly complex (and computationally expensive) free-trajectory simulator were used to generate the training data, the accuracy of the solution would increase without affecting the prediction time. Predictions of racing lines for previously-unseen circuits were found to be with an average ±0.27m mean absolute error - meaning that the accuracy of the generated line is comparable to (and in many cases better than) other existing traditional methods of obtaining the racing line. In addition, the prediction accuracy is greater than a professional racing driver’s ability to follow the optimal line and similar to that of an autonomous vehicle control system’s path-following accuracy. The network provides the most accurate predictions where a breadth of similar features exist in the training data. In order to achieve the lowest prediction errors, the dataset should be centred around similar circuits by using a training dataset featuring circuits of a similar size and complexity ( i.e. if a prediction is desired for a small kart track, training the ANN on a dataset featuring only F1-style circuits would result in increased prediction error). Additionally, the training data should be diversified to reduce sample bias by using as large a number of original circuits as possible (rather than a large number of augmentations of a small number of circuits used in this study). The ANN calculates a prediction for a full-size racing circuit in approximately 0.033 seconds, making this approach over 9,000 times faster than a rapid OCP approach to finding the racing line, and approximately 800 times faster than the most expedient non-trivial approach reported in the literature survey. However, it should be noted that this approach requires extensive training on existing data, and many other solutions simultaneously generate a speed trace - which is currently beyond the capability of the method presented in this paper. Extremely rapid prediction of an accurate racing line means that this approach is the fastest known method of obtaining a target trajectory for a complete (or partial) circuit, with results comparable to the optimal racing line. This approach is therefore ideally suited to a range of applications including; calculation of a target line for use in traditional simulators; pre-calculation to reduce solution time of free-trajectory ( e.g.
OCP) simulators; real time prediction of the racing line in an autonomous racing vehicle - and it could be adapted for use in trajectory planning and accident avoidance for an autonomous road-going vehicle. This represents a re-think of the traditional approaches to obtaining an optimal trajectory - where previous approaches typically rely upon brute-force computation, this method suggests that a data-driven approach may be considerably more efficient without any fundamental trade-off in accuracy.
Acknowledgement
This project has been made possible with the support of the Autonomous Driving research group in the School of Engineering, Computing & Mathematics at Oxford Brookes University, and the
OBR Autonomous team. The authors would like to thank Peter Ball, Fabio Cuzzolin, Matthias Rolf, Alex Rast and Gordana Collier for their support of the project. Later stages of this work were carried out in conjunction with
Manchester Stinger Motorsports at the University of Manchester, where credit goes to Caroline Jay for her support in founding the team. Special thanks go to the Institute of Automotive Technology at TU Munich - this work would not have been possible without their
Global Race Trajectory Optimisation Tool (TUMFTM, 2019). References
AlQuraishi, M., 2019. End-to-end differentiable learning of protein structure. Cell systems, 8(4), pp.292-301. https://doi.org/10.1016/j.cels.2019.03.006 Andersson, J.A., Gillis, J., Horn, G., Rawlings, J.B., Diehl, M., 2019. CasADi: a software framework for nonlinear optimization and optimal control. Mathematical Programming Computation, 11(1), pp.1-36. https://doi.org/10.5281/zenodo.1257968 Andresen, L., Brandemuehl, A., Hönger, A., Kuan, B., Vödisch, N., Blum, H., Reijgwart, V., Bernreiter, L., Schaupp, L., Chung, J.J., Bürki, M., 2020. Accurate Mapping and Planning for Autonomous Racing. IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) (pp. 4743-4749). arXiv preprint arXiv:2003.05266 Balaji, B., Mallya, S., Genc, S., Gupta, S., Dirac, L., Khare, V., Roy, G., Sun, T., Tao, Y., Townsend, B., Calleja, E., 2020. Deepracer: Autonomous racing platform for experimentation with sim2real reinforcement learning. IEEE International Conference on Robotics and Automation (ICRA) (pp. 2746-2754). IEEE. https://doi.org/10.1109/ICRA40945.2020.9197465 Betz, J., Wischnewski, A., Heilmeier, A., Nobis, F., Stahl, T., Hermansdorfer, L., Lohmann, B., Lienkamp, M., 2019. What can we learn from autonomous level-5 motorsport?. 9th International Munich Chassis Symposium 2018 (pp. 123-146). Springer Vieweg, Wiesbaden. https://doi.org/10.1007/978-3-658-22050-1_12 Botta, M., Gautieri, V., Loiacono, D., Lanzi, P.L., 2012. Evolving the optimal racing line in a high-end racing game. IEEE Conference on Computational Intelligence and Games (CIG) (pp. 108-115). IEEE. https://doi.org/10.1109/CIG.2012.6374145 Brayshaw, D.L., Harrison, M.F., 2005. A quasi steady state approach to race car lap simulation in order to understand the effects of racing line and centre of gravity location. Institution of Mechanical Engineers, Part D: Journal of Automobile Engineering, 219(6), pp.725-739. https://doi.org/10.1243/095440705X11211 Cardamone, L., Loiacono, D., Lanzi, P.L.,Bardelli, A.P., 2010. Searching for the optimal racing line using genetic algorithms. IEEE Conference on Computational Intelligence and Games. https://doi.org/10.1109/ITW.2010.5593330 Casanova, D., 2000. On minimum time vehicle manoeuvring: The theoretical optimal lap. PhD thesis, Cranfield University. https://hdl.handle.net/1826/1091 Christ, F., Wischnewski, A., Heilmeier, A., Lohmann, B., 2019. Time-optimal trajectory planning for a race car considering variable tyre-road friction coefficients. Vehicle System Dynamics, pp.1-25. https://doi.org/10.1080/00423114.2019.1704804 Colunga, I.F., Bradley, A., 2014. Modelling of transient cornering and suspension dynamics, and investigation into the control strategies for an ideal driver in a lap time simulator. Institution of Mechanical Engineers, Part D: Journal of Automobile Engineering, 228(10), pp.1185-1199. https://doi.org/10.1177/0954407014525362 Culley, J., Garlick, S., Esteller, E.G., Georgiev, P., Fursa, I., Vander Sluis, I., Ball, P., Bradley, A., 2020. System Design for a Driverless Autonomous Racing Vehicle. Communication Systems, Networks and Digital Signal Processing (CSNDSP) (pp. 1-6). IEEE. https://doi.org/10.1109/CSNDSP49049.2020.9249626 Dal Bianco, N., Bertolazzi, E., Biral, F., Massaro, M., 2019. Comparison of direct and indirect methods for minimum lap time optimal control problems. Vehicle System Dynamics, 57(5), pp.665-696. https://doi.org/10.1080/00423114.2018.1480048 Dal Bianco, N., Lot, R. and Gadola, M., 2018. Minimum time optimal control simulation of a GP2 race car. Institution of Mechanical Engineers, Part D: Journal of Automobile Engineering, 232(9), pp.1180-1195. https://doi.org/10.1177/0954407017728158 Dozat, T., 2016. Incorporating Nesterov momentum into Adam. International Conference on Learning Representations Workshop. 1–4. Erlien, S.M., Fujita, S., Gerdes, J.C., 2013. Safe driving envelopes for shared control of ground vehicles. IFAC Proceedings Volumes, 46(21), pp.831-836. https://doi.org/10.3182/20130904-4-JP-2042.00096 Fridman, L., Ding, L., Jenik, B., Reimer, B., 2019. Arguing machines: Human supervision of black box AI systems that make life-critical decisions. IEEE Conference on Computer Vision and Pattern Recognition Workshops. https://doi.org/10.1109/cvprw.2019.00173 Gulcehre, C., Moczulski, M., Denil, M., Bengio, Y., 2016. Noisy activation functions. In International conference on machine learning (pp. 3059-3068). arXiv preprint arXiv:1603.00391 Heilmeier, A., Wischnewski, A., Hermansdorfer, L., Betz, J., Lienkamp, M., Lohmann, B., 2019. Minimum curvature trajectory planning and control for an autonomous race car. Vehicle System Dynamics, pp.1-31. https://doi.org/10.1080/00423114.2019.1631455 Huber, P.J., 2004. Robust statistics (Vol. 523). John Wiley & Sons. https://doi.org/10.1002/0471725250 Jain, A., Morari, M., 2020. Computing the racing line using Bayesian optimization. arXiv preprint arXiv:2002.04794. Kapania, N.R., 2016. Trajectory planning and control for an autonomous race vehicle. Stanford University. https://ddl.stanford.edu/publications/trajectory-planning-and-control-autonomous-race-vehicle Kapania, N.R., Subosits, J., Christian Gerdes, J., 2016. A sequential two-step algorithm for fast generation of vehicle racing trajectories. Journal of Dynamic Systems, Measurement, and Control, 138(9). https://doi.org/10.1115/1.4033311 Kelly, D. P., 2008. Lap time simulation with transient vehicle and tyre dynamics. PhD thesis, Cranfield University. https://dspace.lib.cranfield.ac.uk/handle/1826/4791 Lathuilière, S., Mesejo, P., Alameda-Pineda, X., Horaud, R., 2019. A comprehensive analysis of deep regression. IEEE transactions on pattern analysis and machine intelligence. https://doi.org/10.1109/TPAMI.2019.2910523 Lenzo, B., Rossi, V., 2020. A Simple Mono-Dimensional Approach for Lap Time Optimisation. Applied Sciences, 10(4), p.1498. https://doi.org/10.3390/app10041498 Lot, R., Dal Bianco, N., 2015. The significance of high-order dynamics in lap time simulations. The Dynamics of Vehicles on Roads and Tracks: International Association for Vehicle System Dynamics (IAVSD 2015), pp. 553–562. https://doi.org/10.1201/b21185-59 National Highway Traffic Safety Administration, US Department of Transportation, 2015. Critical reasons for crashes investigated in the national motor vehicle crash causation survey, Traffic Safety Facts, No. DOT HS 812 115. Patil, M., Johri, A., Sharma, V., Kaushik, V., 2016. Analyzing the performance of a formula type race car using lap time simulation. Indian Journal of Science and Technology, 9(39). https://doi.org/10.17485/ijst/2016/v9i39/94146 Perantoni, G., Limebeer, D.J., 2014. Optimal control for a formula one car with variable parameters. Vehicle System Dynamics, 52(5), pp.653-678. https://doi.org/10.1080/00423114.2014.889315 Perantoni, G., Limebeer, D.J., 2015. Optimal control of a formula one car on a three-dimensional track—Part 1: Track modeling and identification. Journal of Dynamic Systems, Measurement, and Control, 137(5). https://doi.org/10.1115/1.4029466 Redmon, J., Farhadi, A., 2018. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767 Roh, Y., Heo, G., Whang, S.E., 2019. A survey on data collection for machine learning: a big data-ai integration perspective. IEEE Transactions on Knowledge and Data Engineering. https://doi.org/10.1109/TKDE.2019.2946162 Salem, M., Mora, A.M., Merelo, J.J., 2019. Beating uncertainty in racing bot evolution through enhanced exploration and pole position selection. IEEE Conference on Games (CoG) (pp. 1-8). IEEE. https://doi.org/10.1109/CIG.2019.8847998 Siegler, B., Deakin, A., Crolla, D., 2000. Lap time simulation: Comparison of steady state, quasi-static and transient racing car cornering strategies. SAE transactions, pp.2575-2581. https://doi.org/10.4271/2000-01-3563 Skeete, J.P., 2019. The obscure link between motorsport and energy efficient, low-carbon innovation: Evidence from the UK and European Union. Journal of Cleaner Production, 214, pp.674-684. https://doi.org/10.1016/j.jclepro.2019.01.048 Stone, M., 1974. Cross‐validatory choice and assessment of statistical predictions. Journal of the Royal Statistical Society: Series B (Methodological), 36(2), pp.111-133. https://doi.org/10.1111/j.2517-6161.1974.tb00994.x Tampuu, A., Matiisen, T., Semikin, M., Fishman, D., Muhammad, N., 2020. A survey of end-to-end driving: Architectures and training methods. IEEE Transactions on Neural Networks and Learning Systems. https://doi.org/10.1109/TNNLS.2020.3043505 TUMFTM, 2019. TUMFTM/global_racetrajectory_optimization, GitHub. Available at: https://github.com/TUMFTM/global_racetrajectory_optimization [dataset] TUMFTM, 2020. Racetrack-Database. https://github.com/TUMFTM/racetrack-database Wang, R., Jing, H., Hu, C., Yan, F., Chen, N., 2016. Robust H ∞∞