We implemented a PID controller for our quadcopter which allows us to fly from point A to B. The precise position of the quadcopter is measured using an external tracking system.

Now that we can fly from A to B, we would like to implement a controller to fly more complex trajectories with multiple set points. E.g. from A to B to C or flying in a circle using sample points.

We tried to use our regular PID controller for this but this of course doesn't work well since the PID controller forces the quadcopter to stabalize at any set point. We would like to have a controller that allows the quadcopter to fly a trajectory fairly smoothly. I think this has to be a controller that takes into account multiple set points in the trajectory at the same time so that it can already slow down/speed up based on the trajectory that is ahead.

Can someone point me to some controllers / algorithms that I can look at to realize this? Do I need a completely different controller to do this or will it be an adapted version of the PID controller that I have now?


1 Answer 1


The most common way to address this is to actually change the setpoint sent to the controller over time. For example, to get from point A to point B in T seconds, you would do $$ \begin{align} x^d(t) &= t p_B + (T-t) p_A \end{align} $$ where $x^d$ is the desired position sent to the controller, $p_A$ and $p_B$ are the two setpoints, and $t$ is time (assume $t=0$ at the start of the maneuver). For best control it is also good to define a desired velocity: $$ \begin{align} v^d &= \frac{||p_B - p_A||}{T} \end{align} $$

This process in general is called trajectory generation.

  • $\begingroup$ But this formula requires to change the setpoint of the controller all the time. However, normally when I change the setpoint of my PID controller, I also reset my entire PID because we need to go to a new position. This would mean that I have to reset my pid controller all the time ... at that moment it would not do anything anymore. $\endgroup$
    – alcon
    Commented Feb 4, 2015 at 23:37
  • 1
    $\begingroup$ What do you mean "reset" your PID? $\endgroup$
    – ryan0270
    Commented Feb 4, 2015 at 23:46
  • $\begingroup$ When I fly a completely different trajectory, I reset my PID because it has nothing to do with it any more. But probably to go to consecutive setpoints in a single trajectory I should not reset my pid. Does this makes sense? $\endgroup$
    – alcon
    Commented Feb 5, 2015 at 9:05
  • $\begingroup$ Correct, there should be no need to reset your PID. In general, you should always have a trajectory generation step before your PID. This way if the user suddenly changes setpoints, causing a large position erorr, your system doesn't go crazy; the trajectory generation step generates a smooth plan to get from the current position the new one so the controller never needs any "reset". $\endgroup$
    – ryan0270
    Commented Feb 5, 2015 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.