Position control not constant?

Hello all! Sorry for asking so many questions, but i ma new to autopilot and i am quite confused. I have written a very simple flight mode as seen here.:

However, when i run the mode inside Mission Planner through SITL, 2 problems arise. The first is that the copter does not obey the set_max_speed and set_max_accel constraints. Am i oversimplifying how to call these functions? Even when max speed is set to 1 cm/s the copter accelerates until it crashes.
My second problem is when i run the custom flight mode in SITL multiple times, without changing the code, from the same location, the copter seems to go in two different directions. Each purple line marks one simulation. Both were called on the exact same mode.

Any help is greatly appreciated!

changing set_xy_target to shift_pos_xy_target produces the following 2 paths: again the flight paths are different.