Redundant arm IK solution with one fixed joint

Typically: "How do I... ", "How can I... " questions
Post Reply
kat
Posts: 13
Joined: 02 Sep 2021, 15:50

Redundant arm IK solution with one fixed joint

Post 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) 




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

Re: Redundant arm IK solution with one fixed joint

Post by coppelia »

Hello,

that sounds strange. Can you post your scene?

Cheers

kat
Posts: 13
Joined: 02 Sep 2021, 15:50

Re: Redundant arm IK solution with one fixed joint

Post 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

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

Re: Redundant arm IK solution with one fixed joint

Post by coppelia »

Kat,

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

Cheers

kat
Posts: 13
Joined: 02 Sep 2021, 15:50

Re: Redundant arm IK solution with one fixed joint

Post by kat »

Hello,
Ok here is the link:

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

Best,
Kat

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

Re: Redundant arm IK solution with one fixed joint

Post 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

kat
Posts: 13
Joined: 02 Sep 2021, 15:50

Re: Redundant arm IK solution with one fixed joint

Post 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

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

Re: Redundant arm IK solution with one fixed joint

Post by coppelia »

You can find an updated version of the plugin here (Ubuntu18) and here (Ubuntu20). Let me know if that works.

Cheers

kat
Posts: 13
Joined: 02 Sep 2021, 15:50

Re: Redundant arm IK solution with one fixed joint

Post 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!

Post Reply