This code solves the triple pendulum Lagrangian of a system with 4 Degrees of Freedom (3 in flexion/extension and 1 in abduction). A spherical coordinate system attached at the origin of the Metacarpophalangeal (MCP) joint is used and the flexion/extension movement corresponds to the elevation angle and the abduction movement to the azimuthal angle. Each joint has its own local reference system. If someone desires to see the total flexion angle from the origin then for the total angle you simply need to add all the previous angles to the one you are looking.
To solve the system the elevation angle in this code is the complementary angle of the normal definition of the elevation angle. This is chosen so that when the digits are in full extension then all the angles are 0 and not 90 degrees.
The digits are assumed to be rigid cylinders with constant desnity of
The moment of inertial of a cylinder about its center of mass is
The mass of a cylinder is calculated from the density formula as
The center of mass for each cylinder is located at
Let subscript 1,2,3 denote the proximal middle and distal phalanges. Let
Then the equation of the spherical coordinates for the system are:
Then the Kinetic energy of the system is:
The first part of the kinetic energy corresponds to the parallel axis theorem that will shift the moment of inertia from the midpoint towards the rotating joint.
The potential energy of the system is
where
Now that both the Kinetic and Potential energies are determined the Lagrangian equation is:
The damper effect of the passive moment is introduced into the Lagrangian as a Rayleigh dissipation function
where
The equations of motion for each generalised coordinate are obtained from the following equation
This script shows the Lagrangian derivation and also the respective equations of motion. It is meant as a guide to verify the Lagrangian matrix. In it the
This is the main script. It solves the Euler-Lagrange equations of the triple pendulum for some user defined initial conditions. The individual lengths and radii have to be given in millimeters. Some spring and damper constants are given but these can be changed if needed. The equilibrium angles can also be changed to experimentally measured ones. There are also user defined inputs, that can be given that must be functions of time. Running the script, plots the resulting angles and angular velocities that have been calculated from numerically solving the equations of motion. A parametric plot that displays the circumduction movement is also there to visualise the circular motion of the digits. Lastly, excel files with the numerical solutions in rads are created, the change in the abduction moment for the given motion, and the theoretically calculated moments of inertia for the flexion moment, the theoretical calculations for the masses and the abduction moment of inertia when the finger is in extension (i.e. all flexion angles are 0). Lastly, an animation of the resulting motion in flexion/extension is shown.