Read features of the car and switch on/off own robot based ABS/TCL depending on the

features enabled for the car (Only one ABS/TCL system working at the same time)

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

Former-commit-id: 767d8184d7b36d7d65de1d213fa4379d6b63d42f
Former-commit-id: 6ea4085c6744330dae13f7cde5c243649cec2739
This commit is contained in:
wdbee 2014-11-07 13:56:39 +00:00
parent c14253bea3
commit 860f1a9a0b
2 changed files with 32 additions and 3 deletions

View file

@ -289,6 +289,8 @@ TDriver::TDriver(int Index):
oSysFooStuckY(NULL),
oTrackAngle(0.0),
oTargetSpeed(0.0),
oCarHasABS(false),
oCarHasTCL(false),
oTclRange(10.0),
oTclSlip(1.6),
oTclFactor(1.0),
@ -749,6 +751,28 @@ void TDriver::AdjustDriving(
for (int I = 0; I <= NBR_BRAKECOEFF; I++) // Initialize braking
oBrakeCoeff[I] = oInitialBrakeCoeff;
const char *enabling;
oCarHasABS = false;
enabling = GfParmGetStr(Handle, SECT_FEATURES, PRM_ABSINSIMU, VAL_NO);
if (strcmp(enabling, VAL_YES) == 0)
{
oCarHasABS = true;
LogSimplix.info("#oCarHasABS 1\n");
}
else
LogSimplix.info("#oCarHasABS 0\n");
oCarHasTCL = false;
enabling = GfParmGetStr(Handle, SECT_FEATURES, PRM_TCLINSIMU, VAL_NO);
if (strcmp(enabling, VAL_YES) == 0)
{
oCarHasABS = true;
LogSimplix.info("#oCarHasTCL 1\n");
}
else
LogSimplix.info("#oCarHasTCL 0\n");
oTclRange =
GfParmGetNum(Handle,TDriver::SECT_PRIV,PRV_TCL_RANGE,0,
(float)oTclRange);
@ -1449,7 +1473,8 @@ void TDriver::Drive()
GetPosInfo(Pos,oLanePoint); // Info about pts on track
oTargetSpeed = oLanePoint.Speed; // Target for speed control
oTargetSpeed = FilterStart(oTargetSpeed); // Filter Start
if (!oCarHasTCL)
oTargetSpeed = FilterStart(oTargetSpeed); // Filter Start
//fprintf(stderr,"oTargetSpeed %.2f km/h\n",oTargetSpeed*3.6),
//double TrackRollangle = oRacingLine[oRL_FREE].CalcTrackRollangle(Pos);
@ -1513,7 +1538,8 @@ void TDriver::Drive()
oAccel = FilterLetPass(oAccel);
oAccel = FilterDrifting(oAccel);
oAccel = FilterTrack(oAccel);
oAccel = FilterTCL(oAccel);
if (!oCarHasTCL)
oAccel = FilterTCL(oAccel);
if (oUseFilterAccel)
oAccel = FilterAccel(oAccel);
}
@ -1522,7 +1548,8 @@ void TDriver::Drive()
// Filters for brake
oBrake = FilterBrake(oBrake);
oBrake = FilterBrakeSpeed(oBrake);
oBrake = FilterABS(oBrake);
if (!oCarHasABS)
oBrake = FilterABS(oBrake);
//if (oBrake > 0.10)
// oClutch = 0.4;

View file

@ -333,6 +333,8 @@ private:
PSysFoo oSysFooStuckY; // und Y
float oTrackAngle; // Direction of track
double oTargetSpeed; // Target speed for speed controller
bool oCarHasABS; // Flag: Car has ABS in simu enabled
bool oCarHasTCL; // Flag: Car has TCL in simu enabled
double oTclRange; // TCL range
double oTclSlip; // Max TCL slip
double oTclFactor; // TCL scale