Auto_control set pos_sp

In mission mode.i found the quad can not fly follow the line very good.like this blow:

I tried mission (QGroundControl) mode with Pixhawk 4 PX4 (Holybro) + GPS on quadcopter Tarot Sport 650.
It seems; it’s ok for the firsts flight test.

I used Gps Garmin and Basecamp to see if the tracks matches with the waypoints.
The tracks are recorded by Garmin Virb wich used on the quadcopter.

I tried also the “Return to Landing” for abort the mission.

Thanks for your reply,I think the question may caused by the function control_auto in mc_pos_control_main.cpp 。The pos_ps calculate from _pos_sp_triplet.current and _pos_sp_triplet.previous.

pos_sp(0) = closest_point(0) + unit_prev_to_current(0) * vel_sp_along_track / _pos_p(0);
pos_sp(1) = closest_point(1) + unit_prev_to_current(1) * vel_sp_along_track / _pos_p(1);

The pos_sp should not out the range of _pos_sp_triplet.current.