- start work for added meteoroly to dandroid
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7497 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 239358fe1d2c044780aa1f15523be4618920e064 Former-commit-id: af1a34d60c2a4bcd7ed89c0df0d7e6c4754c143a
This commit is contained in:
parent
7fe44b7439
commit
02f5177f24
2 changed files with 46 additions and 1 deletions
|
@ -90,6 +90,9 @@ TDriver::TDriver(int index)
|
|||
mAccelXCount = 0;
|
||||
mSkillGlobal = 1.0;
|
||||
mSkillDriver = 1.0;
|
||||
mRain = false;
|
||||
mRainIntensity = 0.0;
|
||||
mWeatherCode = 0;
|
||||
mWatchdogCount = 0;
|
||||
initVars();
|
||||
setPrevVars();
|
||||
|
@ -158,6 +161,8 @@ void TDriver::InitTrack(PTrack Track, PCarHandle CarHandle, PCarSettings *CarPar
|
|||
// Parameters that are track specific
|
||||
*CarParmHandle = NULL;
|
||||
|
||||
Meteorology(Track);
|
||||
|
||||
switch (Situation->_raceType)
|
||||
{
|
||||
case RM_TYPE_QUALIF:
|
||||
|
@ -2343,3 +2348,35 @@ void TDriver::driverMsgValue(int priority, const std::string &desc, double value
|
|||
LogDANDROID.info("%dm %s s:%d p:%d %s %g\n", (int)mFromStart, oCar->_name, mDrvState, mDrvPath, desc.c_str(), value);
|
||||
}
|
||||
}
|
||||
|
||||
void TDriver::Meteorology(const tTrack* t)
|
||||
{
|
||||
tTrackSeg* Seg;
|
||||
tTrackSurface* Surf;
|
||||
mRainIntensity = 0;
|
||||
mWeatherCode = GetWeather(t);
|
||||
LogDANDROID.info("Meteoroly : %i\n", mWeatherCode);
|
||||
Seg = t->seg;
|
||||
|
||||
for (int I = 0; I < t->nseg; I++)
|
||||
{
|
||||
Surf = Seg->surface;
|
||||
mRainIntensity = MAX(mRainIntensity, Surf->kFrictionDry / Surf->kFriction);
|
||||
LogDANDROID.debug("# %.4f, %.4f %s\n", Surf->kFriction, Surf->kRollRes, Surf->material);
|
||||
Seg = Seg->next;
|
||||
}
|
||||
|
||||
mRainIntensity -= 1;
|
||||
|
||||
if (mRainIntensity > 0)
|
||||
{
|
||||
mRain = true;
|
||||
}
|
||||
else
|
||||
mRain = false;
|
||||
}
|
||||
|
||||
unsigned int TDriver::GetWeather(const tTrack* t)
|
||||
{
|
||||
return (t->local.rain << 4) + t->local.water;
|
||||
};
|
||||
|
|
|
@ -144,6 +144,9 @@ class TDriver
|
|||
void driverMsg(const std::string &desc);
|
||||
void driverMsgValue(int priority, const std::string &desc, double value);
|
||||
|
||||
void Meteorology(const tTrack* t);
|
||||
unsigned int GetWeather(const tTrack* t);
|
||||
|
||||
// Per robot global data
|
||||
int mDrvPath;
|
||||
int mDrvPath_prev;
|
||||
|
@ -296,9 +299,14 @@ class TDriver
|
|||
int mAccelXCount;
|
||||
double mSkillGlobal;
|
||||
double mSkillDriver;
|
||||
|
||||
bool mRain;
|
||||
double mRainIntensity;
|
||||
unsigned int mWeatherCode;
|
||||
|
||||
PidController mSpeedController;
|
||||
PidController mAttackAngleController;
|
||||
int mWatchdogCount;
|
||||
int mWatchdogCount;
|
||||
// Data that should stay constant after first initialization
|
||||
double mBRAKEPRESS;
|
||||
double mBRAKEREPARTITION;
|
||||
|
|
Loading…
Reference in a new issue