forked from speed-dreams/speed-dreams-code
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:
parent
c14253bea3
commit
860f1a9a0b
2 changed files with 32 additions and 3 deletions
|
@ -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,6 +1473,7 @@ void TDriver::Drive()
|
|||
|
||||
GetPosInfo(Pos,oLanePoint); // Info about pts on track
|
||||
oTargetSpeed = oLanePoint.Speed; // Target for speed control
|
||||
if (!oCarHasTCL)
|
||||
oTargetSpeed = FilterStart(oTargetSpeed); // Filter Start
|
||||
//fprintf(stderr,"oTargetSpeed %.2f km/h\n",oTargetSpeed*3.6),
|
||||
|
||||
|
@ -1513,6 +1538,7 @@ void TDriver::Drive()
|
|||
oAccel = FilterLetPass(oAccel);
|
||||
oAccel = FilterDrifting(oAccel);
|
||||
oAccel = FilterTrack(oAccel);
|
||||
if (!oCarHasTCL)
|
||||
oAccel = FilterTCL(oAccel);
|
||||
if (oUseFilterAccel)
|
||||
oAccel = FilterAccel(oAccel);
|
||||
|
@ -1522,6 +1548,7 @@ void TDriver::Drive()
|
|||
// Filters for brake
|
||||
oBrake = FilterBrake(oBrake);
|
||||
oBrake = FilterBrakeSpeed(oBrake);
|
||||
if (!oCarHasABS)
|
||||
oBrake = FilterABS(oBrake);
|
||||
//if (oBrake > 0.10)
|
||||
// oClutch = 0.4;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue