Skip to content

RNE Function on URDF Robot Models #368

Open
@dbacher42

Description

@dbacher42

I am trying to do dynamic simulations on robots using the URDF models. When I run a function that uses the rne() function, I run into errors.

When I run the following commands:

import roboticstoolbox as rtb
robot = rtb.models.URDF.UR10()
M = robot.inertia(robot.q)

I get the following error:

Traceback (most recent call last):

  File "C:\Users\dbacher\OneDrive - NASA\Documents\Python Scripts\UR10 URDF.py", line 18, in <module>
    M = robot.inertia(robot.q)

  File "C:\Users\dbacher\Anaconda3\envs\rrt-mpc\lib\site-packages\roboticstoolbox\robot\Dynamics.py", line 696, in inertia
    In[k, :, :] = self.rne(

  File "C:\Users\dbacher\Anaconda3\envs\rrt-mpc\lib\site-packages\roboticstoolbox\robot\ERobot.py", line 2110, in rne
    v[j] = Xup[j] * v[jp] + vJ

  File "C:\Users\dbacher\OneDrive - NASA\Documents\GitHub\spatialmath-python\spatialmath\spatialvector.py", line 148, in __getitem__
    return self.__class__(self.data[i])

TypeError: list indices must be integers or slices, not NoneType

If I run the same code on a Panda or another robot with a different number of joints, I get a different error:

import roboticstoolbox as rtb
robot = rtb.models.URDF.Panda()
M = robot.inertia(robot.q)
Traceback (most recent call last):

  File "C:\Users\dbacher\OneDrive - NASA\Documents\Python Scripts\UR10 URDF.py", line 18, in <module>
    M = robot.inertia(robot.q)

  File "C:\Users\dbacher\Anaconda3\envs\rrt-mpc\lib\site-packages\roboticstoolbox\robot\Dynamics.py", line 696, in inertia
    In[k, :, :] = self.rne(

  File "C:\Users\dbacher\Anaconda3\envs\rrt-mpc\lib\site-packages\roboticstoolbox\robot\ERobot.py", line 2100, in rne
    vJ = SpatialVelocity(s[j] * qd[j])

ValueError: operands could not be broadcast together with shapes (6,) (7,) 

It seems like there is some problem with between the rne() function and the URDF models. It works with the DH models, but for my application I have a custom end effector that can't be modeled as a point mass, and so we need to use the URDF description with the moments of inertia.

Metadata

Metadata

Assignees

Labels

RTBbugwe got it wrong, will fix

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions