🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Limited-Slip Differential and friends

Started by
22 comments, last by Vu Chi Thien 5 years, 7 months ago

Hi fellow game devs,

First, I would like to apologize for the wall of text.

As you may notice I have been digging in vehicle simulation for some times now through my clutch question posts. And thanks to the generous help of you guys, especially @CombatWombat I have finished my clutch model (Really CombatWombat you deserve much more than a post upvote, I would buy you a drink if I could ha ha). 

Now the final piece in my vehicle physic model is the differential. For now I have an open-differential model working quite well by just outputting torque 50-50 to left and right wheel. Now I would like to implement a Limited Slip Differential. I have very limited knowledge about LSD, and what I know about LSD is through readings on racer.nl documentation, watching Youtube videos, and playing around with games like Assetto Corsa and Project Cars. So this is what I understand so far:

- The LSD acts like an open-diff when there is no torque from engine applied to the input shaft of the diff. However, in clutch-type LSD there is still an amount of binding between the left and right wheel due to preload spring.

- When there is torque to the input shaft (on power and off power in 2 ways LSD), in ramp LSD, the ramp will push the clutch patch together, creating binding force. The amount of binding force depends on the amount of clutch patch and ramp angle, so the diff will not completely locked up and there is still difference in wheel speed between left and right wheel, but when the locking force is enough the diff will lock.

- There also something I'm not sure is the amount of torque ratio based on road resistance torque (rolling resistance I guess)., but since I cannot extract rolling resistance from the tire model I'm using (Unity wheelCollider), I think I would not use this approach. Instead I'm going to use the speed difference in left and right wheel, similar to torsen diff. Below is my rough model with the clutch type LSD:


speedDiff = leftWheelSpeed - rightWheelSpeed;
//torque to differential input shaft.
//first treat the diff as an open diff with equal torque to both wheels
inputTorque = gearBoxTorque * 0.5f;
//then modify torque to each wheel based on wheel speed difference
//the difference in torque depends on speed difference, throttleInput (on/off power)
//amount of locking force wanted at different amount of speed difference,
//and preload force
//torque to left wheel
leftWheelTorque = inputTorque - (speedDiff * preLoadForce + lockingForce * throttleInput);
//torque to right wheel
rightWheelTorque = inputTorque + (speedDiff * preLoadForce + lockingForce * throttleInput);

I'm putting throttle input in because from what I've read the amount of locking also depends on the amount of throttle input (harder throttle -> higher  torque input -> stronger locking). The model is nowhere near good, so please jump in and correct me.

Also I have a few questions:

- In torsen/geared LSD, is it correct that the diff actually never lock but only split torque based on bias ratio, which also based on speed difference between wheels? And does the bias only happen when the speed difference reaches the ratio (say 2:1 or 3:1) and below that it will act like an open diff, which basically like an open diff with an if statement to switch state?

- Is it correct that the amount of locking force in clutch LSD depends on amount of input torque? If so, what is the threshold of the input torque to "activate" the diff (start splitting torque)? How can I get the amount of torque bias ratio (in wheelTorque = inputTorque * biasRatio) based on the speed difference or rolling resistance at wheel?

- Is the speed at the input shaft of the diff always equals to the average speed of 2 wheels ie (left + right) / 2?

Please help me out with this. I haven't found any topic about this yet on gamedev, and this is my final piece of the puzzle. Thank you guys very very much.

Advertisement

Hello Vu,

Would be nice if someone else would happen a long and try to help, but this place seems quieter than it used to be.

I have not tried to do a differential model, but I will try to offer what advice I can...

For starters the wiki page on limited slip diffs is actually pretty good, start there if you have not.  As a very general overview, I would say there are two types that you may want to model:

1) Torque sensitive types, which encompasses ramp loaded, clutch type, and probably Torsens.  The most "general" is the ramp type, since it is very tune-able.

2) Speed sensitive types, which is pretty just much viscous types.

 

Quote

I'm putting throttle input in because from what I've read the amount of locking also depends on the amount of throttle input (harder throttle -> higher  torque input -> stronger locking). The model is nowhere near good, so please jump in and correct me.

So the differential has no idea what the throttle is doing.  Most of them use the loads transmitted by the spider gears in various ways to engage the clutches, so they are sensitive to the torque coming in at their input.  So you can use your torque after it is multiplied by the transmission gear in your function instead of throttle.

 

Quote

