Page 1 of 1

Redundant arm IK solution with one fixed joint

Posted: 19 Nov 2021, 15:20
by kat
Hello!
I'm trying to run simIK.getConfigForTipPose to find the inverse kinematics solution for a redundant arm. I want to fix one of the arm's joint angles and have the solver work out the other angles where the tip is at the target under that constraint. I'm trying to use simIK.setJointMode to passive for the joint but when I use simIK.getConfigForTipPose, it ignores the angle I've set that joint to and solves it using a different angle.
Do you know how I should implement the constraint?
Best,
Kat

Code: Select all


function coroutineMain()
       --joint handles
       for i=1,7,1 do
       jh[i]=sim.getObjectHandle('LBR_iiwa_14_R820_joint'..i)
       end
    -- joint limits
    jointLimitsL={-170,-120,-170,-120,-170,-120,-175}
    jointLimitsR={340,240,340,240,340,240,350}
    
   
    J1_position=10*math.pi/180    -- I want Joint 1 to stay at 10 degrees
    sim.setJointPosition(jh[1],J1_position) -- set Joint 1 to 10degrees
    -- define IK parameters
    simBase=sim.getObjectHandle(sim.handle_self)    
    simTarget=sim.getObjectHandle('LBR_iiwa_target')
    simTip=sim.getObjectHandle('LBR_iiwa_tip')
    ikEnv=simIK.createEnvironment()
    ikGroup=simIK.createIkGroup(ikEnv)
    ikElement,simToIkMap=simIK.addIkElementFromScene(ikEnv,ikGroup,simBase,simTip,simTarget,simIK.constraint_pose)
    ikTip=simToIkMap[simTip]
    ikJoints={}
    for i=1,#jh,1 do
        ikJoints[i]=simToIkMap[jh[i]]
    end
    simIK.setJointPosition(ikEnv,ikJoints[1],J1_position)  -- set IKjoint position of Joint 1
    simIK.setJointMode(ikEnv,ikJoints[1],simIK.jointmode_passive) -- set joint 1 to passive mode

    
-- this finds the solution but Joint 1 is not 10deg
    c=simIK.getConfigForTipPose(ikEnv,ikGroup,ikJoints,1.4,0.04,{1,1,1,1},nil,nil,nil,jointLimitsL,jointLimitsR) 




Re: Redundant arm IK solution with one fixed joint

Posted: 19 Nov 2021, 16:00
by coppelia
Hello,

that sounds strange. Can you post your scene?

Cheers

Re: Redundant arm IK solution with one fixed joint

Posted: 19 Nov 2021, 17:45
by kat
Hello,
Ok, may I please have permission to add an attachment? Or am I just not able to find the button...
Thanks!
Kat

Re: Redundant arm IK solution with one fixed joint

Posted: 22 Nov 2021, 08:30
by coppelia
Kat,

you should post a link to a dropbox file or similar, where you give permission to read

Cheers

Re: Redundant arm IK solution with one fixed joint

Posted: 22 Nov 2021, 10:49
by kat
Hello,
Ok here is the link:

https://www.dropbox.com/s/dyrkk3apg67bt ... t.ttt?dl=0

Best,
Kat

Re: Redundant arm IK solution with one fixed joint

Posted: 22 Nov 2021, 15:20
by coppelia
Thanks Kat,

indeed, there is a bug!
I am not sure there is a workaround in that case (well, in your particular case where the passive joint is at the base of the kinematic chain, you can simply define a kinematic chain that start just above the passive joint).
What platform are you running?

Cheers

Re: Redundant arm IK solution with one fixed joint

Posted: 22 Nov 2021, 15:36
by kat
Hello,
I'm running it on Linux. Thank you for the workaround suggestion, I tried this out and it works nicely!
Best,
Kat

Re: Redundant arm IK solution with one fixed joint

Posted: 23 Nov 2021, 07:48
by coppelia
You can find an updated version of the plugin here (Ubuntu18) and here (Ubuntu20). Let me know if that works.

Cheers

Re: Redundant arm IK solution with one fixed joint

Posted: 23 Nov 2021, 12:03
by kat
Hi,
I used this link https://coppeliarobotics.com/files/tmp/ ... u20.tar.xz for the Ubuntu20 (looks like both posted pointed to the version18)

Ran it and it works nicely now for my scene fixing whichever passive joint in the IK.
Thank you very much!