Simplix AirBrake with latch time to avoid switching on off too often
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5600 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 01803b4288a01b4d88458e11ddcdc049cd5e7d19 Former-commit-id: ea81f9df953ca1646c769c51e2db89f868d9ea52
This commit is contained in:
parent
61bb7e3847
commit
3416b5e9b8
2 changed files with 27 additions and 6 deletions
|
@ -319,6 +319,7 @@ TDriver::TDriver(int Index):
|
|||
oRepairNeeded(0.0),
|
||||
oSideReduction(1.0),
|
||||
oLastSideReduction(1.0),
|
||||
oAirBrakeLatchTime(0.0),
|
||||
oMinDistLong(FLT_MAX),
|
||||
oSlowRadius(1.0),
|
||||
|
||||
|
@ -1478,10 +1479,13 @@ void TDriver::Drive()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (oAbsDriftAngle < PI/64)
|
||||
oWingAngleRear = oWingAngleRearMax;
|
||||
else
|
||||
oWingAngleRear = oWingAngleRearBrake;
|
||||
if (oAirBrakeLatchTime == 0)
|
||||
{
|
||||
if (oAbsDriftAngle < PI/64)
|
||||
oWingAngleRear = oWingAngleRearMax;
|
||||
else
|
||||
oWingAngleRear = oWingAngleRearBrake;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1526,8 +1530,21 @@ void TDriver::Drive()
|
|||
|
||||
if (oWingControl)
|
||||
{
|
||||
if (oBrake > 0.25)
|
||||
oWingAngleRear = oWingAngleRearBrake;
|
||||
if (oWingAngleRear != oWingAngleRearBrake)
|
||||
{
|
||||
if ((oBrake > 0.25) && (oCurrSpeed > 180/3.6f))
|
||||
{
|
||||
oWingAngleRear = oWingAngleRearBrake;
|
||||
oAirBrakeLatchTime = 0.5;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((oBrake > 0.25) && (oCurrSpeed > 100/3.6f))
|
||||
{
|
||||
oAirBrakeLatchTime = 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Keep history
|
||||
|
@ -1917,6 +1934,8 @@ void TDriver::Update(tCarElt* Car, tSituation* S)
|
|||
oCar = Car; // Update pointers
|
||||
oSituation = S;
|
||||
|
||||
oAirBrakeLatchTime = MAX(0, oAirBrakeLatchTime - oSituation->deltaTime);
|
||||
|
||||
// Shortcuts
|
||||
oCurrSpeed = myhypot(CarSpeedLong, CarSpeedLat); // Save currend speed
|
||||
if (fabs(oCurrSpeed) < 1) // At slow speeds use
|
||||
|
|
|
@ -366,6 +366,8 @@ private:
|
|||
double oRepairNeeded;
|
||||
float oSideReduction;
|
||||
float oLastSideReduction;
|
||||
double oAirBrakeLatchTime;
|
||||
|
||||
|
||||
double oMinDistLong;
|
||||
float oSlowRadius;
|
||||
|
|
Loading…
Reference in a new issue