State space description of platooning cars.

control theorydynamical systemsordinary differential equations

Consider two vehicles driving in a platoon formation. Figure $2$ shows the inter-vehicle dynamics in a platoon formation. The variables $p_i(t)$, $v_i(t)$ and $a_i(t)$ for $i = 1,2$ denote the position, the velocity and the acceleration of the corresponding vehicle.

The goal is to control vehicle $2$ by applying an input (acceleration) $a_2(t)$ such that it maintains a safe distance $d$ to vehicle $1$. This implies that the velocity of both vehicles
must be equal, $v_1(t) = v_2(t)$. In this scenario, a human drives vehicle $1$ at a constant velocity, i.e. $v_1(t) = \bar{v}$ and $a_1(t) = 0$. The objective is to regulate the errors to zero.
Hence we use the dynamics of the model for the errors:
\begin{align} \dot{e_1}(t)&=v_1(t)-v_2(t)=e_2(t),\\
\dot{e_2}(t)&=\dot{v_1}(t)-\dot{v_2}(t)=-a_2(t), \quad t \in \mathbb{R}_+ \end{align}

Where $e_1(t)=0$ would mean that the distance equals the desired distance $d$ and $e_2(t)=0$ would mean that vehicle $2$ moves with the same velocity $v_1(t)=v_2(t)$. Thus, a controller must be designed such that the system is steered to the equilibrium point at the origin with $e(t) := [e_1(t)\quad e_2(t)]^\top = [0 \quad 0]^\top$ and $a_2(t)=0$. The sampling perios for simulations is $T_s = 0.1s$. The goal is to design an LQR controller.

My state space representation for these equations is as follows:
$$\begin{bmatrix}\dot{e}_1 \\ \dot{e}_2\end{bmatrix}=\begin{bmatrix}0 &1\\ 0 &0\end{bmatrix}\begin{bmatrix}e_1 \\ e_2\end{bmatrix}+\begin{bmatrix}0 \\ -1\end{bmatrix}a_2$$
So the state space matrices are:
$$A=\begin{bmatrix}0 &1 \\ 0 & 0 \end{bmatrix}, \ B=\begin{bmatrix} 0 \\ -1\end{bmatrix}, \ C = \begin{bmatrix} 1 &1 \end{bmatrix} \ \text{and} \ D = 0.$$
I use Matlab's c2d function to get discrete time state space matrices that look like this:
$$A=\begin{bmatrix}1 &0.1 \\ 0 & 1 \end{bmatrix}, \ B=\begin{bmatrix} -0.005 \\ -0.1\end{bmatrix}, \ C = \begin{bmatrix} 1 &1 \end{bmatrix} \ \text{and} \ D = 0.$$

I use the LQR function to design an LQR controller. I take Q as a $2 \times 2$ matrix and R as a $1 \times 2$ matrix.

My question is are my state space matrices and my assumed Q and R dimesnsions correct?

Thanks very much in advance.

Best Answer

The LQR cost is

$$ J = \int_0^T x^T Q x + u^T R u \ dt, $$

so $Q$ and $R$ must always be $n\times n $ and $p \times p$ respectively. In particular this means they must be square.

What is the dimension of your state ($n$) and how many inputs are there ($p$)?