Skip to the lesson
FixTheRobot Explore Robotics / Guidance, Navigation and Control / M5 Nonlinear, Scheduled and Adaptive Control / M5-T3

Guidance, Navigation and Control · Theory · M5

M5-T3 — Dynamic Inversion and Its Incremental Form

Inversion makes a nonlinear plant look like a double integrator and then designs for the double integrator. It is only as good as the model it cancels. The incremental form cancels what it measures.

  • Lesson 3 of 7
  • Intermediate
  • Module 5: Nonlinear, Scheduled and Adaptive Control
  • Theory
  • About 12 minutes to read

A linear design asks the plant to behave like its linearization. Dynamic inversion asks instead for the control that makes the plant behave like a chosen linear system, whatever the nonlinearity is, provided the nonlinearity is known. This lesson derives the method for Hopper's pitch channel, shows what happens when the model is wrong, and presents the incremental form (INDI), which uses a measured angular acceleration in place of the model and needs only the control effectiveness.

Learning objectives

After this lesson, you should be able to:

  • Derive the dynamic-inversion law for a plant of the form θ̈ = f(x) + bδ and the resulting linear error dynamics.
  • State what the method assumes and show the steady-state error caused by an unmodelled term.
  • Write the incremental law and show that it does not need the model of f.
  • State the condition on the control-effectiveness estimate under which INDI converges.

The intuition

UAV M5-T5: Attitude control used a law that cancels the gyroscopic term of a multirotor and UAV M5-T16: Disturbance rejection and wind compensation estimated a disturbance so as to subtract it. Both are special cases of one idea: if the plant says acceleration equals something plus effectiveness times input, pick the input that makes the acceleration what you want.

Cancel and command

Hopper's pitch obeys θ¨=f(θ,q)+b δ\ddot{\theta} = f(\theta, q) + b\,\delta. The function ff holds everything the vehicle does by itself: the unstable gravity-gradient-like term λ2θ\lambda^2\theta, aerodynamic moments, and any other term. Choose δ=(ν−f)/b\delta = (\nu - f)/b: then θ¨=ν\ddot{\theta} = \nu, and the plant has become a double integrator driven by a virtual input ν\nu. Design ν=−kpθ−kdq\nu = -k_p\theta - k_d q with the poles you like. That is dynamic inversion, and one design serves every flight condition for which ff and bb are known.

Where it breaks

The cancellation is exact only if the model is. Give Hopper an aerodynamic moment of 2+3sin⁡2θ2 + 3\sin 2\theta rad/s² that the model omits, and the loop settles with pitch at 0.20 rad: the error stays whenever θ\theta is nonzero, held by a force the controller never sees. The method has no integral action, and its accuracy is the accuracy of the model.

The incremental form

The remedy replaces the model of ff by a measurement. If the angular acceleration is measured, the change of the command needed to move it from where it is to where it should be is (ν−θ¨meas)/b(\nu - \ddot{\theta}_{\mathrm{meas}})/b. So δk=δk−1+(ν−θ¨meas)/b^\delta_k = \delta_{k-1} + (\nu - \ddot{\theta}_{\mathrm{meas}})/\hat{b}. Whatever ff is, it is already contained in the measured acceleration, so only the control effectiveness bb appears. The same loop, with the same unmodelled moment, goes to zero. The price is a measurement of angular acceleration (a filtered derivative of the gyro) and a loop that must be fast enough that the previous command is still the right basis for the next.

Pitch response with dynamic inversion and with incremental inversion under an unmodelled momentPitch against time from a start of 0.3 radians. With dynamic inversion the pitch settles at 0.2 radians, an offset caused by the moment the model leaves out. With incremental inversion, which measures the angular acceleration instead of modelling it, the pitch goes to zero.012345678-0.050.050.150.250.35time (s)pitch (rad) dynamic inversion: stuck at 0.20 rad incremental (INDI): goes to zero
Pitch from 0.3 rad with an unmodelled aerodynamic moment. Dynamic inversion settles away from zero; incremental inversion measures the acceleration and removes the error.

