Intro to Incremental Non-Linear Dynamic Inversion (INDI)
A blog by Marwan Hussein & Pepijn van den Bos
Incremental Non-linear Dynamic Inversion (or INDI) is the state-of-the-art in control technology. To understand INDI, it is equally important we first get a better understanding of one of the most widely used and basic control methods, PID: Proportional, Integral, and Derivative control. Each of the aforementioned plays a different role in ensuring the stability of a control system and that it performs in the manner it is expected to. To help clarify all this, we spoke to our Lead Control Engineer, Pepijn van den Bos.
In one of your previous discussions you had mentioned that fault tolerant control systems contain two parts, Fault Detection & Diagnosis and the control loop. Can you now tell us a little bit more about what PID is, how it makes up a control loop, and how it contributes to the partial autonomy of drones?
“To help clarify this part and all the following parts, we will look at this from a mechanical engineering point of view. The best way to describe the proportional part of a PID system is by imagining a spring attached to our drone on one end and to an arbitrary position we want to go to – or stay in – on the other.
Let’s say that we want to hold our altitude, the proportional part of our system tries to pull the drone towards our desired position. In the same way, if we pull the drone away from said position, the spring will try to pull it back even harder. If we release the drone, it will move towards the position we want it to go and continue to oscillate about that point.
In a nutshell, the proportional part of the controller is a constant multiplied by the position error, becoming larger the further the drone is pulled away from its target.”
“Using the same spring analogy, if the drone is released, it will oscillate about the desired position.
But what you want to do is bring the drone to a stop at its desired position much faster and more smoothly.
The derivative part of the controller determines how much “damping” is applied to our system. This is where the controller is tuned to make sure there is no overshoot when the “spring” is released.
When you pull the drone away from the desired position and hold it, its velocity and damping will both be zero whereas its proportional error will be large. When you release it, the proportional error gets smaller as it gets closer to the desired position, its velocity increases and so will its damping.”
With the proportional and derivative parts aside, we now have a “PD” controller.
“Imagine we are at the desired position but now there is a steady wind acting on our drone, pushing it away from its place. This wind force acts as a constant and steady disturbance, causing the drone to reach a new position – and stay there – where the virtual springs will be stretched again. You now add an “integrator” which will look at said error and “fill” over time. Once the integrator has determined how much force is needed to bring the drone back to its original position against the wind resistance, it will cause the drone to push back, eventually bringing it to a halt at its target position.
In summation, the integrator is to reject any sorts of steady state offsets which can originate from unknown disturbances as well as unforeseen inaccuracies in the model.”
We now have a PID controller!
Why are we not using PID in our flight controller?
“The “filling” process for the integrator we mentioned earlier takes time, so the question then becomes, how reactive and aggressive do I want to make the system?
Personally, I like to make slower integrators as they do not interfere with the rest of the tracking errors, which helps me identify issues there. The catch is that this prevents it from responding well to any sudden or non-constant disturbances.
Alternatively, you could make a very aggressive integrator but then you risk overshooting your target. So if I make my integrator very aggressive and change my desired position to some other place, the integrator will start to “fill” rapidly. The only way it can “empty” again is by overshooting the target position, which can lead to a cascade of other events that you need to keep an eye out and correct for.”
“Under normal circumstances, you would want to limit how aggressively your integrator behaves until you get a better sense of what the disturbances it will face will be like, which could often times be small but sudden, giving you more room to make it slightly more responsive.
Another issue is that, under very windy conditions, you will be experiencing very large and sudden gusts, forcing you to give the integrator larger freedom to operate. We can see this backfiring in a situation where the drone is crossing through a strong wind stream; The integrator will begin to rapidly apply a very large force to reject the disturbance, but when it exits the stream to an area without any wind force pushing against the now “filled” integrator, the drone will aggressively overshoot, leading to a potential crash.”
Another well-known control technique is Non-Linear Dynamic Inversion (NDI). How is it different from PID?
“We can start by first talking about the advantages of PID, the most obvious of which is that its quite popular and most people that are familiar with control will not have too much of a problem dealing with it.
Another thing is that it is model-free. what this means is that you do not need to know the dynamic behaviour of the drone you will be flying prior to implementing the PID controller into the system, so what this does is it gives you the freedom to tune each of the P, I, and D gains on a generic controller through experimentation fairly easily.
On the other hand, NDI is extremely model-dependent, where the whole point of this method is more about changing the dynamic behaviour of your system by implementing dynamics you would like your machine to have. So imagine you have a heavy industrial robotic arm which you would want to be extended and retracted effortlessly. What NDI does here is calculating the forces and moments needed to manipulate the arm based on its weight, length, etc and cancel them out by applying the exact opposite forces and inertias. That way, when a human pushes against the arm, it will feel almost as light as a feather.”
How do you determine the “model” of the system you are implementing NDI into?
“As I mentioned earlier, NDI is highly dependent on the model that describes the behaviour of the system hosting it – in our case, a drone. In order to be able to “cancel” out the dynamics of the system, you first need to know what they are. In the previous example that we gave with the robotic arm, this can be done fairly easily, mainly because the dimensions and properties of the system are easily identifiable and the conditions it is meant to operate in are highly predictable – it may only need to perform a few specific movements over and over again. For a drone, obtaining these parameters may not be so easy; the unsteady nature of flight makes obtaining valid and accurate sensor readings much more difficult, which in turn makes it challenging for NDI to impose the correct dynamics at the correct times, no matter how well known your drone’s dimensions and specifications are.”
INDI stands for Incremental Non-linear Dynamic Inversion. What does it mean, how is it different from its predecessor NDI, and how does it affect the behaviour of our system?
“There are several steps as to what gave it this name. NDI is a very mathematically-exact approach. In practical sense, you might not have that accurate of a model and you can keep adding to its complexity without much improvement.
INDI starts by taking a few steps to simplify the feedback it obtains from onboard sensors, which is particularly useful when dealing with highly unpredictable and non-linear situations.
The key aspect is that it uses the drone’s acceleration feedback – from onboard accelerometers – to compute the dynamic behaviour of the system in response to external disturbances. This is crucial because acceleration alone happens to contain a large portion of the information we need to create a model of the system. Furthermore, by measuring what the acceleration of the drone is rather than what it should be to reach its desired state, we bypass the issue of having to create a nearly-impossible dynamic model of the wind disturbances against which the drone will have to counteract.”
So, what does the “incremental” part mean?
“Instead of having the flight controller calculate how fast each of the motors should spin in one go, it measures the difference in the actual acceleration of our drone in relation to the acceleration we want it to have in extremely small increments over a very small period of time, hence “incremental”. This causes the motor speeds to continuously and rapidly change such that the next increment in acceleration is one step closer to the acceleration we want.
Putting all three of our control methods side by side, we can say that PID requires the most experimental tuning out of all three, whereas NDI does so algebraically, and INDI falls somewhere in between, requiring a small amount of refinement.”
What would you say are the biggest challenges that you have encountered with INDI?
“Firstly, since this method is new to the field of unmanned aerial flight, it can be said that there are many unknowns that are associated with exploring new technology. Also, given the complexity of INDI compared to PID, you have to be interested in pursuing such an endeavour to begin with – it’s not everyone’s cup of tea.
On a more technical note, since INDI relies heavily on onboard sensor readings, it is generally understandable its performance is impacted by factors that affect the accuracy and validity of said sensors. Invalid data can be caused by anything from sensor defects to disturbances caused by the drone’s structure itself.
One of the things we normally do when implementing the Fusion Reflex into a new drone is that we first use the PID control method to get a better feel of the system’s dynamics under hover conditions. A small drone can rotate much faster than a large drone for example and this is very important to understand. Then we switch to INDI to let it do the rest.
It goes without saying that there will be instances where more experimentation is required, in which cases we either resort to more flight tests, or we use the wind tunnel.”
Speaking of the wind tunnel, you recently did some PID vs INDI tests. What were the main objectives?
“In a few words, we are trying to see how different flight and wind conditions affect the system’s behaviour using INDI compared to PID. Under normal hover conditions without any external disturbances, the results of PID and INDI should be similar.
When you start flying in high winds and high velocities, you get very different drone dynamics, with aerodynamics suddenly taking a much larger effect. In those situations, INDI should be able to capture much more of the dynamics – from acceleration – and make it much more robust while still imposing the desired characteristics.
One of the biggest challenges in wind tunnel testing is making sure that the tuning of both PID and INDI is correct and that the sensors are giving valid data that does not interfere with the performance of your system, both of which are vital for getting a fair comparison. The reason we choose to do wind tunnel tests for these kinds of experiments is because of their consistency and to eliminate sensor inaccuracies; we could technically do flight tests on the beach but the wind conditions would be very difficult to repeatedly replicate.”
“With the wind tunnel tests recently concluded, we were very happy to see that our system behaves as we expected it to; The plan was to outfit the same drone with PID and INDI then test each of them separately, recording how well each control method allows the drone to adapt to sudden disturbances of wind speeds ranging from 5 m/s (~20 km/h) to 25 m/s (90 km/h).
Since the wind tunnel takes time to spool up, we figured the best way to introduce a sudden disturbance to the flying drone is by creating a set of way points that would cause it to fly in a square pattern through the wind stream; it would first hover undisturbed at the edge of the wind-tunnel then it would quickly move into the air stream, simulating a strong and sudden gust of wind. Results showed that when we introduced a 72km/h wind stream, the maximum deviation from the desired reference point of the drone with INDI reached approximately 35cm, whereas the drone with PID was not as successful in maintaining its position, allowing the drone to drift nearly two times further than with INDI. Also, the drone with INDI was able to reach its dedicated position – and hold it – much faster than with PID. To put it into perspective, this is equivalent to throwing a drone out of your car on the highway and then it manages to catch up to your front window!
Overall, we are very happy with the results that we collected and we are eager to try it out again on different sized drones!”
Taking INDI from theory into practice, have you found it to perform as you would have expected it to?
“What’s interesting about INDI is its wind-disturbance-rejection capabilities. For drones, if it’s offshore or in windy situations, it is definitely very interesting to consider.
When talking about the expectations of INDI, it’s important to remember that the majority of the obstacles come from factors unrelated to the control method itself; you still have mechanical limitations to the drone. If you have a huge drone with huge arms and rotors that can’t spool up very fast, then this would be the limiting factor rather than INDI trying to reject disturbances.
Let’s take the same large multi rotor drone as an example: in order to remain in its desired position as a response to a wind disturbance, it would first have to roll to stop itself from drifting away. The speed at which it can actually roll determines how fast it can reject disturbances, hence how far it will be blown off-course.
In general, the effects of INDI are more pronounced in overpowered and small systems, which can be quite fun to watch!”
Lastly, what do you think are the types of drones and applications INDI would be most effective in?
“We are still investigating that as well as fault tolerant control. A situation in which you have rapidly changing dynamics and disturbances is probably most benefitted from INDI, as INDI is better equipped to handle that than PID or NDI.
Generally, If you are flying a drone through gusts of wind coming from the alleys in-between buildings, then INDI has these very tempting features that allow the multi-copter to operate under adverse weather conditions, opening up all sorts of possibilities for unmanned aerial vehicles to be used where no system has gone before. Think for example of flying through cities with tall buildings.
With that said, our goal in Fusion Engineering is to pioneer the era of next-gen flight controllers and make INDI the go-to control method through our Fusion Reflex controller.”