59 #define ZIPPER_ADAPT_TIME 10 61 #define JM_CROSSING_GAP_DEFAULT 10 64 #define DIVERGENCE_MIN_WIDTH 2.5 71 myLaneBefore(predLane),
80 myFoeVisibilityDistance(foeVisibilityDistance),
84 myKeepClear(keepClear),
86 myInternalLaneBefore(nullptr),
90 myWalkingAreaFoe(nullptr),
91 myHavePedestrianCrossingFoe(false),
92 myParallelRight(nullptr),
93 myParallelLeft(nullptr),
103 const double dist = from.back().distanceTo2D(to.front());
109 myLateralShift = (from.back().distanceTo2D(to.front()) < dist) ? dist : -dist;
121 const std::vector<MSLink*>& foeLinks,
122 const std::vector<MSLane*>& foeLanes,
123 MSLane* internalLaneBefore) {
133 for (std::vector<MSLane*>::const_iterator it_lane = foeLanes.begin(); it_lane != foeLanes.end(); ++it_lane) {
141 if (internalLaneBefore !=
nullptr) {
143 lane = internalLaneBefore;
149 #ifdef MSLink_DEBUG_CROSSING_POINTS 152 if (lane !=
nullptr) {
153 const bool beforeInternalJunction = lane->
getLinkCont()[0]->getViaLaneOrLane()->getEdge().isInternal();
158 for (std::vector<const MSLane*>::const_iterator it_lane =
myFoeLanes.begin(); it_lane !=
myFoeLanes.end(); ++it_lane) {
161 if (sameTarget && !beforeInternalJunction && !
contIntersect(lane, *it_lane)) {
165 #ifdef MSLink_DEBUG_CROSSING_POINTS 167 <<
" " << lane->
getID()
168 <<
" merges with " << (*it_lane)->getID()
169 <<
" nextLane " << lane->
getLinkCont()[0]->getViaLaneOrLane()->getID()
176 #ifdef MSLink_DEBUG_CROSSING_POINTS 179 bool haveIntersection =
true;
180 if (intersections1.size() == 0) {
181 intersections1.push_back(-10000.0);
182 haveIntersection =
false;
183 }
else if (intersections1.size() > 1) {
184 std::sort(intersections1.begin(), intersections1.end());
186 std::vector<double> intersections2 = (*it_lane)->getShape().intersectsAtLengths2D(lane->
getShape());
187 #ifdef MSLink_DEBUG_CROSSING_POINTS 190 if (intersections2.size() == 0) {
191 intersections2.push_back(0);
192 }
else if (intersections2.size() > 1) {
193 std::sort(intersections2.begin(), intersections2.end());
195 if (haveIntersection) {
197 intersections1.back() -= (*it_lane)->getWidth() / 2;
198 intersections2.back() -= lane->
getWidth() / 2;
201 intersections2.back() = (*it_lane)->interpolateGeometryPosToLanePos(intersections2.back());
206 intersections1.back() = 0;
211 lane->
getLength() - intersections1.back(),
212 (*it_lane)->getLength() - intersections2.back()));
214 #ifdef MSLink_DEBUG_CROSSING_POINTS 216 <<
" intersection of " << lane->
getID()
218 <<
" with " << (*it_lane)->getID()
219 <<
" totalLength=" << (*it_lane)->getLength()
231 const MSLane* sibling = it->getViaLane();
232 if (sibling != lane && sibling !=
nullptr) {
236 if (l.front().distanceTo2D(s.front()) >= minDist) {
240 double lbcSibling = 0;
242 if (l.back().distanceTo2D(s.back()) > minDist) {
249 std::vector<double> distances = l.
distances(s);
250 #ifdef MSLink_DEBUG_CROSSING_POINTS 251 std::cout <<
" distances=" <<
toString(distances) <<
"\n";
253 assert(distances.size() == l.size() + s.size());
254 if (distances.back() > minDist && distances[l.size() - 1] > minDist) {
256 for (
int j = (
int)s.size() - 2; j >= 0; j--) {
257 const int i = j + (int)l.size();
258 const double segLength = s[j].distanceTo2D(s[j + 1]);
259 if (distances[i] > minDist) {
260 lbcSibling += segLength;
263 lbcSibling += segLength - (minDist - distances[i]) * segLength / (distances[i + 1] - distances[i]);
267 for (
int i = (
int)l.size() - 2; i >= 0; i--) {
268 const double segLength = l[i].distanceTo2D(l[i + 1]);
269 if (distances[i] > minDist) {
270 lbcLane += segLength;
273 lbcLane += segLength - (minDist - distances[i]) * segLength / (distances[i + 1] - distances[i]);
281 const double distToDivergence1 = sibling->
getLength() - lbcSibling;
282 const double distToDivergence2 = lane->
getLength() - lbcLane;
283 const double distToDivergence =
MIN3(
284 MAX2(distToDivergence1, distToDivergence2),
288 lbcSibling =
MAX2(0.0, sibling->
getLength() - distToDivergence);
292 #ifdef MSLink_DEBUG_CROSSING_POINTS 293 std::cout <<
" distToDivergence=" << distToDivergence
294 <<
" distTD1=" << distToDivergence1
295 <<
" distTD2=" << distToDivergence2
299 std::cout <<
" adding same-origin foe" << sibling->
getID()
312 const MSEdge* target = &(it->getLane()->getEdge());
316 if (target == myTarget) {
327 for (MSLinkCont::const_iterator it = predLinks2.begin(); it != predLinks2.end(); ++it) {
328 const MSEdge* target = &((*it)->getLane()->getEdge());
341 if (foe->
getLinkCont()[0]->getViaLane() !=
nullptr) {
343 return intersections.size() > 0;
352 const bool setRequest,
const SUMOTime arrivalTimeBraking,
const double arrivalSpeedBraking,
const SUMOTime waitingTime,
double dist) {
354 #ifdef DEBUG_APPROACHING 356 std::cout <<
SIMTIME <<
" Link ''" << (
myLaneBefore == 0 ?
"NULL" : myLaneBefore->
getID()) <<
"'->'" << (
myLane == 0 ?
"NULL" :
myLane->
getID()) <<
"' Adding approaching vehicle '" << approaching->
getID() <<
"'\nCurrently registered vehicles:" << std::endl;
358 std::cout <<
"'" << i->first->getID() <<
"'" << std::endl;
364 arrivalTimeBraking, arrivalSpeedBraking, waitingTime, dist)));
371 #ifdef DEBUG_APPROACHING 373 std::cout <<
SIMTIME <<
" Link ''" << (
myLaneBefore == 0 ?
"NULL" : myLaneBefore->
getID()) <<
"'->'" << (
myLane == 0 ?
"NULL" :
myLane->
getID()) <<
"' Adding approaching vehicle '" << approaching->
getID() <<
"'\nCurrently registered vehicles:" << std::endl;
375 std::cout <<
"'" << i->first->getID() <<
"'" << std::endl;
393 if ((*i)->isBlockingAnyone()) {
404 #ifdef DEBUG_APPROACHING 407 std::cout <<
"' Removing approaching vehicle '" << veh->
getID() <<
"'\nCurrently registered vehicles:" << std::endl;
409 std::cout <<
"'" << i->first->getID() <<
"'" << std::endl;
430 const double leaveSpeed,
const double vehicleLength)
const {
437 double impatience,
double decel,
SUMOTime waitingTime,
double posLat,
438 std::vector<const SUMOVehicle*>* collectFoes,
bool ignoreRed,
const SUMOVehicle* ego)
const {
449 assert(
myLane != foeLink->getLane());
450 for (
auto& it : foeLink->myApproachingVehicles) {
454 ((posLat < foe->getLateralPositionOnLane() &&
myLane->
getIndex() > foeLink->myLane->getIndex())
457 && (arrivalTime > it.second.arrivalTime
461 if (
blockedByFoe(foe, it.second, arrivalTime, leaveTime, arrivalSpeed, leaveSpeed,
false,
462 impatience, decel, waitingTime, ego)) {
463 #ifdef MSLink_DEBUG_OPENED 465 std::cout <<
SIMTIME <<
" blocked by " << foe->
getID() <<
" arrival=" << arrivalTime <<
" foeArrival=" << it.second.arrivalTime <<
"\n";
468 if (collectFoes ==
nullptr) {
469 #ifdef MSLink_DEBUG_OPENED 471 std::cout <<
" link=" <<
getViaLaneOrLane()->
getID() <<
" blocked by sublaneFoe=" << foe->
getID() <<
" foeLink=" << foeLink->getViaLaneOrLane()->getID() <<
" posLat=" << posLat <<
"\n";
476 collectFoes->push_back(foe);
486 for (
auto& it : foeLink->myApproachingVehicles) {
492 && (posLat < foe->getLateralPositionOnLane()))) {
493 if (
blockedByFoe(foe, it.second, arrivalTime, leaveTime, arrivalSpeed, leaveSpeed,
false,
494 impatience, decel, waitingTime, ego)) {
495 #ifdef MSLink_DEBUG_OPENED 497 std::cout <<
SIMTIME <<
" blocked by sublane foe " << foe->
getID() <<
" arrival=" << arrivalTime <<
" foeArrival=" << it.second.arrivalTime <<
"\n";
500 if (collectFoes ==
nullptr) {
503 collectFoes->push_back(foe);
514 return collectFoes ==
nullptr || collectFoes->size() == 0;
520 #ifdef MSLink_DEBUG_OPENED 528 if ((*i)->haveRed()) {
532 #ifdef MSLink_DEBUG_OPENED 534 std::cout <<
" foeLink=" << (*i)->getViaLaneOrLane()->getID() <<
" numApproaching=" << (*i)->getApproaching().size() <<
"\n";
537 if ((*i)->blockedAtTime(arrivalTime, leaveTime, arrivalSpeed, leaveSpeed,
myLane == (*i)->getLane(),
538 impatience, decel, waitingTime, collectFoes, ego)) {
542 if (collectFoes !=
nullptr && collectFoes->size() > 0) {
551 bool sameTargetLane,
double impatience,
double decel,
SUMOTime waitingTime,
552 std::vector<const SUMOVehicle*>* collectFoes,
const SUMOVehicle* ego)
const {
554 #ifdef MSLink_DEBUG_OPENED 560 <<
" foeVeh=" << it.first->getID() <<
" (below ignore speed)" 571 &&
blockedByFoe(it.first, it.second, arrivalTime, leaveTime, arrivalSpeed, leaveSpeed, sameTargetLane,
572 impatience, decel, waitingTime, ego)) {
573 if (collectFoes ==
nullptr) {
576 collectFoes->push_back(it.first);
586 SUMOTime arrivalTime,
SUMOTime leaveTime,
double arrivalSpeed,
double leaveSpeed,
587 bool sameTargetLane,
double impatience,
double decel,
SUMOTime waitingTime,
589 #ifdef MSLink_DEBUG_OPENED 592 <<
" foeVeh=" << veh->
getID()
603 assert(waitingTime > 0);
618 #ifdef MSLink_DEBUG_OPENED 620 std::cout <<
" imp=" << impatience <<
" fATb=" << avi.
arrivalTimeBraking <<
" fAT2=" << foeArrivalTime <<
" lA=" << lookAhead <<
" egoAT=" << arrivalTime <<
" egoLT=" << leaveTime <<
"\n";
625 if (sameTargetLane && (arrivalTime - avi.
leavingTime < lookAhead
628 #ifdef MSLink_DEBUG_OPENED 630 std::cout <<
" blocked (cannot follow)\n";
635 }
else if (foeArrivalTime > leaveTime + lookAhead) {
639 #ifdef MSLink_DEBUG_OPENED 641 std::cout <<
" blocked (cannot lead)\n";
648 #ifdef MSLink_DEBUG_OPENED 650 std::cout <<
" blocked (hard conflict)\n";
663 if (veh ==
nullptr) {
667 assert(distLeft > 0);
678 if ((*i)->blockedAtTime(arrivalTime, leaveTime, speed, speed,
myLane == (*i)->getLane(), 0, decel, 0)) {
682 for (std::vector<const MSLane*>::const_iterator i =
myFoeLanes.begin(); i !=
myFoeLanes.end(); ++i) {
683 if ((*i)->getVehicleNumberWithPartials() > 0) {
731 assert(predLink != 0);
746 std::vector<std::pair<SUMOTime, const SUMOVehicle*> > toSort;
748 toSort.push_back(std::make_pair(it.second.arrivalTime, it.first));
750 std::sort(toSort.begin(), toSort.end());
751 for (std::vector<std::pair<SUMOTime, const SUMOVehicle*> >::const_iterator it = toSort.begin(); it != toSort.end(); ++it) {
775 while (lane !=
nullptr && lane->
isInternal()) {
787 while (lane !=
nullptr && lane->
isInternal()) {
802 double totalDist = 0.;
803 bool foundCrossing =
false;
804 while (via !=
nullptr) {
810 foundCrossing =
true;
828 for (foe_ix = 0; foe_ix != (int)
myFoeLanes.size(); ++foe_ix) {
835 #ifdef MSLink_DEBUG_CROSSING_POINTS 842 if (dist == -10000.) {
846 #ifdef MSLink_DEBUG_CROSSING_POINTS 848 <<
"' at distance " << dist <<
" (approach along '" 902 while (lane !=
nullptr) {
932 std::cout <<
SIMTIME <<
" getLeaderInfo link=" <<
getViaLaneOrLane()->
getID() <<
" dist=" << dist <<
" isShadowLink=" << isShadowLink <<
"\n";
935 for (
int i = 0; i < (int)
myFoeLanes.size(); ++i) {
941 const double crossingWidth = (sameTarget || sameSource) ? 0 : foeLane->
getWidth();
944 std::cout <<
" distToCrossing=" << distToCrossing <<
" foeLane=" << foeLane->
getID() <<
" cWidth=" << crossingWidth
951 const bool contLane = (foeLane->
getLinkCont()[0]->getViaLaneOrLane()->getEdge().isInternal() && !(
953 if (distToCrossing + crossingWidth < 0
968 const double leaderBackDist = foeDistToCrossing - leaderBack;
969 const bool pastTheCrossingPoint = leaderBackDist + foeCrossingWidth < 0;
970 const bool ignoreIndirectBicycleTurn = (pastTheCrossingPoint
973 const bool cannotIgnore = ((contLane && !ignoreIndirectBicycleTurn) || sameTarget || sameSource) && ego !=
nullptr;
977 std::cout <<
" candiate leader=" << leader->
getID()
978 <<
" cannotIgnore=" << cannotIgnore
979 <<
" fdtc=" << foeDistToCrossing
980 <<
" lb=" << leaderBack
981 <<
" lbd=" << leaderBackDist
982 <<
" fcwidth=" << foeCrossingWidth
983 <<
" foePastCP=" << pastTheCrossingPoint
984 <<
" inTheWay=" << inTheWay
985 <<
" willPass=" << foeLane->
getLinkCont()[0]->getApproaching(leader).willPass
987 <<
" isOpposite=" << isOpposite <<
"\n";
998 if ((!cannotIgnore || leader->
isStopped())
999 && !foeLane->
getLinkCont()[0]->getApproaching(leader).willPass
1011 bool fromLeft =
true;
1012 if (ego ==
nullptr) {
1015 gap = leaderBackDist;
1019 distToCrossing += foeLane->
getWidth() / 2;
1020 if (gap + foeCrossingWidth < 0) {
1027 fromLeft = foeDistToCrossing > 0.5 * foeLane->
getLength();
1028 }
else if ((contLane && !sameSource && !ignoreIndirectBicycleTurn) || isOpposite) {
1032 std::cout <<
" distToCrossing=" << distToCrossing <<
" leader back=" << leaderBack <<
" backDist=" << leaderBackDist <<
"\n";
1034 if (leaderBackDist + foeCrossingWidth < 0) {
1044 const bool stopAsap = leader->
isFrontOnLane(foeLane) ? cannotIgnore : (sameTarget || sameSource);
1046 std::cout <<
" leader=" << leader->
getID() <<
" contLane=" << contLane <<
" cannotIgnore=" << cannotIgnore <<
" stopAsap=" << stopAsap <<
"\n";
1048 result.push_back(
LinkLeader(leader, gap, stopAsap ? -1 : distToCrossing, fromLeft));
1052 if (ego !=
nullptr) {
1059 const double vehSideOffset = (foeDistToCrossing +
myLaneBefore->
getWidth() * 0.5 - vehWidth * 0.5
1075 double distToPeds = std::numeric_limits<double>::max();
1077 for (std::set<MSTransportable*>::const_iterator it = persons.begin(); it != persons.end(); ++it) {
1080 if (collectBlockers !=
nullptr) {
1081 collectBlockers->push_back(p);
1090 const MSLane* foeLane = *it;
1094 if (leader == ego) {
1108 <<
" foeLane=" << foeLane->
getID()
1109 <<
" leader=" << leader->
getID()
1112 <<
" egoLat=" << posLat
1113 <<
" leaderLat=" << posLatLeader
1114 <<
" leaderLatOffset=" << leader->
getLatOffset(foeLane)
1116 <<
" foeIndex=" << foeLane->
getIndex()
1122 if ((posLat < posLatLeader && myInternalLaneBefore->
getIndex() > foeLane->
getIndex())
1125 std::cout <<
SIMTIME <<
" blocked by " << leader->
getID() <<
" (sublane split) foeLane=" << foeLane->
getID() <<
"\n";
1127 result.push_back(
LinkLeader(leader, gap, -1));
1159 if (direction == -1) {
1161 }
else if (direction == 1) {
1174 if (before !=
nullptr && after !=
nullptr) {
1191 std::vector<const SUMOVehicle*>* collectFoes)
const {
1197 throw ProcessError(
"Zipper junctions with more than two conflicting lanes are not supported (at junction '" 1201 const double secondsToArrival =
STEPS2TIME(arrivalTime - now);
1205 <<
" dist=" << dist <<
" ignoring foes (arrival in " <<
STEPS2TIME(arrivalTime - now) <<
")\n";
1211 <<
" egoAT=" << arrivalTime
1213 <<
" vSafe=" << vSafe
1214 <<
" numFoes=" << collectFoes->size()
1218 const double vSafeOrig = vSafe;
1219 for (std::vector<const SUMOVehicle*>::const_iterator i = collectFoes->begin(); i != collectFoes->end(); ++i) {
1231 <<
" ignoring foe=" << foe->
getID()
1233 <<
" foeDist=" << avi.
dist 1236 <<
" deltaDist=" << avi.
dist - dist
1246 const double followInTime = vSafeOrig + (follow - vSafeOrig) /
MAX2(1.0, secondsToArrival);
1247 vSafe =
MIN2(vSafe, followInTime);
1250 <<
" foeDist=" << avi.
dist 1251 <<
" follow=" << follow
1252 <<
" followInTime=" << followInTime
1255 <<
" follow=" << follow
1259 <<
" vSafe=" << vSafe
1270 followDist > leaderDist &&
1288 for (
const MSLink* link : cand->getLinkCont()) {
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
bool gDebugFlag1
global utility flags for debugging
The link is a partial left direction.
static double gLateralResolution
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
bool contIntersect(const MSLane *lane, const MSLane *foe)
check if the lane intersects with a foe cont-lane
int myIndex
The position within this respond.
double getLength() const
Returns the vehicle's length.
#define DIVERGENCE_MIN_WIDTH
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
bool blockedAtTime(SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime, std::vector< const SUMOVehicle *> *collectFoes=0, const SUMOVehicle *ego=0) const
Returns the information whether this link is blocked Valid after the vehicles have set their requests...
double getJMParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
MSLane * myLane
The lane behind the junction approached by this link.
void addBlockedLink(MSLink *link)
LinkState myState
The state of the link.
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
MSLane * getLane() const
Returns the connected lane.
std::map< const SUMOVehicle *, ApproachingVehicleInformation, ComparatorNumericalIdLess > myApproachingVehicles
bool myHavePedestrianCrossingFoe
whether on of myFoeLanes is a crossing
double getLengthBeforeCrossing(const MSLane *foeLane) const
Returns the internal length from the beginning of the link's internal lane before to the crossing wit...
MSLane * getLane() const
Returns the lane the vehicle is on.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
bool myHasFoes
Whether any foe links exist.
This is an uncontrolled, minor link, has to stop.
The base class for an intersection.
std::vector< MSLink * > mySublaneFoeLinks
static bool gComputeLC
whether the simulationLoop is in the lane changing phase
const MSLane * getLaneBefore() const
return the internalLaneBefore if it exists and the laneBefore otherwise
SUMOTime myLastStateChange
The time of the last state change.
std::vector< MSLink * > myFoeLinks
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
MSLink * getCorrespondingExitLink() const
returns the corresponding exit link for entryLinks to a junction.
#define ZIPPER_ADAPT_TIME
void setTLState(LinkState state, SUMOTime t)
Sets the current tl-state.
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane...
std::string time2string(SUMOTime t)
LinkDirection myDirection
An abstract (hopefully human readable) definition of the link's direction.
double getZipperSpeed(const MSVehicle *ego, const double dist, double vSafe, SUMOTime arrivalTime, std::vector< const SUMOVehicle *> *collectFoes) const
return the speed at which ego vehicle must approach the zipper link
static const double ZIPPER_ADAPT_DIST
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static const SUMOTime myLookaheadTime
double getLength() const
Returns the lane's length.
const PositionVector & getShape() const
Returns this lane's shape.
double myLateralShift
lateral shift to be applied when passing this link
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
std::vector< std::pair< double, double > > myLengthsBehindCrossing
bool hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
bool checkContOff() const
figure out whether the cont status remains in effect when switching off the tls
const std::string & getID() const
Returns the id.
double getInternalLengthsBefore() const
Returns the cumulative length of all internal lanes before this link.
std::vector< double > distances(const PositionVector &s, bool perpendicular=false) const
distances of all my points to s and all of s points to myself
double getInternalLengthsAfter() const
Returns the cumulative length of all internal lanes after this link.
The link is controlled by a tls which is off, not blinking, may pass.
This is an uncontrolled, all-way stop link.
std::vector< MSLane * > mySublaneFoeLanes
double getWidth() const
Returns the lane's width.
void setApproaching(const SUMOVehicle *approaching, const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const bool setRequest, const SUMOTime arrivalTimeBraking, const double arrivalSpeedBraking, const SUMOTime waitingTime, double dist)
Sets the information about an approaching vehicle.
bool isInternalJunctionLink() const
return whether the fromLane and the toLane of this link are internal lanes
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
MSAbstractLaneChangeModel & getLaneChangeModel()
MSLink * computeParallelLink(int direction)
MSLink * getParallelLink(int direction) const
return the link that is parallel to this lane or 0
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
bool willHaveBlockedFoe() const
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
bool fromInternalLane() const
return whether the fromLane of this link is an internal lane
The link is a straight direction.
bool willStop() const
Returns whether the vehicle will stop on the current edge.
const MSLane * myInternalLaneBefore
bool lastWasContMajor() const
whether this is a link past an internal junction which currently has priority
A road/street connecting two junctions.
double getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane...
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
int getIndex() const
Returns the lane's index.
SUMOTime getLeaveTime(const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const double vehicleLength) const
return the expected time at which the given vehicle will clear the link
MSLink * getEntryLink() const
Returns the entry link if this is an internal lane, else 0.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
MSLane * getViaLane() const
Returns the following inner lane.
virtual bool blockedAtDist(const MSLane *lane, double vehSide, double vehWidth, double oncomingGap, std::vector< const MSPerson *> *collectBlockers)
whether a pedestrian is blocking the crossing of lane for the given vehicle bondaries ...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isExitLink() const
return whether the fromLane of this link is an internal lane and toLane is a normal lane ...
Representation of a vehicle.
bool opened(SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, double impatience, double decel, SUMOTime waitingTime, double posLat=0, std::vector< const SUMOVehicle *> *collectFoes=0, bool ignoreRed=false, const SUMOVehicle *ego=0) const
Returns the information whether the link may be passed.
std::vector< MSLink * > mySublaneFoeLinks2
static bool unsafeMergeSpeeds(double leaderSpeed, double followerSpeed, double leaderDecel, double followerDecel)
return whether the given vehicles may NOT merge safely
static MSPModel * getModel()
double interpolateGeometryPosToLanePos(double geometryPos) const
ApproachingVehicleInformation getApproaching(const SUMOVehicle *veh) const
static const SUMOTime myLookaheadTimeZipper
static bool couldBrakeForLeader(double followDist, double leaderDist, const MSVehicle *follow, const MSVehicle *leader)
whether fllower could stay behind leader (possibly by braking)
const std::set< MSTransportable * > & getPersons() const
Returns this edge's persons set.
void writeApproaching(OutputDevice &od, const std::string fromLaneID) const
write information about all approaching vehicles to the given output device
std::set< MSLink * > myBlockedFoeLinks
bool isConflictEntryLink() const
return whether this link enters the conflict area (not a continuation link)
bool havePriority() const
Returns whether this link is a major link.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction ...
The link is a (hard) right direction.
const MSLane * getInternalLaneBefore() const
return myInternalLaneBefore (always 0 when compiled without internal lanes)
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction ...
double getLengthsBeforeCrossing(const MSLane *foeLane) const
Returns the sum of the lengths along internal lanes following this link to the crossing with the give...
std::vector< LinkLeader > LinkLeaders
std::vector< double > intersectsAtLengths2D(const PositionVector &other) const
For all intersections between this vector and other, return the 2D-length of the subvector from this ...
bool isEntryLink() const
return whether the toLane of this link is an internal lane and fromLane is a normal lane ...
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
double getMinGap() const
Get the free space in front of vehicles of this class.
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
void initParallelLinks()
initialize parallel links (to be called after all links are loaded)
bool isInternal() const
return whether this edge is an internal edge
The link is a partial right direction.
const SUMOVTypeParameter & getParameter() const
double getLength() const
Returns the length of this link.
void move2side(double amount)
move position vector to side using certain ammount
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
bool isExitLinkAfterInternalJunction() const
return whether the fromLane of this link is an internal lane and its incoming lane is also an interna...
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
MSLink(MSLane *predLane, MSLane *succLane, MSLane *via, LinkDirection dir, LinkState state, double length, double foeVisibilityDistance, bool keepClear, MSTrafficLightLogic *logic, int tlLinkIdx)
Constructor for simulation which uses internal lanes.
static bool maybeOccupied(MSLane *lane)
returns whether the given lane may still be occupied by a vehicle currently on it ...
const MSLane * myWalkingAreaFoe
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
const MSTrafficLightLogic * myLogic
the controlling logic or 0
virtual Position getPosition() const
Return the Network coordinate of the transportable.
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
The link is controlled by a tls which is off and blinks, has to brake.
const MSJunction * getFromJunction() const
MSLane * myLaneBefore
The lane approaching this link.
MSJunction * myJunction
the junction to which this link belongs
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
virtual double getLateralPositionOnLane() const =0
Get the vehicle's lateral position on the lane.
#define JM_CROSSING_GAP_DEFAULT
LinkLeaders getLeaderInfo(const MSVehicle *ego, double dist, std::vector< const MSPerson *> *collectBlockers=0, bool isShadowLink=false) const
Returns all potential link leaders (vehicles on foeLanes) Valid during the planMove() phase...
int getIndex() const
Returns the respond index (for visualization)
double getLength() const
Get vehicle's length [m].
static SUMOTime gIgnoreJunctionBlocker
const MSVehicleType & getVehicleType() const
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
The parent class for traffic light logics.
Static storage of an output device and its base (abstract) implementation.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
MSLane *const myInternalLane
The following junction-internal lane if used.
static const double SAFETY_GAP
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
bool isStopped() const
Returns whether the vehicle is at a stop.
const double INVALID_DOUBLE
const std::map< const SUMOVehicle *, ApproachingVehicleInformation, ComparatorNumericalIdLess > & getApproaching() const
return all approaching vehicles
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
double getSpeed() const
Returns the vehicle's current speed.
virtual double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const =0
Computes the vehicle's follow speed (no dawdling)
const std::string & getID() const
Returns the name of the vehicle.
Representation of a lane in the micro simulation.
bool blockedByFoe(const SUMOVehicle *veh, const ApproachingVehicleInformation &avi, SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime, const SUMOVehicle *ego) const
virtual const std::string & getID() const =0
Get the vehicle's ID.
bool haveRed() const
Returns whether this link is blocked by a red (or redyellow) traffic light.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void setRequestInformation(int index, bool hasFoes, bool isCont, const std::vector< MSLink *> &foeLinks, const std::vector< MSLane *> &foeLanes, MSLane *internalLaneBefore=0)
Sets the request information.
std::vector< const MSLane * > myFoeLanes
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
bool hasApproachingFoe(SUMOTime arrivalTime, SUMOTime leaveTime, double speed, double decel) const
Returns the information whether a vehicle is approaching on one of the link's foe streams...
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.