back Auction Sniper

G-force modulated 4 corner tire slip

Background and disclaimers
My sim driving experience is with an office chair, wheel stand and mostly Assetto Corsa.
I have no experience with the full SRS ShakeKit, which may offer a superior experience.
Without a harness to keep one's back contacting them,
back transducers in ShakeKit Plus seem of debatable benefit.

Haptics based on tire slip are not ideal;  instead, consider slip angle rate

Already using SimHub with available motherboard 7.1 sound
and obsolete Denon surround receiver,
a ShakeSeat pad was ordered because: An equivalent can be made using Dayton pucks with e.g.
40cm square zippered cushion covers and EVA foam floor tiles
Standard SimHub ShakeIt tire slip does not consider tire loading.
For example, an inside tire may be fully unloaded during cornering,
so very high slippage, but no perceived sensation in actual driving.

This attempts to approximate track sensations from street tires,
when securely harnessed in a fitted racing seat.
Usefulness of such haptic feedback may vary widely among users IMO, this feedback is for me less compelling than that from 2DOF harness tensioners,
but reduces a sense of "something missing".

Unambiguously directional haptic cues seemingly want substantially direct stimulation of
body parts, e.g. left and right thighs, lumbars and/or sit bones.

Sensations to be simulated here:
squeal for small slippage, transitioning to moaning with more slippage,
then shuddering near breakaway,
with much less feeling from lightly loaded tires (rear when braking, inside when cornering).

Implementation embellishes SimHub Wheels slip effect using Custom Effects
1. latitudinal and longitudinal acceleration properties
2. loaded tire slips, products of tire slip properties times accelerations

Newer SimHub versions provide Acceleration properties
that had been estimated from changes in speed and yaw samples to proxy G force.
Earlier SimHub versions sampled speed and yaw slower than Assetto Corsa sample updates,
resulting in some changes 2x others, which code here detects and mitigates.

Left channel Lateral G-force proxy:
// lateral acceleration proxy
var y = $prop('OrientationYaw');
const tc = 3;  // IIR smoothing factor
const noise = 0.01 // non-linear filter threshold

// initialize IIR filter history
if(null==root["yaw"]) {
   root["yaw"] = $prop('OrientationYaw');
   root["delta_y"] = 0.2;
}
if (null==root["Gyb4"])
  root["Gyb4"] = 0.5;

var dy = y - root["yaw"];       // change between sample intervals

// yaw flips at +/- 180
if (Math.abs(dy) > 180) {  // yaw went +/- 180
  if (Math.abs(root["yaw"]) > 150)
    dy = -(y + root["yaw"]);
}

root["yaw"] = y;
y = root["delta_y"];    // previous sample change

// mitigate delta spikes from missed samples
var my = 1;     // sample interval
if ((Math.abs(dy * y) > noise)  // missed sample?
 && (Math.abs(dy) > Math.abs(1.8 * y)))
  dy /= (my = 2);

root["delta_y"] = dy;

// IIR low-pass filter
var Gyb4 = root["Gyb4"];        // IIR output
Gyb4 += my * (dy - Gyb4) / tc;  // low-pass IIR
root["Gyb4"] = Gyb4;
return 50 + (50 * Gyb4);  // range 0-100
// 50 corresponds to no G force
Longitudinal acceleration (right channel) is similar, substituting speed for yaw

Loaded tire slip corner effects use products of tire slips and G force proxies:
return .01*$prop('GameRawData.Physics.WheelSlip01')
    *($prop('ShakeITBSV3Plugin.Export.proxy_G.Left'))*(90-$prop('ShakeITBSV3Plugin.Export.proxy_G.Right'))
// since this multiplies two properties with 0-100 ranges,
// results must be reduced by 100 to return the same range
// left vs right G-force distributions are applied to wheel slips
//  by (proxy_G.Left) and (100-proxy_G.Left),
// while front-to-rear G-force distributions are by
//  ( proxy_G.Right-10) vs (90- proxy_G.Right)
// to reflect that, while inner wheels may become fully unloaded in corners,
// track cars are expected to fully unload neither nor rear wheels
These two CUSTOM EFFECTS could be combined,
except that G-force proxy properties are also used by
a Custom serial device for 2DOF harness tensioning.
The complete SimHub profile is available here along with a revised version
After awhile, SimHub can accumulate too many profiles; here are mine.
maintained by blekenbleu