## Vehicles third pass

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

### Vehicles third pass

I am now doing the final touches on the vehicles.
the thing I am doin are:
1-make a load and save utility, make this can make simple for people to use.
2-move the default drive state machine to the controller, this provide default behavior.
3-better modeling of internal combustion engine. (much more realistic)
4-hook joystick controller.
5-conplete the lateral dynamics code for all speeds.

one thing I noticed is the startling differences when driving with the joystick.
I have the drive unplugged for the tire axel so that I can tune the engine.

but now that the tire can be turn smoothly you can see how much different the differential effect is, if you push the car with the mice, you can actually drive around for a long, long time without losing momentum.

and any one who has every try wring a vehicle simulation, or try one from any other engine know that the moment you turn the wheels, the car lose a long of speed because longitudinal drive force on the steering wheel is oppose to the direction of motion.
only a multibody can actually resolve this problem, because it turn out that the force in fact is zero.
and it is the force should be zero. It is a remarkable effect that once you see as an emerging behavior, it make sense, but is something that had bothered me for years.

No that I can finally use a analog controller I can see the nice behavior, that even it was there, it was still hard to see because for the keyboard discrete Input.

anyway if any one read this please check it out with a Game controller and know what you think.

This weekend I will complete the fine-tuning of the engine and plug it back to the drivetrain.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Vehicles third pass

A steering wheel is optimal but i guess only racing game entusiasts have those.

What do you mean with the force being zero? That a vehicle will never lose forward momentum even when turning?
If you drive a vehicle straight in neutral gear and it would roll 100 meters you mean it will roll 100 meters even if driving in a slalom pattern? Wouldnt the lateral friction from the tires cancel some of the longitudinal forces out?
Sweenie

Posts: 492
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

### Re: Vehicles third pass

yes a vehicle coasting a 10 m/s in straight line, should preserve it velocity if is tune say 20 degrees.
this is not 100 true during the trisnsion state, but it is truth once the vehicle reach steady state.

say the vehicle loses 1 m/s during transition, the once is settle it sound state a 9 m/s for a long time with no lost of momentum due to tire forces.
This is quite remarkable effect that is difficult to understand when using reduce coordinate forces, but once the physics is write in generalize system, where the center of motion is the vehicle center.

Then the physics has a remarkable resembling to a planet like or a moon going around another planet.
In fact the physics of drifting happen to be the physics of a small planet in gradational lock like the moon or like mercury. yes that right the moon is in a perpetual drift around the earth.

One way that can make it a coasting car should no lose momentum is this.
when the car is on steady state, (this mean a motion where the acceleration are all zero)

another to say this is that is a motion where the dot product of the net force acting on a body and the velocity of the body is zero. This what happen when you have a multibody coasting.

the force of the body are no zero, but the are perpendicular to the motion.
but how can this be?
the only way this can be is if you have a way to make such that the forces on each tire have different values so that the sum of the along the velocity is zero, and perperducar to the velocity amount to the centripetal acceleration.

the front tires spin free in lock with the ground the rear time are force to do that kinematic relation by the differential.
This is very difficult without a differential, and impossible using recast car and forces.

here is the interesting part, when a body is going on and angle, it is also possible that the car have an angular velocity that make the body spins the same amount that it translate around the turn radius.
and that this is what lock the car on a drift maneuver.

so ever car that is turning is in fact a drifting car, in just happen that when the angle between the car longitudinal axis and the trajectory is zero, when this angle is no zero than the physics of drift.

so yes is possible to simulate pemertual sustained drift and control a car with the throttle to generate variable centripetal acceleration and different orientations.

I am hopping to have some sort of demonstration this weekend.
this is going to be by far the most realistic model in newton yet.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Vehicles third pass

I committed so more handling.
now the engine off and engine idle state
please if you can check it out

the start button is 1 in the joystick (usually the one on the right thong finger)
the hand brake is the trigger.
the throttle do steering breaks and acceleration.

what I do is that I start the engine, then I push the vehicle with the the mouse, and try to cost around for a while.
you should expect the car to drive for a long time without losing speed.

this seem a very simple thing, but believe me this is no as simple as it looks in the demo and that's the beauty of it, it is so smooth, that is seems trivial.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Vehicles third pass

I am looking for a sound library to plane the vehicle sound I am looking at openAL which is very small and simply, fmod is very nice by is commercial so not luck there.

Hey Sweenie here is an example of what I say how people has normalized bad programming over the years. https://www.youtube.com/watch?v=iKsx2faLKYw

This guy is explaining how to make a sound engine go smooth, assuming that all the bad programming people do when the make vehicle simulation is right and that the sound is wrong.

I do accept that you have to do that when this is what you get, what I do no accept is that people propose these asshack as fi they are law of physics.

he is assuming that if you press the acceleration on a car that the engine RPM jump is discrete steps, and he accept that as a fact of the law of physics never make a disclaimer.

so the people at fmod make the bad programing part of the technology, the added a parapet and the called smoothing which is nothing but a low pass filter.

the truth is that car engine in game jump for zero to what engine arbitrary value because the engine does not exist, they simple use a torque- rpm curve to model the engine.

In reality a real car you cat step in the gas pedal in idle and the RMP will increase fast, but will no jump form zero to 8000, because car engines rotor has mass.
In newton the engine is actually modelled with a rigid body, so the smoothing come out naturally from the simulation.
these are things that bother me form the world on the self appointed experts, they figure out these hacks, and they want to normalized then as if these are law of physics, rather that say this is who we do these feature, but beware this is not physically correct or not even plausible simulation.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Vehicles third pass

