Skip to content

Commit

Permalink
stabilize lane choice in roundabout. refs #14587
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Mar 23, 2024
1 parent 2f9f2ee commit 6a89c2a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/microsim/lcmodels/MSLCHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ MSLCHelper::getRoundaboutDistBonus(const MSVehicle& veh,
const double bonus = roundaboutJunctionsAhead * 7.5;
const double relativeJam = (occupancyOuter - occupancyInner + bonus) / (maxOccupancy + bonus);
// no bonus if the inner lane or the left lane entering the roundabout is jammed
const double jamFactor = MAX2(0.0, relativeJam);
double jamFactor = MAX2(0.0, relativeJam);
if (veh.getLane()->getEdge().isRoundabout() && curr.lane->getIndex() > neigh.lane->getIndex()) {
// only use jamFactor when deciding to move to the inside lane but prefer
// staying inside if the distance allows it
jamFactor = 1;
}
const double result = distanceInRoundabout * jamFactor * bonusParam * 9; // the 9 is abitrary and only there for backward compatibility
#ifdef DEBUG_WANTS_CHANGE
if (debugVehicle) {
Expand Down

0 comments on commit 6a89c2a

Please sign in to comment.