Stéphane on Locomotion - Comments: Recursive Newton-Euler algorithmhttps://scaron.info/robot-locomotion/recursive-newton-euler-algorithm.html/2022-08-08T12:32:00+02:00Posted by: Stéphane2022-08-08T12:32:00+02:002022-08-08T12:32:00+02:00Stéphanetag:scaron.info,2022-08-08:/robot-locomotion/recursive-newton-euler-algorithm.html//comment-reply-external-force-and-acceleration<p>Thank you for pointing this out! The acceleration was indeed incorrect, I've corrected it and added a reference to page 94 of <a href="https://doi.org/10.1007/978-1-4899-7560-7">Rigid body dynamics algorithms</a> for reference.</p>
<p>External forces <span class="math">\(\bff_i^\mathit{ext}\)</span> are indeed body vectors, as are the <span class="math">\(\bff_i\)</span>'s used in intermediate computations. This is now pointed …</p><p>Thank you for pointing this out! The acceleration was indeed incorrect, I've corrected it and added a reference to page 94 of <a href="https://doi.org/10.1007/978-1-4899-7560-7">Rigid body dynamics algorithms</a> for reference.</p>
<p>External forces <span class="math">\(\bff_i^\mathit{ext}\)</span> are indeed body vectors, as are the <span class="math">\(\bff_i\)</span>'s used in intermediate computations. This is now pointed out, both under the corresponding equation and when typing the Python prototype.</p>
<script type="text/javascript">if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
var align = "center",
indent = "0em",
linebreak = "false";
if (false) {
align = (screen.width < 768) ? "left" : align;
indent = (screen.width < 768) ? "0em" : indent;
linebreak = (screen.width < 768) ? 'true' : linebreak;
}
var mathjaxscript = document.createElement('script');
mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
mathjaxscript.type = 'text/javascript';
mathjaxscript.src = '/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
var configscript = document.createElement('script');
configscript.type = 'text/x-mathjax-config';
configscript[(window.opera ? "innerHTML" : "text")] =
"MathJax.Hub.Config({" +
" config: ['MMLorHTML.js']," +
" TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'none' } }," +
" jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
" extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
" displayAlign: '"+ align +"'," +
" displayIndent: '"+ indent +"'," +
" showMathMenu: true," +
" messageStyle: 'normal'," +
" tex2jax: { " +
" inlineMath: [ ['\\\\(','\\\\)'] ], " +
" displayMath: [ ['$$','$$'] ]," +
" processEscapes: true," +
" preview: 'TeX'," +
" }, " +
" 'HTML-CSS': { " +
" availableFonts: ['STIX', 'TeX']," +
" preferredFont: 'STIX'," +
" styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: '#333 ! important'} }," +
" linebreaks: { automatic: "+ linebreak +", width: '90% container' }," +
" }, " +
" 'TeX': { " +
" Macros: { " +
" defeq: \"{\\\\stackrel{\\\\mathrm{def}}{=}}\"," +
" Ld: \"{\\\\dot{L}}\"," +
" LdG: \"{\\\\dot{L}_G}\"," +
" bfA: \"{\\\\boldsymbol{A}}\"," +
" bfB: \"{\\\\boldsymbol{B}}\"," +
" bfC: \"{\\\\boldsymbol{C}}\"," +
" bfD: \"{\\\\boldsymbol{D}}\"," +
" bfE: \"{\\\\boldsymbol{E}}\"," +
" bfF: \"{\\\\boldsymbol{F}}\"," +
" bfG: \"{\\\\boldsymbol{G}}\"," +
" bfH: \"{\\\\boldsymbol{H}}\"," +
" bfI: \"{\\\\boldsymbol{I}}\"," +
" bfJ: \"{\\\\boldsymbol{J}}\"," +
" bfK: \"{\\\\boldsymbol{K}}\"," +
" bfL: \"{\\\\boldsymbol{L}}\"," +
" bfM: \"{\\\\boldsymbol{M}}\"," +
" bfN: \"{\\\\boldsymbol{N}}\"," +
" bfO: \"{\\\\boldsymbol{O}}\"," +
" bfP: \"{\\\\boldsymbol{P}}\"," +
" bfQ: \"{\\\\boldsymbol{Q}}\"," +
" bfR: \"{\\\\boldsymbol{R}}\"," +
" bfS: \"{\\\\boldsymbol{S}}\"," +
" bfT: \"{\\\\boldsymbol{T}}\"," +
" bfU: \"{\\\\boldsymbol{U}}\"," +
" bfV: \"{\\\\boldsymbol{V}}\"," +
" bfW: \"{\\\\boldsymbol{W}}\"," +
" bfX: \"{\\\\boldsymbol{X}}\"," +
" bfY: \"{\\\\boldsymbol{Y}}\"," +
" bfZ: \"{\\\\boldsymbol{Z}}\"," +
" bfa: \"{\\\\boldsymbol{a}}\"," +
" bfb: \"{\\\\boldsymbol{b}}\"," +
" bfc: \"{\\\\boldsymbol{c}}\"," +
" bfd: \"{\\\\boldsymbol{d}}\"," +
" bfe: \"{\\\\boldsymbol{e}}\"," +
" bff: \"{\\\\boldsymbol{f}}\"," +
" bfg: \"{\\\\boldsymbol{g}}\"," +
" bfh: \"{\\\\boldsymbol{h}}\"," +
" bfi: \"{\\\\boldsymbol{i}}\"," +
" bfj: \"{\\\\boldsymbol{j}}\"," +
" bfk: \"{\\\\boldsymbol{k}}\"," +
" bfl: \"{\\\\boldsymbol{l}}\"," +
" bfm: \"{\\\\boldsymbol{m}}\"," +
" bfn: \"{\\\\boldsymbol{n}}\"," +
" bfo: \"{\\\\boldsymbol{o}}\"," +
" bfp: \"{\\\\boldsymbol{p}}\"," +
" bfq: \"{\\\\boldsymbol{q}}\"," +
" bfr: \"{\\\\boldsymbol{r}}\"," +
" bfs: \"{\\\\boldsymbol{s}}\"," +
" bft: \"{\\\\boldsymbol{t}}\"," +
" bfu: \"{\\\\boldsymbol{u}}\"," +
" bfv: \"{\\\\boldsymbol{v}}\"," +
" bfw: \"{\\\\boldsymbol{w}}\"," +
" bfx: \"{\\\\boldsymbol{x}}\"," +
" bfy: \"{\\\\boldsymbol{y}}\"," +
" bfz: \"{\\\\boldsymbol{z}}\"," +
" bfalpha: \"{\\\\boldsymbol{\\\\alpha}}\"," +
" bfbeta: \"{\\\\boldsymbol{\\\\beta}}\"," +
" bfchi: \"{\\\\boldsymbol{\\\\chi}}\"," +
" bfgamma: \"{\\\\boldsymbol{\\\\gamma}}\"," +
" bflambda: \"{\\\\boldsymbol{\\\\lambda}}\"," +
" bfomega: \"{\\\\boldsymbol{\\\\omega}}\"," +
" bfone: \"{\\\\boldsymbol{1}}\"," +
" bfsigma: \"{\\\\boldsymbol{\\\\sigma}}\"," +
" bftau: \"{\\\\boldsymbol{\\\\tau}}\"," +
" bfxi: \"{\\\\boldsymbol{\\\\xi}}\"," +
" bfzero: \"{\\\\boldsymbol{0}}\"," +
" calA: \"{\\\\cal A}\"," +
" calB: \"{\\\\cal B}\"," +
" calC: \"{\\\\cal C}\"," +
" calD: \"{\\\\cal D}\"," +
" calE: \"{\\\\cal E}\"," +
" calF: \"{\\\\cal F}\"," +
" calG: \"{\\\\cal G}\"," +
" calH: \"{\\\\cal H}\"," +
" calI: \"{\\\\cal I}\"," +
" calJ: \"{\\\\cal J}\"," +
" calK: \"{\\\\cal K}\"," +
" calL: \"{\\\\cal L}\"," +
" calM: \"{\\\\cal M}\"," +
" calN: \"{\\\\cal N}\"," +
" calO: \"{\\\\cal O}\"," +
" calP: \"{\\\\cal P}\"," +
" calQ: \"{\\\\cal Q}\"," +
" calR: \"{\\\\cal R}\"," +
" calS: \"{\\\\cal S}\"," +
" calT: \"{\\\\cal T}\"," +
" calU: \"{\\\\cal U}\"," +
" calV: \"{\\\\cal V}\"," +
" calW: \"{\\\\cal W}\"," +
" calX: \"{\\\\cal X}\"," +
" calY: \"{\\\\cal Y}\"," +
" calZ: \"{\\\\cal Z}\"," +
" d: [\"{\\\\rm d}{#1}\", 1]," +
" bfcd: \"{\\\\dot{\\\\bfc}}\"," +
" bfpd: \"{\\\\dot{\\\\bfp}}\"," +
" bfpdd: \"{\\\\ddot{\\\\bfp}}\"," +
" dim: \"{\\\\rm dim}\"," +
" p: \"{\\\\boldsymbol{p}}\"," +
" q: \"{\\\\boldsymbol{q}}\"," +
" qd: \"{\\\\dot{\\\\bfq}}\"," +
" qdd: \"{\\\\ddot{\\\\bfq}}\"," +
" xd: \"{\\\\dot{x}}\"," +
" xdd: \"{\\\\ddot{x}}\"," +
" yd: \"{\\\\dot{y}}\"," +
" ydd: \"{\\\\ddot{y}}\"," +
" zd: \"{\\\\dot{z}}\"," +
" zdd: \"{\\\\ddot{z}}\"," +
" defeq: \"{\\\\stackrel{\\\\mathrm{def}}{\\\\ =\\\\ }}\"," +
" } " +
" } " +
"}); " +
"if ('default' !== 'default') {" +
"MathJax.Hub.Register.StartupHook('HTML-CSS Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax['HTML-CSS'].FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"MathJax.Hub.Register.StartupHook('SVG Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"}";
(document.body || document.getElementsByTagName('head')[0]).appendChild(configscript);
(document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}
</script>Posted by: Alex C.2022-08-08T01:51:00+02:002022-08-08T01:51:00+02:00Alex C.tag:scaron.info,2022-08-08:/robot-locomotion/recursive-newton-euler-algorithm.html//comment-external-force-and-acceleration<p>I see you are using <code>f_ext[]</code> as if each component is defined in the joint's local frame. Usually, external "spatial" forces are offered in global space and you have to apply a change of reference inside the RNEA algorithm.</p>
<p>Also, I think you missed a sign: <code>a[0] = gravity</code> should …</p><p>I see you are using <code>f_ext[]</code> as if each component is defined in the joint's local frame. Usually, external "spatial" forces are offered in global space and you have to apply a change of reference inside the RNEA algorithm.</p>
<p>Also, I think you missed a sign: <code>a[0] = gravity</code> should be <code>a[0] = -gravity</code> because it gets propagated, and when it is applied, it's basically, on the right side of the expression, hence, it should have a negative sign.</p>
<p>I hope I didn't mess up something... Really nice list of articles :)</p>Posted by: Subs2022-05-26T23:02:00+02:002022-05-26T23:02:00+02:00Substag:scaron.info,2022-05-26:/robot-locomotion/recursive-newton-euler-algorithm.html//comment-spatial-matlab-error<p>On running the code, I get the following error on Matlab "Unrecognized function or variable 'robot'". Please let me know a way how can I define in case of a RR manipulator.</p>Posted by: Stéphane2022-05-23T23:30:00+02:002022-05-23T23:30:00+02:00Stéphanetag:scaron.info,2022-05-23:/robot-locomotion/recursive-newton-euler-algorithm.html//comment-reply-spatial-matlab-error<p>I won't be able to help you with Matlab as I don't know it. If you don't get
further replies here, you can try contacting the package developer himself, or
asking your question to a broader audience, for instance on <a class="reference external" href="https://robotics.stackexchange.com/">Robotics Stack
Exchange</a>.</p>
Posted by: Stéphane2022-05-23T23:30:00+02:002022-05-23T23:30:00+02:00Stéphanetag:scaron.info,2022-05-23:/robot-locomotion/recursive-newton-euler-algorithm.html//comment-reply-matlab<p>Take a look at the <a class="reference external" href="https://royfeatherstone.org/spatial/v2/index.html">Spatial</a> Matlab package by Roy Featherstone, which implements most of the algorithms from <em>Rigid Body Dynamics Algorithms</em>. The function for the recursive Newton-Euler algorithm is <a class="reference external" href="https://royfeatherstone.org/spatial/v2/index.html#ID">ID</a>.</p>
Posted by: Subs2022-05-23T15:56:00+02:002022-05-23T15:56:00+02:00Substag:scaron.info,2022-05-23:/robot-locomotion/recursive-newton-euler-algorithm.html//comment-matlab<p>Can you publish the code on MATLAB?</p>