What are the equations of motion for this simple system? I have a cart of mass $m_c$ connected to a pole of mass $m_p$ and length $L$ with a frictionless hinge. The cart can slide frictionlessly on a horizontal plane. Let $x_c$ denote the horizontal coordinate of the cart center of mass, and $\theta$ the angle between the vertical direction and the pole, positive if anticlockwise. A force $F$ is applied to the cart. I model gravity as a constant vector field.

I want to find the equations of motion for this simple system. Can you check if the following is correct? Also, I'm using a quite "ad-hoc" approach. If you can derive them in a more systematic way, I'd like to see how to do it.
First of all, it's clear that the system has 2 degrees of freedom, so I'm looking for 2 equations. The $x$-component of the center of mass equation of motion is one:
$$(m_p+m_c)\ddot{x}_G = F$$
Now, since
$$(m_p+m_c)x_G = m_c x_c + m_p \frac L2 \sin{\theta}$$
then
$$m_c\ddot{x}_c + m_p \frac L2 (-\sin\theta\dot{\theta}^2+\cos{\theta}\ddot{\theta})= F$$
Now, for the second equation. It seems to me that the simplest way to get a second equation of motion is to change reference frame to the (nonintertial) one moving with the cart. In this reference frame, a constant force field $-\ddot{x}_c$ acts on any material particle. We can now write the angular momentum equation for the pole. The hinge reaction force has zero torque wrt the hinge, so we're left with the nonintertial forces and the gravity force:
$$\frac{m_p}{3}L^2\ddot{\theta}= mg\frac L2 sin\theta -m\frac L2 \ddot{x}_c cos\theta $$
Thus, the equation of motion become:
$$\begin{aligned}
m_c\ddot{x}_c + m_p \frac L2 (\cos{\theta}\ddot{\theta}-\sin\theta\dot{\theta}^2) &= F \\
\frac{m_p}{3}L^2\ddot{\theta} - mg\frac L2 sin\theta +m\frac L2 \ddot{x}_c cos\theta &=0
\end{aligned}$$
correct?
 A: Nothing is simple in dynamics. You tried to get the equations of motion by inspection, yet there is defined process you should follow:

*

*Define degrees of freedom and draw FBD for each body. You have that except you need to label the kinematic hardpoints whose motion you care, plus all centers of mass. So you need to add the pin forces acting on the pendulum in the diagram. Equal and opposite forces act on the cart, but we only care about the horizontal components along the direction of motion in this case only.



*Write down the kinematic equations of all the hardpoints in terms of the DOF variables (and their derivatives). For example if $x_P = x_c + \tfrac{L}{2} \sin \theta$ and $y_P = \tfrac{L}{2} \cos \theta$ then
$$\begin{aligned}
\ddot{x}_P & = \ddot{x}_c - \tfrac{L}{2} \dot{\theta}^2 \sin \theta + \tfrac{L}{2} 
\ddot{\theta} \cos \theta \\
\ddot{y}_P & = -\tfrac{L}{2} \dot{\theta}^2 \cos \theta - \tfrac{L}{2} \ddot{\theta} \sin \theta
\end{aligned}$$


*For each body write equations for linear and rotational motion. This part is straight forward as long as you sum up torques at each center of mass.
$$\begin{aligned}
   F - A_x & = m_c \ddot{x}_c \\
   A_x & = m_p \ddot{x}_P \\
   A_y - m_p g & = m_p \ddot{y}_P \\
   (\tfrac{L}{2} \sin \theta) A_x - (\tfrac{L}{2} \cos \theta) A_y & = I_p (-\ddot{\theta})
   \end{aligned}$$
Since the cart isn't rotating we can ignore all by the translational force balance. Note the convention of CCW rotation being positive so the rotational acceleration of the pendulum is negative $\ddot{\theta}$.


*Count equations and unknowns to see if the problem is solvable. There are 2 degrees of freedom and 2 unknown forces in the FBD. There are four equations of motion. So the problem has a solution as stated. $\checkmark$
A: Given that the hinge exerts horizontal, H, and vertical, V, forces on each object, we can write force equations for the cart: F – H = $m_c$$a_c$ and for the pole: H = $m_p$$a_{px}$ and  V - $m_p$g = $m_p$$a_{py}$.  Since the pole is in a non-inertial system, I would not use a torque equation.  However, we can say that the acceleration vector of the cart plus the tangential acceleration of the CM of the pole must yield the acceleration components we found from the force equations.
