Can any control problem be put in affine form? For a control problem given by the dynamics $\dot{\mathbf x} = f(\mathbf x, \mathbf u)$, we may extend the state space by declaring $\mathbf y =(\mathbf x, \mathbf u)^\top$ and writing
$$
\dot{\mathbf y}=\begin{bmatrix}f(\mathbf x, \mathbf u)
\\
\tilde{\mathbf u}\end{bmatrix} =h(\mathbf y)+\sum \mathbf e_i \tilde u_i
$$
Where the $\mathbf e_i$ are the standard basis vectors. Now the control inputs are $\mathbf u$ and the problem is control affine. My question is: is this valid? All the books I have seen on optimal control say things such as "if the problem is control affine" instead of saying "assuming the problem is given in affine form". This makes be believe that something is being thrown away or ignored in the above reformulation. Is it the fact that we are in a way smoothing out $\mathbf u$ by taking it to be the integral of $\tilde{\mathbf u}$? What am I missing?
 A: Optimal control quite often searches for the optimal gains given a fixed structure, for example static state feedback.
If you change the structure, you change the solution and the performance you can achieve.
We don't need a nonlinear system to show this. Take the standard LQR problem with the cost function
$$
J = \int_0^\infty (x^T Q x + u^T R u) dt
$$
Now take the system
$$
\dot{x} = A_1 x + B_1 u
$$
and use $A_1 = -1, B_1= 1, Q_1 = 10, R_1 = 1$. The LQR solution is $u = -K_1 x$ and $K_1 = 2.3166$.
Although the system is linear we can still feed $u$ through an integrator. Now you have:
$$
\dot{y} = A_2y + B_2 v
$$
and $A_2 = \begin{pmatrix}-1 & 0 \\ 0 & 0 \end{pmatrix}, B_2 = \begin{pmatrix}0 \\ 1 \end{pmatrix}, Q_2 = \begin{pmatrix}10 & 0 \\ 0 & 0 \end{pmatrix}, R_2 = 1$.
The LQR solution is $v = -K_2 y$ and $K_2 = \begin{pmatrix}1.4559 & 1.7064\end{pmatrix}$.
You can see that the cost function is for both systems the same:
$$
\begin{align}
J_1 &= 10 x^2 + u^2 \\
J_2 &= 10 y_1^2 + v^2
\end{align}
$$
But does that mean we can reach the same performance? No, we can't.
The cost value depends of course on the initial condition:
$$
J = x_0^T S x_0
$$
with $x_0 = x(0)$ and
$$
\begin{align}
S &= \int_0^\infty \Phi^T (Q + K^T R K) \Phi dt \\
\Phi &= e^{(A - B K)t}
\end{align}
$$
You can use this to calculate the cost value for an initial condition.
For example, say we start at $x(0) = y_1(0) = 1$. Then you get:
$$
\begin{align}
J_1 &= 2.3166 \\
J_2 &= 1.7064 y_2(0)^2 + 2.9118 y_2(0) + 3.9402 \\
\end{align}
$$
So $J_2$ (of course) also depends on the inital condition $y_2(0)$ of your new integrator. But maybe we can tune the initial condition of the integrator so we get $J_1 = J_2$?
Again: No, we can't, in general.
You can easily see this by minimizing $J_2$ over $y_2(0)$ which is easy because it is just a quadratic polynomial:
$$
\min_{y_2(0) \in \mathbb{R}} 1.7064 y_2(0)^2 + 2.9118 y_2(0) + 3.9402
$$
You can solve this by setting the derivative w.r.t. $y_2(0)$ to zero:
$$
3.4128 y_2(0) + 2.9118 = 0
$$
So the "best" initial condition for the integrator is:
$$
y_2(0) = -0.8532
$$
If you insert this into the cost value:
$$
\boxed{
\begin{align}
J_1 &= 2.3166 \\
J_2 &= 2.6980
\end{align}}
$$
So you can see that $J_1 < J_2$.
Changing the structure of the controller changed the best possible cost that we can achieve.
If you simulate:

You can see that $x$ and $y_1$ are different although they minimize the same cost function.
Conclusion: In general you can't just change the structure of your system because you will get a different solution. Here the difference is only small but it could be huge of course.
