I'm working with drones and I want them to follow a path.
This is the current behavior (black is the path, red is the drone):
As you can see, it goes to the destination point (C), but it doesn't follow the desired path.
This is the behavior I want to achieve:
It's normal it doesn't follow the path after the turn, but I want to correct it as soon as possible.
It works with speeds so this is what I'm currently doing (this is being done each frame):
Distance:
$distx = pointC.x - drone.x$
$disty = pointC.y - drone.y$
$distxy = \sqrt{distx² + disty²}$
Time:
$time = \frac{distxy}{desiredSpeed}$
Speeds:
$dx = \frac{distx}{time}$
$dy = \frac{disty}{time}$
If you need more details, let me know it. Thank you.


Looks like you just want a PID control.
Without knowing more about the physical properties of the drone I can't tell you what values to use, and you could possibly do this analytically, but depending on the application you can probably just get away with empirically tweaking the coefficients until they give you the behaviour you're after.
You're probably going to want to find the line intersecting B and C and then drop a normal to your drone and heavily weight the distance of that in your error function.