Change Position of ROBOTIQ_85

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

Change Position of ROBOTIQ_85

Post by ercint » 09 Jun 2014, 17:14

Hi Admin and Everyone,

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
Site Admin
Posts: 7266
Joined: 14 Dec 2012, 00:25

Re: Change Position of ROBOTIQ_85

Post by coppelia » 09 Jun 2014, 22:20

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

Post by ercint » 10 Jun 2014, 10:59

Hi Admin,

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.

Can you please help me?

Thanks in advance...
Last edited by ercint on 10 Jun 2014, 16:53, edited 1 time in total.

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

Re: Change Position of ROBOTIQ_85

Post by ercint » 10 Jun 2014, 15:40

Hi,

Thanks for your suggestion, I did what should I do. The previous problem is about my mistake...

Post Reply