-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Observation
In the following example:
The pose visualized at the end of the path is the pose returned by findPathFurthestReachedPoint. However this is wrong as it is clear that none of the trajectories' end pose is closest to that end point (which is what findPathFurthestReachedPoint looks for)
Bug Explanation
The function 'findPathFurthestReachedPoint' contains a flawed optimization that causes many trajectories to incorrectly match the points further along the path, even when they are actually closest to earlier path points.
The inner loop uses a constrained search starting from 'max_id_by_trajectories'
This creates a cascading constraint where each trajectory can only search path points from where the previous best trajectory reached forward. This works well when all trajectories progress monotonically forward along the path, however breaks down in a scenario, like the one illustrated above, where the candidate trajectories approach the path "from another direction".
Because the search length becomes limited, some trajectories, in this case the ones facing forward, are falsely considered to be closer to points further along the path when in reality, when searching from the beginning, they are the closest to poses from the beginning of the path.
It's not the easiest thing to visualize, I hope it's clear?
Solution Proposal
1 - Remove the optimization and search from the beginning of the path
2- I'm not sure that's valid but can't we instead use the last optimal path to get the furthest reached point?
P.S: we can add the optimization to stop the search if max_id_by_trajectories is already at the end of the path