# Control

## 2. Feedback Control

### How it Works

#### A Moving Target

FOREVER { x += -a * (x - x0(t)) }

We can work hard on this and discover that it turns into

FOREVER { x += -a * (x - x0(t)) }

We can work hard on this and discover that

x(t) - x0(t) = exp( -at ) \int^t exp( at') u'(t') dt'

In other words, we converge on a moving target as long as it doesn't move too fast

• The meaning of too fast' is important.
• It means doesn't diverge too quickly from constant velocity motion' over the time it takes to update the position.
x(t + dt) = x(t) - a * dt * ( x(t) - x0(t) )

or

dx/dt = -a * ( x(t) - x0(t) )

x(t) = y(t) * exp(-at)

dx/dt = (dy/dt - a* y) * exp( -at ) = -a * y(t) * exp(-a*t) + a*x0(t)

dy/dt = a * x0(t) * exp( at )

y(t) = a \int^t exp(at') * x0(t') dt'

x(t) = a \int^t exp(-a(t-t')) * x0(t') dt'

x(t) = a \int^t exp(-au) * x0(t-u) du


### How it Doesn't Work

Suppose there is a time lag.

FOREVER {
x += -a * ( x - x0 )
}

This goes to

x(t + dt) = x(t) - a * dt * ( x(t-tl) - x0 )

or

dx/dt = -a * ( x(t-tl) - x0 )

x(t)  = /sum_s A_s * exp(-st)

x0(t)  = /sum_s B_s * exp(-st)

\sum_s ( A_s - B_s ) * (-s * exp(-st)) = -a * \sum_s ( A_s * exp(-st) * exp(s*tl) - B_s * exp(-st) )

(-s + a * exp(s*tl) ) * A_s = -s + B_s

-s * A_s = -a * exp(s*tl) * A_s - B_s

A_s = B_s /

dx/dt = (dy/dt - a* y) * exp( -at ) = -a * y(t-tl) * exp(-a*(t-tl)) + a*x0

dy/dt = a * tl * dy/dt + a^2 * tl * y(t) + a * x0 * exp( at )

dy/dt = y(t) * (a^2 * tl)/(1-a*tl) + (a * x0 * exp( at )) / (1 - a * tl)

y(t) = z(t) * exp( -bt )

dy/dt = (dz/dt - b* z) * exp( -bt ) = z(t) * exp( -bt ) * (a^2 * tl)/(1-a*tl) + (a * x0 * exp( at )) / (1 - a * tl) * exp(-a*(t-tl)) + a*x0

Choose

-b = (a^2 * tl)/(1-a*tl)

dz/dt = ( a * x0 * exp( (a - (a^2 * tl)/(1-a*tl)) * t ) / (1 - a * tl)


We need

a * (1-a*tl) - a^2 * tl < 0