Fix the absence of the objects' bound in prediction. #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, the maintainers of OpenPlanner.
As discussed in hatem-darweesh/autoware.ai.openplanner#7, there has been a problem that the op_trajectory_evaluator would not consider the bounding-box along the predicted trajectories of objects. Hence, this PR aims at solving this problem without hurting performance.
Root Cause of the Problem
While calculating the distance cost of rollouts, the trajectory evaluator will consider the predicted trajectories of detected objects through increasing the lateral cost of rollouts those are close to a waypoint of predicted trajectories, as shown in the following code snippet (from op_planner):
However, in the comparing condition
actual_lateral_distance < c_lateral_d
,c_lateral_d
is defined as:which only considers the width of the ego, but ignores the bound of the detected objects. Therefore, if the object is large (e.g., a truck),
critical_lateral_distance
will be too small, resulting in collisions (see video-1). Hence, the bound of the object should also be considered into the calculation of critical_lateral_distance.However, as pointed out by @hatem-darweesh, if bounding boxes of all predicted trajectory waypoints are calculated, the performance will be hurt a lot (about 20% more CPU clocks, measured by
perf
). To avoid this, I use the circumcircle of the bounding box instead. The calculation of a circumcircle is easier since it does not need to calculate the orientation while the bounding box requires it.The final solution is easy and does not increase the code size (see File changed of the PR) as well as the performance overhead (see Performance Evaluation). And it can actually be safer, demonstrated by video-1 and video-2.
Video demonstrations of the solution
The videos are larger than 10MB, so I put them on youtube.
video-1: https://youtu.be/LYpQKPATKYk. A collision caused by ignoring the bound of objects.
video-2: https://youtu.be/FzZDTIinmxo. After patching the problem, the collision would not happen, and the ego will intendedly try to overtake the truck by changing the driving lane.
Performance Evaluation
I use
perf
(https://perf.wiki.kernel.org/index.php/Main_Page) to measure the performance. The performance of before-patch and after-patch are both measured on a driving scenario with 14 NPCs, using the LGSVL simulator. As the following figures show, the performance does not increase from the aspect of CPU clocks. Before-patch takes 43.05% CPU clocks and After-patch takes 32.39% CPU clocks. After-patch has lower CPU clocks percentage which I think is because the scenario last longer since the collision did not happen.Before patch:
After patch: