# OVERVIEW

In this series of posts I will demonstrate different techniques for tackling problems with one or more rigid bodies in motion. Consider the inverted pendulum problem on a cart as described in this wikipedia page.

An approximation that can be done at this stage is that each rigid body acts like a point mass, and only the forces on each center of gravity are considered. Later we can see how to use all the degrees of freedom (including rotations) to see the effects of rotational inertias and what the reactions might be at the wheels above.

# Method 1 - Cartesian Coordinates

## KINEMATICS

In this example there are two bodies in motion (the cart and the ball) and most simplistic approach is to consider each rigid body moving separately. The center of gravity of the cart (Point A) has two degrees of freedom $x_A$ and $y_A$ when considered free of all contacts and constraints. Similarly the center of gravity of the ball (Point B) has also two degrees of freedom $x_B$ and $y_B$. In vector form the above coordinates are $$\vec{r}_A = \begin{pmatrix} x_A \\ y_A \\ 0 \end{pmatrix}$$ $$\vec{r}_B = \begin{pmatrix} x_B \\ y_B \\ 0 \end{pmatrix}$$
The kinematics (motion description) of such a system is trivial as the velocities and accelerations are just the derivatives of the above quantities. In vector form these are $$\vec{v}_A = \begin{pmatrix} \dot{x}_A \\ \dot{y}_A \\ 0 \end{pmatrix}$$ $$\vec{v}_B = \begin{pmatrix} \dot{x}_B \\ \dot{y}_B \\ 0 \end{pmatrix}$$ and $$\vec{a}_A = \begin{pmatrix} \ddot{x}_A \\ \ddot{y}_A \\ 0 \end{pmatrix}$$ $$\vec{a}_B = \begin{pmatrix} \ddot{x}_B \\ \ddot{y}_B \\ 0 \end{pmatrix}$$
There are a total of 4 unknown degrees of freedom in the system corresponding to the 4 acceleration components of $\vec{a}_A$ and $\vec{a}_B$.
In addition, there are two constraint equations applicable here, one keeping the cart on the ground and the other keeping the ball a distance $l$ from the cart. This makes the system with two effective degrees of freedom. To include the constraint equations in the system we are going to use what is called the Pfaffian form in terms of the velocity components.
Since the cart does not move in the vertical direction this can be written as $\hat{j}\cdot\vec{v}_A = 0$ or in expanded form $$\begin{pmatrix}0\\1\\0\end{pmatrix}\cdot\begin{pmatrix} \dot{x}_A \\ \dot{y}_A \\ 0 \end{pmatrix} = \dot{y}_A = 0$$ Also the ball does not move towards the cart along the rod with direction vector $\hat{n}=\begin{pmatrix}\text{-}\sin\theta & \cos\theta & 0 \end{pmatrix}^\top$ so the constraint is $\hat{n}\cdot\vec{v}_B = 0$ or in expanded form $$\begin{pmatrix}\text{-}\sin\theta \\ \cos\theta \\ 0 \end{pmatrix} \cdot \begin{pmatrix} \dot{x}_B \\ \dot{y}_B \\ 0 \end{pmatrix} = \dot{y}_B \cos\theta – \dot{x}_B \sin\theta = 0$$
This is kind of a tricky part, because $\theta$ depends on our degrees of freedom with $$\tan\theta = \frac{x_A-x_B}{y_B-y_A}$$ In addition, to solve for the motion we need to differentiate all these expressions in order to bring them in terms of accelerations.
To summarize, this technique quickly balloons into unmanageable complexity and thus it is not used at all in practice. The closest I have seen is the computer game particle systems because all interactions between bodies are modeled with compliant forces and not Pfaffian constraints.  Next time I will simplify this technique by only considering the reduced degrees of freedom $x$ and $\theta$ and derive everything else from those.