Vehicle model for 3.14

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Vehicle model for 3.14

Postby Julio Jerez » Sun Mar 27, 2016 9:14 pm

Guys anything new with the vehicle is good but this could be really good.

After being sick and tire of adding code to component for numerical error solving the vehicle, I decided to develop by has a Generalized Coordinated Langragian formulation for all of the vehicle drivetrain.
I used the D'Alembert's form of the Langragian because that version let you get the constraint forces, while using Lagrange getting the Constraint force take more work.
This is quite tedious and it took me two weeks to get all the e correct to get the correct Jacobians
but it turned out that after to get what is going on, there is a lot of symmetry in the system
Here is a picture of what the vehicle solver solves.
car.png
car.png (47.61 KiB) Viewed 9047 times


The first image is the single axel differential with motor, clutch and gear box, 6 degrees of freedoms
The second is the two axel differential for two wheel cars. 18 degree of freddom.

Everything is simulated realistically and now I can add use data from vehicle data sheet without having to hack the values to god around the solver limitation.

The engine rotor mass and inertia can be very small, whiel it can generate the torque from the engine torque data, the transmission gear and differential gear are even a lot smaller, while the tire can have proper size and mass. And the solver has no problem find the solution

I just check in the code with the vehicle suspended in the air, so that you can see the four wheel drive differential in action.

Notice that when to spin one wheel the other spin in the opposite direction just like real car do.
if you apply the hand brake, the rear tire stop, the engine loses rpm, but the front tire still get power, just like rear four wheel drive car.

The engine always distribute power to the tire in the proper ration, in fact the tire can be all of different sized and the power get distributed correctly. so not longer we have to worry that the contact are on the tire surface.
Real car can still drive straight, even the tire radios are different sized, with the solve our car will be able to do that too. :mrgreen:

please check it out and let me know what you guys think
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle model for 3.14

Postby Shaderman » Mon Mar 28, 2016 2:23 am

This looks awesome already! Race anyone? :mrgreen:
Shaderman
 
Posts: 66
Joined: Tue Mar 08, 2016 2:51 am

Re: Vehicle model for 3.14

Postby JoeJ » Mon Mar 28, 2016 6:10 am

The demo seems broken.
I can start engine, throttle and break, wheels turn but car does not move.
Can't set another gear than 1.
I have gamepad pluged in but nothing happens pressing it.

Edit:
Compiled in Win32 debug (VC 2013), almost all demos crashed.
Then x64 release, demos worked again, but car still does not move.
Maybe double prec. enabled accidentely?
dragging a compond shape into floor in compound collision shape demo makes it explode.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Vehicle model for 3.14

Postby Shaderman » Mon Mar 28, 2016 7:58 am

Hi JoeJ,

I wondered myself in the first place, but...

I just check in the code with the vehicle suspended in the air, so that you can see the four wheel drive differential in action.


It seems to be WIP :D
Shaderman
 
Posts: 66
Joined: Tue Mar 08, 2016 2:51 am

Re: Vehicle model for 3.14

Postby Julio Jerez » Mon Mar 28, 2016 9:55 am

JoeJ wrote:dragging a compound shape into floor in compound collision shape demo makes it explode.
what demo did that Joe?
I tested the compounds that add four spherical compound of convexes but I did not see it. Is there a way to make it happens?
It is possible I forget some pathway that do not clean up the intermediate shape instance when dealing with compound.


Joe the vehicle demo is not broken, the vehicle is suspended on the air.
I want to test the engine/clutch/differential/gearbox/break with out the effect of the vehicle.

Is kind of an open loop test to check how the drive train stability at high and low speed. kind of like a smoke test.

Now I need to plug the tire torque resistance coming form the brush model, and see how the car moves. but all that code is there already, I just nee to re arrange a little.

notice that when you apply the engine torque, if you touch a tire the other tire accelerate, this is correct behavior, basically the differentials distribute the momentum to all tire in other to conserve it. Those little things do no look much but those are the thing that make vehicle behave the they do.
for example when a car turns the rpm of the inner tire should be less that the rpm on the out tire.
finding the toque distribution to achieve that kinematic relation seems easy until you consider that the force that drive the tire are hilly non linear. with this model all that happen naturally regales tire sized or what torque are acting on them.
one example is some sport car have rear tire different that the front tire and the are four wheel drive, this model can handle that without problems.

my next step is to plug the collision and see what we get.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle model for 3.14

Postby JoeJ » Mon Mar 28, 2016 10:49 am

