The equations of a moving chain
The question. If you know the torque at every joint of an arm, how do all the joints move?
Swing your upper arm forward with your elbow loose and the forearm lags behind, although nothing pushed it. Bones in a chain cannot be treated one at a time: a torque at one joint accelerates every joint. The simulator’s central calculation is to untangle this, thousands of times a second. This chapter derives the equations for the smallest chain that shows the effect and then describes how the simulator does the same for any chain.
By the end you will be able to write the equations of motion of a two-link arm, compute its accelerations by hand, and say what each term means.
The chain
Keep two of the arm’s five joint coordinates, so that it moves in a vertical plane:
- , the angle of the upper arm from hanging straight down;
- , the bend of the elbow.
The forearm’s angle in the room is then . Two rigid bodies make up the chain.
| Mass | Centre of mass from its joint | Inertia about its centre of mass | Length | |
|---|---|---|---|---|
| Upper arm | kg | m | kg·m² | m |
| Forearm and hand | kg | m | kg·m² |
These are for a person 1.75 m tall with a mass of 70 kg; Scaling a skeleton to a person shows where they come from. The torque applied at the shoulder is and at the elbow . A dot over a symbol means its rate of change, so is an angular velocity and an angular acceleration.
Step 1: what the joints must supply for a given acceleration
Begin with the arm at rest and no gravity, and pretend each body’s mass sits at its centre of mass. Ask the question backwards: to produce the accelerations and , what torques are needed?
Accelerations. The upper arm’s mass moves on a circle of radius , so it accelerates at , across the upper arm. The forearm’s mass does two things at once. The elbow that carries it accelerates at , across the upper arm. And it swings about the elbow at , across the forearm.
Forces. By Newton’s second law each mass needs a force equal to its mass times its acceleration: on the first, and on the second across the upper arm plus across the forearm.
Torque at the elbow. Only the forearm lies beyond the elbow. The torque is the lever arm times the part of the force that acts across the forearm. The second part of the force already does. The first is across the upper arm, which is tilted from the forearm by , so only of it counts:
Torque at the shoulder. Both masses lie beyond the shoulder. The first contributes . The second is reached by going along the upper arm and then along the forearm, so each part of its force has two lever arms: the part across the upper arm has , and the part across the forearm has :
Bodies that are not points. Each body also resists turning about its own centre of mass, as in Bones as rigid bodies. The upper arm turns at and needs more at the shoulder. The forearm turns at and needs , which must pass through both joints.
The mass matrix
Collect the multipliers of and :
This table is the mass matrix: entry is the torque needed at joint for each unit of acceleration at joint . It plays the part that mass plays in and rotational inertia plays in , but for the whole chain at once, and it changes with the pose through .
is the coupling. It answers the opening puzzle. With no torque at the elbow, gives : accelerate the shoulder and the elbow accelerates the other way.
Step 2: terms from velocity
A mass moving round a circle of radius at angular velocity is always being pulled off a straight path. Differentiate its position twice and you get times the position: an acceleration of toward the centre, called centripetal acceleration. It needs a force even at steady speed.
When the arm is moving, the forearm’s mass has two of these: toward the shoulder along the upper arm, and toward the elbow along the forearm. A force along the forearm has no lever arm about the elbow, but the one along the upper arm does, . Working out the torque about each joint as before gives extra torques
Terms with a squared rate are called centrifugal and the term with the product Coriolis. They are not new forces. They are the price of the geometry changing while the masses are moving, and they vanish when the arm is straight () or at rest.
Step 3: gravity
To hold the arm still against gravity each joint must support the weight beyond it, weight times horizontal lever arm:
with m/s².
The standard form
Adding the three steps:
In words: joint torques go into accelerating the chain, into turning the moving masses, and into holding the chain up. The sum is what the joints must supply when nothing accelerates; the simulator calls it the bias. Every chain of rigid bodies, however long, obeys an equation of this form.
Used left to right, from motion to torque, it is inverse dynamics. A simulator needs the other direction, forward dynamics: solve the linear equations for , then step and forward in time.
A worked example
Let the upper arm hang () with the elbow bent 60°, at rest, and let go: and . With :
| Quantity | Calculation | Result |
|---|---|---|
| 0.3405 kg·m² | ||
| 0.1133 kg·m² | ||
| 0.0730 kg·m² | ||
| 2.420 N·m |
The equations are and . Subtracting the second from the first gives , so . Putting that into the second: , so
The forearm drops, and the upper arm, which was hanging where gravity has no grip on it, is kicked forward. Carrying more digits, the lab shows 8.125 and −45.77.
Checking by energy
Nothing in this model removes energy, so kinetic plus potential energy must stay constant when no torque acts, and must rise by exactly the work done when one does. The kinetic energy of the chain is , and the potential energy is each weight times the height of its centre of mass. A simulation that drifts from this balance has an error in its equations or its time step.
How the simulator does it for any chain
For five joints, or fifty, nobody writes out formulas like those above. The simulator repeats the same reasoning link by link, in two sweeps (Featherstone 2008, chapter 5).
- Outward, from the trunk to the hand. Each link’s velocity and acceleration are its parent’s, carried across the joint, plus what its own joint adds. This is the “accelerations” paragraph of step 1, including the velocity terms of step 2.
- Inward, from the hand to the trunk. Each link works out the force and torque it needs for that acceleration, adds what the links beyond it have passed back, and passes the total to its parent. The part of the total that acts about a joint’s axis is that joint’s torque.
Gravity needs no special case: the trunk is given an upward acceleration of , and every link then asks for the force that holds it up.
Run with the accelerations you want, the two sweeps are inverse dynamics. Run with zero accelerations, they return the bias. The mass matrix comes from a third sweep that treats everything beyond each joint as one combined rigid body (Featherstone 2008, chapter 6). The simulator then solves . In three dimensions each link’s velocity is a pair, an angular velocity and a linear one, but the sweeps are the same. The code is crates/biomech/src/multibody.rs.
Try it
- Check the worked example. Before pressing anything, read the mass matrix, 0.340, 0.113 and 0.073 kg·m², and the accelerations, 8.125 and −45.77 rad/s².
- Let go. Press Play. The forearm falls and the upper arm swings forward. The lab pauses when the elbow is straight, because a real elbow would stop there and this hinge will not; press Play again to go on. In the energy plot, kinetic and potential energy trade places and their sum stays on the dashed line.
- Isolate the coupling. Choose No gravity and set the shoulder torque to 2 N·m. Nothing acts at the elbow, yet the elbow acceleration reads −18.9 rad/s². Press Play and watch the forearm lag.
- Predict, then check. Still without gravity, start with the elbow at 90°. Now , so . What does that make ? Exactly : the forearm at first keeps its direction in the room while the upper arm turns under it.
- Follow the energy with a torque. In the last run the line “kinetic + potential − work put in” stays flat while the kinetic energy climbs.
What this model leaves out
- Something to make the torque. The shoulder torque here is a number on a slider. Part 4 replaces it with muscle.
- Joint stops and friction. The hinges turn freely and without limit. Real joints are stopped by bone, ligament and muscle, which Part 5 adds.
- The rest of the body. The shoulder is fixed in space.
Summary
- In a chain, a torque at one joint accelerates all the joints. The mass matrix records how.
- Its off-diagonal entry is the coupling; for the arm it is .
- Moving masses add centrifugal and Coriolis torques, and gravity adds a holding torque. Together: .
- The simulator computes these for any chain with an outward sweep for motion and an inward sweep for force, then solves for the accelerations.
Next: the numbers in this chapter’s table came from somewhere: Scaling a skeleton to a person.