dylanholm.es

/posts/algorithm-recursive-newton-euler

overview

The recursive newton euler algorithm solves the inverse dynamics problem for a kinematic tree of nn bodies in O(n)O(n) time. This document is intended to act as a concise reference to the already informed reader. For an introduction to the topic or a deeper discussion, refer to [1].

history

The recursive newton euler algorithm was first described in [2]. Classical accerations were replaced with spatial accerations in [3], with the addition of spatial accelerations. The version presented in this document is the subsequent reformulation from [1], which introduces the use of generalized coorderinates and spatial vector algebra.

formulation

A rigid body system in any configuration is described as (model,state)(\textit{model},\textit{state}).

For a kinematic tree, the model\textit{model} is a set of parent body indices λ\lambda, joint types jtype\text{jtype}, parent transforms XTX_T, and inertias II.

The state\textit{state} is a set of generalized positions q\bm{q}, velocities q˙\bm{\dot{q}}, and accelerations q¨\bm{\ddot{q}}.

Inverse dynamics is the problem of finding the forces of a rigid body system given its state.

τ=ID(model,state)\bm{\tau} = \text{ID}(\textit{model},\textit{state})

The recursive newton euler algorithm solves the inverse dynamic problem by:

  1. Compute the velocity and acceleration of each body in the tree.
  2. Compute the forces required to produce these accelerations.
  3. Compute the forces transmitted across the joints from the forces acting on the bodies.

Recursive Newton Euler Algorithmv0=0a0=agfor i=1 to NB do[XJ,Si,vj,cj]=jcalc(jtype(i),qi,qi˙)i ⁣Xλ(i)=XJXT(i)if λ(i)0 theni ⁣X0=i ⁣Xλ(i)λ(i) ⁣X0endvi=i ⁣Xλ(i)vλ(i)+vJai=i ⁣Xλ(i)aλ(i)+Siqi¨+cJ+vi×vJfi=Iiai+vi×Iivii ⁣X0fixendfor i=NB to 1 doτi=SiTfiif λ(i)0 thenfλ(i)=fλ(i)+λ(i) ⁣Xifiendend\normalsize \textbf{Recursive Newton Euler Algorithm} \\ \normalsize \hspace{1.5em} \\ \begin{aligned} &v_0 = 0 \\ &a_0 = -a_g \\ &\text{for } i = 1 \text{ to } N_B \text{ do} \\ &\hspace{1.5em} [X_J,S_i,v_j,c_j] = \text{jcalc}(\text{jtype}(i),q_i,\dot{q_i}) \\ &\hspace{1.5em} {}^i\!X_{\lambda(i)} = X_J X_T(i) \\ &\hspace{1.5em} \text{if }\lambda(i) \ne 0 \text{ then} \\ &\hspace{1.5em}\hspace{1.5em} {}^i\!X_0 = {}^i\!X_{\lambda(i)} {}^{\lambda(i)}\!X_0 \\ &\hspace{1.5em} \text{end} \\ &\hspace{1.5em} v_i = {}^i\!X_{\lambda(i)} v_{\lambda(i)} + v_J \\ &\hspace{1.5em} a_i = {}^i\!X_{\lambda(i)} a_{\lambda(i)} + S_i\ddot{q_i} + c_J + v_i \times v_J \\ &\hspace{1.5em} f_i = I_ia_i + v_i \times^{*} I_iv_i - {}^i\!X_0^*f_i^x \\ &\text{end} \\ &\text{for } i = N_B \text{ to } 1 \text{ do} \\ &\hspace{1.5em} \tau_i = S_i^Tf_i \\ &\hspace{1.5em} \text{if }\lambda(i) \ne 0 \text{ then} \\ &\hspace{1.5em}\hspace{1.5em} f_{\lambda(i)} = f_{\lambda(i)} + {}^{\lambda(i)}\!X_i^*f_i \\ &\hspace{1.5em} \text{end} \\ &\text{end} \\ \end{aligned}

Joint Model Formulae (jcalc)Joint TypeJoint Transform(s ⁣Xp)Motion SubspaceConstraint Force SubspaceErSTrevoluterz(q1)[000][000100][100000100000000001000001000001]prismatic13×3[00q1][000001][100000100000100000100000100000]\begin{array}{l} \textbf{Joint Model Formulae (jcalc)} \\ \end{array} \\ \begin{array}{lllll} \\ \textbf{Joint Type} & \textbf{Joint Transform} ({}^s\!X_p) & & \textbf{Motion Subspace} & \textbf{Constraint Force Subspace} \\ \textbf{} & \bm{E} & \bm{r} & \bm{S} & \bm{T} \\ \\ \hline \\ \text{revolute} & rz(q_1) & \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} & \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} & \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \end{bmatrix} \\ \\ \text{prismatic} & \bm{1}_{3 \times 3} & \begin{bmatrix} 0 \\ 0 \\ q_1 \end{bmatrix} & \begin{bmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} & \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{array}

references

[1] R. Featherstone. Rigid Body Dynamics Algorithms. Springer, 2008.
[2] J. Luh, et al. Resolved-Acceleration Control of Mechanical Manipulators. IEEE Trans. On Auto. Control, Vol. AC-25, No. 3, pp. 468– 474, June 1980.
[3] M. Brady, et al. Robot Motion: Planning and Control. The MIT Press, 1982.