In torsen/geared LSD, is it correct that the diff actually never lock but only split torque based on bias ratio, which also based on speed difference between wheels? And does the bias only happen when the speed difference reaches the ratio (say 2:1 or 3:1) and below that it will act like an open diff, which basically like an open diff with an if statement to switch state?

I would suggest forgoing geared type LSDs at this moment.  They are kind of an oddball in the automotive world (other than Audis?).

 

Quote

Is it correct that the amount of locking force in clutch LSD depends on amount of input torque? If so, what is the threshold of the input torque to "activate" the diff (start splitting torque)? How can I get the amount of torque bias ratio (in wheelTorque = inputTorque * biasRatio) based on the speed difference or rolling resistance at wheel?

They are torque sensitive, yes.  I don't know in terms of "bias ratio".  What happens is the torque causes some leverage on the clutch plates which push them together making the two axles want to turn the same speed.

Some very rough psuedo-code.  You have to experiment with the values to make sense!


driveTorque = getDriveTorqueFromTransmissionOutputShaft();

LSDClutch.friction = 0.5f;
LSDClutch.preload = 100.0f;
LSDClutch.accelRamp = 1.0f;
LSDClutch.decelRamp = 0.5f;

if(driveTorque > 0.0f)
	LSDClutchTorque = preload*friction + accelRamp*driveTorque*friction;
else
  	LSDClutchTorque = perload*friction + decelRamp*-driveTorque*friction;

speedDelta = axleL.speed - axleR.speed;

if(speedDelta > 0)	// left axle is faster
  	axleL.torque = 0.5f*driveTorque - LSDClutchTorque;
	axleR.torque = 0.5f*driveTorque + LSDClutchTorque;
else
	axleL.torque = 0.5f*driveTorque + LSDClutchTorque;
	axleR.torque = 0.5f*driveTorque - LSDClutchTorque;

 

Quote

Is the speed at the input shaft of the diff always equals to the average speed of 2 wheels ie (left + right) / 2?

Yes.  As long as the spiders have the same number of teeth.  (This will be the case for all automotive differentials).

 

Thanks for passing by @CombatWombat,

The vehicle simulation scene on gamedev.net is pretty quiet I agree, unlike the 2004-2007 period.

7 hours ago, CombatWombat said:

For starters the wiki page on limited slip diffs is actually pretty good, start there if you have not.  As a very general overview, I would say there are two types that you may want to model:

Surprise. I actually didn't look at this wiki page yet for some reason. I just read on the differential wiki page, but not this one. This even has equation for torque output, so convenient.

7 hours ago, CombatWombat said:

So the differential has no idea what the throttle is doing.  Most of them use the loads transmitted by the spider gears in various ways to engage the clutches, so they are sensitive to the torque coming in at their input.  So you can use your torque after it is multiplied by the transmission gear in your function instead of throttle.

A bit stupid but, the torque input at the differential should not be multiplied by differential gear ratio correct? So instead of engineTorque * gear * diffRatio, just engineTorque * gear. Also the diff is only sensitive to the input torque from the engine to be activated, and I don't have to worry about the rolling resistance torque from the wheels, correct (in term of vicious clutch and ramp type)?

7 hours ago, CombatWombat said:

They are torque sensitive, yes.  I don't know in terms of "bias ratio".  What happens is the torque causes some leverage on the clutch plates which push them together making the two axles want to turn the same speed.

Oh so my early understanding of the model is not correct. I've always think of the output torque to the wheels through the diff as the ratio based on the difference between torque or speed of two wheels, say:

ratio = leftSpeed/rightSpeed

torqueToRight = torqueIn * ratio;

torqueToLeft = torqueIn* (1 - ratio);

 

Another tricky thing is 4WD and AWD, because I would need a total of 3 diffs: 1 center, 1 front, 1 rear.

4WD is a bit easier, as the center diff only needs to  lock up on demand, and LSDTorque needs to be a large number enough to keep the front axle spinning at the same speed as the rear one . If the front diff is open then it is easier as the torque over there at each wheel can just be EngineTorque * gear / 4. Factoring the locking at the center, to make sure the front axle spins at the same speed as the real axle, LSDTorque can be divided and distributed equally between 2 front wheels, so something like:


