Skip to content

Commit

Permalink
fixed invalid detection for oncoming bidi neighbor. refs #13313
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 25, 2023
1 parent a9c80cc commit d62d849
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/microsim/MSLaneChanger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,11 @@ MSLaneChanger::getRealLeader(const ChangerIt& target) const {
double leaderBack = targetLane->getLength();
for (MSVehicle* pl : targetLane->myPartialVehicles) {
double plBack = pl->getBackPositionOnLane(targetLane);
if (plBack < leaderBack &&
pl->getPositionOnLane(targetLane) + pl->getVehicleType().getMinGap() >= egoBack) {
if (pl->getLane() == targetLane->getBidiLane()) {
plBack -= pl->getVehicleType().getLengthWithGap();
}
const double plPos = plBack + pl->getVehicleType().getLength();
if (plBack < leaderBack && plPos + pl->getVehicleType().getMinGap() >= egoBack) {
neighLead = pl;
leaderBack = plBack;
}
Expand All @@ -578,10 +581,7 @@ MSLaneChanger::getRealLeader(const ChangerIt& target) const {
std::cout << " found leader=" << neighLead->getID() << " (partial)\n";
}
#endif
double gap = leaderBack - vehicle->getPositionOnLane() - vehicle->getVehicleType().getMinGap();
if (neighLead->getLane() == targetLane->getBidiLane()) {
gap -= neighLead->getVehicleType().getLengthWithGap();
}
const double gap = leaderBack - vehicle->getPositionOnLane() - vehicle->getVehicleType().getMinGap();
return std::pair<MSVehicle*, double>(neighLead, gap);
}
double seen = myCandi->lane->getLength() - vehicle->getPositionOnLane();
Expand Down

0 comments on commit d62d849

Please sign in to comment.