Impulse and collision in the joint

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Impulse and collision in the joint

Postby neki1 » Thu Apr 14, 2011 2:09 am

I have a table-like object. The table-top and the legs are jointed and the joint is limited, allowing to move in the motion bracket, so when pushed from side it will be supported by the joint limits, legs leaning sideway, and table-top horizontal. It moving in the vertical plane. The table is heavy, and kept on the floor by the gravity.

What I want to model is that if it pushed with sufficiently large impulse (F*dt) from side, the table would overturn around its leg while the table top will sit on the joint limits.

What I get is that the table-top gracefully and nicely stops - no matter how large the impulse, the joints largely overshoot (depleting all the motion energy, not just that of for collision in the joint) and remains there, but HingeGetJointAngle(tableJointRight) shows the clamped joint limit only. Therefore no energy left to overturn the table. I am on Newton 2.30, and using commands like

NewtonSetSolverModel(nWorld, 0);

tableJointRight= CreateCustomHinge(&legMatrixRight[0][0], legRight, tableTop);

HingeEnableLimits(tableJointRight, 1);
HingeSetLimits(tableJointRight, - deg2, deg90);

CustomSetSubmitContraintCallback (tableJointRight, HingeControlledByAngle);

I searched through the forum, tried to tweak the callback in every way without success, and new to Newton.
I think I checked the trivial things but would need an expert insight. The truth somewhere in the material parameters and the solver logic.

Thanks for any hints,
neki
Last edited by neki1 on Thu Apr 14, 2011 9:50 am, edited 2 times in total.
neki1
 
Posts: 5
Joined: Thu Apr 14, 2011 1:47 am

Re: Impulse and collision in the joint

Postby Julio Jerez » Thu Apr 14, 2011 6:37 am

can you make a skectch? I can not figure out what you want to do.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Impulse and collision in the joint

Postby neki1 » Thu Apr 14, 2011 9:42 am

Julio Jerez wrote:can you make a skectch? I can not figure out what you want to do.

Something like this:
Last edited by neki1 on Thu Apr 21, 2011 9:28 am, edited 1 time in total.
neki1
 
Posts: 5
Joined: Thu Apr 14, 2011 1:47 am

Re: Impulse and collision in the joint

Postby Julio Jerez » Thu Apr 14, 2011 11:52 am

you want the effect on the lower image I assume.

you are running into the limits between and ideal approximation and reality. a Rigid body simulation is just an approximation of reality, but it is a very good one.
there are few problems going one here in both case reality and the Approximation.

If you ask a Mechanic or a carpenter to make a think like that for you he will immediately tell you that it will never be strong enough to withstand the side force.
He will suggest to add brakes between the leg and the table top,
the problem is the at the corner the torque that any glue will have to produce to keep the contraction in shape will be so string that the material stranding the part will deform and the table will react all smoggy just like you see in the simulation.

Ironically and rigid body abstraction should be able to recreate that contraction provided that with can deal will number with infinite perdition.
The simulation is an idealization of how infinity strong body behave under forces, as such the joint will generate the force to keep to going however just as in real not material is infinitely strong,
in a computer not floating point representation is initially accurate. so while the physics is correct, we run into a mathematical problem called condition number.
Basically the system matrix generated by that configuartion has what is called high degree of singularities and prevent any numerical algorithm from converging to a solution.
what you are seen is actually correct from the mathematical point of view.

The second problem is that since Newton is a real-time simulator, it cannot make an structural analyzis of the system matrix to determine the weak point, is just try to solve the system doing a few number of iteration.
you can increase the number of iterations and make a little better, but like I said since the system is singular It will do much good, basically the forces will go higher and higher in each iteration,
basically as the force increase they do so by adding a small quantity to an accumulation.
but is numerical analysis when to add to number like a = b + c,

the result is a = b + c + epsilon

where error is bounded by the epsilon < fabs (a) < abs (b)

as one of the two value become much larger than the other say b >> b
then the small value be has no longer meaning as compare to the random error that is produced in the operation, is a effect the noise added by b to a is more dominat that the value of b.

this is something you find in the universe in everything, you cannot make and unlimited copies of a copy, you cannot have a infinitely rigid body, you can not amplify a signal for ever,
you cna no increase you speed indefinitlly, and so on.
in a compute, you cannot execute unlimited number of iterations in an algorithm because a some point the error convert everything into random number.

The sad thing is the even if you add brakes joint connectin teh table top to teh legs, like any carpenter would do, that will not work either because the rigid body simplification,
basically connecting the table top to a leg with another joint will simple add another singular column to teh system.