JoeJ

Posts: 1160
Joined: Tue Dec 21, 2010 6:18 pm

### Re: Vehicles third pass

I am sure is very good, but is approximately 300 mg of compiled code and do not seems to be open source, plus has a special licence.
300 mg is too much, that will probably balloon to twice as much if put in GitHub.
that's probably even larger than wxWidget that we just removed.
Github makes a huge database hidden file in your system.

the Newton Download is now under 100 megabyte and most that is medias assets

when the time come I will try openAL, which is tiny, and use hardware if available, plus is open source. although I do not find the source download anymore.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Vehicles third pass

Yeah, personally i've always been happy with OpenAL. But it seems dead? Strange there are not more audio libs around.

JoeJ

Posts: 1160
Joined: Tue Dec 21, 2010 6:18 pm

### Re: Vehicles third pass

I wouldn't say it is dead. Keep in mind, that OpenAL (like OpenGL) is an API specification, not a library or specific implementation:

http://openal.org/platforms/

OpenAL-Soft (https://github.com/kcat/openal-soft) is an open source implementation, which is very actively developed, supports many platforms and is widely used.

However you are right in so far, that the original reference implementation by Creative (including hardware acceleration) seems to be dead meanwhile.

Strange there are not more audio libs around.

For games OpenAL-Soft indeed is one of the few open source audio libraries - if not the only one.

Other than that most game engines (Unity, Unreal, CryEngine, ...) already come with integrated audio solutions. Also WWise seems to be used more and more (https://www.audiokinetic.com/products/wwise/).
d.l.i.w

Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

### Re: Vehicles third pass

OpenAL-Soft (https://github.com/kcat/openal-soft) is an open source implementation, which is very actively developed, supports many platforms and is widely used.

I did see that one, I will probably use it.
There is a SDK download at the openAL site and it is very lightweight, we maybe use that too.
I think that one do make use hardware DSPs on the PC sound card.
we do not really need sophisticated sound, this is most for tuning physics event and make sure they work.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Vehicles third pass

Use OpenAL, it is small and reliable. It's not dead, it's just finished. Nothing more needs to be added to it. It works everywhere but may need the OpenAL installer to be run (if the user hasn't already installed one of the thousands of games that use it).

I will be working on this next week. We had problems with the previous vehicle implementation.
pHySiQuE

Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

### Re: Vehicles third pass

do not get me wrong. sound has made lot of advances in the last 15 years.

OpenAl is small because it does no catch up with new features, it give you basic fumtionality like mixing, stereo, panning volume, and some other basic filter.

today sound engine have amazing fumtionality, eco, 3d, and sophisticated filters.

OpenAL is good for newton because source, size and license is more importartant the functionality.
beside we only need basic functionality if we need sound at all.
fmod is quite amazing, but some people will no use it because of the license.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Vehicles third pass

Are the updated vehicles ready yet?
pHySiQuE

Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

### Re: Vehicles third pass

pHySiQuE

Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

### Re: Vehicles third pass

are you going to use it?

There are two thing pending.
1- add pre pass so that the vehicle lateral stability at high speed.

of the two the file load is an option that has turned out to be a little problematic, I have no put to much effort because is more like a debug feature.
The problem is that when serializing data is fine if the data goes to a text file, but the loader can not be a simple deserialization, because any change on any class member variable, any data in the file render the file unreadable.

The first one is more important and that is regard to lateral stability.
This is that a vehicle is stable when the are under steer gradients.
there are three kind of vehicle steering.
Under steer, neutral steer and over steering.

Neutral steering is when the vehicle will follows the path of the arch circle described by the tire angle.
Under steering means that at some steer angle and at some speed the vehicle will drive for the outside the ideal circular path.
Over steering mean that at some speed and some steer angle the vehicle will diver to the inside of the ideal path into a spiral.

all front wheel drive vehicles are under steer.
most four wheel drive car tend to be neutral or under steer, this is why most physics engines implement front and four wheel drive car, and never rear wheel drive cars.
Rear wheel drive car tend to be over steering,

The reason this is important is that under and neutral steering cars are boring to drive.
They do not drift or power slide.
This is why I am trying to make the newton vehicle over steering.

over, neutral and under sterrimg is just the way people is the vehicle industry called something the is dynamics is called: unstable, indifferent and stable equilibrium.

basically, indifferent and stable equilibrium (understeer and neutral steer) means that is you are traveling in a straight line at a constant speed, or taking a turn, the vehicle will recover its state if any perturbation is applied. this is stable but boring.

Unstable means that a small perturbation, produces positive feedback that will increase the perturbation. Most higher end sport cars and all race car are over steer vehicles, because that are quit to respond but they need a profession driver to control them or the driver will crash the car very easily.
Today most high performance car (lambos, ferraris porches, etc) have a computers that assist the driver so the car act as understeering, only all race car do not comes with the kind of controls.

This is were the Newton Vehicle lateral stability control coming in, I want to add it so that the can is fund to drive over a wide range of parameters but that is also controllable.

you can read about these definition in the class, I really like that professor

The last reason I stop was
1- I wanted to add the new graphic GUI that let me use joystick, and I have that done already,
2- there has not been any interest in the vehicle, and if there is not demand, as soon as I get tired, I move to some other area until some one bring the issue on.

has you at least tried to get the car going? if you try then I can complete that last face.
Julio Jerez
Moderator

Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next