Skip to content

Commit

Permalink
Fix another linked road issue
Browse files Browse the repository at this point in the history
  • Loading branch information
minhduc0711 committed Aug 11, 2021
1 parent 43eb9aa commit 7c7693d
Showing 1 changed file with 5 additions and 4 deletions.
@@ -1,14 +1,13 @@
package simtools.gaml.extensions.traffic.carfollowing;

import static simtools.gaml.extensions.traffic.DrivingSkill.getCurrentRoad;
import static simtools.gaml.extensions.traffic.DrivingSkill.getAccBias;
import static simtools.gaml.extensions.traffic.DrivingSkill.setFollower;
import static simtools.gaml.extensions.traffic.DrivingSkill.getAccGainThreshold;
import static simtools.gaml.extensions.traffic.DrivingSkill.getAllowedLanes;
import static simtools.gaml.extensions.traffic.DrivingSkill.getLCCooldown;
import static simtools.gaml.extensions.traffic.DrivingSkill.getLaneChangeLimit;
import static simtools.gaml.extensions.traffic.DrivingSkill.getLeadingVehicle;
import static simtools.gaml.extensions.traffic.DrivingSkill.getLeadingDistance;
import static simtools.gaml.extensions.traffic.DrivingSkill.getLinkedLaneLimit;
import static simtools.gaml.extensions.traffic.DrivingSkill.getLowestLane;
import static simtools.gaml.extensions.traffic.DrivingSkill.getMaxSafeDeceleration;
import static simtools.gaml.extensions.traffic.DrivingSkill.getNumLanesOccupied;
Expand Down Expand Up @@ -71,8 +70,10 @@ public static ImmutablePair<Integer, Double> chooseLane(final IScope scope,
int linkedLaneLimit = Utils.computeLinkedLaneLimit(vehicle, road);
List<Integer> allowedLanes = getAllowedLanes(vehicle);
// Restrict the lane index when entering a new road
currentLowestLane = Math.min(currentLowestLane,
numCurrentLanes + linkedLaneLimit - numLanesOccupied);
if (road != getCurrentRoad(vehicle)) {
currentLowestLane = Math.min(currentLowestLane,
numCurrentLanes + linkedLaneLimit - numLanesOccupied);
}

// Determine the lanes which is considered for switching
int laneChangeLimit = getLaneChangeLimit(vehicle);
Expand Down

0 comments on commit 7c7693d

Please sign in to comment.