Dynamic inversion trusts the model of the nonlinearity. INDI trusts a measurement of the acceleration and a rough value of the control effectiveness, which is much easier to know.

Definitions

Control-affine plant
A plant of the form θ¨=f(x)+b δ\ddot{\theta} = f(\mathbf{x}) + b\,\delta, linear in the input with effectiveness bb.
Virtual input ν\nu
The acceleration the loop asks for. The inversion turns the real input into whatever produces it.
Feedback linearization
A change of input that cancels the nonlinearity so that the loop from ν\nu to the output is linear. It needs a model of ff and bb.
INDI
Incremental nonlinear dynamic inversion: δk=δk−1+(νk−θ¨k)/b^\delta_k = \delta_{k-1} + (\nu_k - \ddot{\theta}_{k})/\hat{b}, using the measured acceleration. It needs only b^\hat{b}.
Dynamic inversion
δ=ν−f^(x)b^,ν=−kpθ−kdq\delta = \dfrac{\nu - \hat{f}(\mathbf{x})}{\hat{b}}, \qquad \nu = -k_p\theta - k_d q
With a perfect model f^=f\hat{f} = f and b^=b\hat{b} = b the closed loop is θ¨=−kpθ−kdq\ddot{\theta} = -k_p\theta - k_d q: a linear loop with the poles chosen by kpk_p and kdk_d.
The incremental law
δk=δk−1+νk−θ¨meas,kb^\delta_k = \delta_{k-1} + \dfrac{\nu_k - \ddot{\theta}_{\mathrm{meas},k}}{\hat{b}}
The measured acceleration is the response to the previous command δk−1\delta_{k-1} and to every other force, modelled or not. The correction asks for exactly the change that closes the gap to ν\nu.
INDI convergence condition
0<bb^<20 < \dfrac{b}{\hat{b}} < 2
In the idealized discrete loop the acceleration error shrinks by the factor 1−b/b^1 - b/\hat{b} at every step, so it converges if and only if that factor has magnitude below 1. The estimate of the effectiveness may be wrong by a factor of two either way.

Derivation: the inversion, its steady-state error, and the INDI condition

The pitch channel with a model of f that is wrong by an amount Δf\Delta f.

  1. θ¨=f+b δ,δ=(ν−f^)/b\ddot{\theta} = f + b\,\delta, \qquad \delta = (\nu - \hat{f})/b

    The plant and the inversion law, taking b^=b\hat{b} = b.

  2. θ¨=ν+(f−f^)=ν+Δf\ddot{\theta} = \nu + (f - \hat{f}) = \nu + \Delta f

    Substitute. The model error enters as an additive acceleration that the loop does not see.

  3. θ¨=−kpθ−kdq+Δf\ddot{\theta} = -k_p\theta - k_d q + \Delta f

    With the virtual input of the design.

  4. θss=Δf(θss) / kp\theta_{ss} = \Delta f(\theta_{ss})\,/\,k_p

    At a steady state the derivatives vanish. For the unmodelled moment of the example, Δf=2+3sin⁡2θ\Delta f = 2 + 3\sin 2\theta and kp=16k_p = 16 give 0.197 rad.

INDI

  1. θ¨k=fk+b δk\ddot{\theta}_k = f_k + b\,\delta_k

    The acceleration at step kk, for whatever the unknown ff is.

  2. θ¨k−θ¨k−1≈b (δk−δk−1)\ddot{\theta}_k - \ddot{\theta}_{k-1} \approx b\,(\delta_k - \delta_{k-1})

    For a fast loop ff changes little in one step, so it drops out of the difference. This is the step that removes the model.

  3. θ¨k−ν=(1−bb^)(θ¨k−1−ν)\ddot{\theta}_k - \nu = \left(1 - \dfrac{b}{\hat{b}}\right)(\ddot{\theta}_{k-1} - \nu)

    Insert the incremental law. The acceleration error is multiplied by 1−b/b^1 - b/\hat{b} at each step.

  4. ∣1−b/b^∣<1  ⟺  0<b/b^<2\left|1 - b/\hat{b}\right| < 1 \iff 0 < b/\hat{b} < 2

    The error decays exactly when the multiplier is smaller than one in magnitude. Within that range the loop follows the commanded acceleration whatever ff is.

