Question 5.13: A Cart–Inverted-Pendulum System Consider the mechanical syst...
A Cart-Inverted-Pendulum System
Consider the mechanical system shown in Figure 5.79, in which a uniform rod of mass M and length L is pivoted on a cart of mass m. An external force f is applied to the cart. Assume that the pendulum is constrained to move in a vertical plane, and the cart moves without slipping along a horizontal line. Denote the displacement of the cart as x and the angular displacement of the pendulum as \theta.
a. Draw the necessary free-body diagram and kinematic diagram, and derive the nonlinear equations of motion.
b. Linearize the equations of motion for small angular motions, and determine the state-space form with x and \theta as the outputs.

Learn more on how we answer questions.
a. This is a mixed system with two masses. The motion of the cart is purely translational, and the inverted pendulum undergoes both translation and rotation. The free-body diagram and the kinematic diagram are given in Figure 5.80. Note that the acceleration of the mass center of the rod consists of three components. On the one hand, the pendulum moves together with the cart along the horizontal line at an acceleration of \ddot{x}. On the other hand, it rotates about the pivot P on the cart. The relative rotational accelerations include the tangential component \frac{L}{2} \ddot{\theta} and the normal component \frac{L}{2} \dot{\theta}^{2}.
Applying the force equation to the whole system along the x direction gives
\begin{gathered} +\rightarrow x: \sum F_{x}=\sum_{i=1}^{2} m_{i}\left(a_{C_{i}}\right)_{x^{\prime}} \\ f=m \ddot{x}+M \ddot{x}-M \frac{L}{2} \dot{\theta}^{2} \cdot \sin \theta+M \frac{L}{2} \ddot{\theta} \cdot \cos \theta . \end{gathered}
The forces at the pivot are canceled out because they are internal forces between the cart and the pendulum. Applying the moment equation to the pendulum about point \mathrm{P} results in
\begin{gathered} +\curvearrowright: \sum M_{\mathrm{P}}=I_{\mathrm{C}} \alpha+M_{\mathrm{eff}_{-} m \mathbf{a}_{C^{\prime}}} \\ M g \cdot \frac{L}{2} \sin \theta=\frac{1}{12} M L^{2} \ddot{\theta}+M \ddot{x} \cdot \frac{L}{2} \cos \theta+M \frac{L}{2} \ddot{\theta} \cdot \frac{L}{2} . \end{gathered}
Rearranging the two equations into the standard input-output form
\begin{gathered} (m+M) \ddot{x}+\frac{1}{2} M L \ddot{\theta} \cos \theta-\frac{1}{2} M L \dot{\theta}^{2} \sin \theta=f, \\ \frac{1}{3} M L^{2} \ddot{\theta}+\frac{1}{2} M L \ddot{x} \cos \theta-\frac{1}{2} M g L \sin \theta=0 . \end{gathered}
b. For small angular motions, \cos \theta \approx 1, \sin \theta \approx \theta, \dot{\theta}^{2} \theta \approx 0 (see Section 4.6). The linearized equations are
\begin{gathered} (m+M) \ddot{x}+\frac{1}{2} M L \ddot{\theta}=f, \\ \frac{1}{3} M L^{2} \ddot{\theta}+\frac{1}{2} M L \ddot{x}-\frac{1}{2} M g L \theta=0 . \end{gathered}
The state, the input, and the output are specified as
\mathbf{x}=\left\{\begin{array}{l} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array}\right\}=\left\{\begin{array}{c} x \\ \theta \\ \dot{x} \\ \dot{\theta} \end{array}\right\}, \quad u=f, \quad y=\left\{\begin{array}{l} x \\ \theta \end{array}\right\} .
We then take the time derivative of each state variable. For the first two,
\begin{aligned} & \dot{x}_{1}=\dot{x}=x_{3}, \\ & \dot{x}_{2}=\dot{\theta}=x_{4} . \end{aligned}
Note that the two linearized equations are coupled. The derivatives \ddot{x} and \ddot{\theta} cannot be solved using only one of the equations. To find \dot{x}_{3} and \dot{x}_{4}, we rewrite the two linearized differential equations as
\left[\begin{array}{cc} m+M & \frac{1}{2} M L \\ \frac{1}{2} M L & \frac{1}{3} M L^{2} \end{array}\right]\left\{\begin{array}{c}\ddot{x}\\\ddot{\theta }\end{array}\right\}=\left\{\begin{array}{c} f \\ \frac{1}{2} M g L \theta \end{array}\right\},
from which \ddot{x} and \ddot{\theta} can be solved using Cramer’s rule:
\begin{aligned} & \ddot{x}=\frac{(1 / 3) M L^{2} f-(1 / 4) M^{2} L^{2} g \theta}{(1 / 12) M L^{2}(M+4 m)}, \\ & \ddot{\theta}=\frac{-(1 / 2) M L f+(M+m)(1 / 2) M g L \theta}{(1 / 12) M L^{2}(M+4 m)} . \end{aligned}
Simplifying the equations gives
\begin{aligned} & \dot{x}_{3}=\frac{4}{M+4 m} u-\frac{3 M g}{M+4 m} x_{2}, \\ & \dot{x}_{4}=\frac{-6}{L(M+4 m)} u+\frac{6(M+m) g}{L(M+4 m)} x_{2} . \end{aligned}
Thus, the state-space form is
\begin{aligned} \left\{\begin{array}{l} \dot{x}_{1} \\ \dot{x}_{2} \\ \dot{x}_{3} \\ \dot{x}_{4} \end{array}\right\} & =\left[\begin{array}{cccc} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & -\frac{3 M g}{M+4 m} & 0 & 0 \\ 0 & \frac{6(M+m) g}{L(M+4 m)} & 0 & 0 \end{array}\right]\left\{\begin{array}{l} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array}\right\}+\left[\begin{array}{c} 0 \\ 0 \\ \frac{4}{M+4 m} \\ -\frac{6}{L(M+4 m)} \end{array}\right] u \\ \mathbf{y} & =\left[\begin{array}{llll} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{array}\right]\left\{\begin{array}{c} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array}\right\}+\left[\begin{array}{l} 0 \\ 0 \end{array}\right] u . \end{aligned}
Note that in Part (a), Equation 5.31
\sum{\bf M_{p}}=I_{\mathrm{p}}\alpha+m{\bf r}_{\mathrm{C/P}}\times{\bf a_{P}}. (5.31)
instead of Equation 5.41
\sum M_{\mathrm{P}}=I_{\mathrm{C}} \alpha+M_{\text {eff } \_\mathbf{ma}_{\mathrm{C}}} (5.41)
can also be applied to the pendulum to derive the second equation of motion. The related free-body diagram and the kinematic diagram are shown in Figure 5.81. Summing all externally applied moments about the pivot \mathrm{P}, which moves together with the cart with an acceleration of \ddot{x}, gives
\begin{gathered} +\curvearrowright: \sum \boldsymbol{M}_{\mathrm{P}}=l_{\mathrm{P}} \boldsymbol{\alpha}+m \mathbf{r}_{\mathrm{C} / \mathrm{P}} \times \mathbf{a}_{\mathrm{P}} \\ M g \cdot \frac{L}{2} \sin \theta=\frac{1}{3} M L^{2} \ddot{\theta}+M \frac{L}{2} \ddot{x} \sin \left(\frac{\pi}{2}-\theta\right) \\ \frac{1}{3} M L^{2} \ddot{\theta}+\frac{1}{2} M L \ddot{x} \cos \theta-\frac{1}{2} M g L \sin \theta=0 . \end{gathered}

