Hey all,

Maybe I'm tired and the answer is staring me in the face, but I thought I'd throw this problem out to see who can solve it.

In 2.7.5 I'm looking to add linear deceleration when approaching a waypoint. Right now we decelerate at a proportion of our distance. This is ok in certain situations, but it fails horribly when you're flying faster than 6m/s. Currently the copter will rapidly decelerate and then slow down too much as it approaches the WP. What we need is a continuous and linear deceleration of a set amount (say 100cm/s/s).

If you just do this by measuring time, you'll get burned by wind and aerodynamic effects. We need something that can look at the deceleration and adjust so we don't overshoot or stop short. A PID controller could work or something simpler. I also want to keep it computationally small and close approximations are fine.

We could run a mortgage style calc every GPS read as well. 

Anyone know the best approach?


Views: 2038

Reply to This

Replies to This Discussion

Nice. I'm stuck at work and can't look right now. Will check it out tonight or tomorrow morning.

Just a thought as I've been wanting to do this for a while too.

How about a simple approach where wpspeed is the set speed in m/s and wpdist is the distance from the waypoint in m:

If wpspeed>6 and 60<wpdist<wpspeed*10, then set wpspeed=wpdist/10.

That way for say 10m/s wpspeed, it'll start adjusting the wpspeed from 100m out. By the time it is 60m from waypoint the wpspeed will be set to 6m/s automatically.

One would ofcourse need to store what the original wpspeed setting was and revert back to it as it goes to the next waypoint. It can then gradually accelerate in the same way.

i have this implemented in the sim and its working great.  Thanks everyone. And faster copter flyers will thank you as well.

Robert, i've done a slightly different implementation that i'll fly tomorrow then push for 2.81's release. it still uses your equation, just handles accelerating differently.


If you plot this approach out you'll see some wild differences in deceleration. The velocity command will become a function of the distance which isn't linear. It's basically what we have now and it almost wrecked Roberts very fast heli.


I contributed nothing here, but it was really fun to follow along.

Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service