Its the "Compoind collision shape" dame. With exploding i mean huge reaction forces making the debris ball jumping around wild when i drag it into the floor (but the compound keeps intact).
Same beahiour in the Infinite user plane collision demo.
I'm not sure if it's because the big force from the user interaction, or if it indicates a bug.

Would it make sense to cap huge external forces on your side?
Maybe you can do some math or heuristic to prevent those cases better than we can do?


Ha ha, I really did not notice the car is up in the air :)
Playing with the wheels is like the Lego car with differencial i had as a child.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Vehicle model for 3.14

Postby Julio Jerez » Mon Mar 28, 2016 12:50 pm

JoeJ wrote:Same beahiour in the Infinite user plane collision demo.

Ha I wm going to try reproduce there.

I'm not sure if it's because the big force from the user interaction, or if it indicates a bug.

yes that would be a good idea, but we know is was working before I made the changes to the collision system, therefore it must be a bug there.
Adding that kind of protection usually hide a bug, just to manifest in some other place.
Take for example the cap that I added to prevent high angular velocity. it worked great in almost all cases until I try to make a vehicle drive a high speed. a vehicle driving at 100 miles an our with a tire that is 0.3 m in radio, the wheel spins more than tow complete turns in a single step.
This is why I am very reluctant to add that kind safety.

anyway I see if I can reproduce that bug an get it fixed. the next feature will make heavy use of compounds.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle model for 3.14

Postby Julio Jerez » Mon Mar 28, 2016 12:52 pm

Joe I am confused, when I play user infinite plane, I see a little box dropping on the plane.
Is that the demo that you saw the high forces?

when I try use height field, there are some small compound there, but I do not see the bug you describe there.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle model for 3.14

Postby JoeJ » Mon Mar 28, 2016 2:14 pm

In other demos if i pick a body and drag it into floor it might jitter, or go through the floor.

But the big 'debris balls' in Compound collision shape demo behave really wired.
Lets say those balls have a diameter of 4 m.
I lift one up 2m.
I drag it down with a force of about two times gravity and try to pull it 1 m below the ground.
After trying 3 times, it either starts jittering heavily or jumps 20m to the side, while i still hold it.

Try again, i can make a video if you can't see the same.

Tried Debug, Win32 Release and x64 Release - all the same. I have old i7 930 without AVX - could make a difference if double prec. is accidently enabled in 2013 project.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Vehicle model for 3.14

Postby Julio Jerez » Mon Mar 28, 2016 3:04 pm

Can you make a video please so that I can see how you do that and I can do exactly?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle model for 3.14

Postby JoeJ » Mon Mar 28, 2016 3:49 pm



Mouse pointer hidden, but i'm moving quite slowly.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Vehicle model for 3.14

Postby Julio Jerez » Mon Mar 28, 2016 3:55 pm

On I see, yes that's quite wacked.
My guess is that I have something still incomplete in the mesh or height field vs compound

I will check it out tonight.
Thank you the repro.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle model for 3.14

Postby Julio Jerez » Tue Mar 29, 2016 10:21 am

Ok I was able to modify the demos so that ir reproduce the bug exactly each time, as you can see
the bug is with compound generation contact that are out of place.

This Is one of eth consequences of the new collision system design objective. It is no big deal, I will fix to morrow, late for work already.

Basically what this si the history;
before In 3.xx the collision contact calculation was in global space.
before 3.13 contact calculation was in the local space of one of the colliding shape, this is actually very stable but requires lots of algebra manipulation with dealing with non uniform scales. Plus I always had to make a decision as which shape was more convenient to use a the local system. In the end is became too confusing and hard to maintain.

For 3.14 contact calculation is in a local space common to both shapes.
what this requires is that both shapes should make a temporary instance of the collision shapes before the collision and the after collision apply the transform to the contacts.
I see that some how I am doing some kind of double transformation with doing compound collision so the contact seem to be translated twice. you can see it in the image
Untitled.png
Untitled.png (288.16 KiB) Viewed 8978 times

I will debug later, but I believe I know what it is, thanks for exposing that bug.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle model for 3.14

Postby JoeJ » Tue Mar 29, 2016 11:14 am

I knew nonuniform scale would become hard to maintain :wink:
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Vehicle model for 3.14

Postby collerblade » Fri Apr 01, 2016 10:22 am

Any progress on this?
I tried the new code today, and it looks everything is broken. The vehicle cant even stand still. It gets ignormus forces, and flies to the sky.
How do i start the engine now? I tries engineControl->SetIgnition(true) , but didnt works.
(my vehicle worked a month ago)
collerblade
 
Posts: 88
Joined: Mon Apr 05, 2010 12:09 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron