sim.computeJacobian() is returning -1

Typically: "How do I... ", "How can I... " questions
Post Reply
johnrowlay
Posts: 25
Joined: 09 Aug 2017, 18:52

sim.computeJacobian() is returning -1

Post by johnrowlay » 13 Feb 2019, 16:24

I am having trouble retrieving the Jacobian using the regular API.

So, I have created a new scene, and then imported the Sawyer robot. Then, I created an IK group using the calculation modules, with a tip and a target, and explicit handling not checked. Then, I added a child script for the Sawyer robot, and edited the actuation code as follows:

Code: Select all

function sysCall_actuation()
    print('Actuation ...')
    ik_group_handle = sim.getIkGroupHandle('Sawyer_IK_group')
    print('handle:')
    print(ik_group_handle)
    result = sim.computeJacobian(ik_group_handle, 0)
    print('result:')
    print(result)
    jacobian = sim.getIkGroupMatrix(ik_group_handle, 0)
    print('jacobian:')
    print(jacobian)
    print('... Done')
end
This prints out the following:

Code: Select all

Actuation ...
handle:
2030003
result:
-1
jacobian:

... Done
So what I am finding, is that "sim.computeJacobian()" is returning -1, which is an error. And subsequently, the Jacobian is empty.

What do I need to change?

coppelia
Site Admin
Posts: 7077
Joined: 14 Dec 2012, 00:25

Re: sim.computeJacobian() is returning -1

Post by coppelia » 20 Feb 2019, 10:17

Hello,

something must be wrong with your IK group.
Try using the IRB140 model: replace the code in the child script with your code, and you will see that the Jacobian is computed.
Are you sure your joints are in IK mode?

Cheers

Post Reply