Controls
Presets
Parameters
Model checks
The science
Equation of motion. A planar two-link arm in a vertical plane obeys M(q) q'' + C(q, q') q' + g(q) = tau. With the second rod and the tip payload merged into one body (mass m2e, centre lc2, inertia I2 by the parallel-axis theorem): d11 = m1lc12 + m2e(l12 + lc22 + 2 l1lc2cos q2) + I1 + I2, d12 = m2e(lc22 + l1lc2cos q2) + I2, d22 = m2elc22 + I2; the Coriolis/centripetal matrix uses h = -m2e l1 lc2 sin q2 (the standard textbook form, e.g. Spong, Hutchinson and Vidyasagar); gravity gives g1 = (m1lc1 + m2el1)G cos q1 + m2elc2G cos(q1+q2).
What is shown. The joints follow a prescribed smooth swing (a sinusoid for the shoulder, a phase-shifted one at 0.7 times the amplitude for the elbow). The page computes the inverse dynamics: the torque the motors must deliver, split into the inertial part M q'', the Coriolis and centripetal part C q' and the gravity part. At low frequency gravity dominates; the inertial part grows with the square of the frequency and the Coriolis part with the product of the two joint speeds. In orbit (G = 0) only the dynamic terms remain.
Checks. The closed-form torque is compared with a numerical Euler-Lagrange derivative built from the kinetic and potential energy of the rods and the payload taken separately; the work done by the torques over a period must equal the change of kinetic plus potential energy; M' - 2C must be skew-symmetric; a forward-dynamics integration driven by the computed torques must follow the planned trajectory; and the mass matrix must reproduce the kinetic energy.
Simplifications. Rigid, uniform, massless-joint links with the payload as a point mass, no motor inertia, gear ratios, joint friction or elasticity, no torque saturation, perfect trajectory following (the arm is moved kinematically; the torque is what an ideal controller would need). The default masses and lengths are illustrative values for a small laboratory arm, not a particular product.