dqrobotics / python

The DQ Robotics library in Python
https://dqrobotics.github.io
GNU Lesser General Public License v3.0
24 stars 9 forks source link

[BUG] The pose_jacobian() of DQ_HolonomicBase is trying to access link index 3 #20

Closed marcos-pereira closed 3 years ago

marcos-pereira commented 3 years ago

Bug description

To Reproduce

Code

import numpy as np
from dqrobotics.robot_modeling import DQ_HolonomicBase

q = np.array([0.12,   0.0,    0.0])
holonomic_base = DQ_HolonomicBase()
J = holonomic_base.pose_jacobian(q)
print(J)

Output

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Tried to access link index 3 which is unavailable.

Expected behavior

Matlab code

q = [0.12 0 0];
robot = DQ_HolonomicBase();
J_pose = robot.pose_jacobian(q)

Matlab output

J_pose =

         0         0         0
         0         0         0
         0         0         0
         0         0    0.5000
         0         0         0
    0.5000         0         0
         0    0.5000    0.0300
         0         0         0

Environment:

Additional context

mmmarinho commented 3 years ago

Hello, @marcos-pereira,

I have a little bit too much going on to test this thoroughly but I don't want to leave you hanging. I proposed a quick fix which I think will work, but could you test and let me know how it goes?

Kind regards, Murilo

marcos-pereira commented 3 years ago

Hello @mmmarinho ,

Thank you for the quick fix. I will test it as soon as the update is available. By looking at the fix, it seems it should work :).

Best regards, Marcos

marcos-pereira commented 3 years ago

Hi @mmmarinho ,

The fix with the DQ_HolonomicBase worked, but I found a really similar issue on the DQ_DifferentialDriveRobot. When calculating the Jacobian of the DifferentialDriveRobot, it tries to access link with index 3 because of line 50 in DQ_DifferentialDriveRobot.

Should I open a new issue?

EDIT: I opened issue #22 .

Best regards, Marcos