Inversion removes the nonlinearity by trusting a model; INDI removes the need for the model by trusting a measurement of the acceleration. What remains is the control effectiveness, which must be known to a factor of two, and a loop fast enough that the previous step is a good base.

A worked example

Hopper's pitch channel with the poles at ωn=4, ζ=0.7\omega_n = 4,\ \zeta = 0.7 (kp=16, kd=5.6k_p = 16,\ k_d = 5.6), an unmodelled moment 2+3sin⁡2θ2 + 3\sin 2\theta rad/s², a start at 0.3 rad and a 100 Hz loop.

  1. Dynamic inversion, exact effectiveness. After 12 s the pitch is +0.197 rad, held there by the unmodelled moment, and the gimbal is at −0.166 rad (beyond the 0.15 rad limit, so saturation would make it worse).
  2. INDI, exact effectiveness. The pitch goes to 0 (to 10⁻¹⁶ rad) and the gimbal settles at −0.102 rad, the value that cancels the moment at the equilibrium.
  3. INDI with an estimate of the effectiveness that is wrong. For b/b^b/\hat{b} = 0.5, 1.0, 1.5, 1.9 the pitch converges to zero and its largest excursion stays at the initial 0.3 rad. For 2.1 it diverges: the acceleration error is multiplied by −1.1 at every step, so it grows without bound and the pitch reaches 10⁷⁴ rad within the 12 s simulated.
  4. Dynamic inversion with the same errors. Because the effectiveness error scales the whole control, b/b^=0.5b/\hat{b} = 0.5 leaves the pitch at 0.625 rad and 1.9 at 0.080: the error depends smoothly on the estimate and never vanishes.
  5. Reading. INDI is exact for any unmodelled moment, and it is bounded by a sharp threshold on the effectiveness. Inversion degrades gently and never reaches zero.
import math
import gnckit as g

lam2, b = 0.49, 19.62
wn, zeta = 4.0, 0.7
kp, kd = wn ** 2, 2 * zeta * wn            # the desired acceleration nu = -kp theta - kd q  (a double integrator with these poles)

def f_true(th):
    return 2.0 + 3.0 * math.sin(2 * th)    # an unmodelled aerodynamic moment per inertia (rad/s^2)

def rate(th, q, d):
    return lam2 * th + b * d + f_true(th)

dt = 0.01

def simulate(controller, bhat, T=12.0, th0=0.3):
    th, q, d_prev = th0, 0.0, 0.0
    hist = []
    for k in range(int(T / dt)):
        a_meas = rate(th, q, d_prev)       # the measured angular acceleration, produced by the previous command
        nu = -kp * th - kd * q
        if controller == 'DI':
            d = (nu - lam2 * th) / bhat
        else:
            d = d_prev + (nu - a_meas) / bhat
        # advance one step with the command held (RK4 on the two-state system)
        def fn(t, s):
            return [s[1], rate(s[0], s[1], d)]
        th, q = g.rk4_step(fn, 0.0, [th, q], dt)
        d_prev = d
        hist.append((th, q, d))
    return hist

print('pitch with an unmodelled moment 2 + 3 sin(2 theta) rad/s^2, desired poles (wn 4, zeta 0.7):')
for name in ('DI', 'INDI'):
    h = simulate(name, b)
    print(f'  {name:4s} with the exact b: pitch after 12 s = {h[-1][0]:+.4f} rad, command {h[-1][2]:+.4f} rad')
