Prediction Bug [fixed]
Describe the bug
While testing, we found that the prediction module sometimes crashed due to out-of-range access. The log of the prediction module is as follows.
System information
OS Platform and Distribution: Ubuntu 18.04
Apollo installed from (source or binary): source
Apollo version : master (master branch -commit e373b20)
To Reproduce
The cyber record link: https://drive.google.com/file/d/1fgo5Tz2XXT8VTuH2FazXTdXe-lRcLSWn/view?usp=sharing
Additional context
We found that the crash occurred in function JointlyPredictionPlanningEvaluator::ExtractADCTrajectory.
When the size of the input trajectory_points is 0, when accessing the trajectory_points- >at(i).path_point().x() at line 547 (the i is 0), an out_of_range error occurs and causes a crash.
Further, we found that the
JointlyPredictionPlanningEvaluator::Evaluate function incorrectly called ExtractADCTrajectory, which caused the crash. When the size of adc_traj.trajectory_point() is 1, the judgment on line 328 can be passed, but the size of adc_traj_curr_pos will be 0, causing the above crash.
Solution
Therefore, we recommend setting the threshold for judgment on line 328 to 2. This modification can avoid the above errors and will not affect the functionality of thisfunction.