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);
410 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
411 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
415 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
420 "' is too high for the vehicle type '" + type->
getID() +
"'.");
432 if ((*i).myLink != 0) {
433 (*i).myLink->removeApproaching(
this);
476 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
477 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
480 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
485 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
544 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second, newSpeed)) {
546 if (myTraceMoveReminders) {
547 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
553 if (myTraceMoveReminders) {
554 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
569 rem->second += oldLaneLength;
571 if (myTraceMoveReminders) {
572 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
605 if (offset == 0. && !changingLanes) {
628 #ifdef HAVE_INTERNAL_LANES
659 atan2(p1.
x() - p2.
x(), p2.
y() - p1.
y()) * 180. /
M_PI :
675 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
684 if (stop.
until != -1) {
685 stop.
until += untilOffset;
696 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
706 std::list<Stop>::iterator iter =
myStops.begin();
709 prevStopEdge =
myStops.back().edge;
710 prevStopPos =
myStops.back().endPos;
713 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
719 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
720 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
721 prevStopEdge = iter->edge;
722 prevStopPos = iter->endPos;
726 int index = stopPar.
index;
728 prevStopEdge = iter->edge;
729 prevStopPos = iter->endPos;
737 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
743 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
749 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
757 pos += (*myCurrEdge)->getLength();
769 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is behind departPos.";
774 std::list<Stop>::iterator iter2 = iter;
776 if (stop.
until >= 0 && iter2->until > stop.
until) {
782 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
812 return currentVelocity;
823 for (std::vector<MSPerson*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
851 bool busStopsMustHaveSpace =
true;
857 busStopsMustHaveSpace =
false;
867 if (stop.
until >= 0) {
883 return currentVelocity;
897 #ifdef DEBUG_VEHICLE_GUI_SELECTION
903 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
904 if ((*i).myLink != 0) {
905 (*i).myLink->removeApproaching(
this);
929 assert(bestLaneConts.size() > 0);
930 #ifdef HAVE_INTERNAL_LANES
931 bool hadNonInternal =
false;
933 bool hadNonInternal =
true;
938 unsigned int view = 0;
948 std::pair<const MSVehicle*, SUMOReal> leaderInfo = std::make_pair(pred, gap);
954 adaptToLeader(leaderInfo, seen, lastLink, lane, v, vLinkPass);
966 v =
MIN2(v, stopSpeed);
973 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1020 (*link)->getViaLaneOrLane()->getParallelLane(-
getLaneChangeModel().getLaneChangeDirection()) == 0)) {
1022 const SUMOReal va = seen / timeRemaining;
1027 const bool setRequest = v > 0;
1036 #ifdef HAVE_INTERNAL_LANES
1039 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1041 const MSVehicle* leader = (*it).vehAndGap.first;
1045 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1046 }
else if (leader->myLinkLeaders[(*link)->getJunction()].count(
getID()) == 0) {
1048 myLinkLeaders[(*link)->getJunction()].insert(leader->
getID());
1049 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1050 if (lastLink != 0) {
1058 vLinkWait =
MIN2(vLinkWait, v);
1061 if (lastLink != 0) {
1067 if (!(*link)->havePriority() && stopDist > cfModel.
getMaxDecel()) {
1076 const SUMOReal accelTime = (vLinkPass - v) / accel;
1077 const SUMOReal accelWay = accelTime * (vLinkPass + v) * 0.5;
1089 arrivalSpeedBraking = arrivalSpeed;
1096 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1097 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1100 arrivalTime, arrivalSpeed,
1101 arrivalTimeBraking, arrivalSpeedBraking,
1104 #ifdef HAVE_INTERNAL_LANES
1105 if ((*link)->getViaLane() == 0) {
1106 hadNonInternal =
true;
1113 if (!setRequest || ((v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD)) {
1117 lane = (*link)->getViaLaneOrLane();
1129 lastLink = &lfLinks.back();
1140 if (leaderInfo.first != 0) {
1142 if (lastLink != 0) {
1145 v =
MIN2(v, vsafeLeader);
1146 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1154 assert(leaderInfo.first != 0);
1157 if (leaderInfo.second >= 0) {
1158 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1164 if (distToCrossing >= 0) {
1174 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1195 DriveItemVector::iterator i;
1197 MSLink* link = (*i).myLink;
1199 if (link != 0 && (*i).mySetRequest) {
1205 vSafe = (*i).myVLinkWait;
1212 const bool influencerPrio =
false;
1216 const bool opened = yellow || influencerPrio ||
1217 link->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1223 vSafe = (*i).myVLinkWait;
1242 vSafe = (*i).myVLinkPass;
1248 vSafe = (*i).myVLinkWait;
1256 vSafe = (*i).myVLinkWait;
1315 std::vector<MSLane*> passedLanes;
1317 passedLanes.push_back(*i);
1319 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
1320 passedLanes.push_back(
myLane);
1323 std::string emergencyReason =
" for unknown reasons";
1336 MSLink* link = (*i).myLink;
1347 emergencyReason =
" because of a red traffic light";
1354 emergencyReason =
" because there is no connection to the next edge";
1358 if (approachedLane !=
myLane && approachedLane != 0) {
1366 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
1371 #ifdef HAVE_INTERNAL_LANES
1373 if (link->getViaLane() == 0) {
1383 passedLanes.push_back(approachedLane);
1389 (*i)->resetPartialOccupation(
this);
1411 std::vector<MSLane*>::reverse_iterator i = passedLanes.rbegin() + 1;
1412 while (leftLength > 0 && i != passedLanes.rend()) {
1414 leftLength -= (*i)->setPartialOccupation(
this, leftLength);
1436 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1438 foundStopped =
true;
1439 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
1443 lengths += (*i)->getVehicleType().getLengthWithGap();
1452 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1460 #ifdef HAVE_INTERNAL_LANES
1462 bool hadVehicle =
false;
1463 SUMOReal seenSpace = -lengthsInFront;
1465 bool foundStopped =
false;
1468 for (
unsigned int i = 0; i < lfLinks.size(); ++i) {
1471 if (item.
myLink == 0 || foundStopped) {
1477 const MSLane* approachedLane = item.
myLink->getViaLane();
1478 if (approachedLane != 0) {
1502 foundStopped =
true;
1505 seenSpace += approachedLane->
getLength();
1519 foundStopped =
true;
1527 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1533 for (
int i = (
int)(lfLinks.size() - 1); i > 0; --i) {
1542 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
1543 if (!opened && item.
myLink != 0) {
1547 allowsContinuation =
true;
1551 if (allowsContinuation) {
1557 int removalBegin = -1;
1558 for (
unsigned int i = 0; hadVehicle && i < lfLinks.size() && removalBegin < 0; ++i) {
1572 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
1579 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes()) {
1587 while (removalBegin < (
int)(lfLinks.size())) {
1589 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
1591 lfLinks[removalBegin].mySetRequest =
false;
1600 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
1601 if ((*i).myLink != 0) {
1605 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1606 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime());
1615 if (rem->first->getLane() != 0 && rem->first->getLane() !=
getLane()) {
1617 if (myTraceMoveReminders) {
1618 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
1623 if (rem->first->notifyEnter(*
this, reason)) {
1625 if (myTraceMoveReminders) {
1626 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
1632 if (myTraceMoveReminders) {
1633 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
1663 if (!onTeleporting) {
1700 while (i != route.
begin() && leftLength > 0) {
1707 leftLength -= (lane)->setPartialOccupation(
this, leftLength);
1748 MSLane* clane = enteredLane;
1749 while (leftLength > 0) {
1755 leftLength -= (clane)->setPartialOccupation(
this, leftLength);
1763 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
1765 if (myTraceMoveReminders) {
1766 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
1772 if (myTraceMoveReminders) {
1773 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
1781 (*i)->resetPartialOccupation(
this);
1812 const std::vector<MSVehicle::LaneQ>&
1820 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1826 if (startLane == 0) {
1829 assert(startLane != 0);
1847 std::vector<LaneQ>& lanes = *it;
1848 assert(lanes.size() > 0);
1849 if (&(lanes[0].lane->getEdge()) == nextEdge) {
1851 std::vector<LaneQ> oldLanes = lanes;
1853 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
1854 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
1855 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
1856 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
1857 lanes.push_back(*it_lane);
1864 for (
int i = 0; i < (int)lanes.size(); ++i) {
1865 if (i + lanes[i].bestLaneOffset < 0) {
1866 lanes[i].bestLaneOffset = -i;
1868 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
1869 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
1871 assert(i + lanes[i].bestLaneOffset >= 0);
1872 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
1873 if (lanes[i].bestContinuations[0] != 0) {
1875 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
1877 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
1880 assert(&(lanes[i].lane->getEdge()) == nextEdge);
1893 myLastBestLanesEdge = &startLane->
getEdge();
1897 const MSEdge* nextStopEdge = 0;
1898 const MSLane* nextStopLane = 0;
1902 nextStopLane = nextStop.
lane;
1903 nextStopEdge = &nextStopLane->
getEdge();
1911 if (nextStopEdge != 0) {
1920 bool progress =
true;
1922 std::vector<LaneQ> currentLanes;
1923 const std::vector<MSLane*>* allowed = 0;
1924 const MSEdge* nextEdge = 0;
1926 nextEdge = *(ce + 1);
1929 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
1930 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
1937 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
1938 currentLanes.push_back(q);
1941 if (nextStopEdge == *ce) {
1943 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
1944 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
1945 (*q).allowsContinuation =
false;
1946 (*q).length = nextStopPos;
1953 seenLength += currentLanes[0].lane->getLength();
1955 progress &= (seen <= 4 || seenLength < 3000);
1956 progress &= seen <= 8;
1968 int bestThisIndex = 0;
1971 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
1972 if ((*j).length > bestLength) {
1973 bestLength = (*j).length;
1974 bestThisIndex = index;
1978 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
1979 if ((*j).length < bestLength) {
1980 (*j).bestLaneOffset = bestThisIndex - index;
1987 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
1988 std::vector<LaneQ>& nextLanes = (*(i - 1));
1989 std::vector<LaneQ>& clanes = (*i);
1990 MSEdge& cE = clanes[0].lane->getEdge();
1994 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
1995 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
1996 bestConnectedLength = (*j).length;
1998 if (bestLength < (*j).length) {
1999 bestLength = (*j).length;
2003 int bestThisIndex = 0;
2004 if (bestConnectedLength > 0) {
2006 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2007 LaneQ bestConnectedNext;
2008 bestConnectedNext.
length = -1;
2009 if ((*j).allowsContinuation) {
2010 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
2011 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2012 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
2013 bestConnectedNext = *m;
2018 (*j).
length += bestLength;
2020 (*j).length += bestConnectedNext.
length;
2024 if (clanes[bestThisIndex].length < (*j).length || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))) {
2025 bestThisIndex = index;
2031 int bestNextIndex = 0;
2032 int bestDistToNeeded = (int) clanes.size();
2034 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2035 if ((*j).allowsContinuation) {
2037 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
2038 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2039 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
2040 bestDistToNeeded =
abs((*m).bestLaneOffset);
2041 bestThisIndex = index;
2042 bestNextIndex = nextIndex;
2048 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
2049 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
2054 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2055 if ((*j).length < clanes[bestThisIndex].length || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))) {
2056 (*j).bestLaneOffset = bestThisIndex - index;
2058 (*j).bestLaneOffset = 0;
2069 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
2070 std::vector<LaneQ>::iterator i;
2071 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
2073 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
2074 nextOccupation += (*j)->getBruttoVehLenSum();
2076 (*i).nextOccupation = nextOccupation;
2077 if ((*i).lane == startLane) {
2084 const std::vector<MSLane*>&
2089 return (*myCurrentLaneInBestLanes).bestContinuations;
2093 const std::vector<MSLane*>&
2104 if ((*i).lane == lane) {
2105 return (*i).bestContinuations;
2117 return (*myCurrentLaneInBestLanes).bestLaneOffset;
2124 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
2125 assert(laneIndex < (
int)preb.size());
2126 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
2143 #ifdef DEBUG_VEHICLE_GUI_SELECTION
2148 if (
isOnRoad() && destEdge != NULL) {
2162 std::pair<const MSVehicle* const, SUMOReal>
2165 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
2172 MSLane::VehCont::const_iterator pred = std::find(vehs.begin(), vehs.end(),
this) + 1;
2173 if (pred != vehs.end()) {
2188 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
2189 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
2246 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2247 if (numExpected != 0) {
2252 numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2254 if (numExpected == 0) {
2280 switch ((*link)->getDirection()) {
2325 bool parking,
bool triggered, std::string& errorMsg) {
2327 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2328 if (iter->lane == lane && fabs(iter->endPos - pos) <
POSITION_EPS) {
2329 if (duration == 0 && !iter->reached) {
2332 iter->duration = duration;
2348 const bool result =
addStop(newStop, errorMsg);
2364 if (
myStops.front().busstop != 0) {
2366 myStops.front().busstop->leaveFrom(
this);
2426 std::vector<int> internals;
2439 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
2441 unsigned int routeOffset;
2446 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
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 hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
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)
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
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) ...
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 follow speed (no dawdling)
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
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.
void registerEmergencyStop()
register emergency stop
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.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
SUMOReal getEndLanePosition() const
Returns the end position of this bus stop.
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.
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.
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 !=.
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.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
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 immediate 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
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.
SUMOReal getDistanceBetween(SUMOReal fromPos, SUMOReal toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
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.
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
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
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
std::list< Stop > myStops
The vehicle's list of stops.
bool contains(const MSEdge *const edge) const
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 getSafeFollowSpeed(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, const MSLane *const lane, SUMOReal distToCrossing) const
compute safe speed for following the given leader
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
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) ...
std::vector< LinkLeader > LinkLeaders
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.
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.
MSVehicle * getLastVehicle() const
returns the last vehicle
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuouss lane change.
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)
virtual SUMOReal freeSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal seen, SUMOReal maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
The link is a partial right direction.
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.
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
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
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
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.
const MSJunction * getJunction() const
return the junction to which this link belongs
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
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)
The vehicle starts or ends parking.
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.
void setTentativeLaneAndPosition(MSLane *lane, const SUMOReal pos)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
Structure representing possible vehicle parameter.
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.
bool addTraciStop(MSLane *lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered, std::string &errorMsg)
static SUMOReal compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
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)
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
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.
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)
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
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 adaptBestLanesOccupation(int laneIndex, SUMOReal density)
update occupation from MSLaneChanger
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
MSRouteIterator myCurrEdge
Iterator to current route-edge.
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.
The link has red light (must brake) but indicates upcoming green.
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
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