Search Unity

Collision problems with robotic jaw?

Discussion in 'Editor & General Support' started by soapstar, Sep 2, 2011.

  1. soapstar

    soapstar

    Joined:
    Apr 4, 2011
    Posts:
    56
    Hello,

    I am currently working on a robot which i want to be able to pick up objects (primitives such as cylinders) with its 'jaw'. However i am coming across a big issue when trying to 'grab' a primitive object.

    My jaw has box colliders positioned on either side of the jaw, when i move the jaw shut with a cylinder for example in between the 'fingers' of the jaw the cylinder seems to move randomly and eventually go through the jaw.

    Is there any effective way in which i could 'clamp' a primitive in my jaw and be able to pick it up?


    Thanks for any help, much appreciated :)
     
  2. soapstar

    soapstar

    Joined:
    Apr 4, 2011
    Posts:
    56
    Bump :D Sorry i really need some help, any help would be good! :D
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    sounds like your jaw isn't stopping when there is no space left anymore, causing a "compression" of the object inbetween which prevents it from resolving the collision according your penetration depth settings, which will make the object break free / tunnel through collider pushed by a near infinite force
     
  4. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    28,017
    to avoid this, you need to limit the amount of power on the jaws. Basically adding torque is better than rotating them shut, this way when it reaches a solid object it has the power to grip hold of it, but not the power to explode physics.
     
  5. soapstar

    soapstar

    Joined:
    Apr 4, 2011
    Posts:
    56

    Hey dreamora, thanks so much for your time. Can you please help me understand and fix this issue? Its beginning to compromise my entire project!

    I understand what u mean about having space between the jaw and object not allowing any 'compression' of the object, that makes a lot of sense. However im not sure what u mean by penetration depth settings? I have played around with 'Min Penetration For Penalty' (currently set at 0.03) but this does not resolve the issue...

    I feel so close but yet so far!!! REALLY appreciate your help
     
  6. soapstar

    soapstar

    Joined:
    Apr 4, 2011
    Posts:
    56
    Hey hippocoder! That sounds like a superb idea! However to apply 'rigidbody.AddRelativeTorque (0, 10, 0)' to one of my jaws means i have to disable 'kinematic' on the jaw, this means that my jaw which is a child of the 'arm' of the robot will not stay still and move with the arm!? It just fly's off the arm but does rotate with torque!

    Sorry maybe that was a little confusing! Thanks for your help hippocoder
     
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    28,017
    It just means that both jaws merely need to be parented to a kinematic rigid body. You can use a fixed joint for that if you like. Make sure when you move the whole rig, you use:

    MovePosition Moves the rigidbody to position.
    MoveRotation Rotates the rigidbody to rotation.

    ...on the kinematic parent. This ensures stable physics as opposed to moving a gameobject via it's transform.
     
  8. soapstar

    soapstar

    Joined:
    Apr 4, 2011
    Posts:
    56

    Thanks Hippocoder this is making sense to me now :) However the original problem of the jaws going through the object still persists when using 'AddRelativeTorque' opposed to me previously using 'transform.Rotate'. Is there something else i am missing to limit the jaws from penetrating the object when using torque to shut the jaws?


    Thanks for all your help :)
     
  9. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    28,017
    You can't use transform. anything with physics. Doing so breaks it every time. It's only the fact physx is as well written as it is, that it even works with transform commands and tries to save the day. So remove all traces of transform stuff.

    With that in mind you structure it so it is all connected up by fixed joints. This is the sensible physics-friendly way (forces will propagate through the physics setup in a correct manner).

    You should be using http://unity3d.com/support/documentation/ScriptReference/Rigidbody.AddTorque.html AddTorquie, not relative torque, to rotate the jaws at their hinge. If you aren't using a hinge, nows the time to set one up. Do it properly and you won't face headaches down the line :)

    This is because a hinge joint will have limits how far it can open and close. The better you set it up the better it will behave with other physics objects like several objects collected in the jaws etc.

    By using various types of joints to connect the structure together, you also are able to give the joints a little tiny bit of freedom of movement for that robotic arm feel where things wobble slightly when the base movement has come to a halt.
     
    Last edited: Sep 8, 2011
  10. soapstar

    soapstar

    Joined:
    Apr 4, 2011
    Posts:
    56
    Hey hippocoder, thanks for all this help...its beginning to make a lot more sense to me now, thanks very much :)
     
  11. soapstar

    soapstar

    Joined:
    Apr 4, 2011
    Posts:
    56

    Only me again Hippocoder! I have my robot arm all rigged up with appropriate hinge joints and i am applying 'AddTorque' to the jaws, when i apply torque to both jaws they shut on a cylinder for example and i am able to pick it up! Success! However when i am closing the jaws onto the cylinder the jaws seems to bounce off the cylinder until they come to rest, they also seem to push each other back and forth when the cylinder is in their grasp? Is there anyway in which i can stop this 'bounce' when both jaws collide with an object in between? Almost like a 'one way' joint so they don't 'bounce' the opposite way when shutting them?

    I can always try and give you an example project if u would like to look at it.

    Thanks for all your help
     
unityunity