78 #include <mesosim/MESegment.h>
79 #include <mesosim/MELoop.h>
83 #ifdef CHECK_MEMORY_LEAKS
85 #endif // CHECK_MEMORY_LEAKS
88 #ifdef DEBUG_VEHICLE_GUI_SELECTION
95 #define BUS_STOP_OFFSET 0.5
97 #define CRLL_LOOK_AHEAD 5
100 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0
130 return (myPos != state.
myPos ||
142 myPos(pos), mySpeed(speed) {}
150 mySpeedAdaptationStarted(true),
151 myConsiderSafeVelocity(true),
152 myConsiderMaxAcceleration(true),
153 myConsiderMaxDeceleration(true),
154 myRespectJunctionPriority(true),
155 myEmergencyBrakeRedLight(true),
156 myAmVTDControlled(false),
170 mySpeedAdaptationStarted =
true;
171 mySpeedTimeLine = speedTimeLine;
177 myLaneTimeLine = laneTimeLine;
184 myOriginalSpeed = speed;
186 while (mySpeedTimeLine.size() == 1 || (mySpeedTimeLine.size() > 1 && currentTime > mySpeedTimeLine[1].first)) {
187 mySpeedTimeLine.erase(mySpeedTimeLine.begin());
190 if (mySpeedTimeLine.size() < 2 || currentTime < mySpeedTimeLine[0].first) {
194 if (!mySpeedAdaptationStarted) {
195 mySpeedTimeLine[0].second = speed;
196 mySpeedAdaptationStarted =
true;
200 speed = mySpeedTimeLine[0].second - (mySpeedTimeLine[0].second - mySpeedTimeLine[1].second) * td;
201 if (myConsiderSafeVelocity) {
202 speed =
MIN2(speed, vSafe);
204 if (myConsiderMaxAcceleration) {
205 speed =
MIN2(speed, vMax);
207 if (myConsiderMaxDeceleration) {
208 speed =
MAX2(speed, vMin);
217 while (myLaneTimeLine.size() == 1 || (myLaneTimeLine.size() > 1 && currentTime > myLaneTimeLine[1].first)) {
218 myLaneTimeLine.erase(myLaneTimeLine.begin());
222 if (myLaneTimeLine.size() >= 2 && currentTime >= myLaneTimeLine[0].first) {
223 const unsigned int destinationLaneIndex = myLaneTimeLine[1].second;
224 if (destinationLaneIndex < (
unsigned int)currentEdge.
getLanes().size()) {
225 if (currentLaneIndex > destinationLaneIndex) {
227 }
else if (currentLaneIndex < destinationLaneIndex) {
239 mode = myStrategicLC;
241 mode = myCooperativeLC;
243 mode = mySpeedGainLC;
245 mode = myRightDriveLC;
253 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
261 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
282 switch (changeRequest) {
298 assert(myLaneTimeLine.size() >= 2);
299 assert(currentTime >= myLaneTimeLine[0].first);
300 return STEPS2TIME(myLaneTimeLine[1].first - currentTime);
306 myConsiderSafeVelocity = value;
312 myConsiderMaxAcceleration = value;
318 myConsiderMaxDeceleration = value;
324 myRespectJunctionPriority = value;
330 myEmergencyBrakeRedLight = value;
348 if (myVTDRoute.size() != 0) {
352 if (myVTDPos > myVTDLane->getLength()) {
353 myVTDPos = myVTDLane->getLength();
355 myVTDLane->forceVehicleInsertion(v, myVTDPos);
357 myAmVTDControlled =
false;
371 (*i)->resetPartialOccupation(
this);
375 if ((*i).myLink != 0) {
376 (*i).myLink->removeApproaching(
this);
411 for (std::vector<SUMOVehicleParameter::Stop>::iterator i = pars->
stops.begin(); i != pars->
stops.end(); ++i) {
414 "' on lane '" + i->lane +
"' is too close or not downstream the current route.");
417 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = route->
getStops().begin(); i != route->
getStops().end(); ++i) {
420 "' on lane '" + i->lane +
"' is too close or not downstream the current route.");
423 const MSLane*
const depLane = (*myCurrEdge)->getDepartLane(*
this);
425 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
429 WRITE_WARNING(
"Choosing new speed factor for vehicle '" + pars->
id +
"' to match departure speed.");
433 "' is too high for the departure lane '" + depLane->
getID() +
"'.");
438 "' is too high for the vehicle type '" + type->
getID() +
"'.");
449 if ((*i).myLink != 0) {
450 (*i).myLink->removeApproaching(
this);
494 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
495 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
498 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
503 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
506 "' on lane '" + i->lane +
"' is too close or not downstream the new route.");
561 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second, newSpeed)) {
563 if (myTraceMoveReminders) {
564 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
570 if (myTraceMoveReminders) {
571 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
586 rem->second += oldLaneLength;
588 if (myTraceMoveReminders) {
589 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
622 if (offset == 0. && !changingLanes) {
657 atan2(p1.
x() - p2.
x(), p2.
y() - p1.
y()) * 180. /
M_PI :
678 if (stop.
until != -1) {
679 stop.
until += untilOffset;
691 std::list<Stop>::iterator iter =
myStops.begin();
694 prevStopEdge =
myStops.back().edge;
695 prevStopPos =
myStops.back().endPos;
698 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
704 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
705 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
706 prevStopEdge = iter->edge;
707 prevStopPos = iter->endPos;
711 int index = stopPar.
index;
713 prevStopEdge = iter->edge;
714 prevStopPos = iter->endPos;
722 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
735 pos += (*myCurrEdge)->getLength();
772 return currentVelocity;
783 for (std::vector<MSPerson*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
825 bool busStopsMustHaveSpace =
true;
830 busStopsMustHaveSpace =
false;
840 if (stop.
until >= 0) {
856 return currentVelocity;
870 #ifdef DEBUG_VEHICLE_GUI_SELECTION
876 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
877 if ((*i).myLink != 0) {
878 (*i).myLink->removeApproaching(
this);
882 #ifdef HAVE_INTERNAL_LANES
883 myLinkLeaders.clear();
905 assert(bestLaneConts.size() > 0);
906 #ifdef HAVE_INTERNAL_LANES
907 bool hadNonInternal =
false;
909 bool hadNonInternal =
true;
914 unsigned int view = 0;
924 std::pair<const MSVehicle*, SUMOReal> leaderInfo = std::make_pair(pred, gap);
930 adaptToLeader(leaderInfo, seen, lastLink, lane, v, vLinkPass);
942 v =
MIN2(v, stopSpeed);
949 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
995 (*link)->getViaLaneOrLane()->getParallelLane(-
getLaneChangeModel().getLaneChangeDirection()) == 0)) {
997 const SUMOReal va = seen / timeRemaining;
1002 const bool setRequest = v > 0;
1012 #ifdef HAVE_INTERNAL_LANES
1015 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1017 const MSVehicle* leader = (*it).first.first;
1018 if (leader->myLinkLeaders.count(
getID()) == 0) {
1020 myLinkLeaders.insert(leader->
getID());
1021 adaptToLeader(it->first, seen, lastLink, lane, v, vLinkPass, it->second);
1022 if (lastLink != 0) {
1031 if (lastLink != 0) {
1037 if (!(*link)->havePriority() && stopDist > cfModel.
getMaxDecel()) {
1043 + (seen - (v1 * v1 - arrivalSpeed * arrivalSpeed) * 0.5 / cfModel.
getMaxDecel()) / vLinkWait);
1046 const SUMOReal accelTime = (vLinkPass - v) / accel;
1047 const SUMOReal accelWay = accelTime * (vLinkPass + v) * 0.5;
1059 arrivalSpeedBraking = arrivalSpeed;
1066 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1067 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1070 arrivalTime, arrivalSpeed,
1071 arrivalTimeBraking, arrivalSpeedBraking,
1074 #ifdef HAVE_INTERNAL_LANES
1075 if ((*link)->getViaLane() == 0) {
1076 hadNonInternal =
true;
1083 if (!setRequest || ((v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD)) {
1087 lane = (*link)->getViaLaneOrLane();
1099 lastLink = &lfLinks.back();
1110 if (leaderInfo.first != 0) {
1113 if (leaderInfo.second >= 0) {
1114 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1120 if (distToCrossing >= 0) {
1124 if (lastLink != 0) {
1127 v =
MIN2(v, vsafeLeader);
1128 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1135 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1156 DriveItemVector::iterator i;
1158 MSLink* link = (*i).myLink;
1160 if (link != 0 && (*i).mySetRequest) {
1166 vSafe = (*i).myVLinkWait;
1173 const bool influencerPrio =
false;
1177 const bool opened = yellow || influencerPrio ||
1178 link->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1184 vSafe = (*i).myVLinkWait;
1203 vSafe = (*i).myVLinkPass;
1209 vSafe = (*i).myVLinkWait;
1217 vSafe = (*i).myVLinkWait;
1271 std::vector<MSLane*> passedLanes;
1273 passedLanes.push_back(*i);
1275 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
1276 passedLanes.push_back(
myLane);
1279 std::string emergencyReason =
" for unknown reasons";
1292 MSLink* link = (*i).myLink;
1303 emergencyReason =
" because of a red traffic light";
1310 emergencyReason =
" because there is no connection to the next edge";
1314 if (approachedLane !=
myLane && approachedLane != 0) {
1322 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
1333 passedLanes.push_back(approachedLane);
1339 (*i)->resetPartialOccupation(
this);
1360 std::vector<MSLane*>::reverse_iterator i = passedLanes.rbegin() + 1;
1361 while (leftLength > 0 && i != passedLanes.rend()) {
1363 leftLength -= (*i)->setPartialOccupation(
this, leftLength);
1385 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1387 foundStopped =
true;
1388 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
1392 lengths += (*i)->getVehicleType().getLengthWithGap();
1401 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1409 #ifdef HAVE_INTERNAL_LANES
1411 bool hadVehicle =
false;
1412 SUMOReal seenSpace = -lengthsInFront;
1414 bool foundStopped =
false;
1417 for (
unsigned int i = 0; i < lfLinks.size(); ++i) {
1420 if (item.
myLink == 0 || foundStopped) {
1426 const MSLane* approachedLane = item.
myLink->getViaLane();
1427 if (approachedLane != 0) {
1451 foundStopped =
true;
1454 seenSpace += approachedLane->
getLength();
1468 foundStopped =
true;
1476 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1482 for (
int i = (
int)(lfLinks.size() - 1); i > 0; --i) {
1491 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
1492 if (!opened && item.
myLink != 0) {
1496 allowsContinuation =
true;
1500 if (allowsContinuation) {
1506 int removalBegin = -1;
1507 for (
unsigned int i = 0; hadVehicle && i < lfLinks.size() && removalBegin < 0; ++i) {
1521 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
1528 if (leftSpace < -impatienceCorrection / 10. && item.myLink->isCrossing()) {
1536 while (removalBegin < (
int)(lfLinks.size())) {
1538 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
1540 lfLinks[removalBegin].mySetRequest =
false;
1549 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
1550 if ((*i).myLink != 0) {
1554 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1555 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime());
1564 if (rem->first->getLane() != 0 && rem->first->getLane() !=
getLane()) {
1566 if (myTraceMoveReminders) {
1567 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
1572 if (rem->first->notifyEnter(*
this, reason)) {
1574 if (myTraceMoveReminders) {
1575 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
1581 if (myTraceMoveReminders) {
1582 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
1612 if (!onTeleporting) {
1648 while (i != route.
begin() && leftLength > 0) {
1655 leftLength -= (lane)->setPartialOccupation(
this, leftLength);
1696 MSLane* clane = enteredLane;
1697 while (leftLength > 0) {
1703 leftLength -= (clane)->setPartialOccupation(
this, leftLength);
1711 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
1713 if (myTraceMoveReminders) {
1714 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
1720 if (myTraceMoveReminders) {
1721 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
1729 (*i)->resetPartialOccupation(
this);
1751 const std::vector<MSVehicle::LaneQ>&
1753 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1760 if (startLane == 0) {
1763 assert(startLane != 0);
1766 std::vector<LaneQ>::iterator i;
1767 for (i = lanes.begin(); i != lanes.end(); ++i) {
1769 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
1770 nextOccupation += (*j)->getBruttoVehLenSum();
1772 (*i).nextOccupation = nextOccupation;
1773 if ((*i).lane == startLane) {
1792 std::vector<LaneQ>& lanes = *it;
1793 assert(lanes.size() > 0);
1794 if (&(lanes[0].lane->getEdge()) == nextEdge) {
1796 std::vector<LaneQ> oldLanes = lanes;
1798 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
1799 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
1800 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
1801 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
1802 lanes.push_back(*it_lane);
1809 for (
int i = 0; i < (
int)lanes.size(); ++i) {
1810 if (i + lanes[i].bestLaneOffset < 0) {
1811 lanes[i].bestLaneOffset = -i;
1813 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
1814 lanes[i].bestLaneOffset = (
int)lanes.size() - i - 1;
1816 assert(i + lanes[i].bestLaneOffset >= 0);
1817 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
1818 if (lanes[i].bestContinuations[0] != 0) {
1820 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
1822 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
1825 assert(&(lanes[i].lane->getEdge()) == nextEdge);
1837 myLastBestLanesEdge = &startLane->
getEdge();
1841 const MSEdge* nextStopEdge = 0;
1842 const MSLane* nextStopLane = 0;
1846 nextStopLane = nextStop.
lane;
1847 nextStopEdge = &nextStopLane->
getEdge();
1855 if (nextStopEdge != 0) {
1864 bool progress =
true;
1866 std::vector<LaneQ> currentLanes;
1867 const std::vector<MSLane*>* allowed = 0;
1868 const MSEdge* nextEdge = 0;
1870 nextEdge = *(ce + 1);
1873 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
1874 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
1881 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
1882 currentLanes.push_back(q);
1885 if (nextStopEdge == *ce) {
1887 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
1888 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
1889 (*q).allowsContinuation =
false;
1890 (*q).length = nextStopPos;
1897 seenLength += currentLanes[0].lane->getLength();
1899 progress &= (seen <= 4 || seenLength < 3000);
1900 progress &= seen <= 8;
1912 int bestThisIndex = 0;
1915 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
1916 if ((*j).length > bestLength) {
1917 bestLength = (*j).length;
1918 bestThisIndex = index;
1922 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
1923 if ((*j).length < bestLength) {
1924 (*j).bestLaneOffset = bestThisIndex - index;
1931 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
1932 std::vector<LaneQ>& nextLanes = (*(i - 1));
1933 std::vector<LaneQ>& clanes = (*i);
1934 MSEdge& cE = clanes[0].lane->getEdge();
1938 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
1939 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
1940 bestConnectedLength = (*j).length;
1942 if (bestLength < (*j).length) {
1943 bestLength = (*j).length;
1947 int bestThisIndex = 0;
1948 if (bestConnectedLength > 0) {
1950 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
1951 LaneQ bestConnectedNext;
1952 bestConnectedNext.
length = -1;
1953 if ((*j).allowsContinuation) {
1954 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
1955 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
1956 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
1957 bestConnectedNext = *m;
1962 (*j).
length += bestLength;
1964 (*j).length += bestConnectedNext.
length;
1968 if (clanes[bestThisIndex].length < (*j).length || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))) {
1969 bestThisIndex = index;
1975 int bestNextIndex = 0;
1976 int bestDistToNeeded = (
int) clanes.size();
1978 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
1979 if ((*j).allowsContinuation) {
1981 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
1982 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
1983 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
1984 bestDistToNeeded =
abs((*m).bestLaneOffset);
1985 bestThisIndex = index;
1986 bestNextIndex = nextIndex;
1992 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
1993 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
1998 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
1999 if ((*j).length < clanes[bestThisIndex].length || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))) {
2000 (*j).bestLaneOffset = bestThisIndex - index;
2002 (*j).bestLaneOffset = 0;
2008 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
2009 std::vector<LaneQ>::iterator i;
2010 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
2012 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
2013 nextOccupation += (*j)->getBruttoVehLenSum();
2015 (*i).nextOccupation = nextOccupation;
2016 if ((*i).lane == startLane) {
2024 const std::vector<MSLane*>&
2029 return (*myCurrentLaneInBestLanes).bestContinuations;
2033 const std::vector<MSLane*>&
2044 if ((*i).lane == lane) {
2045 return (*i).bestContinuations;
2057 return (*myCurrentLaneInBestLanes).bestLaneOffset;
2075 #ifdef DEBUG_VEHICLE_GUI_SELECTION
2080 if (
isOnRoad() && destEdge != NULL) {
2094 std::pair<const MSVehicle* const, SUMOReal>
2097 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
2104 MSLane::VehCont::const_iterator pred = std::find(vehs.begin(), vehs.end(),
this) + 1;
2105 if (pred != vehs.end()) {
2120 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
2121 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
2178 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2179 if (numExpected != 0) {
2184 numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2186 if (numExpected == 0) {
2212 switch ((*link)->getDirection()) {
2250 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2251 if (iter->lane == lane && fabs(iter->endPos - pos) <
POSITION_EPS) {
2252 if (duration == 0 && !iter->reached) {
2255 iter->duration = duration;
2328 std::vector<int> internals;
2341 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
2343 unsigned int routeOffset;
2348 myDeparture -= offset;
void resetRoutePosition(unsigned int index)
bool signalSet(int which) const
Returns whether the given signal is on.
const MSLane * myLastBestLanesInternalLane
The link is a partial left direction.
const std::string & getID() const
returns the person id
virtual const std::vector< LaneQ > & getBestLanes(bool forceRebuild=false, MSLane *startLane=0) const
Returns the description of best lanes to use in order to continue the route.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const MSVehicleType * myType
This Vehicle's type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
SUMOReal getSpeedAfterMaxDecel(SUMOReal v) const
Returns the velocity after maximum deceleration.
void addWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
bool amVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
SUMOReal speed() const
Speed of this state.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
void removePerson(MSPerson *p)
const SUMOReal SUMO_const_laneWidth
MSEdgeWeightsStorage * myEdgeWeights
MoveReminderCont myMoveReminders
Current lane's move reminder.
SUMOReal myArrivalPos
the position on the destination lane where the vehicle stops
const MSEdge * myLastBestLanesEdge
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
MSAbstractLaneChangeModel * myLaneChangeModel
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
Position positionAtOffset(SUMOReal pos) const
Returns the position at the given length.
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
std::vector< std::vector< LaneQ > > myBestLanes
bool parking
whether the vehicle is removed from the net while stopping
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
State myState
This Vehicles driving state (pos and speed)
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
void endLaneChangeManeuver()
bool boardAnyWaiting(MSEdge *edge, MSVehicle *vehicle)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
const Position geometryPositionAtOffset(SUMOReal offset) const
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
SUMOReal pos() const
Position of this state.
bool resumeFromStopping()
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
bool hasInfluencer() const
SUMOTime duration
The stopping duration.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
The action is done to help someone else.
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
SUMOReal getImpatience() const
Returns this vehicles impatience.
void setBlinkerInformation()
SUMOReal getLeaveSpeed() const
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
MSEdgeVector::const_iterator MSRouteIterator
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
The vehicle arrived at a junction.
void setRespectJunctionPriority(bool value)
Sets whether junction priority rules shall be respected.
bool isVTDControlled() const
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
virtual SUMOReal followSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const =0
Computes the vehicle's safe speed (no dawdling)
SUMOReal getLength() const
Returns the lane's length.
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
SUMOReal departSpeed
(optional) The initial speed of the vehicle
virtual SUMOReal maxNextSpeed(SUMOReal speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
static MSDevice_Person * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
The car-following model abstraction.
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
The link is a 180 degree turn.
State(SUMOReal pos, SUMOReal speed)
Constructor.
std::vector< MSVehicle * > VehCont
Container for vehicles.
Notification
Definition of a vehicle state.
static SUMOReal rand()
Returns a random real number in [0, 1)
std::string time2string(SUMOTime t)
SUMOReal getLength() const
Get vehicle's length [m].
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0)
Replaces the current route by the given one.
Changes the wished vehicle speed / lanes.
const MSEdgeVector & getEdges() const
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
bool reached
Information whether the stop has been reached.
State & operator=(const State &state)
Assignment operator.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const MSRoute & getRoute() const
Returns the current route.
vehicle doesn't want to change
unsigned int getPersonNumber() const
Returns the number of persons.
TraciLaneChangePriority
modes for prioritizing traci lane change requests
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
const MSRoute * myRoute
This Vehicle's route.
unsigned int myNumberReroutes
The number of reroutings.
bool hasDeparted() const
Returns whether this vehicle has already departed.
The vehicle got vaporized.
void postProcessVTD(MSVehicle *v)
SUMOReal estimateLeaveSpeed(const MSLink *const link, const SUMOReal vLinkPass) const
estimate leaving speed when accelerating across a link
SUMOTime until
The time at which the vehicle may continue its journey.
SUMOReal mySpeed
the stored speed
Definition of vehicle stop (position and duration)
This is an uncontrolled, right-before-left link.
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
unsigned int personNumber
The number of persons in the vehicle.
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::pair< const MSVehicle *const, SUMOReal > getLeader(SUMOReal dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
const SUMOVehicleParameter * myParameter
This Vehicle's parameter.
SUMOReal getDistanceBetween(SUMOReal fromPos, SUMOReal toPos, const MSEdge *fromEdge, const MSEdge *toEdge) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
The base class for microscopic and mesoscopic vehicles.
bool myHaveToWaitOnNextLink
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
The action is due to a TraCI request.
A storage for edge travel times and efforts.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool lastWasContMajor() const
whether this is a link past an internal junction which currently has priority
SUMOReal x() const
Returns the x-position.
This is an uncontrolled, all-way stop link.
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
SUMOReal getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
The action is urgent (to be defined by lc-model)
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define UNUSED_PARAMETER(x)
std::string getBusStopID(const MSLane *lane, const SUMOReal pos) const
Returns the bus stop close to the given position.
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge ¤tEdge, const unsigned int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
The link is a (hard) left direction.
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, unsigned int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
#define WRITE_WARNING(msg)
SUMOReal getBeginLanePosition() const
Returns the begin position of this bus stop.
The car-following model and parameter.
bool triggered
whether an arriving person lets the vehicle continue
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
MSAbstractLaneChangeModel & getLaneChangeModel()
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
Right blinker lights are switched on.
std::vector< Stop > stops
List of the stops the vehicle will make.
SUMOReal getPartialOccupatorEnd() const
Returns the position of the in-lapping vehicle's end.
void enter(SUMOVehicle *what, SUMOReal beg, SUMOReal end)
Called if a vehicle enters this stop.
The vehicles starts to stop.
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of consumed fuel given the vehicle type and state (in ml/s)
void enterLaneAtInsertion(MSLane *enteredLane, SUMOReal pos, SUMOReal speed, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
static SUMOReal computeNoise(SUMOEmissionClass c, double v, double a)
Returns the noise produced by the a vehicle of the given type at the given speed. ...
std::string busstop
(Optional) bus stop if one is assigned to the stop
SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax)
Applies stored velocity information on the speed to use.
bool operator!=(const State &state)
Operator !=.
static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted CO2 given the vehicle type and state (in mg/s)
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
The vehicle changes lanes (micro only)
Position getPositionAtDistance(SUMOReal offset) const
MSLane * lane
The described lane.
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
SUMOReal getLength() const
return the length of the edge
Left blinker lights are switched on.
MSLane * getLogicalPredecessorLane() const
void continueLaneChangeManeuver(bool moved)
void setEmergencyBrakeRedLight(bool value)
Sets whether red lights shall be a reason to brake.
SUMOReal brakeGap(const SUMOReal speed) const
Returns the distance the vehicle needs to halt including driver's reaction time.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
SUMOReal getSpeedDeviation() const
Returns this type's speed deviation.
SUMOReal startPos
The stopping position start.
std::pair< MSVehicle *const, SUMOReal > getLeaderOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle &veh, const std::vector< MSLane * > &bestLaneConts) const
Returns the leader and the distance to him.
The vehicle got a new route.
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
vehicle want's to change to right lane
#define DIST_TO_STOPLINE_EXPECT_PRIORITY
bool addTraciStop(MSLane *lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted NOx given the vehicle type and state (in mg/s)
std::vector< const MSEdge * > MSEdgeVector
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, unsigned int > > &laneTimeLine)
Sets a new lane timeline.
ChangeRequest
Requests set via TraCI.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
A point in 2D or 3D with translation and scaling methods.
SUMOReal endPos
The stopping position end.
MSLane * getLane() const
Returns the connected lane.
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
void addPerson(MSPerson *person)
Add a passenger.
static void clear()
Clears the dictionary.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
Position myCachedPosition
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
const MSLane * lane
The lane to stop at.
static SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
Uses the given values to compute the brutto-gap.
bool triggered
whether an arriving person lets the vehicle continue
std::list< Stop > myStops
The vehicle's list of stops.
bool contains(const MSEdge *const edge) const
static SUMOReal computeHC(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted HC given the vehicle type and state (in mg/s)
bool isStopped() const
Returns whether the vehicle is at a stop.
std::pair< MSVehicle *, SUMOReal > getLastVehicleInformation() const
Returns the last vehicle which is still on the lane.
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
void adaptLeaveSpeed(const SUMOReal v)
MSLane * myLane
The lane the vehicle is on.
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
SUMOTime duration
The stopping duration.
bool isRoundabout() const
MSVehicle()
invalidated default constructor
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
The link is a (hard) right direction.
virtual SUMOReal stopSpeed(const MSVehicle *const veh, const SUMOReal speed, SUMOReal gap2pred) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
A structure representing the best lanes for continuing the route.
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
const std::vector< MSPerson * > & getPersons() const
Returns the list of persons using this vehicle.
static MTRand myVehicleParamsRNG
A random number generator used to choose from vtype/route distributions and computing the speed facto...
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
MSBusStop * getBusStop(const std::string &id) const
Returns the named bus stop.
SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
virtual MSVehicle * getLastVehicle() const
returns the last vehicle
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuouss lane change.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, SUMOTime untilOffset=0)
Adds a stop.
SUMOReal getLengthGeometryFactor() const
return shape.length() / myLength
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
The link is a partial right direction.
SUMOReal computeChosenSpeedDeviation(MTRand &rng, const SUMOReal minDevFactor=0.2) const
Computes and returns the speed deviation.
virtual SUMOReal getHeadwayTime() const
Get the driver's reaction time [s].
void addReference() const
increments the reference counter for the route
bool isParking() const
Returns whether the vehicle is parking.
SUMOReal getLaneChangeCompletion() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
bool allowsContinuation
Whether this lane allows to continue the drive.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Container that holds the vehicles driving state (position+speed).
void unregisterOneWaitingForPerson()
decreases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
void registerOneWaitingForPerson()
increases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
void saveState(OutputDevice &out)
Saves the states of a vehicle.
void planMoveInternal(const SUMOTime t, const MSVehicle *pred, DriveItemVector &lfLinks) const
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
std::string lane
The lane to stop at.
SUMOReal getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
MSEdgeWeightsStorage & _getWeightsStorage() const
void leaveLane(const MSMoveReminder::Notification reason)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
unsigned int getVehicleNumber() const
Returns the number of vehicles on this lane.
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
SUMOReal getSpeedFactor() const
Returns this type's speed factor.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_UNKNOWN) const
Get the allowed lanes to reach the destination-edge.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
vehicle want's to change to left lane
The action is needed to follow the route (navigational lc)
SUMOReal myChosenSpeedFactor
A precomputed factor by which the driver wants to be faster than the speed limit. ...
bool replaceRouteEdges(MSEdgeVector &edges, bool onInit=false)
Replaces the current route by the given edges.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
LaneChangeModel getLaneChangeModel() const
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Structure representing possible vehicle parameter.
virtual SUMOReal freeSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal seen, SUMOReal maxSpeed) const
Computes the vehicle's safe speed without a leader.
bool havePriority() const
Returns whether this link is a major link.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
static SUMOReal computeCO(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted CO given the vehicle type and state (in mg/s)
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
virtual MSPersonControl & getPersonControl()
Returns the person control.
The link has yellow light, may pass.
void setConsiderMaxDeceleration(bool value)
Sets whether the maximum deceleration shall be regarded.
bool fixPosition()
repair errors in vehicle position after changing between internal edges
bool isLaneChangeMidpointPassed() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
int mySignals
State of things of the vehicle that can be on or off.
std::vector< MSLane * > bestContinuations
Consecutive lane that can be followed without a lane change (contribute to length and occupation) ...
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
Definition of vehicle stop (position and duration)
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
SUMOReal y() const
Returns the y-position.
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
void adaptToLeader(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, DriveProcessItem *const lastLink, const MSLane *const lane, SUMOReal &v, SUMOReal &vLinkPass, SUMOReal distToCrossing=-1) const
The action is due to the default of keeping right "Rechtsfahrgebot".
The link has red light (must brake)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
SUMOTime until
The time at which the vehicle may continue its journey.
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
int index
at which position in the stops list
void calculateArrivalPos()
(Re-)Calculates the arrival position from the vehicle parameters
MSRouteIterator edge
The edge in the route to stop at.
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge)
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
The arrival lane is given.
Needs to stay on the current lane.
const std::string & getID() const
Returns the name of the vehicle type.
The vehicle ends to stop.
SUMOReal getSpeed() const
Returns the vehicle's current speed.
void resetMoved()
reset the flag whether a vehicle already moved to false
SUMOReal departPos
(optional) The position the vehicle shall depart from
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle's state change.
bool isCrossing() const
Returns whether this link belongs to a junction where more than one edge is incoming.
void setLaneChangeMode(int value)
Sets lane changing behavior.
SUMOReal myPos
the stored position
virtual void prepareStep()
MSBusStop * busstop
(Optional) bus stop if one is assigned to the stop
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
std::vector< DriveProcessItem > DriveItemVector
void planMove(const SUMOTime t, const MSVehicle *pred, const SUMOReal lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step...
const PositionVector & getShape() const
Returns this lane's shape.
SUMOReal endPos
The stopping position end.
void move2side(SUMOReal amount)
vehicle want's to keep the current lane
LinkState getState() const
Returns the current state of the link.
bool hasValidRoute(std::string &msg) const
Validates the current route.
MSVehicle * getPartialOccupator() const
Returns the vehicle which laps into this lane.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
void switchOffSignal(int signal)
Switches the given signal off.
void switchOnSignal(int signal)
Switches the given signal on.
static std::vector< MSLane * > myEmptyLaneVector
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
MSRouteIterator myCurrEdge
Iterator to current route-edge.
std::vector< std::pair< std::pair< MSVehicle *, SUMOReal >, SUMOReal > > LinkLeaders
virtual ~MSVehicle()
Destructor.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
No information given; use default.
The link has yellow light, has to brake anyway.
void release() const
deletes the route if there are no further references to it
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
MSLane * getLane() const
Returns the lane the vehicle is on.
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
The edge is an internal edge.
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
static SUMOTime gLaneChangeDuration
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
void addPerson(MSPerson *person)
Adds a passenger.
static MSAbstractLaneChangeModel * build(LaneChangeModel lcm, MSVehicle &vehicle)
Factory method for instantiating new lane changing models.
SUMOReal startPos
The stopping position start.
GUISelectedStorage gSelected
A global holder of selected objects.
void addReminder(MSMoveReminder *rem)
Adds a MoveReminder dynamically.
Representation of a lane in the micro simulation.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
unsigned int size() const
Return the number of passengers.
bool opened(SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, std::vector< const SUMOVehicle * > *collectFoes=0) const
Returns the information whether the link may be passed.
unsigned int getRoutePosition() const
static SUMOReal computePMx(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted PMx given the vehicle type and state (in mg/s)
Interface for lane-change models.
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
int getBestLaneOffset() const
returns the current offset from the best lane
void setConsiderMaxAcceleration(bool value)
Sets whether the maximum acceleration shall be regarded.
SUMOTime myDeparture
The real departure time.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
std::string id
The vehicle's id.
bool parking
whether the vehicle is removed from the net while stopping
static const Position INVALID
The vehicle is being teleported.
int getLaneChangeDirection() const
return the direction of the current lane change maneuver
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
const std::string & getID() const
Returns the name of the vehicle.
The action is due to the wish to be faster (tactical lc)
unsigned int getLaneIndex() const