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
sim.rmlMoveToJointPositions with remote API
-
- Posts: 11
- Joined: 08 Mar 2019, 08:48
Re: sim.rmlMoveToJointPositions with remote API
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
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
Hello,
you should use a threaded child script with something like:
Cheers
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