Skip to content

Commit

Permalink
Increasing lookahead distance of gap controller for higher velocities
Browse files Browse the repository at this point in the history
  • Loading branch information
robertalms authored and namdre committed Feb 27, 2024
1 parent eb42d44 commit e61d917
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/microsim/MSVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,13 @@ MSVehicle::Influencer::gapControlSpeed(SUMOTime currentTime, const SUMOVehicle*
std::pair<const MSVehicle*, double> leaderInfo;
if (myGapControlState->referenceVeh == nullptr) {
// No reference vehicle specified -> use current leader as reference
leaderInfo = msVeh->getLeader(MAX2(desiredTargetTimeSpacing, myGapControlState->addGapCurrent) + 20.);
const double brakeGap = msVeh->getBrakeGap(currentSpeed);
leaderInfo = msVeh->getLeader(MAX2(desiredTargetTimeSpacing, myGapControlState->addGapCurrent) + MAX2(brakeGap, 20.0));
#ifdef DEBUG_TRACI
if DEBUG_COND2(veh) {
std::cout << " --- no refVeh; myGapControlState->addGapCurrent: " << myGapControlState->addGapCurrent << ", brakeGap: " << brakeGap << " in simstep: " << SIMSTEP << std::endl;
}
#endif
} else {
// Control gap wrt reference vehicle
const MSVehicle* leader = myGapControlState->referenceVeh;
Expand Down

0 comments on commit e61d917

Please sign in to comment.