Added dandroid_srw and adapted gear switching

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

Former-commit-id: 583e4d3d98e1023badcbc09c1311caeb9e67aebc
Former-commit-id: e0fda7d1294ab9a6235120332eb58013eb2c8615
This commit is contained in:
schellhammer 2016-01-02 18:32:50 +00:00
parent 2071ccf0fc
commit 17c42e966a
3 changed files with 17 additions and 7 deletions

View file

@ -37,7 +37,7 @@ SET(ROBOT_SOURCES
# Official-only dandroid instances.
SET(ROBOT_CLONES dandroid_36GP dandroid_67GP dandroid_lp1 dandroid_ls1 dandroid_ls2 dandroid_mpa1
dandroid_mpa11 dandroid_mpa12 dandroid_rs dandroid_sc dandroid_trb1)
dandroid_mpa11 dandroid_mpa12 dandroid_rs dandroid_sc dandroid_srw dandroid_trb1)
# The ubiquitous robot module and its clones.
ROBOT_MODULE(NAME ${ROBOT_NAME} VERSION 2.0.0 SOVERSION 1.0.0

View file

@ -83,6 +83,7 @@ TDriver::TDriver(int index)
mOfftrackInSector = false;
mLearnedAll = false;
mShiftTimer = 0;
mGear = 0;
mAccelX = 0.0;
mAccelXSum = 0.0;
mAccelXCount = 0;
@ -695,6 +696,11 @@ double TDriver::getAccel(double maxspeed)
}
accel = mSkillDriver * mAccel;
}
if (oCurrSimTime < 0.0) {
if (oCar->_enginerpm / oCar->_enginerpmRedLine > 0.7) {
accel = 0.0;
}
}
return accel;
}
@ -733,26 +739,29 @@ int TDriver::getGear()
}
}
if (mShiftTimer < shifttime) {
return oCar->_gear;
return mGear;
}
if (oCurrSimTime < 0.0) {
return mGear = 0;
}
if (mDrvState == STATE_STUCK) {
return -1;
return mGear = -1;
}
if (oCar->_gear <= 0) {
return 1;
return mGear = 1;
}
if (oCar->_enginerpm / oCar->_enginerpmRedLine > SHIFT_UP) {
mShiftTimer = 0;
return oCar->_gear + 1;
return mGear++;
} else {
double ratiodown = oCar->_gearRatio[oCar->_gear + oCar->_gearOffset - 1] / oCar->_gearRatio[oCar->_gear + oCar->_gearOffset];
if (oCar->_gear > 1 && (oCar->_enginerpmRedLine - SHIFT_DOWN_MARGIN) / oCar->_enginerpm > ratiodown) {
mShiftTimer = 0;
return oCar->_gear - 1;
return mGear--;
}
}
return oCar->_gear;
return mGear;
}

View file

@ -195,6 +195,7 @@ class TDriver {
double mOldTimer;
bool mTenthTimer;
int mShiftTimer;
int mGear;
bool mStuck;
int mStuckcount;
bool mStateChange;