PurePursuit class has left over variable and small bug.
Description
How to Reproduce
Bug is hidden in compute_target_point
method of PurePursuit
class.
When trajectory is so short that all of it’s points are within the distance threshold then m_reference_idx
is used to store the index of the farthest point in traveling direction, so next time the method won’t iterate from the beginning.
However if the PurePursuit
instance will be updated with new trajectory which size is less or equal current value of m_reference_idx
then stop_command will be issued as compute_target_point
won’t be able to compute correctly.
Also PurePursuit
has unused variable m_is_traj_update
.
Current Behavior
It simply won't look for the points in the trajectory as stop condition of for loop (line 244) will be already fulfilled.
Expected behavior
PurePursuit
should analyse new trajectory.
One solution would be to get rid of the m_reference_idx
as this optimization may be negligible in case of such short trajectories and for the long ones it is not used at all.
Other solution would be to reset m_reference_idx
when new trajectory is received, by overloading handle_new_trajectory
.