sim.rmlMoveToJointPositions with remote API

Typically: "How do I... ", "How can I... " questions
Post Reply
Julien_Demetra
Posts: 11
Joined: 08 Mar 2019, 08:48

sim.rmlMoveToJointPositions with remote API

Post by Julien_Demetra »

Hello,

I'm controlling my VREP scene with a python script and I would to make my robot go from a joint configuration to another joint configuration.
However I cannot use the sim.rmlMoveToJointPositions function which is what I want.
How can I do ?

Thanks,

Julien

Julien_Demetra
Posts: 11
Joined: 08 Mar 2019, 08:48

Re: sim.rmlMoveToJointPositions with remote API

Post by Julien_Demetra »

Actually in other words my real need is to call such a function in my python script :

setConfig=function(config)
-- Applies the specified configuration to the robot
if config then

for i=1,#jh,1 do
--sim.setJointPosition(jh,config)
if final then
r,np,pv,pa=sim.rmlMoveToJointPositions(jh,-1,pv,pa,{0.2,0.2,0.2,0.2,0.2,0.2},{1,1,1,1,1,1},{0,0,0,0,0,0},config,{0,0,0,0,0,0},nil)
final = false
else
r,np,pv,pa=sim.rmlMoveToJointPositions(jh,-1,pv,pa,{0.2,0.2,0.2,0.2,0.2,0.2},{1,1,1,1,1,1},{0,0,0,0,0,0},config,{0,0,0,0,0,0},nil)
end
sim.switchThread()
end
end
end

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

Re: sim.rmlMoveToJointPositions with remote API

Post by coppelia »

Hello,

you should use a threaded child script with something like:

Code: Select all

function moveToConfig(inInts,inFloats,inStrings,inBuffer)
    -- put your motion data into moveData variable:
    moveData=...

    return {},{},{},''
end

function sysCall_threadmain()
    while sim.getSimulationState()~=sim.simulation_advancing_abouttostop do
        if moveData then
            -- here, use sim.rmlMoveToJointPosition:
            sim.rmlMoveToPosition(...)
            moveData=nil
        end
        sim.switchThread() -- resume in next simulation step
    end
end

function sysCall_cleanup()
    -- Put some clean-up code here
end
Cheers

Post Reply