IK on parallel robot with two motors

Typically: "How do I... ", "How can I... " questions
Post Reply
Chiara
Posts: 15
Joined: 09 May 2023, 20:44

IK on parallel robot with two motors

Post by Chiara »

Hello,

I need to calculate the inverse kinematics and generate the trajectory for a parallel mechanism which has two motors and three joints.

I saw the "fkAndIkResolutionForParallelMechanism" and "ikPathGeneration" but I can't move my robot.

Here I uploaded an image of my scene hierarchy and my scene file https://www.dropbox.com/scl/fo/axz93s6w ... tcx7dm48cu

Has anyone a suggestion for me please?
Many thanks!!

fferri
Posts: 1193
Joined: 09 Sep 2013, 19:28

Re: IK on parallel robot with two motors

Post by fferri »

Are you sure you set the dummy-dummy link (i.e. ClosureTip to ClosureTarget)? In the dummy properties you should select a linked dummy, and a constraint type (dynamic overlaps in this case).
A coloured line would then show up in the objects hierarchy.

Chiara
Posts: 15
Joined: 09 May 2023, 20:44

Re: IK on parallel robot with two motors

Post by Chiara »

Hi,

here you can see the dummy-dummy link https://www.dropbox.com/s/nnmktfvkyikcvrf/img.png?dl=0 : the blue line is visible.

I uploaded also the adjusted scene here https://www.dropbox.com/s/9fuktmozjabs9 ... K.ttt?dl=0.

If I set a joint position, the chain works properly. I have problem by setting the IK elements and I can't understand why..My scene is quite similar to the one shown in "fkAndIkResolutionForParallelMechanism" except that I have two motors and three joints.

Any help is really appreciated!
Thanks!!

Chiara
Posts: 15
Joined: 09 May 2023, 20:44

Re: IK on parallel robot with two motors

Post by Chiara »

I read again the tutorial https://www.coppeliarobotics.com/helpFi ... torial.htm and fixed some properties of the link and of the joints. Unfortunately I have always the same problem: the Ik can't be solved.

I checked if the target dummy position is actually reachable, and it is.

Many thanks again for any suggestions!

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

Re: IK on parallel robot with two motors

Post by coppelia »

Hello,

you have several problems with your scene: first you should decide if you want/need a dynamically enabled scene, or if a kinematic scene is enough. Currently you have most elements that are dynamically enabled.

For a kinematic scene, make sure all shapes are non-respondable and static. Your joints are already all in kinematic mode (correct in that situation).

Then start with a single loop-closing constraint, and make the motor rotate:

Code: Select all

function sysCall_init()
    -- Take a few handles from the scene:
    local simBase=sim.getObject('.')
    local simClosureTip=sim.getObject('./ClosureTip')
    local simClosureTarget=sim.getObject('./ClosureTarget')

    local simTip=sim.getObject('./Tip')
    local simTarget=sim.getObject('./Target')
    simMotorJoint=sim.getObject('./Motor1')
    
    ikEnv = simIK.createEnvironment()
    
    ikGroup=simIK.createGroup(ikEnv)
    simIK.setGroupCalculation(ikEnv,ikGroup,simIK.method_damped_least_squares,0.1,100)
    local ikElement,simToIkObjectMap=simIK.addElementFromScene(ikEnv,ikGroup,simBase,simClosureTip,simClosureTarget,simIK.constraint_x|simIK.constraint_y|simIK.constraint_orientation)
    simIK.setJointMode(ikEnv,simToIkObjectMap[simMotorJoint],simIK.jointmode_passive) -- make sure that joint will act as 'rigid' during IK calculations
end

function sysCall_actuation()
    sim.setJointPosition(simMotorJoint,sim.getJointPosition(simMotorJoint)+0.01)
    simIK.handleGroup(ikEnv,ikGroup,{syncWorlds=true})
end
then add the second constraint:

Code: Select all

function sysCall_init()
    -- Take a few handles from the scene:
    local simBase=sim.getObject('.')
    local simClosureTip=sim.getObject('./ClosureTip')
    local simClosureTarget=sim.getObject('./ClosureTarget')

    local simTip=sim.getObject('./Tip')
    local simTarget=sim.getObject('./Target')
    simMotorJoint=sim.getObject('./Motor1')
    
    ikEnv = simIK.createEnvironment()
    
    ikGroup=simIK.createGroup(ikEnv)
    simIK.setGroupCalculation(ikEnv,ikGroup,simIK.method_damped_least_squares,0.1,100)
    local ikElement,simToIkObjectMap=simIK.addElementFromScene(ikEnv,ikGroup,simBase,simClosureTip,simClosureTarget,simIK.constraint_x|simIK.constraint_y|simIK.constraint_orientation)
    simIK.setJointMode(ikEnv,simToIkObjectMap[simMotorJoint],simIK.jointmode_passive) -- make sure that joint will act as 'rigid' during IK calculations

    local ikElement,simToIkObjectMap=simIK.addElementFromScene(ikEnv,ikGroup,simBase,simTip,simTarget,simIK.constraint_x|simIK.constraint_y)
end

function sysCall_actuation()
    sim.setJointPosition(simMotorJoint,sim.getJointPosition(simMotorJoint)+0.01)
    simIK.handleGroup(ikEnv,ikGroup,{syncWorlds=true,allowError=true})
end
notice that now we have as option for simIK.handleGroup allowError=true, because the system is now overconstrained and often the tip can't reach the target.

Cheers

Chiara
Posts: 15
Joined: 09 May 2023, 20:44

Re: IK on parallel robot with two motors

Post by Chiara »

Many thanks for the reply! Thanks a lot!

Post Reply