79 #include <mesosim/MESegment.h>
80 #include <mesosim/MELoop.h>
84 #ifdef CHECK_MEMORY_LEAKS
86 #endif // CHECK_MEMORY_LEAKS
89 #ifdef DEBUG_VEHICLE_GUI_SELECTION
96 #define BUS_STOP_OFFSET 0.5
98 #define CRLL_LOOK_AHEAD 5
101 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0
131 return (myPos != state.
myPos ||
143 myPos(pos), mySpeed(speed) {}
151 mySpeedAdaptationStarted(true),
152 myConsiderSafeVelocity(true),
153 myConsiderMaxAcceleration(true),
154 myConsiderMaxDeceleration(true),
155 myRespectJunctionPriority(true),
156 myEmergencyBrakeRedLight(true),
157 myAmVTDControlled(false),
171 mySpeedAdaptationStarted =
true;
172 mySpeedTimeLine = speedTimeLine;
178 myLaneTimeLine = laneTimeLine;
185 myOriginalSpeed = speed;
187 while (mySpeedTimeLine.size() == 1 || (mySpeedTimeLine.size() > 1 && currentTime > mySpeedTimeLine[1].first)) {
188 mySpeedTimeLine.erase(mySpeedTimeLine.begin());
191 if (mySpeedTimeLine.size() < 2 || currentTime < mySpeedTimeLine[0].first) {
195 if (!mySpeedAdaptationStarted) {
196 mySpeedTimeLine[0].second = speed;
197 mySpeedAdaptationStarted =
true;
201 speed = mySpeedTimeLine[0].second - (mySpeedTimeLine[0].second - mySpeedTimeLine[1].second) * td;
202 if (myConsiderSafeVelocity) {
203 speed =
MIN2(speed, vSafe);
205 if (myConsiderMaxAcceleration) {
206 speed =
MIN2(speed, vMax);
208 if (myConsiderMaxDeceleration) {
209 speed =
MAX2(speed, vMin);
218 while (myLaneTimeLine.size() == 1 || (myLaneTimeLine.size() > 1 && currentTime > myLaneTimeLine[1].first)) {
219 myLaneTimeLine.erase(myLaneTimeLine.begin());
223 if (myLaneTimeLine.size() >= 2 && currentTime >= myLaneTimeLine[0].first) {
224 const unsigned int destinationLaneIndex = myLaneTimeLine[1].second;
225 if (destinationLaneIndex < (
unsigned int)currentEdge.
getLanes().size()) {
226 if (currentLaneIndex > destinationLaneIndex) {
228 }
else if (currentLaneIndex < destinationLaneIndex) {
240 mode = myStrategicLC;
242 mode = myCooperativeLC;
244 mode = mySpeedGainLC;
246 mode = myRightDriveLC;
254 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
262 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
283 switch (changeRequest) {
299 assert(myLaneTimeLine.size() >= 2);
300 assert(currentTime >= myLaneTimeLine[0].first);
301 return STEPS2TIME(myLaneTimeLine[1].first - currentTime);
307 myConsiderSafeVelocity = value;
313 myConsiderMaxAcceleration = value;
319 myConsiderMaxDeceleration = value;
325 myRespectJunctionPriority = value;
331 myEmergencyBrakeRedLight = value;
349 if (myVTDRoute.size() != 0) {
353 if (myVTDPos > myVTDLane->getLength()) {
354 myVTDPos = myVTDLane->getLength();
356 myVTDLane->forceVehicleInsertion(v, myVTDPos);
358 myAmVTDControlled =
false;
372 (*i)->resetPartialOccupation(
this);
376 if ((*i).myLink != 0) {
377 (*i).myLink->removeApproaching(
this);
412 for (std::vector<SUMOVehicleParameter::Stop>::iterator i = pars->
stops.begin(); i != pars->
stops.end(); ++i) {
415 "' on lane '" + i->lane +
"' is too close or not downstream the current route.");
418 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = route->
getStops().begin(); i != route->
getStops().end(); ++i) {
421 "' on lane '" + i->lane +
"' is too close or not downstream the current route.");
425 const MSLane*
const depLane = (*myCurrEdge)->getDepartLane(*
this);
427 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
431 WRITE_WARNING(
"Choosing new speed factor for vehicle '" + pars->
id +
"' to match departure speed.");
435 "' is too high for the departure lane '" + depLane->getID() +
"'.");
440 "' is too high for the vehicle type '" + type->
getID() +
"'.");
452 if ((*i).myLink != 0) {
453 (*i).myLink->removeApproaching(
this);
498 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
499 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
502 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
507 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
510 "' on lane '" + i->lane +
"' is too close or not downstream the new route.");
565 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second, newSpeed)) {
567 if (myTraceMoveReminders) {
568 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
574 if (myTraceMoveReminders) {
575 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
590 rem->second += oldLaneLength;
592 if (myTraceMoveReminders) {
593 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
626 if (offset == 0. && !changingLanes) {
661 atan2(p1.
x() - p2.
x(), p2.
y() - p1.
y()) * 180. /
M_PI :
682 if (stop.
until != -1) {
683 stop.
until += untilOffset;
695 std::list<Stop>::iterator iter =
myStops.begin();
698 prevStopEdge =
myStops.back().edge;
699 prevStopPos =
myStops.back().endPos;
702 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
708 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
709 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
710 prevStopEdge = iter->edge;
711 prevStopPos = iter->endPos;
715 int index = stopPar.
index;
717 prevStopEdge = iter->edge;
718 prevStopPos = iter->endPos;
726 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
739 pos += (*myCurrEdge)->getLength();
776 return currentVelocity;
787 for (std::vector<MSPerson*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
815 bool busStopsMustHaveSpace =
true;
820 busStopsMustHaveSpace =
false;
830 if (stop.
until >= 0) {
846 return currentVelocity;
860 #ifdef DEBUG_VEHICLE_GUI_SELECTION
866 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
867 if ((*i).myLink != 0) {
868 (*i).myLink->removeApproaching(
this);
872 #ifdef HAVE_INTERNAL_LANES
873 myLinkLeaders.clear();
895 assert(bestLaneConts.size() > 0);
896 #ifdef HAVE_INTERNAL_LANES
897 bool hadNonInternal =
false;
899 bool hadNonInternal =
true;
904 unsigned int view = 0;
914 std::pair<const MSVehicle*, SUMOReal> leaderInfo = std::make_pair(pred, gap);
920 adaptToLeader(leaderInfo, seen, lastLink, lane, v, vLinkPass);
932 v =
MIN2(v, stopSpeed);
939 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
985 (*link)->getViaLaneOrLane()->getParallelLane(-
getLaneChangeModel().getLaneChangeDirection()) == 0)) {
987 const SUMOReal va = seen / timeRemaining;
992 const bool setRequest = v > 0;
1001 #ifdef HAVE_INTERNAL_LANES
1004 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1006 const MSVehicle* leader = (*it).vehAndGap.first;
1010 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1011 }
else if (leader->myLinkLeaders.count(
getID()) == 0) {
1013 myLinkLeaders.insert(leader->
getID());
1014 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1015 if (lastLink != 0) {
1023 vLinkWait =
MIN2(vLinkWait, v);
1026 if (lastLink != 0) {
1032 if (!(*link)->havePriority() && stopDist > cfModel.
getMaxDecel()) {
1041 const SUMOReal accelTime = (vLinkPass - v) / accel;
1042 const SUMOReal accelWay = accelTime * (vLinkPass + v) * 0.5;
1054 arrivalSpeedBraking = arrivalSpeed;
1061 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1062 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1065 arrivalTime, arrivalSpeed,
1066 arrivalTimeBraking, arrivalSpeedBraking,
1069 #ifdef HAVE_INTERNAL_LANES
1070 if ((*link)->getViaLane() == 0) {
1071 hadNonInternal =
true;
1078 if (!setRequest || ((v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD)) {
1082 lane = (*link)->getViaLaneOrLane();
1094 lastLink = &lfLinks.back();
1105 if (leaderInfo.first != 0) {
1108 if (leaderInfo.second >= 0) {
1109 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1115 if (distToCrossing >= 0) {
1119 if (lastLink != 0) {
1122 v =
MIN2(v, vsafeLeader);
1123 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1130 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1151 DriveItemVector::iterator i;
1153 MSLink* link = (*i).myLink;
1155 if (link != 0 && (*i).mySetRequest) {
1161 vSafe = (*i).myVLinkWait;
1168 const bool influencerPrio =
false;
1172 const bool opened = yellow || influencerPrio ||
1173 link->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1179 vSafe = (*i).myVLinkWait;
1198 vSafe = (*i).myVLinkPass;
1204 vSafe = (*i).myVLinkWait;
1212 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);
1361 std::vector<MSLane*>::reverse_iterator i = passedLanes.rbegin() + 1;
1362 while (leftLength > 0 && i != passedLanes.rend()) {
1364 leftLength -= (*i)->setPartialOccupation(
this, leftLength);
1386 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1388 foundStopped =
true;
1389 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
1393 lengths += (*i)->getVehicleType().getLengthWithGap();
1402 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1410 #ifdef HAVE_INTERNAL_LANES
1412 bool hadVehicle =
false;
1413 SUMOReal seenSpace = -lengthsInFront;
1415 bool foundStopped =
false;
1418 for (
unsigned int i = 0; i < lfLinks.size(); ++i) {
1421 if (item.
myLink == 0 || foundStopped) {
1427 const MSLane* approachedLane = item.
myLink->getViaLane();
1428 if (approachedLane != 0) {
1452 foundStopped =
true;
1455 seenSpace += approachedLane->
getLength();
1469 foundStopped =
true;
1477 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1483 for (
int i = (
int)(lfLinks.size() - 1); i > 0; --i) {
1492 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
1493 if (!opened && item.
myLink != 0) {
1497 allowsContinuation =
true;
1501 if (allowsContinuation) {
1507 int removalBegin = -1;
1508 for (
unsigned int i = 0; hadVehicle && i < lfLinks.size() && removalBegin < 0; ++i) {
1522 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
1529 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes()) {
1537 while (removalBegin < (
int)(lfLinks.size())) {
1539 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
1541 lfLinks[removalBegin].mySetRequest =
false;
1550 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
1551 if ((*i).myLink != 0) {
1555 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1556 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime());
1565 if (rem->first->getLane() != 0 && rem->first->getLane() !=
getLane()) {
1567 if (myTraceMoveReminders) {
1568 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
1573 if (rem->first->notifyEnter(*
this, reason)) {
1575 if (myTraceMoveReminders) {
1576 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
1582 if (myTraceMoveReminders) {
1583 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
1613 if (!onTeleporting) {
1649 while (i != route.
begin() && leftLength > 0) {
1656 leftLength -= (lane)->setPartialOccupation(
this, leftLength);
1697 MSLane* clane = enteredLane;
1698 while (leftLength > 0) {
1704 leftLength -= (clane)->setPartialOccupation(
this, leftLength);
1712 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
1714 if (myTraceMoveReminders) {
1715 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
1721 if (myTraceMoveReminders) {
1722 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
1730 (*i)->resetPartialOccupation(
this);
1761 const std::vector<MSVehicle::LaneQ>&
1769 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1776 if (startLane == 0) {
1779 assert(startLane != 0);
1797 std::vector<LaneQ>& lanes = *it;
1798 assert(lanes.size() > 0);
1799 if (&(lanes[0].lane->getEdge()) == nextEdge) {
1801 std::vector<LaneQ> oldLanes = lanes;
1803 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
1804 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
1805 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
1806 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
1807 lanes.push_back(*it_lane);
1814 for (
int i = 0; i < (
int)lanes.size(); ++i) {
1815 if (i + lanes[i].bestLaneOffset < 0) {
1816 lanes[i].bestLaneOffset = -i;
1818 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
1819 lanes[i].bestLaneOffset = (
int)lanes.size() - i - 1;
1821 assert(i + lanes[i].bestLaneOffset >= 0);
1822 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
1823 if (lanes[i].bestContinuations[0] != 0) {
1825 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
1827 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
1830 assert(&(lanes[i].lane->getEdge()) == nextEdge);
1843 myLastBestLanesEdge = &startLane->
getEdge();
1847 const MSEdge* nextStopEdge = 0;
1848 const MSLane* nextStopLane = 0;
1852 nextStopLane = nextStop.
lane;
1853 nextStopEdge = &nextStopLane->
getEdge();
1861 if (nextStopEdge != 0) {
1870 bool progress =
true;
1872 std::vector<LaneQ> currentLanes;
1873 const std::vector<MSLane*>* allowed = 0;
1874 const MSEdge* nextEdge = 0;
1876 nextEdge = *(ce + 1);
1879 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
1880 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
1887 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
1888 currentLanes.push_back(q);
1891 if (nextStopEdge == *ce) {
1893 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
1894 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
1895 (*q).allowsContinuation =
false;
1896 (*q).length = nextStopPos;
1903 seenLength += currentLanes[0].lane->getLength();
1905 progress &= (seen <= 4 || seenLength < 3000);
1906 progress &= seen <= 8;
1918 int bestThisIndex = 0;
1921 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
1922 if ((*j).length > bestLength) {
1923 bestLength = (*j).length;
1924 bestThisIndex = index;
1928 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
1929 if ((*j).length < bestLength) {
1930 (*j).bestLaneOffset = bestThisIndex - index;
1937 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
1938 std::vector<LaneQ>& nextLanes = (*(i - 1));
1939 std::vector<LaneQ>& clanes = (*i);
1940 MSEdge& cE = clanes[0].lane->getEdge();
1944 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
1945 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
1946 bestConnectedLength = (*j).length;
1948 if (bestLength < (*j).length) {
1949 bestLength = (*j).length;
1953 int bestThisIndex = 0;
1954 if (bestConnectedLength > 0) {
1956 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
1957 LaneQ bestConnectedNext;
1958 bestConnectedNext.
length = -1;
1959 if ((*j).allowsContinuation) {
1960 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
1961 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
1962 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
1963 bestConnectedNext = *m;
1968 (*j).
length += bestLength;
1970 (*j).length += bestConnectedNext.
length;
1974 if (clanes[bestThisIndex].length < (*j).length || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))) {
1975 bestThisIndex = index;
1981 int bestNextIndex = 0;
1982 int bestDistToNeeded = (
int) clanes.size();
1984 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
1985 if ((*j).allowsContinuation) {
1987 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
1988 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
1989 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
1990 bestDistToNeeded =
abs((*m).bestLaneOffset);
1991 bestThisIndex = index;
1992 bestNextIndex = nextIndex;
1998 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
1999 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
2004 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2005 if ((*j).length < clanes[bestThisIndex].length || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))) {
2006 (*j).bestLaneOffset = bestThisIndex - index;
2008 (*j).bestLaneOffset = 0;
2019 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
2020 std::vector<LaneQ>::iterator i;
2021 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
2023 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
2024 nextOccupation += (*j)->getBruttoVehLenSum();
2026 (*i).nextOccupation = nextOccupation;
2027 if ((*i).lane == startLane) {
2034 const std::vector<MSLane*>&
2039 return (*myCurrentLaneInBestLanes).bestContinuations;
2043 const std::vector<MSLane*>&
2054 if ((*i).lane == lane) {
2055 return (*i).bestContinuations;
2067 return (*myCurrentLaneInBestLanes).bestLaneOffset;
2074 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
2075 assert(laneIndex < preb.size());
2076 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
2093 #ifdef DEBUG_VEHICLE_GUI_SELECTION
2098 if (
isOnRoad() && destEdge != NULL) {
2112 std::pair<const MSVehicle* const, SUMOReal>
2115 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
2122 MSLane::VehCont::const_iterator pred = std::find(vehs.begin(), vehs.end(),
this) + 1;
2123 if (pred != vehs.end()) {
2138 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
2139 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
2196 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2197 if (numExpected != 0) {
2202 numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2204 if (numExpected == 0) {
2230 switch ((*link)->getDirection()) {
2268 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2269 if (iter->lane == lane && fabs(iter->endPos - pos) <
POSITION_EPS) {
2270 if (duration == 0 && !iter->reached) {
2273 iter->duration = duration;
2301 if (
myStops.front().busstop != 0) {
2303 myStops.front().busstop->leaveFrom(
this);
2363 std::vector<int> internals;
2376 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
2378 unsigned int routeOffset;
2383 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 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.
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.
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.
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.
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.
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
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
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.
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
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.
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.
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
SUMOReal getSpeedFactor() const
Returns this type's speed factor.
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)
SUMOReal myChosenSpeedFactor
A precomputed factor by which the driver wants to be faster than the speed limit. ...
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.
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 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)
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.
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