Refactoring joints

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Refactoring joints

Postby Julio Jerez » Tue Mar 13, 2018 3:38 pm

ok I refined the demo, the shape now resemble the actual shape the use, you can see the enter made for wood is totally asymmetric, but he one that are like Gems are almost symmetry and the asymmetry is a very small thin irregularly on one side, is this trick the rotate the principals axis so slightly.
That tells me that the skewers of the inertia matrix if critical to get the effect,

you can see that professor Walter Lewin Lewin points that out, if a shape with a very skew inertia matrix the effect does not happens, I disagree, I believe the effect should happen for all shape, is just that the space is why chis happen is outside of the practical limit physical constraints of nature.

for example I was trying to simulate a earth precession, and it seem as if not matter what I did in did not worked, the I let the simulation running for hours and when to watch TV, and when I cam back the annual velocity and almost at 80 degree,
so I check out the code. and what happen is that the prevision rate is a function of the difference for the skew inertia (Imax - Imin) / Imax
so the period of that rotation is very, very large value. this is because for a sphere all axis are axis of symmetry no wonder the earth precession is 26 thousand years.

of could I could fake the value and made I min a long small, so that (Imax - Imin) / Imax grows larger, but that will be cheating, then I realice that we do parcticla example have example of this, is called the Frisbee effect
https://www.youtube.com/watch?v=DLdyR6ZMIwk

basically by making Imin smaller is the equivalent of make a thin cylinder, so I made the demo with a thin cylinder and it works by the book, processing at twice he main omega.

here is the interesting part if Imin == IMax the precession will be zero. and the will be a spherical shape. so the object wil rtale liek si was preseccing and will conserve angular velocity and angular momentum because that the case where Ixx = Tyy == Tzz
this is not wrong but is not right either because is a special case.

This is hwo Mr Kenny Bodin and his student de managed to unilaterally discredit me and may work, base of a total fallacy of an argument fro autoritity.
http://www8.cs.umu.se/education/examina ... gRolin.pdf

if you open the link and go to page 38. you will see the graph of angular momentum total energy.
there is so much wrong with that methodology that is breathtaken. I will just address the Giro part

The general equation of motion is this
I * a = T - w x (I * w)
but T = 0 so the equation is
I * a = - w x (I * w)

and the energy will be
E = w.Dot ((I * w))

as you can see of the three engine they tested, ODE was the one that was trying to do the right thing,
basically ODE was integation this

I * a = - w x L
but since ODE uses an explicit integration, that blew up and
E = w.Dot ((I * w)) went up out of control

Netwon was ignored Gyro velocity torques
I * a = 0
and
I * a = - w x (I * w)

which is the sine wave you see in the graph
because in newton the torque was a responsibility of the callback, but the did not do it and when called on it, they simply ignored me.
https://pybullet.org/Bullet/phpBB3/view ... f=4&t=1334
Instead to cut all my post and placed them out for contactex in one thread.

Had they add the torque function I posted, the energy would be conserved but not the angular momentum, and it would behave more like ODE but without explosion of energy because the position corrector integrator in newton took care of that.

what Novodex was doing was a total cheat the did this
Ix = Tx = Tz
therefore w x (w * L) == w x (w * Ixx) = 0

so they integrated
I * a = 0

and the energy was
E = w x (w * Ixx) = Ixx * w^2 = const.

you would think a self appointed expert like Kr Kenney Boddin would see thought that, instead he accepted those result an published it. This is what they concluded.
As shown by the results this test is hard for ODE and Newton. When running the simulation a little longer, the Newton toolkit will make the object stop moving. The simulation with ODE will explode. The documentation for ODE(section 12.12) explains this problem and gives some suggestions on how to make a simulation more stable. The suggestions are not used in this test since then the physical aspects wont be fair to the other engines. Novodex handles this test best, but still does not conserve angular momentum.


That was how they beat Newton based on a fallacious lies, and to this day that document has been used as a weapon in google scholar to discourage people in academia from even considering using the newton engine.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Refactoring joints

Postby Julio Jerez » Tue Mar 13, 2018 4:48 pm

I now have a far better presentation of the beat, I realize that this demo is batter to make interactive,
giving an initial angular velocity will do just once an after it spins in the right directing I won't flip anymore.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Refactoring joints

Postby Julio Jerez » Wed Mar 14, 2018 6:40 pm

hey Sweenie, I added the code to support full inertia matrix rigid bodies.
If you sync you cna see that is kind of try to do it, but not quite,
teh reason is that the integration of the angular velocity is in dgDynamicsBody, and the solver call it by doing an explicit casting, so overloading the function will not work.
want I fix that to night I am fully convince this is a done deal.

basically the only thing need it is a function that save the rotation matric it a local variable then save the matrix time the principal axis, call the base call integration and restore the all matrices.

I did not want to rush it because the body keep the rotation of form of quat and in form of matrix, no sure is I need to save both. not a big problem

Just like dr Lewin showed in his video if you nudge a little, it art spinning in one direction. :D
is not very clean but that because the integration of not full right yet.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Refactoring joints

Postby JoeJ » Thu Mar 15, 2018 2:14 am

Please correct me if i'm wrong:

Storing inertia with 3 values can represent the shape of an ellipsoid.
Storing with a 3x3 matrix can represent a sheared ellipsoid.

To represent a tapered (and sheared) ellipsoid you'd need a 4x4 matrix, but also perform divisions, like a perspective matrix?

Just asking out of curiosity, and i don't know if shear alone can reproduce that rattleback.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Refactoring joints

Postby Julio Jerez » Thu Mar 15, 2018 10:02 am

here is your sign Sweenie


I made a video you show the range of operation. is think I can explain intuitively why the effect happens.

basically you get is tow pendulum, one along the should inertia and one along the secund show inertia
whne teh shape has tow axis of simetry, these two pendulum have the same period, but when the long axis of inertia is slight tilted, the two pendulum get a phase angle and possibly one get a shorter period, the combined frequency is either additive or subtractive based on the spin of the main axis. when it is subtractive the period becomes smaller and smaller because of the phase angle, increasing the frequency and this is what people called rattle, until it changes sign and at that point is just additive and does not change anymore.

The setting are very critical if you give too much momentum the swing on one pendulum can over turn and the effect is gone, this is why I did not see for a while until last nigh I was thinking that the effect was missing for one of three reason.
1-the parameter are wrong
2-the simulation rate was too slow
3-teh work space was wrong was either too fast of too slow.

it turned out I was trying to do it too fast and teh pendulum were overshooting.

This is why you see people add weight to the side to make more resistant to swing, but whe do not have a way to do that easy with just one shape, you would have to make a compound and put the various components each with it own property and use that to set the mass property,
I see if I can do that thsi weekend so tha the effect happen on a large range of parameters.

but as far as I m concerned yes we can reproduce the effect by the book.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Refactoring joints

Postby Sweenie » Thu Mar 15, 2018 11:18 am

Haha, awesome :D
I guess Newton Dynamics could almost be called a physics emulator instead of simulator :lol:
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Refactoring joints

Postby Julio Jerez » Thu Mar 15, 2018 12:17 pm

JoeJ wrote:.....
To represent a tapered (and sheared) ellipsoid you'd need a 4x4 matrix, but also perform divisions, like a perspective matrix?

Just asking out of curiosity, and i don't know if shear alone can reproduce that rattleback.

It is all correct until the 4 x4 matrix, which may be right if you are doing graphics, but at that point linearity is lost, so shear transformation are not supported.

The point is that the effect does happens in nature with that trick, we seen videos of people making those models and how they get the inertia to be just so slighlly skew. And it just happens.

The way to skew the inertia is by rotating the shape by a small angle, but the low level need to know that the inertia is not longer aligned to the principal axis.

I = Inv(r) * Ii * r

Instead is

I = inv(r) * inv(t) * Ii * t * r

And doing the same for the inverse and so on, and it should work, if it does not work is not the experiment that is wrong, it will be the simulation. And adding extra stuff like 4 x 4 matrix to do shearing is just not correct.

It is possible that some objects do have the property of a shearing inertia matrix, planet earth for example, but that's because part of the mass is fluid, but we are not concern with that.
And example of this is the boiled egg phitop, if you try a row egg it will not rise because the inertia is changing. Gyro torque are very strong.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Refactoring joints

Postby JoeJ » Thu Mar 15, 2018 12:46 pm

As expected, thanks. I thought you'd need shear to reproduce the experiment and would not be able to do it. Cool to see it working :)

There's actually an interesting discussion about character animation: C E N S O R E D :P
Seems many people are still not very open minded to the idea and full of wrong doupts.
Last edited by JoeJ on Thu Mar 15, 2018 4:24 pm, edited 1 time in total.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Refactoring joints

Postby Julio Jerez » Thu Mar 15, 2018 3:03 pm

I read that thread in GDN it's a long time I gave up on that,
Game Developer Dot Net is the latrine of all the game forum and not a good one, is offensive to Latrinas to be compared to GDN, it is corrupted and the moderators are instructed to bullies anyone how disagrees with the status quote. GDN is pay to play site, not pay and the moderator will slander you.

if you want to know an example of a self appointed expert moron that would be that dude
Scouting Ninja.

Those simplistic explanations of how to do some tricks are loopholes that may work her and there for one game, or demo, but very soon run out of steam.
if you do no do the physics using analytical expression that is consistent and can scale up, than is just that, an interesting peculiar thing.
and this is what happen with the crows at Game Dev dot Net.

I remember ten years ago, I was there with a no name account and told one guy that shape matching soft body was not physics, but the moderators moron by the name Growding or something like that, closed by account. In another occasion one dude was debating that it was possible to do Laurent Transformation Relativistic physics using Physx. These are the kind of stuff you find in GDN is kind of like a tabloid of game development.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Refactoring joints

Postby Julio Jerez » Thu Mar 15, 2018 3:22 pm

I made a post on dr Walter Lewin youtube channel.
https://www.youtube.com/watch?v=hmHV-HF-22s&t=193s

I would love to talk to that man about classical physics and get his ideas.
I have followed his lectures for a long time and much I know come from his classes.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Refactoring joints

Postby JoeJ » Thu Mar 15, 2018 4:24 pm

Haha, response even harder than expected... might be better to remove the link from my post to hide the traces... :mrgreen:

Having learned what it means to be treated unfair myself, i won't blame you for your polite behavior anymore. You may be right, but there is audience, so i'll continue my mission to do some advertisement. :twisted: Opportunities are rare anyways, because all people are happy with their lousy tools.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Refactoring joints

Postby JoeJ » Fri Mar 16, 2018 12:49 pm

Julio, have you already thought about the transition from out of joint limit to motor inside the limit?

I'm currently working on the ragdoll joint again and found the final bug. Fixing this broke my simple approach of doing a hard switch depending on limit error. The problem now is the child falls down to the limit cone, but because resolving the limit alone does not move it back inside the cone the motor keeps turned off.
Solution would be to allow the motor movement into the limit and prevent movement outwards, but i have issues mixing limit/motor acceleration and max friction.
(I use max friction rows in any case, also i leave relativeAngle parameter in AddAngularRow to zero and use CalculateRowZeroAccelaration instead for the stop at the limit, which all works fine on its own and seems the right direction to unify both things.)

Did you handle this in any joints of yours so i can take a look?
Or does inverse dynamics deal with this for you?

Ah, see it's the latter, so i would not really need to get this working.
But 'll try anyways before creating a commit...
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Refactoring joints

Postby JoeJ » Fri Mar 16, 2018 2:43 pm

Just made side by side comparison between my old motor and the new one with fixed constraint space. Visually i see no difference, both equally fast - no more doupts this will work :mrgreen:

The twist swing decomposition is not 100% robust. I can see this if i enable motor only for the twist - joint goes crazy because the unconstrained swinging affects measurement of twist angle and things don't converge. But in practice this won't be an issue i'm sure.

No need to double body count confirmed. :mrgreen:
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Refactoring joints

Postby JoeJ » Fri Mar 16, 2018 2:59 pm

Whooo! Repeated the test with higher speed. Guess what? The new joint is even better. The old one bends heavily due to centrifugal force, the new one keeps in place. :mrgreen: :mrgreen: :mrgreen:
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Refactoring joints

Postby JoeJ » Sat Mar 17, 2018 2:23 am

Made the pull request, hope this works, but you'll need to readd the recent gyro demo changes in DemoEntityManager.cpp :oops:
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 14 guests