sim.generateIkPath always returns NULL

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

sim.generateIkPath always returns NULL

Post by johnrowlay » 13 Mar 2019, 14:01

I am having trouble getting the "sim.generateIkPath" function to work, and it is always returning NULL for me (i.e. no path could be computed).

I have created a very simple scene with a Sawyer robot, and introduced a tip-target setup with an IK calculation module. The target is 10cm away from the tip in each of the (x, y, z) directions, and has the same orientation as the tip. I then added a child script to the robot which calls the following in "sysCall_actuation()":

Code: Select all

    number_of_points = 30
    joint_handles = {}
    for i=1,7,1 do
        joint_handles[i] = sim.getObjectHandle('Sawyer_joint'..i)
    end
    ik_group_handle = sim.getIkGroupHandle('Sawyer_IK_group')
    path = sim.generateIkPath(ik_group_handle, joint_handles, number_of_points)
    if path == NULL then
        print('Could not compute IK path')
    else
        print(path)
    end
However, "sim.generateIkPath" always returns NULL.

I have tried varying the following, but they all result in NULL being returned:
- the number of points specified for the path
- the desired angular and positional precisions in the IK group
- the IK calculation method, and max iterations
- the position of the target

Any advice?

A minimal version of my scene can be downloaded from here: https://ufile.io/q3h8w, and you can just press "Play" to see it printing out "Could not compute IK path".

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

Re: sim.generateIkPath always returns NULL

Post by coppelia » 13 Mar 2019, 15:42

Hello,

the reason is that you hit some joint limits (i.e. Sawyer_joint6 will hinder the robot to travel along the desired straight line). If you adjust the joint limits of that joint, it will work.

Cheers

johnrowlay
Posts: 25
Joined: 09 Aug 2017, 18:52

Re: sim.generateIkPath always returns NULL

Post by johnrowlay » 13 Mar 2019, 17:20

Hello,

Yes, that was the reason.

Thank you very much!

Post Reply