58 #ifdef CHECK_MEMORY_LEAKS 60 #endif // CHECK_MEMORY_LEAKS 117 std::vector<std::string> ids;
120 if ((*i).second->isOnRoad() || (*i).second->isParking()) {
121 ids.push_back((*i).first);
133 if (sumoVehicle == 0) {
141 const bool visible = onRoad || v->
isParking();
182 tempMsg.
writeInt((
int)std::distance(lanes.begin(), std::find(lanes.begin(), lanes.end(), v->
getLane())));
255 std::pair<const MSVehicle* const, SUMOReal> leaderInfo = v->
getLeader(dist);
259 tempMsg.
writeString(leaderInfo.first != 0 ? leaderInfo.first->getID() :
"");
272 if (inputStorage.
readInt() != 2) {
304 if (inputStorage.
readInt() != 2) {
356 const std::vector<MSVehicle::LaneQ>& bestLanes = onRoad ? v->
getBestLanes() : std::vector<MSVehicle::LaneQ>();
357 tempContent.
writeInt((
int) bestLanes.size());
359 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
376 std::vector<std::string> bestContIDs;
379 bestContIDs.push_back((*j)->getID());
402 if ((*link)->isTLSControlled()) {
405 tempContent.
writeString((*link)->getTLLogic()->getID());
408 tempContent.
writeInt((*link)->getTLIndex());
414 tempContent.
writeByte((*link)->getState());
418 lane = (*link)->getViaLaneOrLane();
438 b = 1 + (stop.
parking ? 2 : 0) +
475 std::string paramName =
"";
497 std::string warning =
"";
522 const bool shouldExist = variable !=
ADD && variable !=
ADD_FULL;
524 if (sumoVehicle == 0) {
530 if (v == 0 && shouldExist) {
538 int compoundSize = inputStorage.
readInt();
539 if (compoundSize < 4 || compoundSize > 7) {
561 bool parking =
false;
562 bool triggered =
false;
563 bool containerTriggered =
false;
564 bool isBusStop =
false;
565 bool isContainerStop =
false;
566 if (compoundSize >= 5) {
571 parking = ((stopFlags & 1) != 0);
572 triggered = ((stopFlags & 2) != 0);
573 containerTriggered = ((stopFlags & 4) != 0);
574 isBusStop = ((stopFlags & 8) != 0);
575 isContainerStop = ((stopFlags & 16) != 0);
578 if (compoundSize >= 6) {
588 if (compoundSize >= 7) {
594 if (isBusStop || isContainerStop) {
596 if (!v->
addTraciBusOrContainerStop(roadId, waitTime, until, parking, triggered, containerTriggered, isContainerStop, error)) {
604 if (pos < startPos) {
612 const std::vector<MSLane*>& allLanes = road->
getLanes();
613 if ((laneIndex < 0) || laneIndex >= (
int)(allLanes.size())) {
617 if (!v->
addTraciStop(allLanes[laneIndex], startPos, pos, waitTime, until, parking, triggered, containerTriggered, error)) {
628 if (inputStorage.
readInt() != 0) {
632 if (!static_cast<MSVehicle*>(v)->hasStops()) {
636 if (!static_cast<MSVehicle*>(v)->resumeFromStopping()) {
638 std::ostringstream strs;
639 strs <<
"reached: " << sto.
reached;
640 strs <<
", duration:" << sto.
duration;
641 strs <<
", edge:" << (*sto.
edge)->getID();
642 strs <<
", startPos: " << sto.
startPos;
643 std::string posStr = strs.str();
653 if (inputStorage.
readInt() != 2) {
666 if ((laneIndex < 0) || (laneIndex >= (
int)(v->
getEdge()->
getLanes().size()))) {
670 std::vector<std::pair<SUMOTime, int> > laneTimeLine;
671 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
672 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex));
712 if (inputStorage.
readInt() != 2) {
729 std::vector<std::pair<SUMOTime, SUMOReal> > speedTimeLine;
731 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + duration, newSpeed));
761 if (vehicleType == 0) {
790 std::vector<std::string> edgeIDs;
805 int parameterCount = inputStorage.
readInt();
806 if (parameterCount == 4) {
808 int begTime = 0, endTime = 0;
832 }
else if (parameterCount == 2) {
852 }
else if (parameterCount == 1) {
875 int parameterCount = inputStorage.
readInt();
876 if (parameterCount == 4) {
878 int begTime = 0, endTime = 0;
902 }
else if (parameterCount == 2) {
922 }
else if (parameterCount == 1) {
945 if (inputStorage.
readInt() != 0) {
955 if (inputStorage.
readInt() != 0) {
974 if (inputStorage.
readInt() != 2) {
993 if (!v->
willPass(&destinationEdge)) {
1002 while (v->
getEdge() != &destinationEdge) {
1022 std::vector<std::pair<SUMOTime, SUMOReal> > speedTimeLine;
1024 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), speed));
1043 int laneChangeMode = 0;
1066 if (inputStorage.
readInt() != 6) {
1070 vehicleParams.
id = id;
1072 std::string vTypeID;
1081 std::string routeID;
1094 const int proc = -depart;
1101 WRITE_WARNING(
"Departure time for vehicle '" +
id +
"' is in the past; using current time instead.");
1103 vehicleParams.
depart = depart;
1112 const int proc =
static_cast<int>(-vehicleParams.
departPos);
1127 const int proc =
static_cast<int>(-vehicleParams.
departSpeed);
1141 const int proc =
static_cast<int>(-vehicleParams.
departLane);
1167 if (inputStorage.
readInt() != 14) {
1171 vehicleParams.
id = id;
1173 std::string routeID;
1182 std::string vTypeID;
1312 const int numArgs = inputStorage.
readInt();
1313 if (numArgs != 5 && numArgs != 6) {
1329 double origAngle = 0;
1341 bool keepRoute = v->
getID() !=
"VTD_EGO";
1342 bool mayLeaveNetwork =
false;
1348 keepRoute = (keepRouteFlag == 1);
1349 mayLeaveNetwork = (keepRouteFlag == 2);
1352 std::string origID = edgeID +
" " +
toString(laneNum);
1354 edgeID =
'-' + edgeID;
1359 if (angle >= 180.) {
1360 angle = -360. + angle;
1361 }
else if (angle <= -180.) {
1362 angle = 360. + angle;
1367 std::cout << std::endl <<
"begin vehicle " << v->
getID() <<
" vehPos:" << vehPos <<
" lane:" << v->
getLane()->
getID() << std::endl;
1368 std::cout <<
" want pos:" << pos <<
" edge:" << edgeID <<
" laneNum:" << laneNum <<
" origAngle:" << origAngle <<
" angle:" << angle <<
" keepRoute:" << keepRoute << std::endl;
1376 int routeOffset = 0;
1387 found =
vtdMap(pos, maxRouteDistance, origID, angle, *v, server, bestDistance, &lane, lanePos, routeOffset, edges);
1389 if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) {
1394 lanePosLat = perpDist;
1395 if (!mayLeaveNetwork) {
1403 lanePosLat = -lanePosLat;
1407 assert((found && lane != 0) || (!found && lane == 0));
1468 std::set<std::string> into;
1470 shape.push_back(pos);
1473 std::map<MSLane*, LaneUtility> lane2utility;
1475 for (std::set<std::string>::const_iterator j = into.begin(); j != into.end(); ++j) {
1477 const MSEdge* prevEdge = 0;
1478 const MSEdge* nextEdge = 0;
1480 bool onRoute =
false;
1484 #ifdef DEBUG_VTD_ANGLE 1485 std::cout <<
"Ego on normal" << std::endl;
1496 ConstMSEdgeVector::const_iterator edgePos = std::find(ev.begin() + routePosition, ev.end(), e);
1497 onRoute = edgePos != ev.end();
1498 if (edgePos == ev.end() - 1 && v.
getEdge() == e) {
1504 nextEdge = !onRoute || edgePos == ev.end() - 1 ? 0 : *(edgePos + 1);
1505 #ifdef DEBUG_VTD_ANGLE 1506 std::cout <<
"normal:" << e->
getID() <<
" prev:" << prevEdge->
getID() <<
" next:";
1507 if (nextEdge != 0) {
1508 std::cout << nextEdge->
getID();
1510 std::cout << std::endl;
1513 #ifdef DEBUG_VTD_ANGLE 1514 std::cout <<
"Ego on internal" << std::endl;
1522 prevEdge = l == 0 ? 0 : &l->
getEdge();
1526 ConstMSEdgeVector::const_iterator prevEdgePos = std::find(ev.begin() + v.
getRoutePosition(), ev.end(), prevEdge);
1531 if (prevEdgePos != ev.end() && (prevEdgePos + 1) != ev.end()) {
1532 onRoute = *(prevEdgePos + 1) == nextEdge;
1534 #ifdef DEBUG_VTD_ANGLE 1535 std::cout <<
"internal:" << e->
getID() <<
" prev:" << prevEdge->
getID() <<
" next:" << nextEdge->getID() << std::endl;
1541 const std::vector<MSLane*>& lanes = e->
getLanes();
1542 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end(); ++k) {
1564 #ifdef DEBUG_VTD_ANGLE 1565 std::cout << lane->
getID() <<
": " << langle <<
" " << off << std::endl;
1570 onRoute, sameEdge, prevEdge, nextEdge);
1573 maxDist =
MAX2(maxDist, dist);
1582 for (std::map<MSLane*, LaneUtility>::iterator i = lane2utility.begin(); i != lane2utility.end(); ++i) {
1596 std::cout <<
" x; l:" << l->
getID() <<
" d:" << u.
dist <<
" dN:" << distN <<
" aD:" << angleDiffN <<
1597 " ID:" << idN <<
" oRN:" << onRouteN <<
" sEN:" << sameEdgeN <<
" value:" << value << std::endl;
1599 if (value > bestValue || bestLane == 0) {
1605 if (bestLane == 0) {
1608 const LaneUtility& u = lane2utility.find(bestLane)->second;
1609 bestDistance = u.
dist;
1615 ConstMSEdgeVector::const_iterator prevEdgePos = std::find(ev.begin(), ev.end(), prevEdge);
1616 routeOffset = (int)std::distance(ev.begin(), prevEdgePos);
1629 #ifdef DEBUG_VTD_ANGLE 1630 std::cout <<
"internal2:" <<
" prev:";
1634 std::cout <<
" next:";
1638 std::cout << std::endl;
1650 const std::vector<MSLane*>& lanes = edge->
getLanes();
1651 bool newBest =
false;
1652 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end() && bestDistance >
POSITION_EPS; ++k) {
1653 MSLane* candidateLane = *k;
1656 std::cout <<
" b at lane " << candidateLane->
getID() <<
" dist:" << dist <<
" best:" << bestDistance << std::endl;
1658 if (dist < bestDistance) {
1660 bestDistance = dist;
1661 *lane = candidateLane;
1680 for (ConstMSEdgeVector::const_iterator i = v.
getCurrentRouteEdge(); i != edges.end(); ++i) {
1681 #ifdef HAVE_INTERNAL_LANES 1684 const MSEdge* internalCand = prev->getInternalFollowingEdge(*i);
1686 prev = internalCand;
1690 routeOffset = (int)std::distance(edges.begin(), i);
1697 for (ConstMSEdgeVector::const_iterator i = v.
getCurrentRouteEdge(); i != edges.begin(); --i) {
1699 #ifdef HAVE_INTERNAL_LANES 1702 const MSEdge* internalCand = prev->getInternalFollowingEdge(next);
1704 prev = internalCand;
1708 routeOffset = (int)std::distance(edges.begin(), i);
1717 std::cout <<
" b failed - no best route lane" << std::endl;
1727 const std::vector<MSLane*>& lanes = (*lane)->getEdge().getLanes();
1728 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
1729 if ((*i)->getParameter(
"origId",
"") == origID) {
1739 std::cout <<
" b ok lane " << (*lane)->getID() <<
" lanePos:" << lanePos << std::endl;
1751 if (inputStorage.
readInt() != 2) {
1756 std::pair<const MSLane*, SUMOReal> roadPos;
1763 std::string roadID = inputStorage.
readString();
1766 pos = roadPos.first->getShape().positionAtOffset(roadPos.second);
1773 const double p1x = inputStorage.
readDouble();
1774 const double p1y = inputStorage.
readDouble();
1793 v->
getEdge(), &roadPos.first->getEdge());
1824 std::string newID = oType.
getID().find(
'@') == std::string::npos ? oType.
getID() +
"@" + veh->
getID() : oType.
getID();
1826 static_cast<MSVehicle*
>(veh)->replaceVehicleType(type);
1833 const std::map<std::string, std::vector<MSLane*> >&
1837 for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
1838 const std::vector<MSLane*>& lanes = (*i)->getLanes();
1839 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
1840 if ((*j)->knowsParameter(
"origId")) {
1841 std::string origID = (*j)->getParameter(
"origId",
"");
1843 gVTDMap[origID] = std::vector<MSLane*>();
1845 gVTDMap[origID].push_back(*j);
1850 gVTDMap[
"unknown"] = std::vector<MSLane*>();
static bool setVariable(const int cmd, const int variable, MSVehicleType &v, TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
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.
RGBColor color
The vehicle's color.
static bool commandDistanceRequest(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage, const MSVehicle *v)
Representation of a vehicle in the micro simulation.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
#define VAR_EMISSIONCLASS
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
#define REQUEST_DRIVINGDIST
void collectObjectsInRange(int domain, const PositionVector &shape, SUMOReal range, std::set< std::string > &into)
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, SUMOReal &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
#define RESPONSE_GET_VEHICLE_VARIABLE
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static MSVehicleType & getSingularType(SUMOVehicle *const veh)
#define CMD_GET_VEHICLE_VARIABLE
static std::map< std::string, std::vector< MSLane * > > gVTDMap
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, SUMOReal &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
void setTentativeLaneAndPosition(MSLane *lane, SUMOReal pos, SUMOReal posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc4: Change Vehicle State)
SUMOReal getDepartPos() const
Returns this vehicle's real departure position.
void setVTDControlled(MSVehicle *v, Position xyPos, MSLane *l, SUMOReal pos, SUMOReal posLat, SUMOReal angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static const MSLane * getLaneChecking(std::string roadID, int laneIndex, SUMOReal pos)
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
static bool vtdMap(const Position &pos, SUMOReal maxRouteDistance, const std::string &origID, const SUMOReal angle, MSVehicle &v, TraCIServer &server, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
bool readTypeCheckingColor(tcpip::Storage &inputStorage, RGBColor &into)
Reads the value type and a color, verifying the type.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
void setRespectJunctionPriority(bool value)
Sets whether junction priority rules shall be respected.
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
#define VAR_ALLOWED_SPEED
Tag for the last element in the enum for safe int casting.
static bool getVariable(const int variable, const MSVehicleType &v, tcpip::Storage &tempMsg)
Processes a value request for the given type.
virtual double readDouble()
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
Notification
Definition of a vehicle state.
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.
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
static bool getPosition(const std::string &id, Position &p)
Returns the named vehicle's position.
SUMOReal getWidth() const
Returns the lane's width.
bool reached
Information whether the stop has been reached.
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
SUMOReal arrivalPos
(optional) The position the vehicle shall arrive on
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const MSRoute & getRoute() const
Returns the current route.
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
bool hasDeparted() const
Returns whether this vehicle has already departed.
The vehicle got vaporized.
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
static std::pair< MSLane *, SUMOReal > convertCartesianToRoadMap(Position pos)
Definition of vehicle stop (position and duration)
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
std::vector< const MSEdge * > ConstMSEdgeVector
std::pair< const MSVehicle *const, SUMOReal > getLeader(SUMOReal dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
virtual void writeUnsignedByte(int)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
EdgeBasicFunction
Defines possible edge types.
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
Tag for the last element in the enum for safe int casting.
SUMOReal x() const
Returns the x-position.
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
#define VAR_SPEED_DEVIATION
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
#define VAR_NOISEEMISSION
#define VAR_FUELCONSUMPTION
#define UNUSED_PARAMETER(x)
void addEffort(const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value)
Adds an effort information for an edge and a time span.
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
virtual void writeInt(int)
#define WRITE_WARNING(msg)
The car-following model and parameter.
bool triggered
whether an arriving person lets the vehicle continue
SUMOReal distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector) ...
virtual int readUnsignedByte()
std::string toTaz
The vehicle's destination zone (district)
void addTravelTime(const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value)
Adds a travel time information for an edge and a time span.
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa4: Get Vehicle Variable)
SUMOReal nextOccupation
As occupation, but without the first lane.
SUMOReal getElectricityConsumption() const
Returns electricity consumption of the current state.
unsigned char blue() const
Returns the blue-amount of the color.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
MSLane * lane
The described lane.
#define VAR_PERSON_NUMBER
SUMOReal getLength() const
return the length of the edge
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
void setEmergencyBrakeRedLight(bool value)
Sets whether red lights shall be a reason to brake.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
void removeEffort(const MSEdge *const e)
Removes the effort information for an edge.
DepartLaneDefinition
Possible ways to choose a lane on depart.
Representation of a vehicle.
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
void setChosenSpeedFactor(const SUMOReal factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
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...
#define REMOVE_TELEPORT_ARRIVED
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.
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
assigns new values
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
int size() const
Returns the number of edges to pass.
unsigned char alpha() const
Returns the alpha-amount of the color.
virtual void writeByte(int)
ConstMSEdgeVector::const_iterator MSRouteIterator
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
SUMOReal z() const
Returns the z-position.
The vehicle arrived at its destination (is deleted)
bool isStopped() const
Returns whether the vehicle is at a stop.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, const MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
virtual void writeStringList(const std::vector< std::string > &s)
SUMOTime depart
The vehicle's departure time.
const ConstMSEdgeVector & getEdges() const
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime duration
The stopping duration.
#define CMD_SET_VEHICLE_VARIABLE
std::string fromTaz
The vehicle's origin zone (district)
virtual std::string readString()
#define CMD_GET_EDGE_VARIABLE
Tag for the last element in the enum for safe int casting.
A structure representing the best lanes for continuing the route.
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
#define CMD_REROUTE_EFFORT
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
TraCI server used to control sumo by a remote TraCI client.
const int VEHPARS_COLOR_SET
bool isInternal() const
return whether this edge is an internal edge
virtual void writeStorage(tcpip::Storage &store)
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
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.
int getRoutePosition() const
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, SUMOReal &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
int getPersonNumber() const
Returns the number of persons.
bool allowsContinuation
Whether this lane allows to continue the drive.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
static SUMOReal naviDegree(const SUMOReal angle)
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::string line
The vehicle's line (mainly for public transport)
#define INVALID_DOUBLE_VALUE
DepartSpeedDefinition
Possible ways to choose the departure speed.
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
void alreadyDeparted(SUMOVehicle *veh)
stops trying to emit the given vehicle (because it already departed)
static bool findCloserLane(const MSEdge *edge, const Position &pos, SUMOReal &bestDistance, MSLane **lane)
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat=0)
Inserts the given vehicle at the given position.
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, SUMOReal &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
#define VAR_EDGE_TRAVELTIME
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
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 {.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
virtual void writeString(const std::string &s)
void removeTravelTime(const MSEdge *const e)
Removes the travel time information for an edge.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Influencer & getInfluencer()
Returns the velocity/lane influencer.
void scheduleVehicleRemoval(SUMOVehicle *veh)
Removes a vehicle after it has ended.
Structure representing possible vehicle parameter.
#define INVALID_INT_VALUE
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
std::string toHex(const T i, std::streamsize numDigits=0)
bool containerTriggered
whether an arriving container lets the vehicle continue
void setConsiderMaxDeceleration(bool value)
Sets whether the maximum deceleration shall be regarded.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
int setParameter
Information for the router which parameter were set.
#define CMD_REROUTE_TRAVELTIME
std::vector< MSLane * > bestContinuations
Consecutive lane that can be followed without a lane change (contribute to length and occupation) ...
#define VAR_ELECTRICITYCONSUMPTION
SUMOReal y() const
Returns the y-position.
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
static SUMOReal getMinAngleDiff(SUMOReal angle1, SUMOReal angle2)
Returns the minimum distance (clockwise/counter-clockwise) between both angles.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
static SUMOReal gLateralResolution
void set(SUMOReal x, SUMOReal y)
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false, bool check=false)
Replaces the current route by the given edges.
MSRouteIterator edge
The edge in the route to stop at.
SUMOReal getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
bool addTraciBusOrContainerStop(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const bool isContainerStop, std::string &errorMsg)
const std::string & getID() const
Returns the name of the vehicle type.
SUMOReal getSpeed() const
Returns the vehicle's current speed.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
SUMOReal departPos
(optional) The position the vehicle shall depart from
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void setLaneChangeMode(int value)
Sets lane changing behavior.
SUMOReal getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
virtual void writeDouble(double)
const PositionVector & getShape() const
Returns this lane's shape.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
void move2side(SUMOReal amount)
move position vector to side using certain ammount
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
int getSignals() const
Returns the signals.
unsigned char green() const
Returns the green-amount of the color.
void switchOffSignal(int signal)
Switches the given signal off.
void switchOnSignal(int signal)
Switches the given signal on.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
const MSEdgeVector & getSuccessors() const
Returns the following edges.
#define VAR_SPEED_WITHOUT_TRACI
MSEdgeControl & getEdgeControl()
Returns the edge control.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
void reroute(SUMOTime t, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false)
Performs a rerouting using the given router.
#define VAR_LANECHANGE_MODE
int getSpeedMode() const
return the current speed mode
bool retrieveExistingEffort(const MSEdge *const e, const SUMOReal t, SUMOReal &value) const
Returns an effort for an edge and time if stored.
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
The vehicle was teleported out of the net.
The class responsible for building and deletion of vehicles.
std::vector< MSEdge * > MSEdgeVector
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
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)
MSLane * getLane() const
Returns the lane the vehicle is on.
The edge is an internal edge.
static const std::map< std::string, std::vector< MSLane * > > & getOrBuildVTDMap()
#define WRITE_MESSAGE(msg)
Tag for the last element in the enum for safe int casting.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, MTRand *rng=0)
Returns the named vehicle type or a sample from the named distribution.
DepartPosDefinition
Possible ways to choose the departure position.
unsigned char red() const
Returns the red-amount of the color.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
bool addTraciStop(MSLane *const lane, const SUMOReal startPos, const SUMOReal endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
SUMOReal startPos
The stopping position start.
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
Representation of a lane in the micro simulation.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
bool retrieveExistingTravelTime(const MSEdge *const e, const SUMOReal t, SUMOReal &value) const
Returns a travel time for an edge and time if stored.
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
virtual const std::string & getID() const =0
Get the vehicle's ID.
DepartDefinition
Possible ways to depart.
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
bool readTypeCheckingByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and a byte, verifying the type.
void setConsiderMaxAcceleration(bool value)
Sets whether the maximum acceleration shall be regarded.
static const SUMOReal INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string id
The vehicle's id.
bool parking
whether the vehicle is removed from the net while stopping
The vehicle is being teleported.
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
const MSEdgeVector & getEdges() const
Returns loaded edges.
const std::string & getID() const
Returns the name of the vehicle.
static bool vtdMap_matchingRoutePosition(const Position &pos, const std::string &origID, MSVehicle &v, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.