# Equation of motion for 2-link arm

I have the following robot arm:

Now how do I obtain the equation of motion:

$$M \ddot\theta + \vec{b} + \vec{g} = \vec{\tau}$$

I am familiar with forces, torque, velocity and so on. I know that this equation follows from force and torque equations. However, I don't know how to establish these force and torque equations.

The torque is applied by motors in the joints, so that the arm does not move. No payload is attached to the end-effector.

As far as I understood, $\vec{\tau}$ contains the two scalar torques for each of the two joints. $\vec{g}$ should be the force vector in negative y-direction, although I am not quite sure. I have no idea what $\vec{b}$ might be.

Define $\vec{\tau}_1$ on the first joint and $\vec{\tau}_2$ on the second joint. The first arm is well defined. The traditional $\sum \vec{F} = m\vec{a}$ and $\sum \vec{M} = I\vec{\alpha}$, valid only when looking at the center of mass, can be applied. However, the moment equation is only valid relative to the center of mass. The general formula for motion when described by another point P on the body (travelling with the body) is $\sum \vec{M}_P = I_p\vec{\alpha} + \vec{p} \times m\vec{a}_P$, where $\vec{p}$ is the distance vector from point P to the center of mass, and $\vec{a}_P$ is the acceleration at P.

Since the pinned point doesn't have an acceleration, it can be established for pinned bodies that, with P being the point of the pin, $\sum \vec{M}_P = I_P\vec{\alpha}$. The second arm doesn't have this luxury, and we must establish an equation of motion for the body. A major note is that we need an equation to describe $\vec{p} \times m\vec{a}_J$. While $\vec{a}_J$ the acceleration of the joint, in terms of $\theta_1$, in Cartesian coordinates, is quite complex:

$$\vec{a}_J = L_1\left[\left(-\ddot{\theta_1}\sin(\theta_1)-\dot{\theta_1}^2\cos(\theta_1)\right)\hat{i} + \left(\ddot{\theta_1}\cos(\theta_1)-\dot{\theta_1}^2\sin(\theta_1)\right)\hat{j}\right]$$

Since $\theta_2$ is defined by the relative angle, this can be simplified as we evaluate across the cross product of the two vectors:

$$\vec{p} \times m\vec{a}_J = \frac{mL_1L_2}{2}\left(\ddot{\theta_1}\cos(\theta_2)-\dot{\theta_1}^2\sin(\theta_2)\right)$$

So, the equation of motion for the second body would be:

$$\vec{\tau_2} = I_J\ddot{\theta_2}+ \frac{mL_1L_2}{2}\left(\ddot{\theta_1}\cos(\theta_2)-\dot{\theta_1}^2\sin(\theta_2)\right)$$

Where $I_J$ is the inertia of the second body relative to that joint. Since $\vec{\tau_1(t)} = I_P\ddot{\theta_1}$, which implies that $\dot{\theta_1} = I_P^{-1}\int_0^t\vec{\tau_1(t)}dt$, we can simplify:

$$\vec{\tau_2(t)} = I_J\ddot{\theta_2}+ \frac{mL_1L_2}{2I_P}\left[\vec{\tau_1(t)}\cos(\theta_2)-\left(\int^t_0\vec{\tau_1(t)}dt\right)^2\frac{\sin(\theta_2)}{I_P}\right]$$

This simplification allows for solving in $\theta_2$ only, without solving for $\theta_1$ simultaneously. Assuming the input function $\tau_1(t)$ is known, the resulting equation can be simple or vastly complex.