About sim.gerateIKpath and sim.followpath

Typically: "How do I... ", "How can I... " questions
Post Reply
salmon_w
Posts: 1
Joined: 10 Dec 2020, 07:36

About sim.gerateIKpath and sim.followpath

Post by salmon_w »

Hi, I am completely new to this kind of robot simulation, and I really don't know how this sim.gerateIkpath works.

https://github.com/salmon9/robot/blob/m ... 140_IK.lua

Here's the code I wrote, but it doesn't seem to work.
I think I am misunderstanding how sim.generateIKpath works, so would someone please tell me how to use it correctly in this case?
I want to use sim.followpath to make the robot arm follow the generated path.
Or are there other ways to use sim.generateIKpath and make my robot arm follow the generated path?

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

Re: About sim.gerateIKpath and sim.followpath

Post by coppelia »

Hello,

we highly recommend you to use the new kinematics plugin functionality. In there, you will find several new API functions in next release, including simIK.generatePath.

You can however easily mimic the generate path functionality by looping several time through the IK solver (simIK.handleIkGroup) and recording/memorizing joint values.

sim.followPath also should not be used anymore, since not flexible enough. Best would be to simply apply computed joint values from simIK.handleIkGroup, e.g. directly, or in an interpolated manner.

To apply a configuration to a robot, you would do, e.g.:

Code: Select all

for j=1,#joints,1 do
    if robotIsDynamicallyEnabled then
        sim.setJointTargetPosition(joints[j],jointAngles[j])
    else
        sim.setJointPosition(joints[j],jointAngles[j])
    end
end
In release 4.1.0, have also a look at the demo scene ik_fk_simple_examples/9-programmaticallySettingUpIk.ttt and inspect the script attached to the blue robot.

Cheers

Post Reply