Page 1 of 1

sim.rmlMoveToJointPositions with remote API

Posted: 09 Apr 2019, 15:35
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

Re: sim.rmlMoveToJointPositions with remote API

Posted: 09 Apr 2019, 15:39
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

Re: sim.rmlMoveToJointPositions with remote API

Posted: 11 Apr 2019, 11:54
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