- Update Shadow's driver

- Update USR's driver
- Update weather datas

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6855 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 906a3027ad3913accd952eaf2bba345a3da9116e
Former-commit-id: 41f4179c5d3952604c92e2d40591156af1b32ae4
This commit is contained in:
torcs-ng 2020-03-21 15:21:04 +00:00
parent f0d3fa3c00
commit b85fa03d47
6 changed files with 173 additions and 349 deletions

View file

@ -24,17 +24,6 @@ static const int s_next_corner[] = {FRNT_LFT, REAR_LFT, REAR_RGT, FRNT_RGT};
CarBounds2d::CarBounds2d( const tCarElt* car )
{
/*
xAxis = Vec2d(car->pub.DynGC.pos.az);
yAxis = xAxis.GetNormal();
Vec2d middle(car->pub.DynGC.pos.x, car->pub.DynGC.pos.y);
pts[FRNT_LFT] = middle + xAxis * car->pub.corner[FRNT_LFT].x + yAxis * car->pub.corner[FRNT_LFT].y;
pts[FRNT_RGT] = middle + xAxis * car->pub.corner[FRNT_RGT].x + yAxis * car->pub.corner[FRNT_RGT].y;
pts[REAR_LFT] = middle + xAxis * car->pub.corner[REAR_LFT].x + yAxis * car->pub.corner[REAR_LFT].y;
pts[REAR_RGT] = middle + xAxis * car->pub.corner[REAR_RGT].x + yAxis * car->pub.corner[REAR_RGT].y;
*/
pts[FRNT_LFT] = Vec2d(car->pub.corner[FRNT_LFT].ax, car->pub.corner[FRNT_LFT].ay);
pts[FRNT_RGT] = Vec2d(car->pub.corner[FRNT_RGT].ax, car->pub.corner[FRNT_RGT].ay);
pts[REAR_LFT] = Vec2d(car->pub.corner[REAR_LFT].ax, car->pub.corner[REAR_LFT].ay);

View file

@ -259,8 +259,8 @@ void Driver::InitTrack(
const char* raceTypeStr[] = { "practice", "qualify", "race" };
int raceType = pS->raceInfo.type;
if( raceType == RM_TYPE_PRACTICE && (pS->raceInfo.totLaps == 3 || pS->raceInfo.totLaps == 10) )
raceType = RM_TYPE_QUALIF;
//if( raceType == RM_TYPE_PRACTICE && (pS->raceInfo.totLaps == 3 || pS->raceInfo.totLaps == 10) )
// raceType = RM_TYPE_QUALIF;
LogSHADOW.debug(" # Shadow Race type = %s \n", raceTypeStr[raceType]);
@ -281,34 +281,31 @@ void Driver::InitTrack(
if (weathercode > 0)
{
// override params for default car type.
snprintf( buf, sizeof(buf), "%sdrivers/%s/%s/default.xml",
GfDataDir(), MyBotName, m_carName);
hCarParm = MergeParamFile(hCarParm, buf, hCarParm != pCarHandle);
LogSHADOW.debug("PATH = %s \n", buf);
// override params for car type on track of specific race type and driver.
snprintf( buf, sizeof(buf), "%sdrivers/%s/%s/%s-%d.xml",
GfDataDir(), MyBotName, m_carName, m_trackName, weathercode);
hCarParm = MergeParamFile(hCarParm, buf, hCarParm != pCarHandle);
LogSHADOW.debug("PATH = %s \n", buf);
}
else
{
// override params for default car type.
snprintf( buf, sizeof(buf), "%sdrivers/%s/%s/default.xml",
GfDataDir(), MyBotName, m_carName);
hCarParm = MergeParamFile(hCarParm, buf, hCarParm != pCarHandle);
LogSHADOW.debug("PATH = %s \n", buf);
LogSHADOW.info("PATH = %s \n", buf);
}
else
{
// override params for car type on track of specific race type and driver.
snprintf( buf, sizeof(buf), "%sdrivers/%s/%s/%s.xml",
GfDataDir(), MyBotName, m_carName, m_trackName);
hCarParm = MergeParamFile(hCarParm, buf, hCarParm != pCarHandle);
LogSHADOW.debug("PATH = %s \n", buf);
// override params for default car type.
snprintf( buf, sizeof(buf), "%sdrivers/%s/%s/default.xml",
GfDataDir(), MyBotName, m_carName);
hCarParm = MergeParamFile(hCarParm, buf, hCarParm != pCarHandle);
LogSHADOW.debug("PATH = %s \n", buf);
LogSHADOW.info("PATH = %s \n", buf);
}
// setup the car param handle to be returned.
@ -456,8 +453,9 @@ void Driver::InitTrack(
// setup initial fuel for race.
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 maxFuel = SafeParmGetNum(hCarParm, SECT_CAR, PRM_TANK, (char*)NULL, 100.0f);
int pittest = SafeParmGetNum(hCarParm, SECT_PRIV, PRV_PIT_TEST_STOP, (char*)NULL, 0);
LogSHADOW.info(" # Pit test stop = %i\n", pittest);
double fullRaceFuel = 1.02 * pS->_totLaps * (double)pTrack->length * fuelPerM;
double fuel = fullRaceFuel;

View file

@ -31,6 +31,8 @@ SET(ROBOT_SOURCES
src/spline.cpp
src/strategy.h
src/strategy.cpp
src/tiresdata.cpp
src/tiresdata.h
src/vec2d.h
src/globaldefs.h)
@ -38,7 +40,7 @@ SET(ROBOT_SOURCES
SET(ROBOT_CLONES usr_trb1 usr_sc usr_srw usr_ls1 usr_ls2 usr_mpa1 usr_mpa11 usr_mpa12 usr_36GP usr_rs usr_lp1 usr_mp10)
ROBOT_MODULE(NAME ${ROBOT_NAME} VERSION 3.0.0 SOVERSION 1.0.0
INTERFACE ${ROBOT_INTERFACE}
INTERFACE ${ROBOT_INTERFACE}
SOURCES ${ROBOT_SOURCES}
CLONENAMES ${ROBOT_CLONES})

View file

@ -95,6 +95,9 @@ void SingleCardata::init( CarElt *pcar )
HasABS = HasESP = HasTCL = HasTYC = false;
speed, angle, width, length = 0.0;
MAX_SLIP = 0.27;
TARGET_SLIP = 0.175;
const char *enabling;
enabling = GfParmGetStr(car->_carHandle, SECT_FEATURES, PRM_TIRETEMPDEG, VAL_NO);
@ -267,6 +270,13 @@ double SingleCardata::TyreTreadDepthRear()
return 100 * MIN(Right, Left);
}
/*double SingleCardata::FrontAxleSlipTangential() const
{
double xfslip = (car->wheel(0).slipX() + car->wheel(1).slipX()) * 0.5;
return xfslip;
}*/
Cardata::Cardata(tSituation *s)
{
ncars = s->_ncars;

View file

@ -98,6 +98,7 @@ protected:
double TyreConditionRight();
double TyreTreadDepthFront();
double TyreTreadDepthRear();
double FrontAxleSlipTangential() const;
public:
double lTT;
@ -108,6 +109,8 @@ public:
double GRIP_FACTOR_RIGHT;
tdble TYREWEAR;
tdble CRITICAL_TYREWEAR;
double TARGET_SLIP; // amount of slip to give maximum grip.
double MAX_SLIP; // amount of slip where grip level drops below 99% of maximum grip.
tdble lftOH;
tdble rgtOH;
tdble carMu;

File diff suppressed because it is too large Load diff