//front axle speed
frontSpeed = (LF + RF) * 0.5f;
//rear axle speed
rearSpeed = (LF + RF) * 0.5f;
//speed difference between front and rear axle
//this is the case when front spins faster
axleDifference = frontSpeed - rearSpeed;
//LSDTorque at center diff to be delivered at front and rear axle
centerLSDTorque = axleDifference * lockUpForce;
//torque from center diff to front open diff
frontDiffInput = (outPutTorque * 0.5f) - centerLSDTorque;
//torque to each front wheel
LF.torque = RF.torque = frontDiffInput * 0.5f;
//same for rear axle
//torque to rear diff
rearDiffInput = (outPutTorque * 0.5f) + centerLSDTorque;
//torque to rear wheel, open diff
LR.torque = RR.torque = rearDiffInput * 0.5f;
//if LSD
if (LSD)
{
  //speed difference of 2 wheels, left wheel is faster
  speedDiff = LR.speed - RR.torque;
  //calculate LSDTorque, 1 way for now, simplicity
  rearLSDTorque = preload + driveTorque * ramp * friction;
  //distribute LSDTorque to rear wheels
  LR.torque = 0.5f * rearDiffInput - speedDiff * (rearLSDTorque);
  RR.torque = 0.5f * rearDiffInput + speedDiff * (rearLSDTorque);
}
//I guess the rearLSD model can also be applied to the front if the front has LSD also.

AWD is trickier since I have to factor in and carefully monitor torque distribution between front and rear. Also each car manufacturer has their own AWD system which makes thing much more confusing, from OpenDiff with braking to Subaru's snowTrek and Audi's Quattro. I guess I can take the above 4WD model and change the centerLSDTorque around, with some if's else's.

Again thank you very much. My progress has been skyrocketing ever since you helped me. 

Quote

the torque input at the differential should not be multiplied by differential gear ratio correct? So instead of engineTorque * gear * diffRatio, just engineTorque * gear.

Maybe.  It's a matter of semantics and will change your other scaling values but shouldn't change how things fundamentally work.

Quote

Also the diff is only sensitive to the input torque from the engine to be activated, and I don't have to worry about the rolling resistance torque from the wheels,

In reality it needs some resistance working against the input torque to generate the locking forces.  That resistance will be a combination of inertia of the wheels/axles and grip generated by the tire.  So, for all intents you can just look at the input torque and trust in the 3rd law that there will be a reaction.

For the most part, diff effects will be very subtle.  Even if commercial racing games it can be tough to tell the difference between locked and open.  Unless you're doing some kind of off-road rock climbing racer.  Then it matters.

So for AWD, a simple viscous type (tries to equalize speeds with a linear torque based on speed delta) is probably Good Enough™. 

 

 

2 hours ago, CombatWombat said:

For the most part, diff effects will be very subtle.  Even if commercial racing games it can be tough to tell the difference between locked and open.  Unless you're doing some kind of off-road rock climbing racer.  Then it matters.

What about in drifting? Would a good diff setup (in combination with suspension setup of course) help with recovering from a slide and prevent spinning out?

 

2 hours ago, CombatWombat said:

So for AWD, a simple viscous type (tries to equalize speeds with a linear torque based on speed delta) is probably Good Enough™. 

Thanks to your post, I'm having a differential craze right now. I'm thinking of an AWD system with more than 4 wheels with Inter axle differential setup (center diffs chained together with a overarching center diff, taking output of one as input of other), kind of like:

GearBoxTorque -> MainCenterDiff -> FrontCenterDiff -> FrontDiff

                                                                                       -> RearDiff

                                                        -> RearCenterDiff -> FrontDiff

                                                                                      -> RearDiff

Also I'm having some trouble with the math of induction (superchargers, turbochargers). Is there a formula that relates induction air pressure to the amount of extra torque it gives to the engine? Because I see in games the turbocharger air pressure actually turns negative when the throttle is fully released. Does that means that the extra torque also changes sign or there is just 0 extra torque? Would you mind helping me with this really quick?

Quote

I'm thinking of an AWD system with more than 4 wheels

So like.... https://en.wikipedia.org/wiki/Six-wheel_drive ?  I'm now picturing armored personnel carriers racing around Monaco.  That's a game I would play. 

 

Quote

What about in drifting? Would a good diff setup (in combination with suspension setup of course) help with recovering from a slide and prevent spinning out?

Yes, but again the effects are pretty small except in very specific circumstances (one wheel on low grip surface for example).  I'm not saying don't tinker with fancier setups, but it's good to make something simple that works well first and then build on that.

 

Quote

Also I'm having some trouble with the math of induction (superchargers, turbochargers). Is there a formula that relates induction air pressure to the amount of extra torque it gives to the engine?

