Equilibrium points of an inverted pendulum on a cart

control theorysystems of equations

Question

Find the equilibrium points of the inverted pendulum on a cart system whose dynamics equation are given by

$$
\begin{bmatrix}
(M+m) & -m l \cos\theta\\
-m l \cos\theta & (J+m l^2)
\end{bmatrix}
\begin{bmatrix}
\ddot{p} \\
\ddot{\theta}
\end{bmatrix}
+
\begin{bmatrix}
c \dot{p}+ m l \sin\theta \theta^2\\
\gamma \dot{\theta} – m g \sin \theta
\end{bmatrix}
=
\begin{bmatrix}
F\\
0
\end{bmatrix}
$$

where $M$ is the mass of the base, $m$ and $J$ are the mass and moment of inertia of the system to be balanced, $l$ is the distance from the base to the center of the mass of the balanced body, $c$ and $\gamma$ are coefficients of viscous friction, $g$ is the acceleration due to the gravity and $F$ represents the force applied at the base of the system, assumed to be in the horizontal direction.

Attempt

State-space representation
We can rewrite the dynamics of the system in state space form by taking the input as $u=F$ and defining four state as follows
$$
{x} =
\begin{bmatrix}
x_1\\
x_2\\
x_3\\
x_4
\end{bmatrix}
=
\begin{bmatrix}
p \\
\theta\\
\dot{p}\\
\dot{\theta}\\
\end{bmatrix}
$$

For readability purposes, we define
\begin{equation*}
s_\theta=\sin\theta, \hspace{0.6cm} c_\theta=\cos\theta, \hspace{0.6cm} M_t = M + m, \hspace{0.6cm} J_t = J + ml^2,
\end{equation*}

and define the equations of motion then become
$$
\dot{x} =
\begin{bmatrix}
\dot{x_1}\\
\dot{x_2}\\
\dot{x_3}\\
\dot{x_4}
\end{bmatrix}
=
\underbrace{
\begin{bmatrix}
x_3\\
x_4\\
\frac{ \displaystyle
-m l s_{x_2}{x_4}^2 + m g (m l^2/J_t) s_{x_2} c_{x_2}- c x_3 – (\gamma/ J_t) m l c_{x_2} {x_4} +u}
{\displaystyle M_t – m (m l^2 / J_t) c_{x_2} }\\
\frac{ \displaystyle
-m l s_{x_2} c_{x_2} {x_4}^2 + M_t g l s_{x_2} – c l c_{x_2} x_3 – \gamma (M_t/ m){x_4} +l c_{x_2} u}
{\displaystyle J_t (M_t/m) – m (l c_{x_2})^2 }\\
\end{bmatrix}
}_{f(x,u)}\\
$$

Equilibrium points
The pair $(x_{eq}, u_{eq})$ is called an equilibrium point of the dynamic system if $f(x_{eq}, u_{eq})=0$. Setting $f(x,u)=0$, we get the following system of equations
$$
\left\{\begin{aligned}
x_3 &= 0 \\
x_4 &= 0 \\
\frac{ \displaystyle -m l s_{x_2}{x_4}^2 + m g (m l^2/J_t) s_{x_2} c_{x_2}- c x_3 – (\gamma/ J_t) m l c_{x_2} {x_4} +u} {\displaystyle M_t – m (m l^2 / J_t) c_{x_2} } &= 0 \\
\frac{ \displaystyle
-m l s_{x_2} c_{x_2} {x_4}^2 + M_t g l s_{x_2} – c l c_{x_2} x_3 – \gamma (M_t/ m){x_4} +l c_{x_2} u}
{\displaystyle J_t (M_t/m) – m (l c_{x_2})^2 } &= 0
\end{aligned}\right.
$$

From the above system of equations, we have
$$
x_{eq} =
\begin{bmatrix}
x_1 \\
? \\
0\\
0
\end{bmatrix},
\hspace{0.6cm} \text{and} \hspace{0.6cm}
u_{eq}= ?
$$

I'm stuck at finding $x_2$ and $u_{eq}$. How should I proceed?

MATLAB Code

syms x1 x2 x3 x4 u m l g c gamma Mt Jt p 

% Define f(x,u)
f=sym(zeros(4,1));
f=[x3;
   x4;
   (-m*l*sin(x2)*x4^2+m*g*((m*l^2)/Jt)*sin(x2)*cos(x2)-c*x3...
   -(gamma/Jt)*m*l*cos(x2)*x4+u)/(Mt-m*(m*l^2/Jt)*cos(x2));
   (-m*l^2*sin(x2)*cos(x2)*x4^2+Mt*g*l*sin(x2)-c*l*cos(x2)*x3...
   -gamma*(Mt/m)*x4+l*cos(x2)*u)/(Jt*(Mt/m)-m*(l*cos(x2))^2);
   ];

% Find equilibrium points  
sol=solve(f==zeros(4,1),x1, x2, x3, x4)

I get sol.x1=z1, sol.x2=z, sol.x3=sol.x4=0. But this is not what I'm expecting. I believe there should be an $n\pi$ there somewhere.

Best Answer

Substituting in that $x_{3,eq}=x_{4,eq}=0$ and multiplying by the denominator of the fractions (since those should always be greater than zero and bounded) into the equations that you want to solve for the equilibrium point reduces the equations to

$$ \left\{\begin{aligned} m g (m l^2/J_t) s_{x_2} c_{x_2} + u &= 0 \\ M_t g l s_{x_2} + l c_{x_2} u &= 0 \end{aligned}\right. $$

Solving the first equation for $u$ and substituting it into the second equation gives

$$ u = -m g (m l^2/J_t) s_{x_2} c_{x_2} \\ M_t g l s_{x_2} = l c_{x_2} m g (m l^2/J_t) s_{x_2} c_{x_2} $$

Simplifying the last equation, when assuming that $s_{x_2}\neq0$, yields

$$ c_{x_2}^2 = \frac{M_t\,J_t}{m^2 l^2} $$

but $M_t>m$ and $J_t>m\,l^2$, which would imply $c_{x_2}^2>1$ which would require a complex value for $x_2$ and thus is not feasible. This would only leave $s_{x_2}=0$ as solution candidate.

Related Question