I made a type of traction control using LUA for ETB-equipped vehicles. It is quite basic, works well in my book, but it could use a phase-in/out timer to smooth transitions into/out of traction control events.
current code is
Code: Select all
-- traction control
local slipRatio = rvss / fvss
if slipRatio > 1.1 and tcState == 0 then
setEtbAdd(slipRatio * - 40)
else
setEtbAdd(0)
end
slipRatio = a simple division of driving/driven wheel speeds (in this car, car is RWD, so rvss = rear vss). If one of the rear wheels is going faster than one of the front ones, we are probably slipping
tcState = a traction control on/off button
I noticed in my case that noticeable slip happens after a ratio of about 10% deviation (which is what the 1.1 represents). I multiply this by a constant -40 so if we have minimal slip, we reduce TPS by 40%, and gets multiplied by the amount of slip to compensate for more slippery situations.
The arrow indicates where slip was detected, and ETB target changes from 100% to ~50%
At the top of second gear we are starting to actually have grip, and once we shift into 3rd, we can see that slip% is small enough to where we can target 100% TPS