print('INDI with a wrong estimate of the control effectiveness bhat (ratio b / bhat), 12 s from 0.3 rad:')
for ratio in (0.5, 1.0, 1.5, 1.9, 2.1):
    h = simulate('INDI', b / ratio)
    mx = max(abs(s[0]) for s in h)
    print(f'  b/bhat = {ratio:3.1f}: pitch after 12 s = {h[-1][0]:+.2e} rad, largest |pitch| = {mx:.2e}')
print('DI with the same wrong estimate:')
for ratio in (0.5, 1.0, 1.5, 1.9, 2.1):
    h = simulate('DI', b / ratio)
    print(f'  b/bhat = {ratio:3.1f}: pitch after 12 s = {h[-1][0]:+.4f} rad')
pitch with an unmodelled moment 2 + 3 sin(2 theta) rad/s^2, desired poles (wn 4, zeta 0.7):
  DI   with the exact b: pitch after 12 s = +0.1970 rad, command -0.1655 rad
  INDI with the exact b: pitch after 12 s = -0.0000 rad, command -0.1019 rad
INDI with a wrong estimate of the control effectiveness bhat (ratio b / bhat), 12 s from 0.3 rad:
  b/bhat = 0.5: pitch after 12 s = -1.89e-16 rad, largest |pitch| = 3.00e-01
  b/bhat = 1.0: pitch after 12 s = -7.67e-16 rad, largest |pitch| = 3.00e-01
  b/bhat = 1.5: pitch after 12 s = -6.61e-16 rad, largest |pitch| = 3.00e-01
  b/bhat = 1.9: pitch after 12 s = -5.56e-16 rad, largest |pitch| = 2.99e-01
  b/bhat = 2.1: pitch after 12 s = +1.18e+74 rad, largest |pitch| = 1.18e+74
DI with the same wrong estimate:
  b/bhat = 0.5: pitch after 12 s = +0.6250 rad
  b/bhat = 1.0: pitch after 12 s = +0.1970 rad
  b/bhat = 1.5: pitch after 12 s = +0.1093 rad
  b/bhat = 1.9: pitch after 12 s = +0.0804 rad
  b/bhat = 2.1: pitch after 12 s = +0.0710 rad
The measured acceleration is the plant acceleration produced by the previous command; the plant is advanced one step with rk4_step; the loop runs at 100 Hz with the command held over each step.

In robotics

INDI flies in research aircraft and in the cascaded attitude controllers of agile multirotors.

  • Aircraft and multirotors. INDI replaces a model of aerodynamic moments, which is hard to identify, by a measurement of angular acceleration from the gyro, and needs only the control effectiveness, which is much easier to identify. This is why the method has been adopted for high-angle-of-attack flight and aggressive multirotors.
  • Dynamic inversion alone. Where the model is very good (a rigid arm with known inertia, a spacecraft with reaction wheels) inversion is accurate and has no derivative noise. Robotics calls it computed torque.
  • The measurement. The acceleration comes from differentiating a gyro, which amplifies noise. A low-pass filter is applied, and the same filter must be applied to the actuator command so the two are synchronized. The delay of the filter limits how fast the loop can be, as in M3-T6: Limits of Performance: Delay, Right-Half-Plane Zeros and the Bode Integral.
  • Actuator limits. An inversion law has no notion of saturation or rate limit. The commanded increment can ask for more than the gimbal gives, and the allocation of M5-T6: Control Allocation is the place where limits are respected.
  • Robustness. The cancellation is high gain in disguise. The loop with delay and actuator lag must be checked with the tools of module 3; disk margins in M5-T7: Robustness Beyond Gain and Phase Margin are a good measure.

The robot-learning counterpart, with a learned model in place of f^\hat{f}, is in Robot Learning M9-T4: Hybrid Learning and Control Systems.

Common misconceptions

“Dynamic inversion makes the loop linear regardless of the plant.”

Only if the model of the plant is exact. With an error, the loop has an additive disturbance equal to the model error, and the steady-state offset is that error divided by the position gain.

