 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
51 #define DEBUG_COND_ZIPPER (ego->isSelected())
63 #define ZIPPER_ADAPT_TIME 10
65 #define JM_CROSSING_GAP_DEFAULT 10
68 #define DIVERGENCE_MIN_WIDTH 2.5
75 myLaneBefore(predLane),
84 myFoeVisibilityDistance(foeVisibilityDistance),
88 myKeepClear(keepClear),
90 myInternalLaneBefore(nullptr),
94 myWalkingAreaFoe(nullptr),
95 myWalkingAreaFoeExit(nullptr),
96 myHavePedestrianCrossingFoe(false),
97 myParallelRight(nullptr),
98 myParallelLeft(nullptr),
108 const double dist = from.back().distanceTo2D(to.front());
114 myLateralShift = (from.back().distanceTo2D(to.front()) < dist) ? dist : -dist;
126 const std::vector<MSLink*>& foeLinks,
127 const std::vector<MSLane*>& foeLanes,
128 MSLane* internalLaneBefore) {
138 for (std::vector<MSLane*>::const_iterator it_lane = foeLanes.begin(); it_lane != foeLanes.end(); ++it_lane) {
146 if (internalLaneBefore !=
nullptr) {
148 lane = internalLaneBefore;
154 #ifdef MSLink_DEBUG_CROSSING_POINTS
157 if (lane !=
nullptr) {
158 const bool beforeInternalJunction = lane->
getLinkCont()[0]->getViaLaneOrLane()->getEdge().isInternal();
163 for (std::vector<const MSLane*>::const_iterator it_lane =
myFoeLanes.begin(); it_lane !=
myFoeLanes.end(); ++it_lane) {
166 if (sameTarget && !beforeInternalJunction && !
contIntersect(lane, *it_lane)) {
170 #ifdef MSLink_DEBUG_CROSSING_POINTS
172 <<
" " << lane->
getID()
173 <<
" merges with " << (*it_lane)->getID()
174 <<
" nextLane " << lane->
getLinkCont()[0]->getViaLaneOrLane()->getID()
181 #ifdef MSLink_DEBUG_CROSSING_POINTS
184 bool haveIntersection =
true;
185 if (intersections1.size() == 0) {
186 intersections1.push_back(-10000.0);
187 haveIntersection =
false;
188 }
else if (intersections1.size() > 1) {
189 std::sort(intersections1.begin(), intersections1.end());
191 std::vector<double> intersections2 = (*it_lane)->getShape().intersectsAtLengths2D(lane->
getShape());
192 #ifdef MSLink_DEBUG_CROSSING_POINTS
195 if (intersections2.size() == 0) {
196 intersections2.push_back(0);
197 }
else if (intersections2.size() > 1) {
198 std::sort(intersections2.begin(), intersections2.end());
200 if (haveIntersection) {
202 intersections1.back() -= (*it_lane)->getWidth() / 2;
203 intersections2.back() -= lane->
getWidth() / 2;
205 intersections1.back() =
MAX2(0.0, intersections1.back());
206 intersections2.back() =
MAX2(0.0, intersections2.back());
210 intersections2.back() = (*it_lane)->interpolateGeometryPosToLanePos(intersections2.back());
215 intersections1.back() = 0;
220 lane->
getLength() - intersections1.back(),
221 (*it_lane)->getLength() - intersections2.back()));
223 #ifdef MSLink_DEBUG_CROSSING_POINTS
225 <<
" intersection of " << lane->
getID()
227 <<
" with " << (*it_lane)->getID()
228 <<
" totalLength=" << (*it_lane)->getLength()
240 const MSLane* sibling = it->getViaLane();
241 if (sibling != lane && sibling !=
nullptr) {
245 if (l.front().distanceTo2D(s.front()) >= minDist) {
249 double lbcSibling = 0;
251 if (l.back().distanceTo2D(s.back()) > minDist) {
258 std::vector<double> distances = l.
distances(s);
259 #ifdef MSLink_DEBUG_CROSSING_POINTS
260 std::cout <<
" distances=" <<
toString(distances) <<
"\n";
262 assert(distances.size() == l.size() + s.size());
263 if (distances.back() > minDist && distances[l.size() - 1] > minDist) {
265 for (
int j = (
int)s.size() - 2; j >= 0; j--) {
266 const int i = j + (int)l.size();
267 const double segLength = s[j].distanceTo2D(s[j + 1]);
268 if (distances[i] > minDist) {
269 lbcSibling += segLength;
272 lbcSibling += segLength - (minDist - distances[i]) * segLength / (distances[i + 1] - distances[i]);
276 for (
int i = (
int)l.size() - 2; i >= 0; i--) {
277 const double segLength = l[i].distanceTo2D(l[i + 1]);
278 if (distances[i] > minDist) {
279 lbcLane += segLength;
282 lbcLane += segLength - (minDist - distances[i]) * segLength / (distances[i + 1] - distances[i]);
290 const double distToDivergence1 = sibling->
getLength() - lbcSibling;
291 const double distToDivergence2 = lane->
getLength() - lbcLane;
292 const double distToDivergence =
MIN3(
293 MAX2(distToDivergence1, distToDivergence2),
297 lbcSibling =
MAX2(0.0, sibling->
getLength() - distToDivergence);
301 #ifdef MSLink_DEBUG_CROSSING_POINTS
302 std::cout <<
" distToDivergence=" << distToDivergence
303 <<
" distTD1=" << distToDivergence1
304 <<
" distTD2=" << distToDivergence2
308 std::cout <<
" adding same-origin foe" << sibling->
getID()
321 const MSEdge* target = &(it->getLane()->getEdge());
325 if (target == myTarget) {
327 #ifdef MSLink_DEBUG_CROSSING_POINTS
328 std::cout <<
" sublaneFoeLink (same target): " << it->getViaLaneOrLane()->getID() <<
"\n";
333 #ifdef MSLink_DEBUG_CROSSING_POINTS
334 std::cout <<
" sublaneFoeLink2 (other target: " << it->getViaLaneOrLane()->getID() <<
"\n";
342 for (MSLinkCont::const_iterator it = predLinks2.begin(); it != predLinks2.end(); ++it) {
343 const MSEdge* target = &((*it)->getLane()->getEdge());
356 if (foe->
getLinkCont()[0]->getViaLane() !=
nullptr) {
358 return intersections.size() > 0;
366 const bool setRequest,
const SUMOTime arrivalTimeBraking,
const double arrivalSpeedBraking,
const SUMOTime waitingTime,
double dist) {
368 #ifdef DEBUG_APPROACHING
372 std::cout <<
"'" << i->first->getID() <<
"'" << std::endl;
378 arrivalTimeBraking, arrivalSpeedBraking, waitingTime, dist));
385 #ifdef DEBUG_APPROACHING
389 std::cout <<
"'" << i->first->getID() <<
"'" << std::endl;
407 if ((*i)->isBlockingAnyone()) {
418 #ifdef DEBUG_APPROACHING
421 std::cout <<
"' Removing approaching vehicle '" << veh->
getID() <<
"'\nCurrently registered vehicles:" << std::endl;
423 std::cout <<
"'" << i->first->getID() <<
"'" << std::endl;
444 const double leaveSpeed,
const double vehicleLength)
const {
451 double impatience,
double decel,
SUMOTime waitingTime,
double posLat,
452 std::vector<const SUMOVehicle*>* collectFoes,
bool ignoreRed,
const SUMOVehicle* ego)
const {
463 assert(
myLane != foeLink->getLane());
464 for (
auto& it : foeLink->myApproachingVehicles) {
468 ((posLat < foe->getLateralPositionOnLane() &&
myLane->
getIndex() > foeLink->myLane->getIndex())
471 && (arrivalTime > it.second.arrivalTime
475 if (
blockedByFoe(foe, it.second, arrivalTime, leaveTime, arrivalSpeed, leaveSpeed,
false,
476 impatience, decel, waitingTime, ego)) {
477 #ifdef MSLink_DEBUG_OPENED
479 std::cout <<
SIMTIME <<
" blocked by " << foe->
getID() <<
" arrival=" << arrivalTime <<
" foeArrival=" << it.second.arrivalTime <<
"\n";
482 if (collectFoes ==
nullptr) {
483 #ifdef MSLink_DEBUG_OPENED
485 std::cout <<
" link=" <<
getViaLaneOrLane()->
getID() <<
" blocked by sublaneFoe=" << foe->
getID() <<
" foeLink=" << foeLink->getViaLaneOrLane()->getID() <<
" posLat=" << posLat <<
"\n";
490 collectFoes->push_back(foe);
501 for (
auto& it : foeLink->myApproachingVehicles) {
507 && (posLat * lhSign < foe->getLateralPositionOnLane() * lhSign))) {
508 if (
blockedByFoe(foe, it.second, arrivalTime, leaveTime, arrivalSpeed, leaveSpeed,
false,
509 impatience, decel, waitingTime, ego)) {
510 #ifdef MSLink_DEBUG_OPENED
512 std::cout <<
SIMTIME <<
" blocked by sublane foe " << foe->
getID() <<
" arrival=" << arrivalTime <<
" foeArrival=" << it.second.arrivalTime <<
"\n";
515 if (collectFoes ==
nullptr) {
518 collectFoes->push_back(foe);
529 return collectFoes ==
nullptr || collectFoes->size() == 0;
535 #ifdef MSLink_DEBUG_OPENED
543 if ((*i)->haveRed()) {
547 #ifdef MSLink_DEBUG_OPENED
549 std::cout <<
" foeLink=" << (*i)->getViaLaneOrLane()->getID() <<
" numApproaching=" << (*i)->getApproaching().size() <<
"\n";
552 if ((*i)->blockedAtTime(arrivalTime, leaveTime, arrivalSpeed, leaveSpeed,
myLane == (*i)->getLane(),
553 impatience, decel, waitingTime, collectFoes, ego)) {
557 if (collectFoes !=
nullptr && collectFoes->size() > 0) {
566 bool sameTargetLane,
double impatience,
double decel,
SUMOTime waitingTime,
567 std::vector<const SUMOVehicle*>* collectFoes,
const SUMOVehicle* ego)
const {
569 #ifdef MSLink_DEBUG_OPENED
575 <<
" foeVeh=" << it.first->getID() <<
" (below ignore speed)"
586 &&
blockedByFoe(it.first, it.second, arrivalTime, leaveTime, arrivalSpeed, leaveSpeed, sameTargetLane,
587 impatience, decel, waitingTime, ego)) {
588 if (collectFoes ==
nullptr) {
591 collectFoes->push_back(it.first);
601 SUMOTime arrivalTime,
SUMOTime leaveTime,
double arrivalSpeed,
double leaveSpeed,
602 bool sameTargetLane,
double impatience,
double decel,
SUMOTime waitingTime,
604 #ifdef MSLink_DEBUG_OPENED
607 <<
" foeVeh=" << veh->
getID()
618 assert(waitingTime > 0);
633 #ifdef MSLink_DEBUG_OPENED
635 std::cout <<
" imp=" << impatience <<
" fATb=" << avi.
arrivalTimeBraking <<
" fAT2=" << foeArrivalTime <<
" lA=" << lookAhead <<
" egoAT=" << arrivalTime <<
" egoLT=" << leaveTime <<
"\n";
640 if (sameTargetLane && (arrivalTime - avi.
leavingTime < lookAhead
643 #ifdef MSLink_DEBUG_OPENED
645 std::cout <<
" blocked (cannot follow)\n";
650 }
else if (foeArrivalTime > leaveTime + lookAhead) {
654 #ifdef MSLink_DEBUG_OPENED
656 std::cout <<
" blocked (cannot lead)\n";
663 #ifdef MSLink_DEBUG_OPENED
665 std::cout <<
" blocked (hard conflict)\n";
678 if (veh ==
nullptr) {
682 assert(distLeft > 0);
693 if ((*i)->blockedAtTime(arrivalTime, leaveTime, speed, speed,
myLane == (*i)->getLane(), 0, decel, 0)) {
697 for (std::vector<const MSLane*>::const_iterator i =
myFoeLanes.begin(); i !=
myFoeLanes.end(); ++i) {
698 if ((*i)->getVehicleNumberWithPartials() > 0) {
746 assert(predLink != 0);
761 std::vector<std::pair<SUMOTime, const SUMOVehicle*> > toSort;
763 toSort.push_back(std::make_pair(it.second.arrivalTime, it.first));
765 std::sort(toSort.begin(), toSort.end());
766 for (std::vector<std::pair<SUMOTime, const SUMOVehicle*> >::const_iterator it = toSort.begin(); it != toSort.end(); ++it) {
790 while (lane !=
nullptr && lane->
isInternal()) {
802 while (lane !=
nullptr && lane->
isInternal()) {
817 double totalDist = 0.;
818 bool foundCrossing =
false;
819 while (via !=
nullptr) {
825 foundCrossing =
true;
843 for (foe_ix = 0; foe_ix != (int)
myFoeLanes.size(); ++foe_ix) {
850 #ifdef MSLink_DEBUG_CROSSING_POINTS
857 if (dist == -10000.) {
861 #ifdef MSLink_DEBUG_CROSSING_POINTS
863 <<
"' at distance " << dist <<
" (approach along '"
917 while (lane !=
nullptr) {
947 std::cout <<
SIMTIME <<
" getLeaderInfo link=" <<
getViaLaneOrLane()->
getID() <<
" dist=" << dist <<
" isShadowLink=" << isShadowLink <<
"\n";
950 for (
int i = 0; i < (int)
myFoeLanes.size(); ++i) {
956 const double crossingWidth = (sameTarget || sameSource) ? 0 : foeLane->
getWidth();
959 std::cout <<
" distToCrossing=" << distToCrossing <<
" foeLane=" << foeLane->
getID() <<
" cWidth=" << crossingWidth
966 const bool contLane = (foeLane->
getLinkCont()[0]->getViaLaneOrLane()->getEdge().isInternal() && !(
968 if (distToCrossing + crossingWidth < 0
983 const double leaderBackDist = foeDistToCrossing - leaderBack;
984 const bool pastTheCrossingPoint = leaderBackDist + foeCrossingWidth < 0;
985 const bool ignoreIndirectBicycleTurn = (pastTheCrossingPoint
988 const bool cannotIgnore = ((contLane && !ignoreIndirectBicycleTurn) || sameTarget || sameSource) && ego !=
nullptr;
992 std::cout <<
" candiate leader=" << leader->
getID()
993 <<
" cannotIgnore=" << cannotIgnore
994 <<
" fdtc=" << foeDistToCrossing
995 <<
" lb=" << leaderBack
996 <<
" lbd=" << leaderBackDist
997 <<
" fcwidth=" << foeCrossingWidth
998 <<
" foePastCP=" << pastTheCrossingPoint
999 <<
" inTheWay=" << inTheWay
1000 <<
" willPass=" << foeLane->
getLinkCont()[0]->getApproaching(leader).willPass
1002 <<
" isOpposite=" << isOpposite <<
"\n";
1004 if (leader == ego) {
1013 if ((!cannotIgnore || leader->
isStopped() || sameTarget)
1014 && !foeLane->
getLinkCont()[0]->getApproaching(leader).willPass
1026 bool fromLeft =
true;
1027 if (ego ==
nullptr) {
1030 gap = leaderBackDist;
1034 distToCrossing += foeLane->
getWidth() / 2;
1035 if (gap + foeCrossingWidth < 0) {
1042 fromLeft = foeDistToCrossing > 0.5 * foeLane->
getLength();
1043 }
else if ((contLane && !sameSource && !ignoreIndirectBicycleTurn) || isOpposite) {
1047 std::cout <<
" distToCrossing=" << distToCrossing <<
" leader back=" << leaderBack <<
" backDist=" << leaderBackDist
1052 if (leaderBackDist + foeCrossingWidth < 0) {
1066 const bool stopAsap = leader->
isFrontOnLane(foeLane) ? cannotIgnore : (sameTarget || sameSource);
1068 std::cout <<
" leader=" << leader->
getID() <<
" contLane=" << contLane <<
" cannotIgnore=" << cannotIgnore <<
" stopAsap=" << stopAsap <<
"\n";
1070 result.push_back(
LinkLeader(leader, gap, stopAsap ? -1 : distToCrossing, fromLeft));
1081 const double vehSideOffset = (foeDistToCrossing +
myLaneBefore->
getWidth() * 0.5 - vehWidth * 0.5
1092 if (ego !=
nullptr) {
1100 const MSLane* foeLane = *it;
1104 if (leader == ego) {
1118 <<
" foeLane=" << foeLane->
getID()
1119 <<
" leader=" << leader->
getID()
1122 <<
" egoLat=" << posLat
1123 <<
" leaderLat=" << posLatLeader
1124 <<
" leaderLatOffset=" << leader->
getLatOffset(foeLane)
1126 <<
" foeIndex=" << foeLane->
getIndex()
1132 if ((posLat < posLatLeader && myInternalLaneBefore->
getIndex() > foeLane->
getIndex())
1135 std::cout <<
SIMTIME <<
" blocked by " << leader->
getID() <<
" (sublane split) foeLane=" << foeLane->
getID() <<
"\n";
1137 result.push_back(
LinkLeader(leader, gap, -1));
1154 double distToPeds = std::numeric_limits<double>::max();
1156 MSPerson* p = static_cast<MSPerson*>(t);
1160 if (collectBlockers !=
nullptr) {
1161 collectBlockers->push_back(p);
1165 if (distToPeds != std::numeric_limits<double>::max()) {
1194 if (direction == -1) {
1196 }
else if (direction == 1) {
1209 if (before !=
nullptr && after !=
nullptr) {
1226 std::vector<const SUMOVehicle*>* collectFoes)
const {
1232 throw ProcessError(
"Zipper junctions with more than two conflicting lanes are not supported (at junction '"
1236 const double secondsToArrival =
STEPS2TIME(arrivalTime - now);
1240 <<
" dist=" << dist <<
" ignoring foes (arrival in " <<
STEPS2TIME(arrivalTime - now) <<
")\n";
1246 <<
" egoAT=" << arrivalTime
1248 <<
" vSafe=" << vSafe
1249 <<
" numFoes=" << collectFoes->size()
1253 for (std::vector<const SUMOVehicle*>::const_iterator i = collectFoes->begin(); i != collectFoes->end(); ++i) {
1254 const MSVehicle* foe = dynamic_cast<const MSVehicle*>(*i);
1268 <<
" ignoring foe=" << foe->
getID()
1270 <<
" foeDist=" << avi.
dist
1271 <<
" foeDist2=" << foeDist
1274 <<
" deltaDist=" << foeDist - dist
1297 const double uEnd =
MIN2(uMax, uAccel);
1298 const double uAvg = (foe->
getSpeed() + uEnd) / 2;
1300 const double tf =
MAX2(1.0, ceil((tf0) /
TS) *
TS);
1304 const double vEnd =
MIN3(vMax, vAccel, uEnd);
1305 const double vAvg = (ego->
getSpeed() + vEnd) / 2;
1307 const double te =
MAX2(1.0, ceil((te0) /
TS) *
TS);
1314 const double deltaGap = gap + tf * uAvg - safeGap - vAvg * tf;
1315 const double a = 2 * deltaGap / (tf * tf);
1321 const double w =
MIN2(1.0, te / 10);
1323 const double vZipper =
MAX3(vFollow, ego->
getSpeed() -
ACCEL2SPEED(maxDecel), w * vSafeGap + (1 - w) * vFollow);
1325 vSafe =
MIN2(vSafe, vZipper);
1328 <<
" foeDist=" << foeDist
1333 <<
" uAccel=" << uAccel
1337 <<
" safeGap=" << safeGap
1341 <<
" dg=" << deltaGap
1342 <<
" aSafeGap=" << a
1344 <<
" vAccel=" << vAccel
1346 <<
" vSafeGap=" << vSafeGap
1347 <<
" vFollow=" << vFollow
1349 <<
" maxDecel=" << maxDecel
1350 <<
" vZipper=" << vZipper
1351 <<
" vSafe=" << vSafe
1362 followDist > leaderDist &&
1380 for (
const MSLink* link : cand->getLinkCont()) {
bool hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
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.
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
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.
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.
MSLink * computeParallelLink(int direction)
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
const std::set< MSTransportable * > & getPersons() const
Returns this edge's persons set.
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.
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
#define ZIPPER_ADAPT_TIME
Representation of a lane in the micro simulation.
bool isStopped() const
Returns whether the vehicle is at a stop.
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
virtual std::mt19937 * getRNG() const =0
Returns the associated RNG for this vehicle.
The link is controlled by a tls which is off and blinks, has to brake.
bool myHasFoes
Whether any foe links exist.
bool lastWasContMajor() const
whether this is a link past an internal junction which currently has priority
const std::map< const SUMOVehicle *, const ApproachingVehicleInformation, ComparatorNumericalIdLess > & getApproaching() const
return all approaching vehicles
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
Static storage of an output device and its base (abstract) implementation.
MSLane *const myInternalLane
The following junction-internal lane if used.
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 ...
static bool gComputeLC
whether the simulationLoop is in the lane changing phase
The link is controlled by a tls which is off, not blinking, may pass.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
double getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane.
LinkState myState
The state of the link.
bool isExitLink() const
return whether the fromLane of this link is an internal lane and toLane is a normal lane
static const double ZIPPER_ADAPT_DIST
virtual const std::string & getID() const =0
Get the vehicle's ID.
static bool unsafeMergeSpeeds(double leaderSpeed, double followerSpeed, double leaderDecel, double followerDecel)
return whether the given vehicles may NOT merge safely
The link is a partial right direction.
ApproachingVehicleInformation getApproaching(const SUMOVehicle *veh) const
static const double SAFETY_GAP
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...
double getLength() const
Returns the vehicle's length.
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
Representation of a vehicle.
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
MSLane * myLaneBefore
The lane approaching this link.
double getLengthsBeforeCrossing(const MSLane *foeLane) const
Returns the sum of the lengths along internal lanes following this link to the crossing with the give...
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
#define DEBUG_COND_ZIPPER
MSLink * getParallelLink(int direction) const
return the link that is parallel to this lane or 0
void initParallelLinks()
initialize parallel links (to be called after all links are loaded)
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
int getIndex() const
Returns the respond index (for visualization)
bool isEntryLink() const
return whether the toLane of this link is an internal lane and fromLane is a normal lane
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
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
static double gLateralResolution
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
The link is a (hard) right direction.
bool isInternal() const
return whether this edge is an internal edge
std::string getDescription() const
get string description for this link
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
double getInternalLengthsBefore() const
Returns the cumulative length of all internal lanes before this link.
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.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const MSJunction * getFromJunction() const
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
The link is a straight direction.
void checkWalkingAreaFoe(const MSVehicle *ego, const MSLane *foeLane, std::vector< const MSPerson * > *collectBlockers, LinkLeaders &result) const
check for persons on walkingarea in the path of ego vehicle
MSLane * getLane() const
Returns the connected lane.
double interpolateGeometryPosToLanePos(double geometryPos) const
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.
bool myHavePedestrianCrossingFoe
whether on of myFoeLanes is a crossing
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
void writeApproaching(OutputDevice &od, const std::string fromLaneID) const
write information about all approaching vehicles to the given output device
const MSLane * myWalkingAreaFoe
walkingArea that must be checked when entering the intersection
bool lefthand() const
return whether the network was built for lefthand traffic
SUMOTime getLastActionTime() const
Returns the time of the vehicle's last action point.
void setTLState(LinkState state, SUMOTime t)
Sets the current tl-state.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
const MSLane * getInternalLaneBefore() const
return myInternalLaneBefore (always 0 when compiled without internal lanes)
This is an uncontrolled, zipper-merge link.
std::vector< LinkLeader > LinkLeaders
double getLength() const
Returns the lane's length.
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
static SUMOTime gIgnoreJunctionBlocker
MSJunction * myJunction
the junction to which this link belongs
MSAbstractLaneChangeModel & getLaneChangeModel()
LinkDirection myDirection
An abstract (hopefully human readable) definition of the link's direction.
double myLateralShift
lateral shift to be applied when passing this link
virtual double getLateralPositionOnLane() const =0
Get the vehicle's lateral position on the lane.
std::string time2string(SUMOTime t)
std::vector< MSLink * > mySublaneFoeLinks2
bool contIntersect(const MSLane *lane, const MSLane *foe)
check if the lane intersects with a foe cont-lane
double getMinGap() const
Get the free space in front of vehicles of this class.
A road/street connecting two junctions.
The link is a (hard) left direction.
The parent class for traffic light logics.
void addBlockedLink(MSLink *link)
std::vector< std::pair< double, double > > myLengthsBehindCrossing
Position getPosition(const double) const
Return current position (x/y, cartesian)
static const SUMOTime myLookaheadTimeZipper
double getInternalLengthsAfter() const
Returns the cumulative length of all internal lanes after this link.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
const MSLane * myWalkingAreaFoeExit
walkingArea that must be checked when leaving the intersection
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
std::set< MSLink * > myBlockedFoeLinks
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 * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
bool willHaveBlockedFoe() const
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
MSLane * getLane() const
Returns the lane the vehicle is on.
bool isInternalJunctionLink() const
return whether the fromLane and the toLane of this link are internal lanes
MSEdge & getEdge() const
Returns the lane's edge.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
bool haveRed() const
Returns whether this link is blocked by a red (or redyellow) traffic light.
bool willStop() const
Returns whether the vehicle will stop on the current edge.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const PositionVector & getShape() const
Returns this lane's shape.
virtual double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
SUMOTime myLastStateChange
The time of the last state change.
std::vector< MSLink * > myFoeLinks
std::map< const SUMOVehicle *, const ApproachingVehicleInformation, ComparatorNumericalIdLess > myApproachingVehicles
MSLink * getCorrespondingExitLink() const
returns the corresponding exit link for entryLinks to a junction.
const MSLane * myInternalLaneBefore
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::vector< const MSLane * > myFoeLanes
double getLength() const
Returns the length of this link.
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...
virtual double getSpeed() const
the current speed of the transportable
const MSVehicleType & getVehicleType() const
Returns the vehicle's type.
double getLength() const
Get vehicle's length [m].
static const SUMOTime myLookaheadTime
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
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 couldBrakeForLeader(double followDist, double leaderDist, const MSVehicle *follow, const MSVehicle *leader)
whether fllower could stay behind leader (possibly by braking)
static bool maybeOccupied(MSLane *lane)
returns whether the given lane may still be occupied by a vehicle currently on it
const double INVALID_DOUBLE
const SUMOVTypeParameter & getParameter() const
bool checkContOff() const
figure out whether the cont status remains in effect when switching off the tls
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
const std::string & getID() const
Returns the name of the vehicle.
MSLane * getParallelLane(int offset, bool includeOpposite=true) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
bool isStrategicBlocked() const
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
#define DIVERGENCE_MIN_WIDTH
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
MSLane * myLane
The lane behind the junction approached by this link.
double getWidth() const
Returns the lane's width.
const MSTrafficLightLogic * myLogic
the controlling logic or 0
static MSPModel * getModel()
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
This is an uncontrolled, all-way stop link.
std::vector< MSLane * > mySublaneFoeLanes
bool gDebugFlag1
global utility flags for debugging
double getSpeed() const
Returns the vehicle's current speed.
std::vector< MSLink * > mySublaneFoeLinks
bool fromInternalLane() const
return whether the fromLane of this link is an internal lane
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
const MSLane * getLaneBefore() const
return the internalLaneBefore if it exists and the laneBefore otherwise
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const
#define JM_CROSSING_GAP_DEFAULT
The link is a partial left direction.
const std::string & getID() const
Returns the id.
bool isExitLinkAfterInternalJunction() const
return whether the fromLane of this link is an internal lane and its incoming lane is also an interna...
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)
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane,...
int getIndex() const
Returns the lane's index.
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 * getViaLane() const
Returns the following inner lane.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
int myIndex
The position within this respond.
MSLink * getEntryLink() const
Returns the entry link if this is an internal lane, else 0.
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction
This is an uncontrolled, minor link, has to stop.
Representation of a vehicle in the micro simulation.