what you can do is to make another rigid body and connect one with hinge to the middle of the leg
and the other end with a hinge to the middle of the table top, then use hinges instead of solid joint to connect the legs.

what that will do is the it will remove the rows that are singular, (meaning require large force to maintain the constraint) and replace with joint which will need small forces.

then you can make the Brake body invisible
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Impulse and collision in the joint

Postby neki1 » Sun Apr 17, 2011 5:49 am

Thanks, Julio.
neki1
 
Posts: 5
Joined: Thu Apr 14, 2011 1:47 am

Re: Impulse and collision in the joint

Postby neki1 » Mon Apr 18, 2011 2:12 pm

Hi Again,

I don't understand the relation of the 'stock' and 'user' callbacks for the joints.
Some subclassed joints have well developed 'SubmitConstraints' function, which are called before the user callback:
Code: Select all
   // call the constraint call back
   joint->SubmitConstraints(timestep, threadIndex);

   // if there is a user define callback call it form here;
   if (joint->m_userContrationCallback) {
      joint->m_userContrationCallback ((const NewtonUserJoint*) joint, timestep, threadIndex);

Some user callbacks also handles joint limits. Will then both routines handles joints limits overwriting each others effects? Seemingly not. But I'm badly confused. I'd like to have access to m_minAngle, m_maxAngle; from the user callback, which I don't see how to do. Thanx.
Last edited by neki1 on Thu Apr 21, 2011 9:29 am, edited 1 time in total.
neki1
 
Posts: 5
Joined: Thu Apr 14, 2011 1:47 am

Re: Impulse and collision in the joint

Postby Julio Jerez » Mon Apr 18, 2011 2:50 pm

the user callback is my way to provide object oriented support for non C++ languages.
if you are using C++ you do not need to worrie just derive from the joint call to want wite your code in the Virtual SubmitConstraints
an example can clarify.

In C++ say you wna to make a motizide Hinge, you can aderive form Hinge, and override SubmitConstraints like this
Code: Select all
MYHinge::SubmitConstraints()
{
   Hinge::SubmitConstraints()
  // add extra constration
}

if you are using C or othe language that do no support classes,
then you can not override the base class but you can register a m_userContrationCallback, that will be called after the base class and there you add the extrat joint.
I hope that makes it clear.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Impulse and collision in the joint

Postby Stucuk » Tue Apr 19, 2011 1:36 am

Julio Jerez wrote:if you are using C or othe language that do no support classes

Languages other than C++ that support class's won't support C++'s classes because they are a different language.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Impulse and collision in the joint

Postby neki1 » Tue Apr 19, 2011 2:35 am

Using c++. While we are here, most ppl using callback for their own limit handling and motorized joints while there is a full flagged functionality of those in
Code: Select all
void CustomHinge::SubmitConstraints (dFloat timestep, int threadIndex)
{ ...

that still didn't get, how SubmitConstraints and the callback don't interfere with each other. Just curious. Anyway, will try to follow Julio advice, since my (beloved) c++ skills got rusty, I would appreciate some pointers to ready examples, to shorten the configuration of this part of the programming. Wanted to have motorized hinge, possibly on top of CustomHinge what I use now, and using callback at the present.
[Edited] for the Record: works now, by SubmitConstraints. Thanks.
Last edited by neki1 on Thu Apr 21, 2011 9:40 am, edited 1 time in total.
neki1
 
Posts: 5
Joined: Thu Apr 14, 2011 1:47 am

Re: Impulse and collision in the joint

Postby JernejL » Tue Apr 19, 2011 3:47 am

Stucuk wrote:
Julio Jerez wrote:if you are using C or othe language that do no support classes

Languages other than C++ that support class's won't support C++'s classes because they are a different language.


It's mostly a matter of being binary-incompatible (internal records, VMT tables, etc..), i believe even different C++ compiles don't generate binary-compatible object structures internally and won't work the same.
A while ago i was thinking of building a self-generating piece of code to achieve binary compatibility with c++ objects within delphi, it's certainly possible to automaticly generate code for a c++ object wrapper but in the end i went and worked on more sane things instead.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Impulse and collision in the joint

Postby Julio Jerez » Tue Apr 19, 2011 2:32 pm

Stucuk wrote:
Julio Jerez wrote:if you are using C or othe language that do no support classes

Languages other than C++ that support class's won't support C++'s classes because they are a different language.


what I meand was a way to impelmnet objects, for example Java, objecetive, c#, and Phyton support classes in virstual functions
while Pascal and C do not supprt that kind of funtionality
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron