// Drive during race. void Driver::drive(tSituation *s) { memset(&car->ctrl, 0, sizeof(tCarCtrl)); update(s); //pit->setPitstop(true); if (isStuck()) { car->_steerCmd = -mycardata->getCarAngle() / car->_steerLock; car->_gearCmd = -1; // Reverse gear. car->_accelCmd = 1.0f; // 100% accelerator pedal. car->_brakeCmd = 0.0f; // No brakes. car->_clutchCmd = 0.0f; // Full clutch (gearbox connected with engine). } else { car->_steerCmd = filterSColl(getSteer()); car->_gearCmd = getGear(); car->_brakeCmd = filterABS(filterBrakeSpeed(filterBColl(filterBPit(getBrake())))); if (car->_brakeCmd == 0.0f) { car->_accelCmd = filterTCL(filterTrk(filterOverlap(getAccel()))); } else { car->_accelCmd = 0.0f; } car->_clutchCmd = getClutch(); } }
/* Drive during race. */ void Driver::drive(tSituation *s) { memset(&car->ctrl, 0, sizeof(tCarCtrl)); update(s); if (isStuck()) { car->ctrl.steer = -angle / car->_steerLock; car->ctrl.gear = -1; // reverse gear car->ctrl.accelCmd = 0.5; // 50% accelerator pedal car->ctrl.brakeCmd = 0.0; // no brakes } else { car->ctrl.steer = filterSColl(getSteer()); car->ctrl.gear = getGear(); car->ctrl.brakeCmd = filterABS(filterBrakeSpeed(filterBColl(filterBPit(getBrake())))); if (car->ctrl.brakeCmd == 0.0) { car->ctrl.accelCmd = filterTCL(filterTrk(getAccel())); } else { car->ctrl.accelCmd = 0.0; } } }