# Vu Chi Thien

Member

24

0 Neutral

• Rank
Member

• Role
Programmer
• Interests
Design
DevOps
Education
Production
Programming

## Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

1. ## Limited-Slip Differential and friends

Thanks for the big help. My model is different as I said from above (I brought in the model in the Wikipedia page directly) so it's up to myself on further modeling now . however though, in the case of rotation difference based diff (vicious), the locking torque can be calculated from the difference in rotation speed. But how about torque based diff (clutch, spool/locked), how should correct amount of output torques for two sides to have equal speed be calculated since the input is torque not rotation speed? What I meant is (and also my question) : - since locking means two sides must almost always rotate at same speed, then how can I make sure that every frame, the speed will always be equal, given that reaction torque and inertia of 2 sides are known? I know that I can do it the "cheating" way where if in the current frame speed of 2 sides are different, then calculate an amount of torque to bring them back together with the average speed in the next frame, but that would defeat the purpose of locking, making it rather a viscous, and introduce jitters. This has been my main problem when trying to implement the model. I think this question relates to programming and integration techniques that I haven't yet know the name to look up for. Any input on this would be a big help. again, thank you very much.
2. ## Limited-Slip Differential and friends

Thank you very much for taking your time in this ancient topic :). Strange that even though many driving sims have come out but it's really hard to find any "programmer friendly" paper on modelling and implementations. So I'm guessing this is sort of similar to input torque bias of Torsen diffs? Where input torque from the engine is biased with a ratio calculated from the locking torque, before reaching the wheels? Sort of: ratio = wheelSpeed/speedDifference? Not just spliting 50-50 like an open diff and then apply locking torque to each wheel, wheelDriveTorque = torqueEngine * 0.5f - locking? So I'm imagining this is similar to the clutch at the engine somehow. The lockingTorque going to each wheel would be min(maxClutchTorque, lockingTorque). The lockingTorque used to keep both wheels rotating at the same rate is less than or equal what the maximum the diff can provide. If this lockingTorque is exceeded then no more locking, also means that the wheel torque from both sides overcome the lockingTorque to spin at their own rate.
3. ## Limited-Slip Differential and friends

Hello. I'm sorry for digging this topic up. But I'm still having trouble understanding the math model (or rather, the programmer way of modeling) the differentials. I figured the mechanical stuffs out, but still having some questions: 1 - For the case of open diff, in an extreme case where one wheel have 0 road reaction force/torque to push the car forward, is it neccessary that ALL the POWER will go to the slipping wheel? Because my understanding is that torque coming in from the drivetrain will always be split 50-50 between wheels so: - Let's say the torque coming in is 1000Nm, 500 to left wheel and 500 to right wheel. Left wheel is on air so no road force. Right wheel can put down 500Nm it receives to the road. Ignoring wheel radius and exact car mass for the moment, let's say the neccessary amount of torque to push the car forward is 500Nm, exactly equal to how much the right wheel with traction can put down. So now should the car still move? Because although the left wheel is slipping and not producing any force to push the car forward, the right wheel is still having enough traction to push the car. Which means some power is still going the the wheel with traction, not all to the slipping wheel, correct? 2 - For clutch type LSD, is there a way for calculating the amount of locking torque that would be sent to each side? According to the wikipedia page on LSD, the amount of torque going to each side would be: TorqueIn * 0.5 + lockingTorque (side with traction) and TorqueIn * 0.5f - lockingTorque (side slipping). Is the magnitude of this locking torque the same for both sides? Also, can the clutch type LSD be completely locked up like a spool? Or there would always be some slipping? Does the diff work by behaving like a spool when the torque bias between sides is less than or equal to the diff's bias ratio (or the torque difference is within the maximum locking torque of the diff)? Or does it constantly applying a locking torque that is equal to the maximum locking torque? Thank you very much.

6. ## Limited-Slip Differential and friends