“INDI needs no model at all.”

It needs the control effectiveness to within a factor of two, a measured acceleration, and a loop fast enough that the unmodelled term changes little in one step. It removes the model of the dynamics, not of the actuator.

“Cancelling a stable nonlinearity is harmless.”

The cancellation puts a high gain in the loop, whose cost is margin against delay and noise. A nonlinearity that was helping (damping) is also thrown away.

“A larger estimate of effectiveness is safer.”

It is safer against divergence, which needs b/b^<2b/\hat{b} < 2, but the loop is slower: the error shrinks by 1−b/b^1 - b/\hat{b} per step, closer to 1 as b^\hat{b} grows. Too large an estimate gives a sluggish loop.

“The measured acceleration is free.”

It is a differentiated, filtered gyro signal, with noise and delay. The quality of INDI is limited by this signal and by the actuator lag, which has to be modelled in the filter.

Key takeaways

  1. Dynamic inversion picks the input (ν−f^)/b^(\nu - \hat{f})/\hat{b} that makes the plant a double integrator driven by the virtual input ν\nu.
  2. A model error Δf\Delta f enters as a disturbance; for Hopper's unmodelled moment the loop settles at 0.197 rad.
  3. INDI uses the measured acceleration: δk=δk−1+(ν−θ¨meas)/b^\delta_k = \delta_{k-1} + (\nu - \ddot{\theta}_{\mathrm{meas}})/\hat{b}, and removes the dependence on ff.
  4. INDI converges if and only if 0<b/b^<20 < b/\hat{b} < 2 in the ideal discrete loop; at 2.1 the pitch of the example diverges.
  5. Both methods are high-gain cancellations: they need margin checks, and they know nothing about saturation.
  6. The practical cost of INDI is a filtered acceleration measurement, with its delay and noise.

References and further reading

Each source is marked free or paid. Free to read does not mean free to reuse: the course resources page lists every source with its licence.

Knowledge check

Three questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

Hopper's inversion law uses a model whose unmodelled moment is a constant 2 rad/s² and kp = 16. What pitch does the loop settle at, and what would INDI do?

Explanation

The model error enters as a constant disturbance, so at a steady state kp θ = 2 and θ = 2/16 = 0.125 rad (for a constant error: the example had a state-dependent term, and settled at 0.197). INDI measures the acceleration, which includes the 2 rad/s², and changes the command until the measured acceleration equals ν, so the steady state has ν = 0 and the pitch goes to zero, however large the constant is, until the gimbal saturates.

Question 2

In INDI the estimate b̂ is twice the true b. What happens to the speed of the loop and does it still converge?

Explanation

The ratio b/b̂ is 0.5, inside the interval (0, 2), so it converges. The error is multiplied by 1 − 0.5 = 0.5 at each step, so it halves every sample: stable, but slower than the dead-beat response obtained with b̂ = b, which removes the error in one step. A conservative (larger) estimate gives a safe but sluggish loop.

Question 3

Why must the loop of INDI be fast compared with the unmodelled dynamics f?

Explanation

The step from the second derivation line assumes f does not change between samples, so the measured acceleration of the previous step contains the same f as the present one and drops out of the difference. If f changes appreciably in a step, the measurement is stale and the cancellation is partial, and the unmodelled change acts as a disturbance. The loop has to be several times faster than the changes in f it is meant to reject.

What’s next

Next lesson

M5-T4 — Sliding-Mode Control

Design a sliding surface and a switching law for a second-order system, and remove chattering with a boundary layer at a stated cost in accuracy.

Nothing below is required to finish this lesson.

  • Before
    M5-T2: Gain Scheduling

    Schedule a linear design on a measured variable such as dynamic pressure, and name the conditions under which the scheduled loop is no longer the designed loop.

Other courses on this site treat neighbouring topics from their own angle:

This course leaves the following to the pages that already teach them: