Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

codeFighter2022
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant