Skip to content

Commit

Permalink
further adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewell committed Oct 23, 2023
1 parent b13e6ab commit 4213063
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ void Integrate(float elapsedClockSeconds)
NumOfSubstepsPS -= 5;
waitBeforeSpeedingUp = 5;
}
else if (Math.Abs(integratorError) < 0.005)
else if (Math.Abs(integratorError) < 0.000277)
{
NumOfSubstepsPS -= 2;
waitBeforeSpeedingUp = 5;
Expand All @@ -945,6 +945,7 @@ void Integrate(float elapsedClockSeconds)
for (int i = 0; i < NumOfSubstepsPS; i++)
{
var k1 = GetAxleMotionVariation(AxleSpeedMpS, dt);
/*
if (i == 0)
{
if (k1.Item1 * dt > Math.Max((Math.Abs(SlipSpeedMpS) - 1) * 10, 1) / 100)
Expand All @@ -955,6 +956,7 @@ void Integrate(float elapsedClockSeconds)
hdt = dt / 2;
}
}
*/
var k2 = GetAxleMotionVariation(AxleSpeedMpS + k1.Item1 * hdt, hdt);
var k3 = GetAxleMotionVariation(AxleSpeedMpS + k2.Item1 * hdt, hdt);
var k4 = GetAxleMotionVariation(AxleSpeedMpS + k3.Item1 * dt, dt);
Expand Down Expand Up @@ -1033,17 +1035,17 @@ public virtual void Update(float timeSpan)
if (Math.Abs(SlipSpeedMpS) > WheelSlipThresholdMpS)
{
// Wait some time before indicating wheelslip to avoid false triggers
if (WheelSlipTimeS > 0.75f)
if (WheelSlipTimeS > 1)
{
IsWheelSlip = IsWheelSlipWarning = true;
Trace.TraceInformation("Wheel Slip Triggered");
// Trace.TraceInformation("Wheel Slip Triggered");
}
WheelSlipTimeS += timeSpan;
}
else if (Math.Abs(SlipSpeedPercent) > SlipWarningTresholdPercent)
{
// Wait some time before indicating wheelslip to avoid false triggers
if (WheelSlipWarningTimeS > 0.75f) IsWheelSlipWarning = true;
if (WheelSlipWarningTimeS > 1) IsWheelSlipWarning = true;
IsWheelSlip = false;
WheelSlipWarningTimeS += timeSpan;
}
Expand Down

0 comments on commit 4213063

Please sign in to comment.