Autonomous driving technology has been a particular interest for both industrial and research communities in the last a few years. Baidu, one of the leading companies in this field, has been putting great efforts into building an open community with its open-source self-driving solution since 2017 [1], [2], [3]. With years’ development (Baidu began its autonomous driving research since 2013), we had tested hundreds of vehicles with tens of thousand hours and with multiple generations of algorithms. As the number of deployed vehicles keeps increasing, we soon found that manually calibrating (we only refer to longitudinal vehicle dynamics calibration in this paper) each vehicle is infeasible. Manual calibration involves considerable labours, which, in other words, predicts large amount of time and great potential for man-made mistakes. Further, vehicle dynamics usually vary noticeably during driving (i.e. loads changes, vehicle parts worn out over time, surface friction [4]), and manual calibration cannot possibly cover them. Taken together, it is surprising that most research papers did not attempt to address this manual-calibration puzzle. One could attribute this to the fact that most research-oriented projects only focus on very few vehicles. To solve this industrial-specific problem, in this paper we propose a novel auto-calibration (for longitudinal dynamics) system based on both offline model and online learning.
Previous researches have investigated longitudinal control algorithms extensively, and regarded it as a challenging problem [5], [6], [7]. One major challenge lies in a mission impossible — to establish an accurate longitudinal vehicle dynamics in real time [8], [9], [10]. A control model with accurate longitudinal vehicle dynamics bridges gap between desired speeds and vehicle throttling/braking commands. A popular solution is to establish this state-space relation based on Newton formula [11], [12], [13], [14]. However, transmission system, power-train system, and actuator system are all very complex. It is not only difficult to model all these systems but also it requires unacceptable computing time as more systems involved.
In this paper, we address this challenging topic from another perspective. We consider the entire longitudinal control algorithm as an end-to-end problem, which can be solved in two steps: (1) Based on human driving data, we first generate a calibration table, which takes throttle, brake, and speed as inputs, and outputs acceleration. (2) Then a sophisticated on-line algorithm updates the table to properly cover the varying vehicle dynamics. Our results show that the auto-calibration system does save considerable amount of time and improves control accuracy. The calibration is also automated and intelligent, due to which, is suitable for mass-scale self-driving vehicle deployment.
A. Apollo Autonomous Driving Control Module
Before launching into the methodological detail of this paper, it is useful to briefly review the current architecture of Apollo control module. Apollo control module is designed to track trajectories generated by Apollo planning module, and minimize tracking errors. It takes trajectory, vehicle position, and vehicle status as inputs, and sends steering, braking, and throttling commands to manipulate vehicle. Apollo control module includes lateral algorithm (which generates steering commands) and longitudinal algorithm (which generates braking/throttling commands), see Fig.1 for details. The longitudinal calibration algorithm, the topic of this paper, calculates throttle/brake values in the form of Eq. 1. Note that acceleration (acc) and speed (v) are known variables given by longitudinal algorithm. This table hence simply maps (acc,v) to throttling/braking commands (cmd). An offline auto-calibration algorithm is used to generate an initial table for each vehicle. To cover varying vehicle dynamics, Apollo control module compensates offline table with an online learning algorithm. Together, the offline model and online algorithm guarantee the stability and accuracy of Apollo control module.
where T refers to calibration table, acc is desired acceleration, v is current vehicle speed, and cmd is control command, i.e. throttling/braking value.
Fig. 1: Apollo control framework
1) Offline Model: Offline model generates an initial calibration table from manual driving data that best reflects vehicle longitudinal performance at the time of driving. The workflow of offline algorithm includes: (1) collecting human driving data, (2) preprocessing the data and select input features, (3) generating calibration table through machine learning models.
2) Online Learning: Online algorithm instantly adjusts the offline table based on real-time feedback in self-driving mode. It aims to best match current vehicle dynamics based on offline model established from manual driving data. Several challenges this algorithm has to handle includes frequent vehicle load changes and mechanical components fatigue in the long run. The workflow of online algorithm includes: (1) collecting vehicle status and feedback in real time, (2) preprocessing and filter data, (3) adjusting calibration table accordingly.
B. Data Preprocessing
Since real-world data always comes with noises, it is essential to preprocess data for both offline model and online learning algorithm. Note that due to different data sources, separate data preprocessing methods are used for offline model and online learning algorithm.
1) Offline Model Data Preprocessing: Offline model takes
human driving data as input. Throttling/braking values, speed, and longitudinal acceleration are chosen as features for this model. Note that throttling model and braking model are trained separately.
Since human driving data are naturally noisy and nonuniform (i.e. speed/acceleration does not distribute evenly during driving), Apollo control module takes a few steps to clean the data. First, a mean filter in Eq. 2 is used to smooth data. Further, Eq. 3 is applied to remove data with lateral swing. Last but not least, Eq. 4 is enforced to remove outliers.
where N is the mean filter window size, xt, xt
, xt
are data from time t
1 to t
N.
where refers to steering wheel angle,
refers to steering wheel angle threshold.
where x is data to be processed, xmean is mean of the data, xstd is standard deviation of the data.
2) Online Learning Data Preprocessing: Online learning
algorithm frequently adjusts calibration table built by offline model, on the basis of real-time vehicular status feedback in self-driving mode. The selected features for this algorithm are: a) throttling/braking commands; b) speed; c) desired acceleration; d) actual acceleration.
Again, only data complying with Eq. 3 are used. Meanwhile, since certain differential techniques are involved (see next Section for details), we use Eq. 5 to guarantee monotonicity throughout sequences of control commands.
T cmdi][vx
T
cmdj][vx] cmdi
cmd j < 0,
cmdi,cmdj,vx (5) where T
refers to updated calibration table; T
cmdi][vx] indexes the acceleration corresponding to control command cmdi and speed vx. As to real-time data acquisition, one would expect a response delay (i.e. the time between throttling/braking commands being sent and corresponding acceleration being executed) caused by vehicular actuator. Such delay inevitably affects the quality of data, a common and useful technique is to collect data from sensors with a reasonable delay estimation [21]. In our case, we take acceleration measured by IMU (Inertial Measurement Unit), 200 milliseconds after sending throttling/braking command, as the actual acceleration driven by that command. A Butterworth low pass filter, with an order of 3 and cutoff frequency of 2 Hz, is then used to remove high-frequency fluctuations. In case that 200 milliseconds’ delay estimation may not always be appropriate, Eq. 6 is used to further ensure data consistency.
PSEUDO ALGORITHM 1: OFFLINE AUTO-CALIBRATION Input: cmd: control command (throttle/brake) Input: speed: current speed Input: acc: acceleration from IMU Input: : steering wheel angle
1 if 2 then remove current sample 3 for each sample 4 then determine [v][cmd] grid based on sample
5 store sampleacc to corresponding [v][cmd] grid 6 for each [v][cmd] grid 7 then uniform sample numbers in each [v][cmd] grid 8 remove outlier sampleacc outlier from each grid 9 Throttle Model
10 Brake Model
enforced on sensor data (vk, ak) to remove senseless noises.
C. Offline Model Algorithm
Pseudo Algorithm 1 illustrates the procedure of offline model training process. Data is first preprocessed as described in Section II-B.1 (Line 1 to Line 8), after which, different models for throttling and braking are constructed (Line 9 to Line 10). A standard three-layer feedforward neural network is used in offline algorithm model, with a sigmoid function as the activation function and mean square error as the cost function. The network is built using Tensorflow with a build-in Adam optimizer. In comparison, we have evaluated multiple traditional machine learning regression methods for offline model:
• Gaussian Process Regression [22], with polynomial kernel. It is a model-free algorithm used to solve regression problems in various domains [23], [24], [25], [26].
• Linear Regression, a basic regression model with linear kernel.
• Support Vector Machine [27], with polynomial kernel. • M5P [28], a M5 model trees.
• Random Forest [29], with one hundred iterations.
These methods were implemented and evaluated with WEKA [30]. Detailed settings and parameters can be found in WEKA.
D. Online Learning Algorithm
For each control cycle, online learning algorithm updates calibration table based on real-time vehicular feedback. Once adjusted, new table takes effect immediately from the next control cycle. Pseudo Algorithm 2 gives the implementation detalis of real-time calibration process.
Data is first preprocessed via Line 1 to Line 5. If desired speed and actual speed already converges (Eq. 8), the algorithm stops calibrating process (Line 6 to Line 7).
PSEUDO ALGORITHM 2: ONLINE AUTO-CALIBRATION Input: cmdre f: control command at time k Input: vre f
: current speed at time k Input: accre f
: expected acceleration at time k Input: acck: actual acceleration at time k Input:
: the updated value for acct
1 Fetch original table in the form of T[cmd][v] = acc 2 if Driving Mode != AUTO or 3 then break 4 Calculate and Preprocess cmdre f
5 Get acck from sensor 6 if ConvergeCheck == true 7 then break 8 for i
9 then acct
for each [v][cmd] grid 11 Updating: acct = acct
12 Export T
13 Updating: T
14 Longitudinal controller
where ev is current speed error, vref is expected speed, vactual is vehicle actual speed and is the threshold.
The gain (From Line 8 to Line 11) is determined by comparing the difference between expected acceleration and actual acceleration (Eq. 9).
where accref is expected acceleration, acck is actual acceleration collected from sensors like IMU with delay estimation. To update calibration table T, a cost function described by Eq. 10 is used for each table grid T[cmdi][v j].
where distancecmdirefers to distance decay coefficient written as Eq. 11:
cmdref
cmdi
vref
vj
(11) where
and
refer to control command decay coefficient and speed decay coefficient, respectively. Both mcmd and mv are distance decay factors.
is set to 1e
and
is written as Eq. 12.
Apart from distance factor, similarity cost (costsimilarity) is defined as Eq. 13. Generally, similarity cost intends to preserve the original table. This is because we assume that initial table is reasonably accurate and should not be modified significantly during any short time.
TABLE I: Vehicle performance of Lincoln MKZ and AX1
TABLE II: Models Accuracy Comparisons (m/s2)
where is similarity decay coefficient, and
is exponential decay factor. Taken together, the update gain
is calculated as Eq. 14:
where is learning ratio. Finally, original Table (T) is updated to new table (T
) in the form of Eq. 15 (Line 12),
subjected to:
cmdi cmdj < 0, j, x
n (16a)
cmdref
cmdm
, m
t (16b) (vref
vk
are f
ak) > 0 (16c)
and T is then ready to be used (Line 11). As one would expect, T
becomes T in the next control circle and a new iteration begins (Line 13).
A. Test Vehicles
Two types of vehicles (Table I) were used to test the performance under different algorithms: (1) hybrid passenger vehicle — Lincoln MKZ; (2) electronic delivery-only vehicle — Neolix AX1 [31] 1.
B. Offline Model Evaluation
Offline model was tested on Lincoln MKZ with cross validation and road performance. In this section, test vehicles were put to a medium load, e.g. two passengers plus standard on-board equipments, around 200 kg in total.
Lincoln MKZ has more complex powertrain systems than Neolix AX1. Hence, if the offline calibration model works fine on Lincoln MKZ it should work well on Neolix AX1 too (and it does, see next Section).
TABLE III: Offline Calibration Comparison
1) Cross Validation: Table II shows ten-fold crossvalidation results for offline calibration model described in Section II-C. Note that MAE refers to Mean Absolute Error, whereas RMSE refers to Root Mean Square Error.
Among all algorithms tested, Gaussian process regression, linear regression, and support vector machine were first ruled out due to their poor performance. Random Forest performed considerably better, but best results were obtained using neural network, which, in general, was able to achieve an accuracy within 3%, compared to [0,4] m/s2 effective range for throttling and s2 effective range for braking. Taken together, neural network was chosen as the offline calibration model.
2) Calibration Table View: Figure 2 intuitively shows a calibration table modeled by the offline algorithm, where neural network is the modeling algorithm with the same dataset in Section III-B.1. Figure 2a and 2b indicate that both the command-acceleration relation and speed-acceleration relation are close to monotonicity, as one may expect.
3) Road Performance: Usually, algorithms working fine under laboratory conditions with given inputs do not necessary mean they would have the same level of performance in actual industrial environments. In Baidu, we take road performance very seriously. After all, our algorithms will be implemented on numberless vehicles, including but not limited to our own 100+ vehicles. We used speed error and station error to exam road performance: (1) speed error = desired speed - actual speed; (2) station error = expected location - actual location.
The offline calibration algorithm was first deployed on a Lincoln MKZ with a standard Baidu Apollo driving solution. We then compared road performance between manual calibration2 and offline auto-calibration algorithm. Ten rounds of road tests, each of which consists of 30 minutes with maximum speed at 10 m/s, were run for both control group (manual calibration) and experimental group (offline auto-calibration).
The results show that offline auto-calibration model and manual calibration almost performed equivalently on speed error (Table III). As to station error, however, offline auto-calibration model performed considerably better (Table III).
Fig. 2: Offline calibration table 3D view
TABLE IV: Cross-Vehicle Performance
Table IV shows more results on randomly selected vehicles (all Lincoln MKZ) for offline auto-calibration model only. It is clear that the offline model performed similarly across different vehicles, which proves its robustness.
C. Online Algorithm Evaluation
For online calibration tests, a Neolix AX1 (a delivery-only vehicle, maximum speed at 3 m/s) was used. During tests, an offline calibration table was first built at dead load (0 kg), then online calibration algorithm started adjusting the table at dead load, 150 kg load, 300 kg load, and 360 kg load (20% overload). One would expect small speed/station errors across all loads with online calibration enabled.
TABLE V: Speed Errors with Load Changes (m/s)
1) Road Performance: Three repeated rounds were set for the test vehicle at each load, with each round consisting of 15 minutes’ autonomous driving. Results can be found in Table V and Table VI. Online calibration outperformed the offline one at almost every load, suggesting that online calibration
TABLE VI: Station Errors with Load Changes (m)
algorithm did adjust the initial table appropriately. Interestingly, improvement on station error again outweighed that on speed error, similar to the results of offline calibration tests. This might due to the fact that commands (throttling/braking) generated from the table only directly affects acceleration. Any error on acceleration will be amplified twice to station error (since station error is second integration of acceleration error).
Figure 3 shows speed/station error per frame during a typical round at full load (300 kg). Without online calibration, the vehicle’s speed fluctuated considerably, with peak value around -2.0 m/s. Conversely, the vehicle was able to maintain a relatively steady speed with online calibration. Similar pattern can also be found on station error.
2) Calibration Table View: A table before and after calibration is available in Appendix in Section V-A. Note that before calibration the table was simply an initial calibration table built from manual driving data at dead load. Then the vehicle was put at 300 kg load and run for approximately 30 minutes and a new table was generated after thousands of real-time adjustments.
From the updated table, it is clear that same throttling/braking commands lead to lower acclerations/decelerations. This suggests that the vehicle’s ability of accleration/deceleration is reduced, exactly matching what one would expect when a vehicle is at full load.
D. Computational complexity
Offline calibration model requires less than ten seconds on a Dell Precision 7510 workstation to build an initial calibration table. On an industrial standard Nuvo-5095GC
Fig. 3: Control error of AX1 under full load
machine, online calibration takes less than 2 milliseconds to complete adjustment on calibration table per cycle. It is also possible to parallelize the computation of grid updating during online calibration, since each grid in a table is independent of other grids [32].
In this manuscript, we presented a longitudinal control calibration algorithm, consisting of an offline calibration model and an online calibration algorithm. For the offline calibration model, we have tested quite a few machine learning techniques (see Table II) and eventually found an end-to-end solution (neural network). We have also tried numberless data preprocessing methods to obtain clean and useful data out of massive amount of data and noises (see Section II-B). Contrary to offline calibration, we chose a model-free method for online calibration. Specifically, online calibration was implemented in a gradient-descent way (see Section II-D). Since online calibration runs at high frequency (i.e. 100 Hz in our case), gradient-descent is a more reliable way to update calibration table, without the risk of choosing a wrong model. The results show that with calibration enabled, our test vehicles performed significantly better as to control accuracy (speed/station error). What is more, the algorithm has been deployed to multiple Baidu Apollo autonomous driving vehicles, including standard hybrid family vehicles and electronic delivery-only vehicles. As of August 27th 2018, it had been tested more than two thousands hours, with around ten thousands kilometers’ (6,213 miles) road tests. Finally, we would like to end with Baidu Apollo slogan: We choose to go to the moon in this decade and do the
other things, not because they are easy, but because they are hard. — John F. Kennedy. Baidu Apollo autonomous driving platform is designed to target one of the most challenging problems in the field of artificial intelligence. We, the Apollo Community, will continue delivering systems that can free drivers’ hands.
[1] Apollo Auto, https://github.com/ApolloAuto/apollo.
[2] Fan, H., et al. ”Baidu Apollo EM Motion Planner.” arXiv preprint arXiv:1807.08048 (2018).
[3] Fan, H., et al. ”An Auto-tuning Framework for Autonomous Vehicles.” arXiv preprint arXiv:1808.04913 (2018).
[4] Canudas-de-Wit, C., et al. ”Dynamic friction models for road/tire longitudinal interaction.” Vehicle System Dynamics 39.3 (2003): 189-226.
[5] Khodayari, A., et al. ”A historical review on lateral and longitudinal control of autonomous vehicle motions.” Mechanical and Electrical Technology (ICMET), 2010 2nd International Conference on. IEEE, 2010.
[6] Rajamani, R. ”Vehicle dynamics and control.” Springer Science & Business Media, 2011.
[7] Pack, R.T., et al. ”System and method for behavior based control of an autonomous vehicle.” U.S. Patent 8,078,338, iRobot Corp, 2011.
[8] Chen, Y. and Wang, J. ”Adaptive vehicle speed control with input injections for longitudinal motion independent road frictional condition estimation.” IEEE Transactions on Vehicular Technology, 60(3), pp.839-848, 2011
[9] Falcone, et al. ”A linear time varying model predictive control approach to the integrated vehicle dynamics control problem in autonomous systems.” In Decision and Control, 2007 46th IEEE Conference on (pp. 2980-2985). IEEE, 2007, December.
[10] Martinez, J.J. and Canudas-de-Wit, C. ”A safe longitudinal control for adaptive cruise control and stop-and-go scenarios.” IEEE Transactions on control systems technology, 15(2), pp.246-258, 2007
[11] Bageshwar, et al. ”Model predictive control of transitional maneuvers for adaptive cruise control vehicles.” IEEE Transactions on Vehicular Technology, 53(5), pp.1573-1585, 2004
[12] Levinson, J., ”Towards fully autonomous driving: Systems and algorithms.” In Intelligent Vehicles Symposium (IV), 2011 IEEE (pp. 163-168). IEEE, 2011, June.
[13] Raffo, G.V., et al. ”A predictive controller for autonomous vehicle path tracking.” IEEE transactions on intelligent transportation systems, 10(1), pp.92-102, 2009.
[14] Attia, R., et al. ”Combined longitudinal and lateral control for automated vehicle guidance.” Vehicle System Dynamics 52.2 (2014): 261-279.
[15] Kim, H., et al. ”Mode transition control using disturbance compensation for a parallel hybrid electric vehicle.” Proceedings of the Institution of Mechanical Engineers, Part D: Journal of Automobile Engineering, 225(2), pp.150-166, 2011.
[16] Bayindir, K.., et al. ”A comprehensive overview of hybrid electric vehicle: Powertrain configurations, powertrain control techniques and electronic control units.” Energy Conversion and Management, 52(2), pp.1305-1313, 2011.
[17] Del Re, L., et al. ”Automotive model predictive control: models, methods and applications (Vol. 402).” Springer, 2010.
[18] Nam, K, et al. ”Wheel slip control for improving traction-ability and energy efficiency of a personal electric vehicle.” Energies 8.7 (2015): 6820-6840.
[19] Wu, C., et al. ”A fuel economy optimization system with applications in vehicles with human drivers and autonomous vehicles.” Transportation Research Part D: Transport and Environment, 16(7), pp.515-524, 2011.
[20] Nelles, O. ”Nonlinear system identification: from classical approaches to neural networks and fuzzy models.” Springer Science & Business Media, 2013.
[21] Sukkarieh, S., et al. ”A high integrity IMU/GPS navigation loop for autonomous land vehicle applications.” IEEE Transactions on Robotics and Automation 15.3 (1999): 572-578.
[22] Rasmussen, C. ”Gaussian processes in machine learning.” Advanced lectures on machine learning. Springer, Berlin, Heidelberg, 2004. 63-71.
[23] Zhu, F., et al. ”Computed tomography perfusion imaging denoising using Gaussian process regression.” Physics in Medicine & Biology 57.12 (2012): N183.
[24] Zhu, F., and Yuanfang Guan. ”Predicting dynamic signaling network response under unseen perturbations.” Bioinformatics 30.19 (2014): 2772-2778.
[25] Sieberts, S. K., et al. ”Crowdsourced assessment of common genetic contribution to predicting anti-TNF treatment response in rheumatoid arthritis.” Nature communications 7 (2016): 12460.
[26] Zhu, F., et al. ”COMPASS: A computational model to predict changes in MMSE scores 24-months after initial assessment of Alzheimers disease.” Scientific reports 6 (2016): 34567.
[27] Hearst, M. A., et al. ”Support vector machines.” IEEE Intelligent Systems and their applications 13.4 (1998): 18-28.
[28] Quinlan, J. R. ”Learning with continuous classes.” 5th Australian joint conference on artificial intelligence. Vol. 92. 1992.
[29] Breiman, L., ”Random forests.” Machine learning 45.1 (2001): 5-32.
[30] Hall, M., et al. ”The WEKA data mining software: an update.” ACM SIGKDD explorations newsletter 11.1 (2009): 10-18.
[31] Neolix AX1, https://www.neolix.cn.
[32] Zhu, F., et al. ”Parallel perfusion imaging processing using GPGPU.” Computer methods and programs in biomedicine 108.3 (2012): 1012-1021.
A. Calibration Table View
Figure A.1 illustrates the calibration table before and after the online calibration. As there is no ground truth for calibration table, whether the updating changes suit our expectation is the criteria here.
Take 20 percent of throttle command as an example, it is able to generate an acceleration around 0.5 m/s2 in the initial table, which is inferred without any load. After online calibrating, system determines that a 20 percent of throttle is only able to generate a slightly bigger than zero acceleration, as one may expected.
Fig. A.1: Comparison of initial and online updated calibration table