Example of Joint-Target-Position command

Typically: "How do I... ", "How can I... " questions
Post Reply
Luis Nieto
Posts: 49
Joined: 26 Oct 2021, 01:35

Example of Joint-Target-Position command

Post by Luis Nieto »

Hello! Would there be a sample scene I could look at to see how the command sim.setJointTargetPosition works? Thank you.

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

Re: Example of Joint-Target-Position command

Post by coppelia »

What CoppeliaSim version and revision do you have?

e.g. take the model Models/robots/non-mobile/KUKA LBR iiwa 14 R820.ttm, open the child script attached to it an replace it with:

Code: Select all

function sysCall_init()
    local jointHandle=sim.getObject('./link2_resp/joint')
    sim.setJointTargetPosition(jointHandle,45*math.pi/180)
end
With the last revision, you can now also control a joint that is in kinematic mode with sim.setJointTargetPosition.

See also the demo scene scenes/motorControllerExamples.ttt

Cheers

Luis Nieto
Posts: 49
Joined: 26 Oct 2021, 01:35

Re: Example of Joint-Target-Position command

Post by Luis Nieto »

Thanks. I will check this out.

Besides, I also would like to know how are revolute joints generally manipulated using Lua code, including specifics like how many degrees it can rotate and how fast it rotates?

Would the KUKA robot mentioned in the previous message have a demo of that already, or are there more that can be suggested? Please and Thanks.

Luis Nieto
Posts: 49
Joined: 26 Oct 2021, 01:35

Re: Example of Joint-Target-Position command

Post by Luis Nieto »

To briefly answer the version question, I am using 4_3_0.

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

Re: Example of Joint-Target-Position command

Post by coppelia »

You can adjust all those dynamic properties in the joint dynamic properties dialog. Joint range and similar can be adjusted in the joint dialog.

Cheers

Post Reply