Algorithm Search⌘K

Problemcore

Inverse dynamics

Also called inverse dynamics problem.

Given the state q, q' of a robot and a wanted acceleration q'', find the joint torques tau = M q'' + C q' + g. Solved in O(n) by the recursive Newton-Euler algorithm.

Inverse dynamics is the problem of finding the joint torques that give a robot a wanted motion: given its joint positions qq, velocities q˙\dot q and accelerations q¨\ddot q, find τ\tau. For a robot with a fixed base and no contact, the answer is the left side of the manipulator equation, τ=M(q)q¨+C(q,q˙)q˙+g(q)\tau = M(q)\ddot q + C(q, \dot q)\dot q + g(q), and it needs no linear solve. Controllers evaluate it at every control step, and planners use it to check torque limits. The recursive Newton-Euler algorithm solves it in O(n)O(n); forward dynamics is the opposite problem.

In plain words

You want the arm to follow a path: at this instant each joint should be at a given angle, turn at a given rate and speed up at a given rate. Which torque must each motor give? Inverse dynamics answers this. The torque has three parts: a part to speed up the links, a part to keep moving links on their curved paths, and a part to hold the links up against gravity. Because the wanted motion is known, the answer is a direct calculation, with no equations to solve.

Definition

Input:

  • A robot model: nn joints, each revolute or prismatic, joined into a serial chain or a tree with a fixed base; the joint axes and link frames; and the mass, center of mass and rotational inertia of each link.
  • The gravity vector, (0,0,−9.81)(0, 0, -9.81) m/s2^2 in the space frame {s}\{s\}.
  • The joint positions qq, velocities q˙\dot q and accelerations q¨\ddot q, all in Rn\mathbb{R}^n, and optionally known external wrenches FextF_{\text{ext}} with their Jacobians J(q)J(q).

Output: the joint torques and forces τ∈Rn\tau \in \mathbb{R}^n with

τ=M(q)q¨+C(q,q˙)q˙+g(q)−J(q)TFext,\tau = M(q)\ddot q + C(q, \dot q)\dot q + g(q) - J(q)^T F_{\text{ext}},

so that the manipulator equation holds. The output is unique and always exists.

The trajectory version takes a twice-differentiable path qd(t)q_d(t) and returns τ(t)\tau(t) for each sampled time, which is the feedforward torque of the path.

Variants

  • Floating base. A robot whose base is not bolted down has six unactuated coordinates. The six base rows of the equation must be satisfied by contact forces, not by motors, so the problem gains unknown contact wrenches and constraints: friction cones and unilateral normal forces. It can have no solution (the motion needs a pull on the ground) or many (several feet share the load). Whole-body controllers solve it as a quadratic program; see floating-base dynamics.
  • Redundant actuation and closed chains. A parallel robot with more motors than degrees of freedom has many torque vectors that give the same motion. A common choice is the one with the smallest norm.
  • Task-space inverse dynamics. The wanted motion is given as an end-effector acceleration. With the operational space formulation, the wrench is Λ(q)V˙+η(q,V)\Lambda(q)\dot{\mathcal{V}} + \eta(q, \mathcal{V}) and the torque is JTJ^T times it, plus a null-space term for redundant arms.
  • Friction and motors. Joint friction and rotor inertia add known terms to τ\tau if they are modeled.
  • Regressor form. For identification and adaptive control, the output is written as Y(q,q˙,q¨)πY(q, \dot q, \ddot q)\pi; see linearity in the dynamic parameters.

Examples

Take the planar 2R arm with L1=L2=1L_1 = L_2 = 1 m and point masses of 1 kg at the link ends, in a vertical plane, with q1q_1 measured from the horizontal. With c2=cos⁡q2c_2 = \cos q_2, s2=sin⁡q2s_2 = \sin q_2, c1=cos⁡q1c_1 = \cos q_1 and c12=cos⁡(q1+q2)c_{12} = \cos(q_1 + q_2):

τ1=(3+2c2)q¨1+(1+c2)q¨2−s2(2q˙1q˙2+q˙22)+9.81(2c1+c12),\tau_1 = (3 + 2c_2)\ddot q_1 + (1 + c_2)\ddot q_2 - s_2(2\dot q_1\dot q_2 + \dot q_2^2) + 9.81(2c_1 + c_{12}),
τ2=(1+c2)q¨1+q¨2+s2q˙12+9.81 c12.\tau_2 = (1 + c_2)\ddot q_1 + \ddot q_2 + s_2\dot q_1^2 + 9.81\,c_{12}.
qq (rad) q˙\dot q (rad/s) q¨\ddot q (rad/s2^2) gravity τ\tau (N m)
(0,π/2)(0, \pi/2) (1,1)(1, 1) (0,0)(0, 0) no (−3,1)(-3, 1)
(0,π/2)(0, \pi/2) (1,1)(1, 1) (0,0)(0, 0) yes (16.62,1)(16.62, 1)
(0,0)(0, 0) (0,0)(0, 0) (0,0)(0, 0) yes (29.43,9.81)(29.43, 9.81)
(0.3,0.7)(0.3, 0.7) (0.5,−1.2)(0.5, -1.2) (2,−1)(2, -1) yes (31.184,7.991)(31.184, 7.991)
(0,π/2)(0, \pi/2) (1,1)(1, 1) (2,−3)(2, -3) no (0,0)(0, 0)

