Scroll back to top
Consider a planar 2-DOF robotic arm with constant link lengths 

The position of the center of mass of the first link reads
where 
which accounts for the fact that the second arm is attached to the first and that we have another generalized coordinate, 
In order to construct the Lagrangian 
Here, the squared velocities of the centers of mass of both links via 
Since we also consider rotational kinematics we have to account for the change in the kinetic energy due to the rotation of each link about its center of mass. The corresponding angular velocities read
The potential energy is:
The main idea is that the Euler–Lagrange equations result in the equations of motion for the links. To control that motion, external torques 
where 
where 
In our example of a two link robotic arm, we have two generalized coordinates
and thus the inertia matrix 
Those are
Note that this matrix changes with the configuration of the robotic arm.
A common form of the velocity-dependent matrix 
where 
The final equations of motion read
To move the robotic arm smoothly from its initial configuration to the target configuration, we plan trajectories for the joint angles 
A common, even though somewhat counterintuitive approach is not to solve the equations of motion for the joint angles but to assert that all angles must behave in a way that smooths transitions between the initial and final positions.
In other words, we postulate that a joint angle 
The coefficients 
The time evolution of the joint angles is given by
and angular velocities and accelerations follow by differentiation:
With the joint velocities and accelerations known, the required joint torques 
by substituting 
Let us consider the an example with the following parameters:
where 
First we need to calculate the value of the generalized coordinates at the initial and final times.
To achieve the desired end-effector position 
we can derive
and find the joint angles 
Here, 
Suppose we plan to reach the target configuration in 
Then, based on the inverse Kinematics we have
Since we also want the arm to be at rest before and after the maneuver we add
where all values have units of rad/s.
The joint angles should follow a cubic polynomial trajectory:
From the boundary conditions we can compute the coefficients for 
The boundary conditions 
Since we know 
in units of rad/s
Following a similar path, we find the coefficients for 
The final equations for the joint angles and their derivatives in units of rad, rad/s and rad/s
We can now compute the torques 
This results in
Inserting the polynomials for