Code: Select all

```
sim.simxCallScriptFunction(clientID, 'Dobot', sim.sim_scripttype_childscript, 'movetoPoss', [50,0,0,0], [], [], bytearray(), sim.simx_opmode_blocking)
```

Code: Select all

```
function movetoPos(j1,j2,j3,j4,enable)
modelBase=sim.getObjectAssociatedWithScript(sim.handle_self)
modelName=sim.getObjectName(modelBase)
motorHandles = {}
j={j1*math.pi/180,j2*math.pi/180,j3*math.pi/180,j4*math.pi/180}
for i=1,4,1 do
motorHandles[i]=sim.getObjectHandle('Dobot_motor'..i)
end
for i=1,4,1 do
sim.setJointTargetPosition(motorHandles[i],j[i])
sim.wait(2)
end
if enable then
sim.setIntegerSignal(modelName .."_suctionCup",1)
else
sim.setIntegerSignal(modelName .."_suctionCup",0)
end
return {},{},{},''
end
function sysCall_threadmain()
--[[
--Motor1,Motor2,Motor3,Motor4,Suction Cup
movetoPos(50,50,47,0,true)
movetoPos(100,0,0,45,true)
movetoPos(50,50,47,45,false)
movetoPos(50,0,0,45,false)
movetoPos(0,0,0,0,false)
--]]
end
function movetoPoss(j1, j2, j3, j4)
movetoPos(50,20,20,60,true)
end
```