Topic hub

Dynamics

How forces and torques produce robot motion. The manipulator equation, Newton-Euler and Lagrange formulations, identifying inertial parameters on a real arm, and the friction and contact models simulators use.

Updated 14 Nov 2026 · rigid-body dynamics, Newton-Euler, Lagrange, inverse dynamics, forward dynamics, inertia identification, friction, contact model

Overview

Kinematics says where the robot is. Dynamics says what it takes to get it there: which joint torques produce which accelerations, given the masses, inertias, gravity, friction and anything the robot is touching. You need dynamics to size motors and gearboxes, to compute feedforward torques so a controller does not have to fight gravity with its integrator, to run torque-controlled arms and legged robots, and to simulate any of them.

This hub is for engineers moving from position-controlled robots, where the vendor hides the dynamics inside the drive, to torque control, simulation or model-based control, where you own the model and its errors.

Key ideas

The manipulator equation

For a rigid serial robot, every dynamics method arrives at the same equation. The mass matrix M(q) times the joint accelerations, plus a Coriolis and centrifugal term C(q, q̇) times the joint velocities, plus a gravity term g(q), equals the joint torques plus the torques that external forces produce through the Jacobian transpose. Friction adds a further term.

The equation is used in two directions. Inverse dynamics takes positions, velocities and desired accelerations and returns the torques needed. Controllers use it for feedforward and computed-torque control. Forward dynamics takes torques and returns accelerations. Simulators integrate it to step the world forward.

Newton-Euler and Lagrange

The Lagrangian route writes the kinetic and potential energy of the whole robot and differentiates. It gives the structure of M, C and g explicitly, which helps when proving controller properties or deriving the equations of a small mechanism by hand or in SymPy. It scales badly to long chains if done symbolically.

The recursive Newton-Euler algorithm, published by Luh, Walker and Paul in 1980, applies Newton’s and Euler’s laws link by link. A forward pass carries velocities and accelerations from the base out to the tool. A backward pass carries forces and torques back to the base, and each joint torque falls out on the way. The cost grows linearly with the number of joints, which makes it cheap enough for a fast control loop. Featherstone’s spatial-vector formulation extends the same recursive idea to forward dynamics and to branched robots such as humanoids. Libraries such as Pinocchio and RBDL implement it.

forward pass: velocity and acceleration, base to tipbasegravity inlink 1mass, inertialink 2mass, inertia…link nmass, inertiatoolcontact forceτ1τ2τnbackward pass: force and torque, tip to base, joint torques read offinputs: q, q̇ and q̈ for every joint, gravity, external wrench at the tool
The recursive Newton-Euler algorithm on a serial chain. A forward pass carries velocities and accelerations from the base to the tool, a backward pass carries forces and torques from the tool back to the base, and each joint torque is read off on the way. The cost grows linearly with the number of joints.

Identifying the inertial parameters

CAD models give a starting point, but they miss cables, grease, motor rotor inertia reflected through the gearbox, and whatever is bolted to the flange. The useful fact, shown by Atkeson, An and Hollerbach in 1986, is that the dynamics are linear in the inertial parameters: ten per link (mass, the three first moments and the six independent entries of the inertia tensor). Torque can be written as a regressor matrix, which depends only on the measured motion, times a parameter vector. Record joint positions and torques along a trajectory, stack the regressors, and solve a least-squares problem.

Two details decide whether this works. The trajectory must excite every parameter, so it is designed rather than improvised. Swevers and colleagues showed how to optimise it. Some parameter combinations cannot be separated from joint torques at all, so you identify a reduced set of base parameters and constrain the result to be physically consistent (positive mass, positive-definite inertia).

Friction and contact

Joint friction is usually modelled as Coulomb friction (a constant opposing motion) plus viscous friction (proportional to speed), sometimes with a Stribeck dip at low speed. In geared joints, friction can be a large share of the torque at low speed, and it varies with temperature and load. Identify it alongside the inertial parameters.

Contact with the world is harder. Rigid contact with Coulomb friction is non-smooth, and different simulators resolve it differently. MuJoCo, for example, uses soft contacts: its computation documentation describes contact forces as the solution of a convex optimisation problem, with pyramidal or elliptic friction cones. Choices like these, and the timestep and contact stiffness that go with them, change how a simulated grasp slips or a simulated foot lands. They are a main source of the sim-to-real gap discussed in /topics/simulation-and-digital-twins/.

Where to start

/learn/beginner/09-simulate-an-arm-in-mujoco/ puts a dynamic model in your hands. /learn/beginner/05-pid-control/ shows what happens when a controller has to fight gravity without a model. The project /projects/pybullet-pick-and-place/ adds contact and friction.

Tools and platforms

Tool What it is for Licence Platform
MuJoCo Forward dynamics with contact, inverse dynamics, fast stepping Apache-2.0 /platforms/mujoco/
Pinocchio Recursive algorithms (RNEA, ABA) with analytical derivatives BSD-2-Clause /platforms/opensource/
Drake Multibody dynamics, contact and optimisation for model-based design BSD-3-Clause /platforms/opensource/
RBDL Compact C++ library of Featherstone’s algorithms zlib /platforms/opensource/
PyBullet Simulation with contact from Python zlib /platforms/opensource/

Common mistakes

  • Inertia tensors about the wrong point or in the wrong frame. URDF gives the tensor in the frame set by the <inertial> origin. MJCF computes mass and inertia from the geoms when a body has no inertial element, using a default density, so a missing element still gives a model that runs.
  • Leaving out motor rotor inertia. Through a 100:1 gearbox it is multiplied by 10,000 and can exceed the link’s own inertia.
  • Identifying from a trajectory that does not excite the parameters. The fit looks good on that trajectory and fails on the next.
  • Treating simulated contact as ground truth. Change the timestep or solver settings and check whether the result survives.
  • Ignoring friction in gravity compensation. The arm then drifts at low speed or sticks.

Going deeper