Throwing object

Typically: "How do I... ", "How can I... " questions
GodANU
Posts: 3
Joined: 07 Oct 2016, 19:51

Throwing object

Post by GodANU » 09 Oct 2016, 15:03

Hi there,

I am trying to throw an object from somewhere into a basket. While this is happening I'd like to observe this object with Kinect. But unfortunately, I could not find anything to throw as an object and also I do not know how to do this animation even I would have an object.

I am very new in V-REP. I would be appreciated a lot if someone could help me fill those blanks in my mind.

Thank you,

coppelia
Site Admin
Posts: 7450
Joined: 14 Dec 2012, 00:25

Re: Throwing object

Post by coppelia » 11 Oct 2016, 08:08

Hello,

you can add a primitive sphere (i.e. a pure sphere) with [Menu bar --> Add --> Primitive shape --> Sphere]. This could be your object.

Then, you can apply an initial velocity to that sphere by attaching in a non-threaded child script like in following example:

Code: Select all

if (sim_call_type==sim_childscriptcall_initialization) then
    h=simGetObjectAssociatedWithScript(sim_handle_self)
    simSetObjectFloatParameter(h,sim_shapefloatparam_init_velocity_z,10)
end
Above will give to your sphere an initial velocity in the Z-direction of 10 meters/seconds. So your sphere will jump up and eventually come down again.

Cheers

GodANU
Posts: 3
Joined: 07 Oct 2016, 19:51

Re: Throwing object

Post by GodANU » 19 Dec 2016, 16:31

Thank you sir

govind458
Posts: 5
Joined: 28 Nov 2019, 20:08

Re: Throwing object

Post by govind458 » 29 Nov 2019, 13:09

Hey,
I was working on a similar project where the gripper can close and pickup an object before throwing it into a basket. But, we are stuck after picking up the object. Can you please help me with understanding in how to throw an object!

Thank You

coppelia
Site Admin
Posts: 7450
Joined: 14 Dec 2012, 00:25

Re: Throwing object

Post by coppelia » 02 Dec 2019, 10:16

Throwing an object is quite difficult, even if it doesn't appear so. The point is that the moment where the object has to be released is crucial. Also how the object is released.
I would highly recommend to use a pseudo gripping mechanism where you attach the object via a simple force/torque sensor. Then, to release it, simply set the parent of the object to -1 (sim.setObjectParent).

Cheers

govind458
Posts: 5
Joined: 28 Nov 2019, 20:08

Re: Throwing object

Post by govind458 » 02 Dec 2019, 14:11

Can you please guide me along the processes I should follow by using the pseudo-gripper mechanism? For come reference we are using a phantom pitcher robot with a RG2 Gripper to throw a cube present in air, after making it move along a certain path

coppelia
Site Admin
Posts: 7450
Joined: 14 Dec 2012, 00:25

Re: Throwing object

Post by coppelia » 03 Dec 2019, 14:00

simply remove the last 6 object in the robot's hierarchy. Then attach a force/torque sensor to object PhantomXPincher_link5.
Then, you can simply programmatically attach/detach a dynamic shape to the force/torque sensor via sim.setObjectParent.

Cheers

govind458
Posts: 5
Joined: 28 Nov 2019, 20:08

Re: Throwing object

Post by govind458 » 03 Dec 2019, 14:02

Oh I see. We were thinking along those lines. The next issue we faced was, we didn't know how to make the robot do a task such as open gripper/close gripper DURING THE EXECUTION OF THE PATH. Is this possible?

coppelia
Site Admin
Posts: 7450
Joined: 14 Dec 2012, 00:25

Re: Throwing object

Post by coppelia » 03 Dec 2019, 14:20

Yes, this is possible. It depends how you are doing things. If you are following a path in a blocking manner, then you can't do it from that script. You'll have to handle the detachment from another script, or handle everything inside of a non-threaded child script.

Cheers

govind458
Posts: 5
Joined: 28 Nov 2019, 20:08

Re: Throwing object

Post by govind458 » 03 Dec 2019, 14:23

So then, how do we do it during the path execution?

Post Reply