Skip to content

Issue: Inverse Dynamics with Recursive Newton-Euler Not Working for URDF Imports#486

Open
codeFighter2022 wants to merge 1 commit intopetercorke:masterfrom
codeFighter2022:master
Open

Issue: Inverse Dynamics with Recursive Newton-Euler Not Working for URDF Imports#486
codeFighter2022 wants to merge 1 commit intopetercorke:masterfrom
codeFighter2022:master

Conversation

@codeFighter2022
Copy link
Copy Markdown

Problem:

The inverse dynamics computation using the recursive Newton-Euler algorithm (rne) does not work for URDF imports and also fails for the provided Panda model:

import roboticstoolbox as rtb import numpy as np robot = rtb.models.Panda() q = np.random.rand(robot.n) qD = np.random.rand(robot.n) qDD = np.random.rand(robot.n) tau = robot.rne(q, qD, qDD) 

Cause of the Error:

The issue originates from the line:
jp = self.links[j].parent.jindex

For certain types, parent.jindex is empty, causing the computation to fail.
Proposed Solution

Solution:

I implemented an alternative method to find the parent index using the following approach:

jp = next(i for i, link in enumerate(self.links) if link.name == parent_name)

Additional information

Roboticstoolbox version: 1.1.1
Numpy version: 1.26.4
Spatialmath version: 1.1.14

Inverse dynamics with recursive Newton-Euler does not work for URDF imports and also not for the Panda model: import roboticstoolbox as rtb robot = rtb.models.Panda() q = np.random.rand(robot.n) qD = np.random.rand(robot.n) qDD = np.random.rand(robot.n) tau = robot.rne(q, qD, qDD) The origin of the error is jp = self.links[j].parent.jindex which is empty for some types. I implemented a another search algorithm of the parent algorithm via: jp = next(i for i, link in enumerate(self.links) if link.name == parent_name)
@freezeLUO
Copy link
Copy Markdown

How does your solution compare to#408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants