Robot dynamics: from joint torques to motion and back
机器人动力学
How the joint torques of an open-chain robot relate to its motion: the equation of motion and its mass, Coriolis and gravity terms, Lagrangian and Newton–Euler derivations, the recursive Newton–Euler algorithm, forward dynamics and simulation, checked on an original two-link point-mass model.
robot-dynamicsKinematics says where; dynamics says how hard
Kinematics describes where a robot’s links are and how fast they move, without asking why. Robot dynamics adds the forces and torques that cause the motion, leading to two main questions. Inverse dynamics: to make the arm follow a planned motion, what torque must each motor deliver right now? Forward dynamics: if the motors apply given torques, how will the arm move? Controllers rely on inverse dynamics, while simulators use forward dynamics. Chapter 8 introduction
Even a two-link arm moving in a vertical plane shows why the answer is not simply “torque equals inertia times acceleration”. Holding the arm still and horizontal already needs a torque against gravity. Swinging the shoulder flings the forearm outward, which the elbow must resist. Bending the elbow while the shoulder turns pulls the forearm’s mass closer to the shoulder, which changes how hard the shoulder must work to keep the same speed, like a spinning skater pulling in her arms. And the same motor torque accelerates the arm differently depending on its posture. All of these effects appear as separate terms in one equation.
This article builds on robot kinematics for forward kinematics and the Jacobian, and on the positive-definite matrices article for the linear algebra of the mass matrix. Using the model for control (PID, optimal control, model predictive control) and matching simulation to real hardware are covered in separate articles. Every number from code below comes from an original simulation of an idealized two-link arm with point masses; it is a teaching model, not a measurement of any real robot.
One equation, two derivations, one recursion
The equation of motion. For an open chain with joint vector θ, the joint torques (or forces, for sliding joints) τ satisfy a second-order differential equation of the form: Equations of motion
M(θ) is the n × n mass matrix, symmetric and positive definite. c(θ, θ̇) collects the Coriolis and centripetal torques, g(θ) the gravity torques, and the last term is the torque needed for the end effector to apply a wrench F_tip to the environment. Friction is not part of this rigid-body model and is added separately. Lynch and Park note that even for “simple” chains with orthogonal or parallel joint axes, M and the velocity terms can be extraordinarily complex. Equations of motion; end-effector wrench Inverse dynamics evaluates the right-hand side for a desired acceleration. Forward dynamics solves for the acceleration (shown here with no end-effector wrench):
Two routes to the same equation. The Newton–Euler route applies Newton’s and Euler’s equations to each rigid link. The Lagrangian route starts from the kinetic and potential energy of the whole robot. The book judges the Lagrangian route elegant and effective for robots with about three or fewer degrees of freedom but cumbersome beyond that, while Newton–Euler leads to efficient recursive algorithms; this is a practical judgement, not a hard limit. The two formulations give, and must give, identical equations of motion. Lagrange vs Newton–Euler
Lagrangian mechanics. Choose independent generalized coordinates (here the joint angles) and generalized forces dual to them, so that τᵀθ̇ is power. Form the Lagrangian, kinetic minus potential energy; for rigid-link robots the kinetic energy can always be written with the mass matrix. The Euler–Lagrange equations then give each joint torque: Lagrangian formulation
The “Lagrangian” here is a function of mechanics, not the method of Lagrange multipliers from optimization; multipliers appear in robot dynamics only when constraints are added (below). As a check, a particle of mass m on a vertical line pushed up by force f has Lagrangian ½mẋ² − mgx, and the equation gives f = mẍ + mg, which is Newton’s law. Particle example
The planar 2R arm with point masses. Put mass m1 at the end of link 1 (length L1) and m2 at the end of link 2 (length L2), with gravity g along −y. Writing the two kinetic and potential energies and applying the Euler–Lagrange equations gives, with the shorthand c_2 = cos θ2, s_2 = sin θ2, c_1 = cos θ1 and c_12 = cos(θ1 + θ2): 2R example
For serial chains of revolute joints the book observes that such equations are linear in θ̈, quadratic in θ̇ and trigonometric in θ; prismatic joints give polynomial rather than trigonometric dependence. The same Mθ̈ + c terms come out of writing f = ma for each point mass and taking moments: joint 1 carries both masses, joint 2 only m2. Structure; per-mass Newton view
Centripetal, Coriolis, and the skater. Terms in θ̇i² are centripetal; terms in θ̇iθ̇j with i ≠ j are Coriolis. θ̈ = 0 does not mean the masses are unaccelerated. At θ = (0, 90°), with both joints turning, the Coriolis acceleration of m2 passes through joint 2, so joint 2 feels no torque from it, but joint 1 needs a negative torque: m2 is moving closer to joint 1, its moment of inertia about joint 1 drops, and keeping θ̇1 constant requires removing angular momentum, as for a spinning skater. Fig. 8.2 discussion
Christoffel symbols and skew symmetry. In general the velocity terms are determined by the mass matrix alone. With the Christoffel symbols of the first kind built from derivatives of M, the torque is τ_i = Σ_j m_ij θ̈_j + Σ_j Σ_k Γ_ijk θ̇_j θ̇_k + ∂P/∂θ_i. Collecting the velocity terms into a Coriolis matrix C (so that c = Cθ̇) gives a matrix with a useful property: Christoffel symbols; Proposition 8.1
The matrix C with c = Cθ̇ is not unique in general; the skew symmetry holds for this Christoffel-based choice. It is called the passivity property and is used in stability proofs for some robot control laws. Passivity
What the mass matrix means. Positive definiteness generalizes m > 0: any nonzero velocity has positive kinetic energy. Unlike a scalar mass, a matrix gives different effective masses in different directions, so even at rest θ̈ is generally not parallel to τ. For L1 = L2 = m1 = m2 = 1 the book gives M(0°, 90°) = [[3, 1], [1, 1]] and M(0°, 150°) ≈ [[1.27, 0.13], [0.13, 1]]. Expressed at the end effector, the mass matrix becomes Λ = J⁻ᵀMJ⁻¹ when J is invertible; for the same arm at (0°, 90°) it is diag(1, 2), so the hand feels twice as heavy in one direction as in the other. These ellipsoid pictures hold only at zero velocity. Mass ellipsoids and Λ
Recursive Newton–Euler. For more than a few joints, deriving and differentiating the energy expressions becomes cumbersome. The recursive Newton–Euler algorithm (RNEA) computes inverse dynamics in two passes. A forward pass from base to tip propagates each link’s velocity and acceleration from its parent plus its own joint’s contribution. A backward pass from tip to base accumulates the force each link must receive from its parent: what the link needs for its own motion plus what it passes on to its child. The joint torque is the component of that transmitted force along the joint axis; the joint’s structure supplies the other components. Featherstone’s course slides write the whole algorithm in four lines of spatial-vector notation, with s_i the joint axis, I_i the link’s spatial inertia and ×* the spatial cross product for forces: RNEA
starting from v_0 = 0, a_0 = 0 and with f_(n+1) the force the robot exerts on whatever it touches at the end effector. Spatial vectors are six-dimensional: motion vectors and force vectors live in separate spaces with a scalar product between them (the slide calls it work), but neither space has an inner product of its own. Spatial vectors Note on slide 3 Lynch and Park state the same two-pass algorithm with twists, wrenches and screw axes in link frames, the torque again being the projection of the transmitted wrench on the joint’s screw axis. Newton–Euler inverse dynamics Both handle gravity by a trick: set the base acceleration to the opposite of gravity, as if the whole robot were in an upward-accelerating elevator. Featherstone’s notes point out that this is simpler and cheaper than computing each link’s weight, but the accelerations computed along the way are then not the true link accelerations. Note on slide 55 Gravity as base acceleration
The book traces the spatial-vector recursive formulation to Featherstone’s 1983 paper and his 2008 book Rigid Body Dynamics Algorithms, which also develop articulated-body methods; its own Lie-group version follows Park, Bobrow and Ploen (1995), and the task-space (operational space) formulation is due to Khatib (1987). We know these works only through the book’s notes and bibliography. Chapter 8 notes
Forward dynamics from inverse dynamics. Any inverse-dynamics routine also yields forward dynamics. Calling it with θ̈ = 0 and no end-effector wrench gives the velocity and gravity terms; calling it n times with zero gravity, zero velocity and θ̈ equal to each unit vector gives M column by column. Then solve Mθ̈ = τ − c − g with any efficient linear solver. Forward dynamics The mass matrix can also be assembled as a sum over links of J_ibᵀ G_i J_ib, from each link’s spatial inertia G_i and body Jacobian J_ib. Closed form
Simulation. To simulate, rewrite the second-order equation as a first-order system in (θ, θ̇) and integrate. The simplest scheme is the explicit Euler step: Numerical integration
It converges as the step shrinks, and higher-order schemes such as fourth-order Runge–Kutta (RK4) can be more accurate with fewer computations. Numerical integration
What the model leaves out. Neither derivation includes joint friction. Friction models often combine a static (Coulomb-type) term, which needs a nonzero torque to start motion, with a viscous term growing with speed, and real friction also depends on Stribeck effects, load, temperature and rest time; gearhead friction often grows with the gear ratio. Friction An ideal gearhead of ratio G multiplies motor torque by G, divides speed by G, and makes the rotor’s inertia appear at the output as G² times its value. Velocity constraints A(θ)θ̇ = 0, for example from contact, add a term Aᵀλ with Lagrange multipliers λ. Gearing and constraints
Checking one small model six ways
The program implements the 2R point-mass arm with L1 = L2 = m1 = m2 = 1 and g = 9.81 m/s². It uses numpy and one seeded random generator. Part 1 checks the mass matrix against the book’s values. Part 2 compares three independent computations of inverse dynamics on 1000 random states: the closed form above, a point-mass Newton derivation (f = m(a − g) for each mass and moments r × f about each joint), and Christoffel symbols obtained by central finite differences of M. Part 3 checks the gravity torque and rebuilds M from inverse-dynamics calls. Part 4 checks the skew symmetry of Ṁ − 2C. Part 5 simulates the unpowered arm and measures energy drift for three integrators. Part 6 asks what an energy test can and cannot detect. The “Newton” routine is the planar point-mass special case, not the general spatial RNEA.
import numpy as np
np.set_printoptions(precision=4, suppress=True)
M1, M2, L1, L2, G = 1.0, 1.0, 1.0, 1.0, 9.81
def mass_matrix(q):
c2 = np.cos(q[1])
m11 = M1 * L1**2 + M2 * (L1**2 + 2 * L1 * L2 * c2 + L2**2)
m12 = M2 * (L1 * L2 * c2 + L2**2)
return np.array([[m11, m12], [m12, M2 * L2**2]])
def coriolis(q, qd):
s2 = np.sin(q[1])
return np.array([-M2 * L1 * L2 * s2 * (2 * qd[0] * qd[1] + qd[1]**2),
M2 * L1 * L2 * qd[0]**2 * s2])
def gravity(q):
c1, c12 = np.cos(q[0]), np.cos(q[0] + q[1])
return np.array([(M1 + M2) * L1 * G * c1 + M2 * G * L2 * c12, M2 * G * L2 * c12])
def tau_closed_form(q, qd, qdd):
return mass_matrix(q) @ qdd + coriolis(q, qd) + gravity(q)
def tau_newton(q, qd, qdd):
t1, t12 = q[0], q[0] + q[1]
w1, w12 = qd[0], qd[0] + qd[1]
a1, a12 = qdd[0], qdd[0] + qdd[1]
p1 = L1 * np.array([np.cos(t1), np.sin(t1)])
p2 = p1 + L2 * np.array([np.cos(t12), np.sin(t12)])
acc1 = L1 * (a1 * np.array([-np.sin(t1), np.cos(t1)]) - w1**2 * np.array([np.cos(t1), np.sin(t1)]))
acc2 = acc1 + L2 * (a12 * np.array([-np.sin(t12), np.cos(t12)])
- w12**2 * np.array([np.cos(t12), np.sin(t12)]))
g = np.array([0.0, -G])
f1 = M1 * (acc1 - g)
f2 = M2 * (acc2 - g)
def cross(r, f):
return r[0] * f[1] - r[1] * f[0]
tau1 = cross(p1, f1) + cross(p2, f2)
tau2 = cross(p2 - p1, f2)
return np.array([tau1, tau2])
def potential(q):
y1 = L1 * np.sin(q[0])
y2 = y1 + L2 * np.sin(q[0] + q[1])
return M1 * G * y1 + M2 * G * y2
def tau_christoffel(q, qd, qdd, h=1e-6):
n = len(q)
dM = np.zeros((n, n, n))
for k in range(n):
e = np.zeros(n)
e[k] = h
dM[:, :, k] = (mass_matrix(q + e) - mass_matrix(q - e)) / (2 * h)
gamma = np.zeros((n, n, n))
for i in range(n):
for j in range(n):
for k in range(n):
gamma[i, j, k] = 0.5 * (dM[i, j, k] + dM[i, k, j] - dM[j, k, i])
dP = np.array([(potential(q + h * np.eye(n)[i]) - potential(q - h * np.eye(n)[i])) / (2 * h)
for i in range(n)])
return mass_matrix(q) @ qdd + np.einsum("ijk,j,k->i", gamma, qd, qd) + dP
def energy(q, qd):
return 0.5 * qd @ mass_matrix(q) @ qd + potential(q)
def forward_dynamics(q, qd, tau):
return np.linalg.solve(mass_matrix(q), tau - coriolis(q, qd) - gravity(q))
print("1) Mass matrix checks (L1 = L2 = m1 = m2 = 1)")
print(" M(0, 90 deg) =", mass_matrix(np.radians([0.0, 90.0])).ravel())
print(" M(0, 150 deg) =", mass_matrix(np.radians([0.0, 150.0])).ravel())
print(" eigenvalues of M(0, 90 deg) =", np.linalg.eigvalsh(mass_matrix(np.radians([0.0, 90.0]))))
print("\n2) Three derivations of inverse dynamics on 1000 random states")
rng = np.random.default_rng(0)
d_ne, d_ch = 0.0, 0.0
for _ in range(1000):
q, qd, qdd = rng.uniform(-np.pi, np.pi, 2), rng.uniform(-3, 3, 2), rng.uniform(-5, 5, 2)
ref = tau_closed_form(q, qd, qdd)
d_ne = max(d_ne, np.max(np.abs(tau_newton(q, qd, qdd) - ref)))
d_ch = max(d_ch, np.max(np.abs(tau_christoffel(q, qd, qdd) - ref)))
print(f" max |closed form - point-mass Newton| = {d_ne:.1e} N m")
print(f" max |closed form - Christoffel from M| = {d_ch:.1e} N m")
print("\n3) Static gravity torque and the column-by-column mass matrix")
q = np.radians([0.0, 90.0])
print(" gravity torque at (0, 90 deg) =", gravity(q))
print(" tau at (0, 90 deg), qd = 0, qdd = 0 =", tau_newton(q, np.zeros(2), np.zeros(2)))
q = np.array([0.4, -1.1])
cols = [tau_newton(q, np.zeros(2), np.eye(2)[i]) - tau_newton(q, np.zeros(2), np.zeros(2)) for i in range(2)]
print(f" max |M from ID calls - M closed form| = {np.max(np.abs(np.array(cols).T - mass_matrix(q))):.1e}")
print("\n4) Skew symmetry of dM/dt - 2C at a random state")
q, qd = np.array([0.7, -0.4]), np.array([1.3, -2.1])
s2, c2 = np.sin(q[1]), np.cos(q[1])
Mdot = np.array([[-2 * M2 * L1 * L2 * s2 * qd[1], -M2 * L1 * L2 * s2 * qd[1]],
[-M2 * L1 * L2 * s2 * qd[1], 0.0]])
hh = -M2 * L1 * L2 * s2
C = np.array([[hh * qd[1], hh * (qd[0] + qd[1])], [-hh * qd[0], 0.0]])
S = Mdot - 2 * C
print(f" |C qd - c(q, qd)| = {np.max(np.abs(C @ qd - coriolis(q, qd))):.1e}")
print(" dM/dt - 2C =", S.ravel(), f" |S + S^T| = {np.max(np.abs(S + S.T)):.1e}")
print("\n5) Passive motion (tau = 0) from (0.5, 0.0) at rest for 5 s: max |E(t) - E0|")
q0, qd0 = np.array([0.5, 0.0]), np.zeros(2)
E0 = energy(q0, qd0)
def f(x):
return np.concatenate([x[2:], forward_dynamics(x[:2], x[2:], np.zeros(2))])
for dt in [1e-2, 1e-3]:
n = int(round(5.0 / dt))
drift = {"explicit Euler": 0.0, "semi-implicit Euler": 0.0, "RK4": 0.0}
q, qd = q0.copy(), qd0.copy()
for _ in range(n):
q, qd = q + dt * qd, qd + dt * forward_dynamics(q, qd, np.zeros(2))
drift["explicit Euler"] = max(drift["explicit Euler"], abs(energy(q, qd) - E0))
q, qd = q0.copy(), qd0.copy()
for _ in range(n):
qd = qd + dt * forward_dynamics(q, qd, np.zeros(2))
q = q + dt * qd
drift["semi-implicit Euler"] = max(drift["semi-implicit Euler"], abs(energy(q, qd) - E0))
x = np.concatenate([q0, qd0])
for _ in range(n):
k1 = f(x)
k2 = f(x + 0.5 * dt * k1)
k3 = f(x + 0.5 * dt * k2)
k4 = f(x + dt * k3)
x = x + dt / 6 * (k1 + 2 * k2 + 2 * k3 + k4)
drift["RK4"] = max(drift["RK4"], abs(energy(x[:2], x[2:]) - E0))
print(f" dt = {dt:g}: " + ", ".join(f"{k} {v:.1e} J" for k, v in drift.items()))
print(f" initial energy E0 = {E0:.4f} J")
print("\n6) What the energy test can and cannot catch (RK4, dt = 0.001, 5 s)")
def rk4_drift(accel, energy_fn, dt=1e-3, T=5.0):
x = np.array([0.5, 0.0, 0.0, 0.0])
e0 = energy_fn(x[:2], x[2:])
worst = 0.0
g = lambda s: np.concatenate([s[2:], accel(s[:2], s[2:])])
for _ in range(int(round(T / dt))):
k1 = g(x)
k2 = g(x + 0.5 * dt * k1)
k3 = g(x + 0.5 * dt * k2)
k4 = g(x + dt * k3)
x = x + dt / 6 * (k1 + 2 * k2 + 2 * k3 + k4)
worst = max(worst, abs(energy_fn(x[:2], x[2:]) - e0))
return worst
doubled = lambda q, qd: np.linalg.solve(mass_matrix(q), -2 * coriolis(q, qd) - gravity(q))
flipped = lambda q, qd: np.linalg.solve(mass_matrix(q), -coriolis(q, qd) + gravity(q))
flipped_energy = lambda q, qd: 0.5 * qd @ mass_matrix(q) @ qd - potential(q)
print(f" Coriolis vector doubled (bug): max |dE| = {rk4_drift(doubled, energy):.2e} J")
print(f" gravity sign flipped in model and energy: max |dE| = {rk4_drift(flipped, flipped_energy):.2e} J")
print(" c(q, qd) at q = (0, 90 deg), qd = (1, 0):", coriolis(np.radians([0.0, 90.0]), np.array([1.0, 0.0])))
print(" gravity torque at q = (0, 0):", gravity(np.zeros(2)))
Recorded output (CPython 3.12, numpy 1.26.4)
1) Mass matrix checks (L1 = L2 = m1 = m2 = 1)
M(0, 90 deg) = [3. 1. 1. 1.]
M(0, 150 deg) = [1.2679 0.134 0.134 1. ]
eigenvalues of M(0, 90 deg) = [0.5858 3.4142]
2) Three derivations of inverse dynamics on 1000 random states
max |closed form - point-mass Newton| = 1.8e-14 N m
max |closed form - Christoffel from M| = 6.3e-09 N m
3) Static gravity torque and the column-by-column mass matrix
gravity torque at (0, 90 deg) = [19.62 0. ]
tau at (0, 90 deg), qd = 0, qdd = 0 = [19.62 0. ]
max |M from ID calls - M closed form| = 1.8e-15
4) Skew symmetry of dM/dt - 2C at a random state
|C qd - c(q, qd)| = 3.9e-16
dM/dt - 2C = [ 0. -0.1947 0.1947 0. ] |S + S^T| = 2.2e-16
5) Passive motion (tau = 0) from (0.5, 0.0) at rest for 5 s: max |E(t) - E0|
dt = 0.01: explicit Euler 1.1e+01 J, semi-implicit Euler 5.2e+00 J, RK4 1.7e-05 J
dt = 0.001: explicit Euler 7.7e-01 J, semi-implicit Euler 6.3e-01 J, RK4 1.8e-09 J
initial energy E0 = 14.1095 J
6) What the energy test can and cannot catch (RK4, dt = 0.001, 5 s)
Coriolis vector doubled (bug): max |dE| = 1.21e+00 J
gravity sign flipped in model and energy: max |dE| = 2.23e-11 J
c(q, qd) at q = (0, 90 deg), qd = (1, 0): [-0. 1.]
gravity torque at q = (0, 0): [29.43 9.81]Parts 1 to 4, the model itself. M(0, 90°) = [[3, 1], [1, 1]] and M(0, 150°) = [[1.2679, 0.134], [0.134, 1]], matching the book’s [[3, 1], [1, 1]] and [[1.27, 0.13], [0.13, 1]]. The eigenvalues 0.5858 and 3.4142 (that is, 2 ∓ √2) show the joint-space inertia differing by a factor of about six between directions. On 1000 random states the closed form and the point-mass Newton derivation agree to 1.8e-14 N·m, round-off level; the Christoffel computation agrees to 6.3e-09 N·m, the error of finite differences with step 1e-6. The gravity torque at (0, 90°) is [19.62, 0] N·m, equal to inverse dynamics with zero velocity and acceleration. Building M column by column from inverse-dynamics calls reproduces the closed form to 1.8e-15. (The code removes gravity by subtracting the θ̈ = 0 call rather than setting g = 0, which is equivalent here because θ̇ = 0.) At q = (0.7, −0.4) rad and θ̇ = (1.3, −2.1) rad/s, the Christoffel-based C satisfies Cθ̇ = c to 3.9e-16, and Ṁ − 2C = [[0, −0.1947], [0.1947, 0]] is skew-symmetric to 2.2e-16.
Part 5, energy drift is an integrator property. With τ = 0 and no friction, the arm released at rest from (0.5, 0) rad should conserve its energy E0 = 14.1095 J. Over 5 s with δt = 0.01 s, explicit Euler drifts by up to 1.1e+01 J, most of the initial energy; the variant that updates θ̇ first and then θ (“semi-implicit Euler” here) drifts by up to 5.2e+00 J; RK4 drifts by 1.7e-05 J. With δt = 0.001 s the figures are 7.7e-01, 6.3e-01 and 1.8e-09 J. Ten times smaller steps reduce the explicit-Euler drift by roughly fourteen times and the RK4 drift by roughly ten thousand times. The model is identical in all six runs; only the integrator and step differ. Our semi-implicit variant is not presented as an energy-preserving method: in these runs it drifts by the same order of magnitude as explicit Euler.
Part 6, what the energy test catches. Doubling the Coriolis vector, a plausible coding slip, makes RK4 energy drift jump to 1.21e+00 J, so an energy test catches it: the bug breaks the structure (the skew symmetry above) on which energy conservation rests. Flipping the sign of gravity consistently in both the dynamics and the energy function gives a drift of only 2.23e-11 J: the wrong model conserves its own wrong energy perfectly. An energy test is necessary, not sufficient. Hand-checkable values complete the picture: c at q = (0, 90°), θ̇ = (1, 0) is [0, 1] (printed as “-0.” because of a signed zero), and the gravity torque at q = (0, 0) is [29.43, 9.81] N·m, the outstretched horizontal arm needing the most shoulder torque.
What a two-link point-mass model cannot tell you
The example has point masses instead of rigid links with distributed inertia, and no friction, gearing, motor dynamics, joint flexibility, joint limits or contact. A real arm’s parameters must be identified from data; we read no system-identification source, so this article makes no claims about how well identified models match hardware. Learned dynamics models, as in model-based reinforcement learning, are a different approach: a fitted function instead of the physics equation above. We make no comparison between the two.
The code checks the planar special case. It does not implement the spatial-vector RNEA, articulated-body algorithms, or the closed-form M = Σ JᵀGJ, so it tests the structure of the equations, not an efficient general implementation. We make no claims about the computational cost of the various algorithms: none of the material we read states operation counts.
The energy comparisons cover one start state, one horizon and two step sizes. They show the order of magnitude of integrator error for this system, not a ranking of integrators in general. Stiff contact, friction and control loops change which integrator is appropriate.
Derive, compute, check
-
The arm is at θ = (0, 90°), both joints turn with positive speeds θ̇1, θ̇2 > 0, and neither accelerates (θ̈ = 0). Joint 2’s motion brings m2 closer to joint 1. Why does joint 1 still need a torque from the Coriolis effect, and with which sign?
Answer: m2’s acceleration has a Coriolis component that passes through joint 2 but not through joint 1. As m2 approaches joint 1, the moment of inertia about joint 1 falls; keeping θ̇1 constant then requires reducing the angular momentum, so joint 1 must apply a negative torque. Formally, the first component of c, −m2L1L2s2(2θ̇1θ̇2 + θ̇2²), is negative at s2 = 1 with positive speeds. θ̈ = 0 does not mean zero torque: the c(θ, θ̇) term is nonzero.
-
With L1 = L2 = m1 = m2 = 1 and g = 9.81: (a) compute M at θ = (0, 90°); (b) compute the gravity torques at (0, 90°) and at (0, 0); (c) compute c at θ = (0, 90°), θ̇ = (1, 0).
Answer: (a) c2 = cos 90° = 0, so m11 = 1 + (1 + 0 + 1) = 3, m12 = 0 + 1 = 1, m22 = 1: M = [[3, 1], [1, 1]]. (b) At (0, 90°): c1 = 1 and c12 = cos 90° = 0, so g = [2 · 9.81 + 0, 0] = [19.62, 0]. At (0, 0): c1 = c12 = 1, so g = [2 · 9.81 + 9.81, 9.81] = [29.43, 9.81]. (c) s2 = 1: the first component is −1 · (2 · 1 · 0 + 0) = 0 and the second is 1 · 1² · 1 = 1, so c = [0, 1] N·m, the centripetal effect of joint 1’s rotation on m2 as felt at joint 2. All three match the program’s output.
-
A colleague validates a new dynamics implementation by simulating τ = 0 and checking energy conservation. Using the program’s numbers, explain why a failed check is not automatically a model bug, and why a passed check does not prove the model correct.
Answer: With the correct model, explicit Euler at δt = 0.01 s drifts by 11 J out of 14.1 J: the drift comes from the integrator, not the model. Try an accurate integrator with small steps first (RK4 at δt = 0.001 s drifts only 1.8e-9 J). Conversely, a model with gravity’s sign flipped consistently in both the dynamics and the energy conserves its own wrong energy to 2.2e-11 J. The test did catch the doubled Coriolis vector (1.21 J), because that bug breaks the structure energy conservation relies on. Complement it with an independent derivation (Part 2), known values such as the book’s mass matrices, and static checks like the gravity torque.
-
Which formulation or algorithm would you use to (a) derive by hand the equations of a two-joint arm for insight; (b) compute feedforward torques at every control cycle for a seven-joint arm; (c) simulate a robot’s motion from commanded torques?
Answer: (a) Lagrangian: form L = K − P and apply the Euler–Lagrange equations, which is elegant for about three or fewer degrees of freedom. (b) Recursive Newton–Euler: one forward and one backward pass over the links gives τ directly without differentiating energy expressions. (c) Forward dynamics: get c + g from one inverse-dynamics call with θ̈ = 0, M from n calls with unit θ̈ (or from Σ JᵀGJ), solve Mθ̈ = τ − c − g, and integrate with a sufficiently accurate scheme. The book’s notes also mention more efficient extensions based on articulated-body inertias (Featherstone); we only name them, since we did not read them.
Sources and open problems
Lynch and Park’s Modern Robotics is the main source. From the May 2017 preprint we read the Chapter 8 opening and all of §8.1 (pp. 271–282: Lagrangian formulation, the 2R example, Christoffel symbols, skew symmetry, mass ellipsoids and the end-effector mass matrix), §§8.3–8.5 (pp. 291–300: Newton–Euler inverse dynamics, the closed form, forward dynamics and integration), the friction subsection (p. 314), the gearing and constraint items of the chapter summary (p. 318) and the chapter notes (pp. 320–321) with four bibliography entries. We did not read §8.2 on single-body dynamics, the main text of §§8.6–8.8, the rest of §8.9 or the exercises. Modern Robotics preprint From Featherstone’s 2008 short course we read slides 1–3 and 51–55 of the slides Spatial vector algebra slides and the four pages of accompanying notes in full. Accompanying notes Featherstone’s 1983 paper and 2008 book, Khatib’s operational-space paper and Park, Bobrow and Ploen’s paper are mentioned only through the book’s bibliography; we did not read them.
Open problems lie where the idealized model meets real machines. How should friction, gear compliance and motor dynamics be modelled and identified so that inverse-dynamics feedforward actually helps a controller? How should contact, which adds constraints and impacts, be simulated both fast and faithfully? When does a learned correction on top of the physics model generalize, and when does it hide modelling errors? A useful dynamics report states the model’s assumptions (rigid links, friction model, gearing), how its parameters were obtained, which independent checks it passed, and which integrator and step were used for any simulation result.
Make a prediction, then check
A dynamics implementation is simulated with τ = 0 and passes an energy-conservation check with an accurate integrator. What does that establish?
Learning objectives
- Derive the mass matrix, Coriolis/centripetal terms and gravity terms of a planar two-link arm with the Lagrangian method, and explain the physical meaning of each term.
- Distinguish forward from inverse dynamics, describe the two-pass structure of the recursive Newton–Euler algorithm, and check an implementation with independent derivations and an energy test, knowing that test's limits.
Prerequisites & connections
Explore related knowledge →References
- Modern Robotics: Mechanics, Planning, and Control — May 2017 preprint, scoped
Kevin M. Lynch; Frank C. Park · 2017 - A Short Course on Spatial Vector Algebra: The Easy Way to do Rigid Body Dynamics (slides)
Roy Featherstone · 2008 - Notes to Accompany the Slides for Spatial Vector Algebra
Roy Featherstone · 2008
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Claude · 2026-12-03 · Independent AI check (Claude subagent, not the author; not a human or expert review). Research was done by a separate research subagent (facts.md) and the prose by a writer subagent; style-only edits suggested by the Gemini app were applied to the opening (intuition) sections before this check, and all six logged edits for this topic in gemini-edits-016a.json were compared old-versus-new. Ran example.py with the pinned interpreter (CPython 3.12, numpy 1.26.4): output identical to example.stdout.txt; code blocks byte-identical to example.py in both languages; display equations identical; re-ran with more digits to confirm the 'about fourteen times' and 'about ten thousand times' step-size ratios. Re-derived the 2R point-mass M, c and g, the Christoffel symbols and the code's C matrix by hand, the eigenvalues 2 -/+ sqrt(2), and exercise 2. Downloaded and re-read myself: Modern Robotics May 2017 preprint Chapter 8 opening and 8.1 (pp. 271-282: Lagrange vs Newton-Euler judgement, 2R equations, Fig. 8.2 Coriolis/skater discussion, Eqs. 8.16-8.19, Proposition 8.1, mass ellipsoids M(0,90)=[[3,1],[1,1]], M(0,150) approx [[1.27,0.13],[0.13,1]], Lambda=diag(1,2), zero-velocity caveat), 8.3-8.5 (Newton-Euler algorithm with gravity as base acceleration, Eq. 8.57, Eq. 8.77 with F_tip applied by the end effector, forward dynamics, Euler integration and RK4 remark), 8.9.4 friction, the gearing summary item, Eqs. 8.93-8.94, the chapter notes and refs 46, 47, 74, 133; Featherstone's 2008 slides 1-3 and 51-55 and the four-page notes in full (fetched via WebFetch). Featherstone's 1983 paper and 2008 book are mentioned only as the book's bibliography items. Not checked: 8.2, 8.6-8.8, the exercises, the primary papers, rendered HTML.
- Code output matches example.stdout.txt; the mass matrices match the book's [[3,1],[1,1]] and approx [[1.27,0.13],[0.13,1]]; Lambda = diag(1,2) matches the book's Fig. 8.4.
- The Christoffel formula, C_ij = sum_k Gamma_ijk qdot_k and the skew symmetry of Proposition 8.1 match the book; the code's C was verified by hand to be the Christoffel-based choice; the Fig. 8.2 Coriolis/skater explanation matches the book.
- Semi-implicit Euler is not called symplectic or energy-preserving; the article states it drifts by the same order as explicit Euler; there are no unsourced complexity claims.
- The four-line RNEA, v0 = a0 = 0, the lack of an inner product on either spatial-vector space, and the gravity-as-base-acceleration trick and its caveat come from Featherstone's 2008 slides and notes; the 1983 paper and 2008 book appear only as the book's bibliography items; zh/en correspond fully and the Gemini style edits changed no fact.
Source locations checked:
- Modern Robotics: Mechanics, Planning, and Control — May 2017 preprint, scoped · MR.pdf read via pdftotext; printed page numbers. pp. 271–272 (Eqs. 8.1–8.2, complexity remark, Lagrangian ≤3 DOF vs Newton–Euler recursive); pp. 272–277 (§8.1.1: Eq. 8.3, particle Eqs. 8.4–8.6, 2R point-mass K1, K2, P1, P2, Eq. 8.9–8.10 M, c, g, 'linear in θ̈, quadratic in θ̇, trigonometric in θ', per-mass f = ma Eqs. 8.11–8.12 and moments, centripetal vs Coriolis, Fig. 8.2 skater explanation); pp. 277–279 (§8.1.2: Eq. 8.14, Eqs. 8.16–8.19, Proposition 8.1 with proof); pp. 279–282 (§8.1.3 mass ellipsoid, Fig. 8.3 values M(0°,90°) = [3 1; 1 1], M(0°,150°) = [1.27 0.13; 0.13 1]; Eq. 8.21 Λ, Fig. 8.4 Λ = diag(1,2) at (0°,90°), zero-velocity caveat; §8.1.4 identical equations); pp. 291–294 (§8.3 derivation and algorithm Eqs. 8.44–8.54, V̇0 = (0, −g)); pp. 294–298 (§8.4 Eqs. 8.55–8.80, M = Σ JᵀGJ, τ = … + JᵀF_tip); pp. 298–300 (§8.5 h via θ̈ = 0, M via n calls, Euler algorithm, RK4 remark); p. 314 (§8.9.4 friction, Fig. 8.13); p. 318 (§8.10 summary: constrained dynamics with Aᵀλ, ideal gearhead G²I_rotor); pp. 320–321 (§8.12 notes) and bibliography [46] Featherstone 1983 IJRR, [47] Featherstone 2008 Springer, [74] Khatib 1987, [133] Park–Bobrow–Ploen 1995. NOT read: §8.2 (pp. 283–291), §§8.6–8.8 main text, §§8.9.1–8.9.3 and 8.9.5–8.9.x, §8.11 software, §8.13 exercises. Note: the repo already has a source row 'modern-robotics' pointing to the book's resource page; the integrator may merge.
- A Short Course on Spatial Vector Algebra: The Easy Way to do Rigid Body Dynamics (slides) · slides.pdf (55 pages, PDF created 2008-11-02, © 2008 Roy Featherstone), read via pdftotext: slides 1–3 (title; 6D notation; M6 motion vectors, F6 force vectors, scalar product m·f = work) and slides 51–55 (constrained-motion example with S and (SᵀIS)⁻¹, inverse-dynamics notation for a chain of links, recursions v_i = v_{i−1} + s_i q̇_i, a_i = a_{i−1} + ṡ_i q̇_i + s_i q̈_i, f_i − f_{i+1} = I_i a_i + v_i ×* I_i v_i, τ_i = s_iᵀ f_i, and the boxed RNEA with v0 = 0, a0 = 0, f_{n+1} = f_ee). Slides 4–50 (bases, motion/force cross products, inertia, etc.) not read in detail. The teaching index page http://royfeatherstone.org/teaching/index.html was opened only to locate this file.
- Notes to Accompany the Slides for Spatial Vector Algebra · notes.pdf (4 pages, PDF created 2008-11-04) read in full via pdftotext: preamble (course follows Rigid Body Dynamics Algorithms), note on slide 3 (scalar product; neither M6 nor F6 has an inner product), notes on slides 4–9, 45–49 (motion subspace as null space of the constraint Jacobian), and note on slide 55 (complete RNEA with ^iX_{i−1} = X_J(q_i) X_L_i, a0 = −a_g, f_{n+1} = f_ee, ṡ_i = v_i × s_i for constant axes; gravity-as-base-acceleration means a_i is not the true acceleration; stationary link coordinates).
Related topics