krishauser / Klampt

Kris' Locomotion and Manipulation Planning Toolkit
BSD 3-Clause "New" or "Revised" License
378 stars 96 forks source link

Subrobot jacobian #166

Closed patricknaughton01 closed 1 year ago

patricknaughton01 commented 1 year ago

Getting the Jacobian of a SubRobotLink throws error:

Traceback (most recent call last):
  File "example.py", line 7, in <module>
    subrobot_model.link(0).getJacobian([0,0,0])
  File "/usr/local/lib/python3.8/dist-packages/Klampt-0.9.0-py3.8-linux-x86_64.egg/klampt/model/subrobot.py", line 424, in getJacobian
    self._robot.fromfull(self._link.getJacobian(p))
  File "/usr/local/lib/python3.8/dist-packages/Klampt-0.9.0-py3.8-linux-x86_64.egg/klampt/model/subrobot.py", line 146, in fromfull
    raise ValueError("Invalid object type, not an integer, configuration, or Trajectory")
ValueError: Invalid object type, not an integer, configuration, or Trajectory

Example code to reproduce:

import klampt
from klampt.model.subrobot import SubRobotModel

wm = klampt.WorldModel()
robot_model = wm.loadRobot("...")
subrobot_model = SubRobotModel(robot_model, [0, 1, 2])
subrobot_model.link(0).getJacobian([0,0,0])

This might be because getJacobian returns a numpy array, which it looks like fromfull is not checking for.

krishauser commented 1 year ago

Fixed in main, staged for next 0.9.1 update