This is a big area depending on how deep you want to go.  There are commercial software packages out there that simulate engine parameters for purposes of designing real engines such as Dynomation, Pipemax, and many others.  There was an old game, Burnout Drag Racing that had a pretty detailed engine simulation built into the game!

The short answer to this direct question is "sort of".  An engine will make X power at atmospheric pressure (1bar).  If you add another 1bar of boost and were somehow able to hold every other variable constant, it would make close to 2X power. 

If I get some time this evening I will try to write you up something more in depth.

 

 

 

On 2/21/2018 at 2:09 AM, CombatWombat said:

So like.... https://en.wikipedia.org/wiki/Six-wheel_drive ?  I'm now picturing armored personnel carriers racing around Monaco.  That's a game I would play. 

Why not 8 ha ha? I think 8 is also easier thanks to the symmetrical tree setup

On 2/21/2018 at 2:09 AM, CombatWombat said:

Yes, but again the effects are pretty small except in very specific circumstances (one wheel on low grip surface for example).  I'm not saying don't tinker with fancier setups, but it's good to make something simple that works well first and then build on that.

Just implemented a quick and simple RWD viscous LSD and ... it worked?! I mean it worked and very well actually. With the diff setup I was able to catch slides by modulating the accelerator and counter-steering. My luck was beginning to turn I guess?  Again thank you very much for helping me reaching this huge milestone in such a short time.

 

On 2/21/2018 at 2:09 AM, CombatWombat said:

The short answer to this direct question is "sort of".  An engine will make X power at atmospheric pressure (1bar).  If you add another 1bar of boost and were somehow able to hold every other variable constant, it would make close to 2X power. 

Right now I'm thinking of a simple induction setup with 2 states. 

State 1 will be compression stage where the charger compresses air and provides boost. The activation is when the throttle > 0 && engineRPM >= activationRPM. The max boost provided would just be a any number times the throttleInput. The currentBoostAmount going to the engine will gradually move to the maxBoost by turboLag amount of time. Air pressure times times throttleInput and move to maxAirPressure by turboLag amount of time.

State 2 will be the bypass stage where the charger release and bypass air, not providing any boost. The activation is when the throttle is 0 or engineRPM < activationRPM. Here the boost will just be 0 and air pressure is negative. If engineRPM < activationRPM but throttle > 0 then boost is 0 and air pressure is 0.

With my currently limited knowledge, I can only make air pressure to be just something to be shown on the HUD in a gauge to make the HUD more interesting.

Anyway I will wait and see what you can find, can't fake things forever.

 

Another quick question about the clutch and the handbrake. I see in games, arcade and sim, in case of RWD, when you are on the gas and pull the handbrake without stepping on the clutch, the rear wheels lockup but the engine doesn't stall, why is that? The clutch should be locked since the clutch capacity is larger than the engine max torque when it's engaging in this case, when the rear wheels lockup the engine should also be held and jump to 0 RPM which makes it stall.

And sorry but really this question is about driving technique, you can ignore it if you don't know. This is about the angle of counter-steering needed. When the car oversteer, how can I determine how much of an angle my counter-steering should be, to maintain the current direction of travel and not spinning out? I see a lot of auto countersteering in arcade racers but really don't know how it is calculated.

1 hour ago, Vu Chi Thien said:

Why not 8 ha ha? I think 8 is also easier thanks to the symmetrical tree setup

Can you have an 8-wheel drive vehicle with only 4 wheel steering? The beauty of 6 wheels is that the middle wheels can use a fixed axle...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

10 hours ago, swiftcoder said:

Can you have an 8-wheel drive vehicle with only 4 wheel steering? The beauty of 6 wheels is that the middle wheels can use a fixed axle...

Uh ... 

Chill man I'm just joking. I'm a programmer, not a military engineer ... I have no idea how those vehicles are set up, this is just my speculation.

That's why I'm asking questions here to get help ...

On 2/20/2018 at 6:55 PM, Vu Chi Thien said:

I'm thinking of an AWD system with more than 4 wheels with Inter axle differential setup (center diffs chained together with a overarching center diff, taking output of one as input of other), kind of like:

GearBoxTorque -> MainCenterDiff -> FrontCenterDiff -> FrontDiff

                                                                                       -> RearDiff

                                                        -> RearCenterDiff -> FrontDiff

                                                                                      -> RearDiff

I've implemented a setup like that. This one uses that exact tree of 7 differentials chained:

However, in reality these vehicles use a so called H-drive drivetrain. There's a single center differential, then the drive wheels at each side are linked together.

This topic is closed to new replies.

Advertisement