## Change Position of ROBOTIQ_85

Typically: "How do I... ", "How can I... " questions
ercint
Posts: 7
Joined: 06 Jan 2014, 17:26

### Change Position of ROBOTIQ_85

I am pretty new on V-REP, so I have a simple question.

I would like to use ROBOTIQ_85 gripper which is built in model of V_REP for grasp operation. So I need to change its position and orientation for trying of grasping objects.

But when I use simSetObjectPosition function, it moves where I would like to go but parts of it disperse so I cannot close gripper in proper way. So how can I move it and change orientation properly?

The simple code I wrote on built in model is as follows. If you can help me, I really appreciate.

objectHandle = simGetObjectHandle('ROBOTIQ_85')
objectNewPos = {1,0,0}
result=simSetObjectPosition(obje,-1,targetPosition)

coppelia
Posts: 7605
Joined: 14 Dec 2012, 00:25

### Re: Change Position of ROBOTIQ_85

Hello,

when you move a dynamic object instantly, the attached dynamic objects will have difficulties to follow (e.g. like in real life: you cannot instantaneously move an object, and if you do (or something close to instantaneous), it will break because of the infinite acceleration).

So you have two options:
• move the objects slowly, or by applying forces (e.g. simAddForce)
• remove the object from the dynamics engine, move it, then add it again. You would need the function simResetDynamicObject. If you have several objects built on a tree, you will have to call simResetDynamicObject for all the objects in the tree, for example to iterate over all objects in a model:

Code: Select all

local objects=simGetObjectsInTree(modelBase,sim_handle_all,0)
for i=1,#objects,1 do
simResetDynamicObject(objects[i])
end
If you have to iterate over several objects to reset, make sure you are running in a non-threaded child script, or if you are running in a threaded child script, make sure you won't get interrupted for the full procedure of reset and reposition: use simSetThreadAutomaticSwitch(false) before and simSetThreadAutomaticSwitch(false) after, in that case.

Cheers

ercint
Posts: 7
Joined: 06 Jan 2014, 17:26

### Re: Change Position of ROBOTIQ_85

Thanks for your valuable post; but I cannot handle the proper movement in accordance with physics engine in V-REP. My simple code is below. I have used your suggestion and setposition function as you propose. But when use it, it become not stable so I cannot use it.