# following a trajectory with LQR controller

We want our wheeled robot to follow a (rather short) trajectory. We wrote an LQR controller, which works well in simulation. However, our robot offers two problems:

1.) The reported state information does not seem to be very accurate.

2.) Its motion seems to underly some random deviations. We did not succeed in establishing a good model to predict the robots motion with a given control input.

Is it possible to manage these problems with the LQR controller? If yes, how?

It is possible under limited conditions. The Linear-quadratic regulator (LQR) controller assumes that the system under control has linear dynamics and that the transition and observation models are deterministic. While in practice it works if these conditions are violated, the more extreme the violation the more likely it is to fail.

An alternative is the Linear-quadratic-gaussian controller because it allows for noise in the motions and percepts. A challenge with using LQG is that you must have model of the noise.

More specifically, assume you have the following dynamical model:

$\dot{\mathbf{x}}(t) = A\mathbf{x}(t) + B\mathbf{u}(t) + \mathbf{v}(t), \mathbf{v}(t) \sim \mathcal{N}(0, M) \\ \mathbf{y}(t) = C\mathbf{x}(t) + \mathbf{w}(t), \mathbf{w}(t) \sim \mathcal{N}(0, N)$

where $\mathbf{x}(t)$, and $\mathbf{u}(t)$ represent the state of the system and the control applied to at it at time $t$ respectively, $A$, $B$, and $C$ represent the natural dynamics, the control dynamics, and the observation dynamics respectively, and finally $\mathbf{v}(t)$ and $\mathbf{w}(t)$ represent noise of the motion and observation models respectively and are zero mean gaussian distributions with covariances $M$ and $N$.

In order to use LQG you need to know $A$, $B$, $C$, $M$, and $N$ as well as the initial state of the system, i.e. $\mathbf{x}(0)$.

It depends on the actual source of problems. If you just have a lot of noise in your state estimate you can improve things a bit by adjusting weights to be less aggressive.

If the problem is that your state estimate is consistently far off you can't do anything until you fix your estimator. Quite often in vehicle control this is actually the biggest challenge.