The third row can be checked by hand with the Newton-Euler equations applied as statics: each mass weighs 9.819.81 N, the masses are at horizontal distances 1 m and 2 m from joint 1 and at 1 m from joint 2, so τ1=9.81(1+2)=29.43\tau_1 = 9.81(1 + 2) = 29.43 N m and τ2=9.81\tau_2 = 9.81 N m. The last row is the state and acceleration of the forward dynamics example: with τ=0\tau = 0 the arm accelerates at (2,−3)(2, -3) rad/s2^2, and inverse dynamics returns τ=0\tau = 0.

The first row shows that a constant joint rate is not free. Joint 1 needs −3-3 N m and joint 2 needs 11 N m to keep both rates at 1 rad/s, because the outer mass moves on a curved path.

Known algorithms

All counts are in the real-RAM model for a serial chain or a tree of nn joints with one degree of freedom each.

  1. Closed form. Derive MM, CC and gg with Euler-Lagrange manipulator dynamics or Kane's method and evaluate them. MM alone has n2n^2 entries and the Coriolis term has n3n^3 Christoffel symbols, so this is not linear in nn. Hollerbach (1980) compared the operation counts of the Lagrangian and Newton-Euler formulations. The closed form is best for small arms and for analysis.
  2. Recursive Newton-Euler algorithm (Luh, Walker and Paul 1980; Featherstone 2008, Chapter 5; Lynch and Park, Section 8.3). A pass from the base outward computes the twist and acceleration of each link, with gravity entered as an upward acceleration of the base. The Newton-Euler equations give the net wrench of each link. A pass inward sums the wrenches and projects them on the joint axes. Each pass costs O(1)O(1) per link, so the total is O(n)O(n).
  3. Recursive Lagrangian. Hollerbach (1980) arranged the Lagrangian computation recursively and also reached a cost linear in nn.

Bounds

  • Upper bound: O(n)O(n) arithmetic operations for a serial chain or a tree, by the recursive Newton-Euler algorithm. No factorization is needed.
  • Lower bound: Ω(n)\Omega(n), because the output has nn numbers. So inverse dynamics of a serial chain or a tree is Θ(n)\Theta(n) in the real-RAM model.
  • Exact operation counts depend on the joint types and on the frame conventions. Featherstone (2008, Chapter 10) gives published counts; use those and not a count of your own.

Reductions

  • Forward dynamics to inverse dynamics. Inverse dynamics with q¨=0\ddot q = 0 gives the bias Cq˙+gC\dot q + g, and calls with q˙=0\dot q = 0, no gravity and q¨=ej\ddot q = e_j give column jj of MM. So n+1n + 1 calls and an O(n3)O(n^3) solve give forward dynamics (Walker and Orin 1982). The composite-rigid-body algorithm is a faster way to get the same columns.
  • Inverse dynamics to forward dynamics. The map τ↦q¨\tau \mapsto \ddot q is affine, so n+1n + 1 forward dynamics calls give M−1M^{-1} and the bias, and τ=M(q¨−b)\tau = M(\ddot q - b) follows. This reduction is never used in practice, because the direct O(n)O(n) algorithm exists.
  • Control to inverse dynamics. Computed-torque control evaluates inverse dynamics with the acceleration q¨d+Kde˙+Kpe\ddot q_d + K_d\dot e + K_pe at each step.

Applications

  • Feedforward and computed-torque control of robot arms.
  • Checking that a planned trajectory respects the torque limits, and time-optimal path parameterization, where τ\tau along a fixed path is affine in the path acceleration.
  • Sizing motors and gears from the torques of the worst-case motions.
  • Dynamic parameter identification, which fits the regressor form of inverse dynamics to measured torques.
  • Biomechanics, which computes the joint torques of a human from motion capture data and measured ground forces.

References

  1. Kevin M. Lynch and Frank C. Park, Modern Robotics, Mechanics, Planning, and Control, Cambridge University Press, 2017, Chapter 8, Section 8.3 (Newton-Euler inverse dynamics: derivation and algorithm) and Section 8.4 (dynamic equations in closed form)
  2. Roy Featherstone, Rigid Body Dynamics Algorithms, Springer, 2008, Chapter 5 (inverse dynamics, the recursive Newton-Euler algorithm) and Chapter 10 (accuracy and efficiency)
  3. J. Y. S. Luh, M. W. Walker and R. P. C. Paul, On-line computational scheme for mechanical manipulators, Journal of Dynamic Systems, Measurement, and Control 102(2), 69-76, 1980, the whole paper (the recursive Newton-Euler computation of the joint torques)
  4. John M. Hollerbach, A recursive Lagrangian formulation of manipulator dynamics and a comparative study of dynamics formulation complexity, IEEE Transactions on Systems, Man, and Cybernetics 10(11), 730-736, 1980, the whole paper (the operation counts of the Lagrangian and Newton-Euler formulations)
  5. Mark W. Spong, Seth Hutchinson and M. Vidyasagar, Robot Modeling and Control, second edition, Wiley, 2020, Chapter 6, Section 6.6 (Newton-Euler formulation)
  6. Bruno Siciliano, Lorenzo Sciavicco, Luigi Villani and Giuseppe Oriolo, Robotics, Modelling, Planning and Control, Springer, 2009, Chapter 7 (direct dynamics and inverse dynamics)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a known algorithm
  • a contract.yaml