I guessing an example of asymmetric differential would be the center diff/torque splitter in AWD that split torque front-rear based on requirements (Audi's Quattro 60-40 front-rear)? I thought Viscous has looking effect based on wheel speed difference? Or maybe I'm getting the wrong idea about locking effect. In my understanding looking effect means the amount of resistance torque from the differential (friction from clutch patch that applied to the spinning wheel with less traction, opposite to the rolling direction of that wheel. Maybe what you're saying about viscous is that the clutch patch get pushed by the liquid but never locked up, and the resistance torque is just constantly applied to the spinning wheel every time a wheel loses traction and spin, without an activation (throttle, engine brake) I think I'm slowly getting the (maybe wrong) picture. A locked diff would make the car understeer when cornering when coasting, but once you get on the throttle hard, both wheels would loose traction because of the locked diff, and also because the outer wheel gets all the torque,. This allow for easier to initiate and maintain a drift. So coasting: understeer, accelerating: oversteer An open diff would make the car corner easily when coasting due to the free rolling motion of each wheel, inner wheel can spin slower to rotate the car around, but when the engine braking is too strong, you can get oversteer. However, when you get on throttle, the inner wheel would get all the power (torque remains 50-50 between each wheel), while the outer wheel still rotates slowly, resulting in understeer. So coasting: oversteer, accelerating: understeer. Do all Technic cars have differentials? What kind of diff do they have? I'm thinking of getting one now. Thank you very much for your help with a huge amount of information
7. ## Limited-Slip Differential and friends

So lucky to be noticed by a famous Unity developer Definitely gonna drive that around the Nurburgring and set a record In the vehicle physics asset you're developing, do you also model the torsen differential? Most people seems to steer away from it and go for clutch type instead. By the way, what is your opinion on the importance of modelling different types of differential? Even in a notable sim like Assetto Corsa, there are only a few most importance options like coast, power and preload to mimic the effects of different types of differentials. And one thing that I've heard around the drifting corner of sim community is that a "sensitive" diff, which is a diff that locks up even with low torque difference between 2 wheels and low power input from the engine, would help break out the rear easier, because when the diff locks, the inner wheel would lose traction and cause oversteer. However, in my understanding, differential lock up is used to prevent oversteer. Locking up means the inner wheel would receive less torque and rotate at the same speed as the outside wheel. An open diff would make oversteer easier since the torque is always 50-50, so when the inner wheel lose traction, it would receive all the torque and keep on spinning without traction. With the racing and drifting experience you have, would you mind clear this confusion up for me? (I saw your drifting video on youtube, and it was awesome)
8. ## Limited-Slip Differential and friends

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 ...
9. ## Limited-Slip Differential and friends

Why not 8 ha ha? I think 8 is also easier thanks to the symmetrical tree setup 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. 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.
10. ## Limited-Slip Differential and friends

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? 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?
11. ## Limited-Slip Differential and friends

Thanks for passing by @CombatWombat, The vehicle simulation scene on gamedev.net is pretty quiet I agree, unlike the 2004-2007 period. 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. 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)? 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.

13. ## Clutch Lockup Logic State Machine

Hi fellow game devs, With the help of @CombatWombat in my previous post about clutch modeling, I now have a solid direction for the modeling the clutch. The way I'm doing it is having 2 clutch states: locked and unlocked. EngineRPM and torque will be calculated separately in each state. My problem right now is the logic and code for specifying locking and unlocking. The condition for locking is when (engineSpeed - drivetrainSpeed) in previous update cross zero (different sign) with the current update (to determine if engineSpeed = drivetrainSpeed or not in-between updates) and engineTorque <= clutchTorque. The condition for unlocking is when engineTorque > clutchTorque. The diagram looks roughly like this (taken from matlab website with the similar implementation): However, the 2 conditions are triggers for switching states, not for determine the current state to be in, so in the end my clutch state just jumped around. I don't have a lot of experience in doing state machine, so can some one give me rough code of how to implement this? Below is my rough code: speedError = engineSpeed - drivetrainSpeed; if ((Math.Sign(speedError) != Math.Sign(deltaW) && currentTotalEngineTorque <= clutchReactTorque)) { clutchLocked = true; } else clutchLocked = false; deltaW = speedError; //end of update I think the main struggle is the cross zero. Because cross zero is the "trigger condition" to check if the clutch should lock when it is slipping, not the condition for continuous locking, while the code I have above is the "continuous condition" saying "this condition is true then it is locked/unlocked". Another word, if the clutch is slipping, the condition above would decide if it's locked or not, but once it is locked, the cross zero condition is not true anymore (since speedError and deltaW have same sign as engineSpeed == drivetrainSpeed when clutch is locked). I'm sorry that I cannot explain this better as English is not my first language.
14. ## Clutch Modelling Help

OK, so with non-locking model, there will always be a little bit of oscillation when delta velocity gets smaller, but eventually gets averaged after enough timestep, and the output at the frame update is smoothed. And with high torque cases (super cars, race cars, high power trucks ...) we need small timesteps/high frequency. So basically like: if (clutchLocked) { engineSpeed = wheelSpeed * Gear; torqueAtWheel = (engineTorque * Gear) * diffBias; } else { engineSpeed += (engineTorque - clutchTorque)/engineInertia; torqueAtWheel = clutchTorque * Gear * diffBias; } I'm still experimenting with different values and having fairly good result at high speed, high engine RPM, but still lots of jittering at low speed low gear and high torque. One reason for the jittering is actually because of the built-in physic engine, so I also have to play around a lot with the timestep and substep config of the engine itself, which is going to take a long time. This problem occurs with everyone I asked in the official forum and no one has the solid solution yet. Talks about impulse, I bumped into this forum post of an open-source racing sim, with used impulse for clutch modeling, and based on the engine - wheel speed difference. Basically this model calculate engine torque impulse and clutch resistance impulse, and the net torque drives the engine inertia: engineVelocity += (engineTorqueImpulse - clutchDragImpulse) / engineInertia; And here's the clutch impulse calculation: public float GetDragImpulse(float engine_speed, float drive_speed, float engineInertia, float drivetrainInertia, float ratio, float engineTorquedt){ float drivetrainInertiaR=drivetrainInertia/ratio; impulseLimit=clutch_position*torqueCapacity*Time.deltaTime; float lambda=(engineInertia*drivetrainInertiaR*(drive_speed - engine_speed) - drivetrainInertiaR*engineTorquedt)/(engineInertia + drivetrainInertiaR); lambda = Mathf.Clamp(lambda, -impulseLimit, impulseLimit); return lambda; } Here the topic: http://vdrift.net/Forum/showthread.php?tid=1617&page=2
15. ## Clutch Modelling Help

Thanks so much again. I'm still studying and testing around with the model you gave me in the xls. It will take a while for me to get good result and come up with a good combination of values. Still I have some confusion I would like to ask: So after trying different values, to me increasing the proportional and integral would result in getting to the desired value faster, but gives more oscillation at high time step. Lower values would result in a smother jump. So from here I think with high torque value using lower proportional and integral would be better, and higher values for lower torque. Because in the model discussing here in the topic, clutchTorque, which is frictionConstant * clutchInput, is used to drive the wheels. So say I have an example: The engine produce 400Nm maximum torque. The torque capacity of the clutch is 500Nm. So when the clutch is fully closed, would the full 500Nm of clutchTorque go to the wheels despite the engine cannot produce that much torque (max 400Nm)? This is the biggest confusion for me right now.