Skip to content

Commit

Permalink
ensure more foes are found. refs #13313
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 25, 2023
1 parent d39a6fe commit 5a79a49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/microsim/MSLane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3687,7 +3687,8 @@ MSLane::getFollowersOnConsecutive(const MSVehicle* ego, double backOffset,
const MSLink::LinkLeaders linkLeaders = (*it).viaLink->getLeaderInfo(ego, -backOffset);
for (const auto& ll : linkLeaders) {
if (ll.vehAndGap.first != nullptr) {
const bool egoIsLeader = ll.vehAndGap.first->isLeader((*it).viaLink, ego, ll.vehAndGap.second);
const bool bidiFoe = (*it).viaLink->getLane() == ll.vehAndGap.first->getLane()->getNormalPredecessorLane()->getBidiLane();
const bool egoIsLeader = !bidiFoe && ll.vehAndGap.first->isLeader((*it).viaLink, ego, ll.vehAndGap.second);
// if ego is leader the returned gap still assumes that ego follows the leader
// if the foe vehicle follows ego we need to deduce that gap
const double gap = (egoIsLeader
Expand All @@ -3699,6 +3700,7 @@ MSLane::getFollowersOnConsecutive(const MSVehicle* ego, double backOffset,
std::cout << SIMTIME << " ego=" << ego->getID() << " link=" << (*it).viaLink->getViaLaneOrLane()->getID()
<< " (3) added veh=" << Named::getIDSecure(ll.vehAndGap.first)
<< " gap=" << ll.vehAndGap.second << " dtC=" << ll.distToCrossing
<< " bidiFoe=" << bidiFoe
<< " egoIsLeader=" << egoIsLeader << " gap2=" << gap
<< "\n";
}
Expand Down

0 comments on commit 5a79a49

Please sign in to comment.