explainer
Robot dynamics: separate the torques that move an arm
Explore robot dynamics through a two-link arm's torque budget. Separate inertia, velocity coupling, gravity, and friction, then check holding torque, link mass, and mechanical power.
What you will learn
- Identify the four torque contributions in a manipulator equation.
- Explain why one joint's acceleration can require torque at another joint.
- Calculate gravity compensation with an explicit sign convention.
- Connect a positive definite mass matrix to kinetic energy.
- Check mechanical power against energy change and damping loss.
Before you start
A horizontal robot arm can need substantial torque while it sits still. With two one-meter rods weighing one kilogram each, our model needs 19.62 N m at the shoulder and 4.905 N m at the elbow just to hold its pose.
Robot dynamics explains those torques and how they change during motion. This lesson separates inertia, velocity coupling, gravity, and friction, then checks the result through mechanical power.
A stationary arm can need torque
Imagine holding a long board horizontally with one hand. Gravity pulls down at its center of mass, creating a turning moment about your hand. Supporting that moment requires torque even when the board's velocity and acceleration are zero.
A robot joint faces the same calculation. Moving the arm introduces additional requirements: accelerating mass, maintaining curved motion, and overcoming joint friction.
Forward kinematics tells us where the arm sits for given joint angles. Dynamics adds mass and forces to explain which torques can support or change that motion.
Define the arm and its coordinates
The example uses two rigid, uniform slender rods in a vertical plane. A fixed shoulder supports link 1, and an elbow connects link 2.
- Both links have length 1 m and a center of mass 0.5 m from their proximal joint.
- Link 1 has mass 1 kg. Link 2 starts at 1 kg, with a control from 0.5 to 2 kg.
- Each rod's moment of inertia about its center is I = mL²/12. Changing link 2's mass changes its inertia too.
- Gravity points downward, along world −y. Its magnitude is 9.81 m/s² unless you turn it off.
Let q₁ measure the shoulder angle counterclockwise from world +x. Let q₂ measure the elbow angle relative to link 1. Link 2's absolute orientation is q₁ + q₂, so its absolute angular velocity is q̇₁ + q̇₂.
The equations use radians. The angle sliders show degrees and convert them before calculation. Positive actuator torques correspond to increasing their joint coordinates; the elbow actuator acts between the two links.
The model has no payload, tip force, gearing, motor inertia, joint springs, or contact constraints. The mass control changes the entire second rod, preserving its uniform distribution. DFKI's double-pendulum documentation shows a broader parameter set; its coordinate and inertia conventions differ from this example.
Read the robot dynamics equation
For this fully actuated arm with zero external force:
τ = M(q) q̈ + c(q, q̇) + g(q) + f(q̇)
Each vector has one entry per joint. The Lagrangian formulation in Modern Robotics derives this structure from kinetic and potential energy.
| Term | What it contributes | Units here |
|---|---|---|
| M q̈ | Torque associated with joint acceleration | N m |
| c | Torque from products of joint velocities | N m |
| g | Torque that balances gravity at this pose | N m |
| f | Torque that offsets joint friction | N m |
The mass matrix M uses kg m² for these rotational coordinates. Joint velocity uses rad/s and acceleration uses rad/s², with radians treated as dimensionless in the SI torque calculation.
This equation answers an inverse-dynamics question: which torques produce a specified acceleration at the current position and velocity? Forward dynamics uses the same equation to find acceleration from supplied torques.
Account for inertia and joint coupling
With the fixed lengths and first-link mass above, let m denote the numerical value of link 2's mass in kilograms. The mass-matrix entries below then have units kg m²:
M₁₁ = 1/3 + 4m/3 + m cos q₂
M₁₂ = M₂₁ = m/3 + (m/2) cos q₂
M₂₂ = m/3
At full extension with m = 1, the rows are (8/3, 5/6) and (5/6, 1/3). If only the elbow accelerates at 1 rad/s², the inertial torque vector is the second column: (5/6, 1/3) N m. The shoulder needs torque even though its own acceleration is zero.
That coupling comes from the connected links. Elbow motion changes forces that pass through the shoulder. Off-diagonal entries need not stay positive: folding the elbow to 180° makes M₁₂ = −1/6 for this mass.
The matrix remains symmetric positive definite. For every nonzero joint-velocity vector v, vᵀMv is positive, giving positive kinetic energy. Positive definite describes the quadratic form, not the sign of every entry.
For this model, the numerical determinant is m/9 + m²(1/3 − cos²q₂/4). Its lower bound is m/9 + m²/12, which is positive for every allowed mass. Full extension may make a tip Jacobian singular, while M remains invertible.
Include the velocity-product terms
Even constant joint velocities can accelerate a link's center of mass along a curved path. Define h = (m/2) sin q₂ using the same substituted SI geometry:
c₁ = −h (2q̇₁q̇₂ + q̇₂²)
c₂ = h q̇₁²
The mixed product contributes a Coriolis term; squared speeds contribute centripetal terms. Setting q̈ = 0 removes M q̈, but it can leave c nonzero. Setting both joint velocities to zero removes c.
You may also see c = C(q, q̇) q̇. Different C matrices can produce the same velocity-product vector. MIT's manipulator-equation notes explain that nonuniqueness; this lab displays c directly.
For q₂ = −60° and q̇ = (1, −0.5) rad/s, h = −√3/4. The resulting c is approximately (−0.324760, −0.433013) N m. These signed terms subtract from the total actuator torque at that instant.
Check the sign of gravity compensation
Let γ be the positive gravitational acceleration magnitude. The compensation vector is the gradient of gravitational potential energy:
g₁ = (0.5 + m)γ cos q₁ + 0.5mγ cos(q₁ + q₂)
g₂ = 0.5mγ cos(q₁ + q₂)
Gravity itself applies generalized torque −g. Our equation places +g on the compensation side, so a stationary hold needs τ = g. Check which side of an equation a source uses before comparing signs.
With both rods horizontal to the right, their centers sit 0.5 m and 1.5 m from the shoulder. Their gravitational moments add to 9.81 × (0.5 + 1.5) = 19.62 N m. Only link 2's 0.5 m moment arm contributes to the elbow hold: 4.905 N m.
Rotate the straight arm to face left and both hold torques change sign. Point it vertically upward or downward and the ideal gravitational joint moments vanish. Zero torque at the upright pose does not establish stable balance under a disturbance.
Account for joint damping
The lab uses the same nonnegative viscous coefficient B at both joints:
f = (Bq̇₁, Bq̇₂)
P_loss = B(q̇₁² + q̇₂²)
B has units N m s/rad. The physical damping torque opposes each joint's velocity, so the actuator adds +Bq̇ to compensate. The compensation torque can be negative, while its dissipated power stays nonnegative.
For B = 0.25 and q̇ = (1, −0.5), f = (0.25, −0.125) N m. Damping removes 0.3125 W of mechanical energy. This simple model omits static friction, Coulomb friction, and changing lubrication effects.
The friction models lesson compares viscous, Coulomb, and Stribeck behavior. It also treats static friction as a range of holding torques at zero velocity, where the simple Bq̇ term always vanishes.
Inspect one instant of arm motion
The initial Horizontal hold reproduces the two gravity torques. The experiment inspects a prescribed instant; it does not integrate a trajectory. Choosing velocities and accelerations changes the torque calculation without animating the arm.
- Bent and moving sets q = (30°, −60°), q̇ = (1, −0.5), and q̈ = (0.5, −1), with damping 0.25. The shoulder total is 17.416659 N m and the elbow total is 3.648175 N m.
- Elbow acceleration turns gravity off and sets q̈ = (0, 1) with zero angles and velocities. Only inertial torque remains: (0.833333, 0.333333) N m.
- Zero gravity hold sets all motion values to zero with gravity off. Every torque term becomes zero, while the mass matrix still describes the arm's inertia.
The torque table shows signed contributions. For Bent and moving, the shoulder adds 0.500000 − 0.324760 + 16.991418 + 0.250000. Small differences when adding the displayed values come from rounding.
Presets replace all controls with their stated values. Reset returns to Horizontal hold. The drawing shows centers of mass and permits link overlap; the model omits self-collision, obstacles, actuator limits, and structural flexibility.
Connect torques to energy and power
The kinetic and gravitational potential energies are:
T = ½ q̇ᵀ M(q) q̇
V = (0.5 + m)γ sin q₁ + 0.5mγ sin(q₁ + q₂)
Both use joules. V uses zero height at the shoulder, so it can be negative. Adding a constant to V changes no torque because its gradient stays the same.
For fixed model parameters and no external force, the energy balance is:
d(T + V)/dt = τᵀq̇ − B(q̇₁² + q̇₂²)
The dot product τᵀq̇ gives signed mechanical actuator power in watts. A negative value means the actuators absorb mechanical power at that instant. Electrical consumption also depends on motors and drives, which this model omits.
Because M changes with the elbow angle, differentiating T includes ½ q̇ᵀṀq̇ as well as q̇ᵀM q̈. The velocity-product vector satisfies q̇ᵀc = ½ q̇ᵀṀq̇. Omitting that term would spoil the power check.
Bent and moving has T = 0.833333 J and V = 4.905000 J. Its actuator power is 15.592571 W, mechanical energy rate is 15.280071 W, and damping loss is 0.312500 W. The displayed residual subtracts the last two from actuator power and should read zero up to rounding.
A stationary horizontal hold has nonzero torque but zero mechanical power, since q̇ = 0. Its motors may still draw current and generate heat. A mass-slider change creates a different model; the power identity describes time evolution with that model's mass held constant.
Reproduce the torque budget in Python
This Python 3 example uses only the standard library. It evaluates the same uniform-rod model, including the configuration derivative needed for the power check.
from math import sin, cos, radians
def budget(angles, velocity, acceleration, mass=1, gravity=9.81, damping=0):
q1, q2 = map(radians, angles)
v1, v2 = velocity
a1, a2 = acceleration
M11 = 1/3 + 4*mass/3 + mass*cos(q2)
M12 = mass/3 + mass*cos(q2)/2
M22 = mass/3
h = mass*sin(q2)/2
inertia = (M11*a1 + M12*a2, M12*a1 + M22*a2)
coupling = (-h*(2*v1*v2 + v2*v2), h*v1*v1)
g2 = mass*gravity*cos(q1+q2)/2
weight = ((0.5+mass)*gravity*cos(q1) + g2, g2)
friction = (damping*v1, damping*v2)
torque = tuple(sum(terms) for terms in zip(inertia, coupling, weight, friction))
kinetic = (M11*v1*v1 + 2*M12*v1*v2 + M22*v2*v2)/2
potential = (0.5+mass)*gravity*sin(q1) + mass*gravity*sin(q1+q2)/2
Mdot11 = -mass*sin(q2)*v2
energy_rate = (v1*inertia[0] + v2*inertia[1]
+ Mdot11*(v1*v1 + v1*v2)/2
+ v1*weight[0] + v2*weight[1])
power = torque[0]*v1 + torque[1]*v2
loss = damping*(v1*v1 + v2*v2)
return torque, kinetic, potential, power, energy_rate, loss
for name, args, damping in [
("Hold", ((0, 0), (0, 0), (0, 0)), 0),
("Bent", ((30, -60), (1, -0.5), (0.5, -1)), 0.25),
]:
torque, T, V, power, rate, loss = budget(*args, damping=damping)
print(f"{name} torque: ({torque[0]:.6f}, {torque[1]:.6f}) N m")
print(f"{name} energy: T={T:.6f} J; V={V:.6f} J")
print(f"{name} power: actuator={power:.6f} W; rate={rate:.6f} W; loss={loss:.6f} W")
Expected output:
Hold torque: (19.620000, 4.905000) N m
Hold energy: T=0.000000 J; V=0.000000 J
Hold power: actuator=0.000000 W; rate=0.000000 W; loss=0.000000 W
Bent torque: (17.416659, 3.648175) N m
Bent energy: T=0.833333 J; V=4.905000 J
Bent power: actuator=15.592571 W; rate=15.280071 W; loss=0.312500 W
Try it yourself
Exercise 1. Make the second rod heavier. Start at Horizontal hold and change link 2's mass to 2 kg. Calculate both holding torques. Which moment arms explain the increase?
Check the heavier-link calculation
The shoulder supports 1 kg at 0.5 m and 2 kg at 1.5 m. Its torque is 9.81 × (0.5 + 3) = 34.335 N m. The elbow supports the 2 kg rod at 0.5 m, requiring 9.81 N m.
The increases are 14.715 N m and 4.905 N m. Link 2's center stays in the same location, and its rotational inertia doubles. A tip payload would use a different center location and inertia model.
Exercise 2. Accelerate only the elbow. Turn gravity off, keep both links horizontal with mass 1 kg each, and set both velocities to zero. Request q̈ = (0, 1) rad/s². Find both torques and the instantaneous mechanical power.
Check the coupled acceleration
Multiply M by (0, 1) to select its second column. The required torques are (5/6, 1/3) N m, approximately (0.833333, 0.333333). The Elbow acceleration preset reproduces this case.
Both joint velocities are zero at that instant, so τᵀq̇ = 0 W. Acceleration can be nonzero while instantaneous power is zero; as velocity changes, the subsequent power can change. A zero shoulder torque would generally fail to produce the requested zero shoulder acceleration.
Sources and further study
- Kevin M. Lynch and Frank C. Park, Modern Robotics, Section 8.1, for the Lagrangian formulation and the mass, velocity-product, and gravity terms. Its introductory example concentrates link mass at points; this lesson uses uniform rods.
- Russ Tedrake, MIT Underactuated Robotics: Multi-Body Dynamics, for manipulator equations, kinetic energy, mass-matrix properties, and the nonunique C representation. Its gravity-force vector sits on the right side of the equation; ours uses compensation +g on the left.
- DFKI Robotics Innovation Center: The Double Pendulum System, for the role of link mass, center of mass, inertia, and actuator friction parameters in a physical model.
Continue with inverse dynamics to calculate torques for a prescribed motion and a tip force. Then use forward dynamics to see how the arm accelerates when you supply the torques.