- Update shadow's driver
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6840 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: d0208cce965f289e349a2c5e4425e28fd4d5bb01 Former-commit-id: 96f7fd9e2a34b6786d51f5438854a9226bda3074
This commit is contained in:
parent
cb5528af33
commit
e9e32dfc33
4 changed files with 28 additions and 18 deletions
|
@ -380,6 +380,12 @@ void CarModel::update( const tCarElt* car, const tSituation* sit )
|
|||
POS_AZ = new_pos_az;
|
||||
VEL_AZ = new_vel_az;
|
||||
|
||||
if (HASTYC)
|
||||
{
|
||||
GRIP_SCALE_F = MN(car->priv.wheel[0].condition, car->priv.wheel[1].condition);
|
||||
GRIP_SCALE_R = MN(car->priv.wheel[2].condition, car->priv.wheel[3].condition);
|
||||
}
|
||||
|
||||
// DEBUGF( "vx %7.4f %7.4f vy %7.4f %7.4f vz %7.4f %7.4f vaz %7.4f %7.4f\n",
|
||||
// VEL_L.x, car->pub.DynGC.vel.x,
|
||||
// VEL_L.y, car->pub.DynGC.vel.y,
|
||||
|
@ -492,7 +498,7 @@ double CarModel::CalcMaxSpeedAeroOld(
|
|||
mua = MU * MU_SCALE;// * 0.975;
|
||||
}
|
||||
|
||||
// mua *= (GRIP_SCALE_F + GRIP_SCALE_R) * 0.5;
|
||||
// mua *= (GRIP_SCALE_F + GRIP_SCALE_R) * 0.5;
|
||||
mua *= MN(GRIP_SCALE_F, GRIP_SCALE_R);
|
||||
|
||||
double cs = cos(trackRollAngle) * cos(trackPitchAngle);
|
||||
|
|
|
@ -189,8 +189,8 @@ static void* MergeParamFile( void* hParams, const char* fileName, bool relSrc =
|
|||
return hNewParams;
|
||||
}
|
||||
|
||||
const char* path = SECT_GROBJECTS "/" LST_RANGES "/1";
|
||||
const char* ac3d_car = GfParmGetStr(hNewParams, path, "car", "");
|
||||
//const char* path = SECT_GROBJECTS "/" LST_RANGES "/1";
|
||||
//const char* ac3d_car = GfParmGetStr(hNewParams, path, "car", "");
|
||||
|
||||
float fw_ang = GfParmGetNum(hNewParams, "Front Wing", "angle", NULL, 0);
|
||||
|
||||
|
@ -201,7 +201,7 @@ static void* MergeParamFile( void* hParams, const char* fileName, bool relSrc =
|
|||
GFPARM_MMODE_SRC | GFPARM_MMODE_DST |
|
||||
(relSrc ? GFPARM_MMODE_RELSRC : 0) | GFPARM_MMODE_RELDST);
|
||||
|
||||
const char* ac3d_car2 = GfParmGetStr(hParams, path, "car", "");
|
||||
//const char* ac3d_car2 = GfParmGetStr(hParams, path, "car", "");
|
||||
return hParams;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ void Driver::InitTrack(
|
|||
//
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "drivers/%s", MyBotName);
|
||||
const char* baseParamPath = buf;
|
||||
//const char* baseParamPath = buf;
|
||||
|
||||
weathercode = GetWeather(pTrack);
|
||||
|
||||
|
@ -325,7 +325,7 @@ void Driver::InitTrack(
|
|||
*ppCarParmHandle = hCarParm;
|
||||
|
||||
// get the private parameters now.
|
||||
const char* ac3d_car = GfParmGetStr(hCarParm, SECT_GROBJECTS "/" LST_RANGES "/1", PRM_CAR, "");
|
||||
//const char* ac3d_car = GfParmGetStr(hCarParm, SECT_GROBJECTS "/" LST_RANGES "/1", PRM_CAR, "");
|
||||
|
||||
double rpm = GfParmGetNum(hCarParm, SECT_PRIV, PRV_GEAR_UP_RPM, "rpm", 8190);
|
||||
m_gearUpRpm = rpm * 2 * PI / 60;
|
||||
|
@ -467,7 +467,7 @@ void Driver::InitTrack(
|
|||
double fuelPerM = SafeParmGetNum(hCarParm, SECT_PRIV, "fuel per m", 0, 0.001f);
|
||||
double maxFuel = SafeParmGetNum(hCarParm, SECT_CAR, PRM_TANK, (char*) NULL, 100.0f);
|
||||
int pittest = SafeParmGetNum(hCarParm, SECT_PRIV, PRV_PIT_TEST_STOP, (char*) NULL, 0);
|
||||
double fullRaceFuel = 1.02 * pS->_totLaps * pTrack->length * fuelPerM;
|
||||
double fullRaceFuel = 1.02 * pS->_totLaps * (double)pTrack->length * fuelPerM;
|
||||
double fuel = fullRaceFuel;
|
||||
|
||||
if( raceType == RM_TYPE_PRACTICE )
|
||||
|
@ -516,7 +516,7 @@ void Driver::InitTrack(
|
|||
|
||||
if (skillHandle)
|
||||
{
|
||||
global_skill = GfParmGetNum(skillHandle, (char *)SECT_SKILL, (char *)PRV_SKILL_LEVEL, (char *) NULL, 30.0f);
|
||||
global_skill = GfParmGetNum(skillHandle, SECT_SKILL, PRV_SKILL_LEVEL, (char *) NULL, 30.0f);
|
||||
}
|
||||
|
||||
global_skill = MAX(0.0f, MIN(30.0f, global_skill));
|
||||
|
@ -940,7 +940,7 @@ void Driver::GetPathToLeftAndRight( const CarElt* pCar, double& toL, double& toR
|
|||
|
||||
double Driver::GripFactor( const CarElt* pCar, bool front ) const
|
||||
{
|
||||
const double initialTemperature = 273.15 + 20.0;
|
||||
//const double initialTemperature = 273.15 + 20.0;
|
||||
|
||||
double gripFactor = 1.0;
|
||||
|
||||
|
@ -2413,7 +2413,7 @@ void Driver::Drive( int index, tCarElt* car, tSituation* s )
|
|||
{
|
||||
m_cm[PATH_NORMAL].update( car, s );
|
||||
|
||||
#if EXPERIMENTAL
|
||||
/*#if EXPERIMENTAL
|
||||
//#if 1
|
||||
launchControlFullThrottle(car, s);
|
||||
// launchControlClutch(car, s);
|
||||
|
@ -2422,7 +2422,7 @@ void Driver::Drive( int index, tCarElt* car, tSituation* s )
|
|||
// launchControlAccSlip2(car, s);
|
||||
// launchControlSimple(car, s);
|
||||
return;
|
||||
#endif
|
||||
#endif*/
|
||||
|
||||
double h[4];
|
||||
for( int i = 0; i < 4; i++ )
|
||||
|
|
|
@ -44,6 +44,7 @@ Strategy::Strategy( const MyTrack& track, const PitPath& pitPath )
|
|||
m_lastFuel(0),
|
||||
m_totalFuel(0),
|
||||
m_totalLaps(0),
|
||||
m_lastTyreWear(1.0),
|
||||
m_pitType(PT_NORMAL)
|
||||
{
|
||||
}
|
||||
|
@ -64,14 +65,16 @@ void Strategy::Process( CarElt* pCar, TeamInfo::Item* pTeamInfo )
|
|||
//
|
||||
// update statistics.
|
||||
//
|
||||
double tyreWear = 0;
|
||||
double tyreWear = 1.0;
|
||||
|
||||
if (m_HasTYC)
|
||||
{
|
||||
for( int w = 0; w < 4; w++ )
|
||||
tyreWear = MX(tyreWear, pCar->priv.wheel[w].condition);
|
||||
tyreWear = MN(tyreWear, pCar->priv.wheel[w].treadDepth);
|
||||
|
||||
if( pCar->_fuel > m_lastFuel || pCar->_dammage < m_lastDamage || tyreWear < m_lastTyreWear )
|
||||
LogSHADOW.info(" # Tyre wear = %.8f\n", tyreWear);
|
||||
|
||||
if( pCar->_fuel > m_lastFuel || pCar->_dammage < m_lastDamage || tyreWear > m_lastTyreWear )
|
||||
{
|
||||
// been in pits... reset.
|
||||
LogSHADOW.debug( "***** Been in pits... resetting stats.\n" );
|
||||
|
@ -97,6 +100,7 @@ void Strategy::Process( CarElt* pCar, TeamInfo::Item* pTeamInfo )
|
|||
{
|
||||
m_totalTyreWear += (tyreWear - m_lastTyreWear);
|
||||
m_lastTyreWear = tyreWear;
|
||||
LogSHADOW.info(" # TyreWear = %.8f - Last TyreWear = %.8f\n", tyreWear, m_lastTyreWear);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,9 +143,9 @@ void Strategy::Process( CarElt* pCar, TeamInfo::Item* pTeamInfo )
|
|||
damagePerM = m_totalDamage / pCar->_distRaced;
|
||||
|
||||
if(m_HasTYC)
|
||||
tyreWearPerM = m_totalTyreWear / pCar->_distRaced;
|
||||
tyreWearPerM = (1.0 - m_lastTyreWear) / pCar->_distRaced;
|
||||
|
||||
LogSHADOW.debug(" # Fuel per meter = %.6f - Damage per meter = %.6f - Wear per meter = %.6f\n", fuelPerM, damagePerM, tyreWearPerM);
|
||||
LogSHADOW.info(" # Fuel per meter = %.6f - Damage per meter = %.1f - Wear per meter = %.8f\n", fuelPerM, damagePerM, tyreWearPerM);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -67,8 +67,8 @@ private:
|
|||
|
||||
int m_warnDamageLimit;
|
||||
int m_dangerDamageLimit;
|
||||
int m_warnTyreLimit;
|
||||
int m_dangerTyreLimit;
|
||||
double m_warnTyreLimit;
|
||||
double m_dangerTyreLimit;
|
||||
|
||||
bool m_HasTYC;
|
||||
|
||||
|
|
Loading…
Reference in a new issue