60 #define FAR_AWAY 1000.0 272 if (inputStorage.
readInt() != 2) {
294 if (inputStorage.
readInt() != 2) {
331 tempContent.
writeInt((
int) bestLanes.size());
333 for (std::vector<TraCIBestLanesData>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
361 const int cnt = 1 + (int)nextTLS.size() * 4;
364 tempMsg.
writeInt((
int)nextTLS.size());
365 for (std::vector<TraCINextTLSData>::iterator it = nextTLS.begin(); it != nextTLS.end(); ++it) {
389 if (inputStorage.
readInt() != 2) {
401 std::string roadID = inputStorage.
readString();
474 std::string paramName =
"";
499 std::string warning =
"";
531 std::cout <<
SIMTIME <<
" processSet veh=" <<
id <<
"\n";
533 const bool shouldExist = variable !=
ADD && variable !=
ADD_FULL;
535 if (sumoVehicle == 0) {
541 if (v == 0 && shouldExist) {
544 const bool onInit = v == 0 || v->
getLane() == 0;
551 int compoundSize = inputStorage.
readInt();
552 if (compoundSize < 4 || compoundSize > 7) {
574 if (compoundSize >= 5) {
580 if (compoundSize >= 6) {
590 if (compoundSize >= 7) {
603 if (inputStorage.
readInt() != 0) {
614 if (inputStorage.
readInt() != 2) {
627 if ((laneIndex < 0) || (laneIndex >= (
int)(v->
getEdge()->
getLanes().size()))) {
631 std::vector<std::pair<SUMOTime, int> > laneTimeLine;
632 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
633 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex));
681 if (inputStorage.
readInt() != 2) {
698 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
700 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + duration, newSpeed));
736 if (vehicleType == 0) {
765 std::vector<std::string> edgeIDs;
784 int parameterCount = inputStorage.
readInt();
785 if (parameterCount == 4) {
787 int begTime = 0, endTime = 0;
811 }
else if (parameterCount == 2) {
831 }
else if (parameterCount == 1) {
854 int parameterCount = inputStorage.
readInt();
855 if (parameterCount == 4) {
857 int begTime = 0, endTime = 0;
881 }
else if (parameterCount == 2) {
901 }
else if (parameterCount == 1) {
924 if (inputStorage.
readInt() != 0) {
934 if (inputStorage.
readInt() != 0) {
959 if (inputStorage.
readInt() != 2) {
978 if (!v->
willPass(&destinationEdge)) {
987 while (v->
getEdge() != &destinationEdge) {
1008 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
1010 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), speed));
1025 int laneChangeMode = 0;
1033 int routingMode = 0;
1056 if (inputStorage.
readInt() != 6) {
1060 vehicleParams.
id = id;
1062 std::string vTypeID;
1071 std::string routeID;
1084 const int proc = -depart;
1092 WRITE_WARNING(
"Departure time for vehicle '" +
id +
"' is in the past; using current time instead.");
1094 vehicleParams.
depart = depart;
1103 const int proc =
static_cast<int>(-vehicleParams.
departPos);
1118 const int proc =
static_cast<int>(-vehicleParams.
departSpeed);
1132 const int proc =
static_cast<int>(-vehicleParams.
departLane);
1158 if (inputStorage.
readInt() != 14) {
1162 vehicleParams.
id = id;
1164 std::string routeID;
1173 std::string vTypeID;
1306 const int numArgs = inputStorage.
readInt();
1307 if (numArgs != 5 && numArgs != 6) {
1323 double origAngle = 0;
1335 bool keepRoute = v->
getID() !=
"VTD_EGO";
1336 bool mayLeaveNetwork =
false;
1342 keepRoute = (keepRouteFlag == 1);
1343 mayLeaveNetwork = (keepRouteFlag == 2);
1346 const std::string origID = edgeID +
"_" +
toString(laneNum);
1349 double angle = origAngle;
1353 while (angle >= 360.) {
1356 while (angle < 0.) {
1364 std::cout <<
" want pos:" << pos <<
" origID:" << origID <<
" laneNum:" << laneNum <<
" origAngle:" << origAngle <<
" angle:" << angle <<
" keepRoute:" << keepRoute << std::endl;
1370 double lanePosLat = 0;
1372 int routeOffset = 0;
1374 double maxRouteDistance = 100;
1383 found =
vtdMap(pos, maxRouteDistance, mayLeaveNetwork, origID, angle, *v, server, bestDistance, &lane, lanePos, routeOffset, edges);
1385 if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) {
1390 lanePosLat = perpDist;
1391 if (!mayLeaveNetwork) {
1399 WRITE_WARNING(
"Could not determine position on lane '" + lane->
getID() +
" at lateral position " +
toString(-lanePosLat) +
".");
1403 lanePosLat = -lanePosLat;
1411 assert((found && lane != 0) || (!found && lane == 0));
1452 std::vector<std::string> edgeIDs;
1514 std::set<std::string> into;
1516 shape.push_back(pos);
1519 std::map<MSLane*, LaneUtility> lane2utility;
1521 for (std::set<std::string>::const_iterator j = into.begin(); j != into.end(); ++j) {
1523 const MSEdge* prevEdge = 0;
1524 const MSEdge* nextEdge = 0;
1525 bool onRoute =
false;
1529 #ifdef DEBUG_MOVEXY_ANGLE 1530 std::cout <<
"Ego on normal" << std::endl;
1541 ConstMSEdgeVector::const_iterator edgePos = std::find(ev.begin() + routePosition, ev.end(), e);
1542 onRoute = edgePos != ev.end();
1543 if (edgePos == ev.end() - 1 && v.
getEdge() == e) {
1549 nextEdge = !onRoute || edgePos == ev.end() - 1 ? 0 : *(edgePos + 1);
1550 #ifdef DEBUG_MOVEXY_ANGLE 1551 std::cout <<
"normal:" << e->
getID() <<
" prev:" << prevEdge->
getID() <<
" next:";
1552 if (nextEdge != 0) {
1553 std::cout << nextEdge->
getID();
1555 std::cout << std::endl;
1558 #ifdef DEBUG_MOVEXY_ANGLE 1559 std::cout <<
"Ego on internal" << std::endl;
1564 while (prevEdge != 0 && prevEdge->
isInternal()) {
1567 prevEdge = l == 0 ? 0 : &l->
getEdge();
1571 ConstMSEdgeVector::const_iterator prevEdgePos = std::find(ev.begin() + v.
getRoutePosition(), ev.end(), prevEdge);
1573 while (nextEdge != 0 && nextEdge->isInternal()) {
1576 if (prevEdgePos != ev.end() && (prevEdgePos + 1) != ev.end()) {
1577 onRoute = *(prevEdgePos + 1) == nextEdge;
1579 #ifdef DEBUG_MOVEXY_ANGLE 1580 std::cout <<
"internal:" << e->
getID() <<
" prev:" << prevEdge->
getID() <<
" next:" << nextEdge->getID() << std::endl;
1586 const std::vector<MSLane*>& lanes = e->
getLanes();
1587 const bool perpendicular =
false;
1588 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end(); ++k) {
1590 double langle = 180.;
1592 double perpendicularDist =
FAR_AWAY;
1610 double dist2 = dist;
1611 if (mayLeaveNetwork && dist != perpendicularDist) {
1616 #ifdef DEBUG_MOVEXY_ANGLE 1617 std::cout << lane->
getID() <<
" lAngle:" << langle <<
" lLength=" << lane->
getLength()
1618 <<
" angleDiff:" << angleDiff
1620 <<
" pDist=" << perpendicularDist
1622 <<
" dist2=" << dist2
1627 dist2, perpendicularDist, off, angleDiff,
1629 onRoute, sameEdge, prevEdge, nextEdge);
1637 double bestValue = 0;
1639 for (std::map<MSLane*, LaneUtility>::iterator i = lane2utility.begin(); i != lane2utility.end(); ++i) {
1642 double distN = u.
dist > 999 ? -10 : 1. - (u.
dist / maxDist);
1643 double angleDiffN = 1. - (u.
angleDiff / 180.);
1644 double idN = u.
ID ? 1 : 0;
1645 double onRouteN = u.
onRoute ? 1 : 0;
1647 double value = (distN * .5
1653 std::cout <<
" x; l:" << l->
getID() <<
" d:" << u.
dist <<
" dN:" << distN <<
" aD:" << angleDiffN <<
1654 " ID:" << idN <<
" oRN:" << onRouteN <<
" sEN:" << sameEdgeN <<
" value:" << value << std::endl;
1656 if (value > bestValue || bestLane == 0) {
1666 if (bestLane == 0) {
1669 const LaneUtility& u = lane2utility.find(bestLane)->second;
1670 bestDistance = u.
dist;
1676 ConstMSEdgeVector::const_iterator prevEdgePos = std::find(ev.begin(), ev.end(), prevEdge);
1677 routeOffset = (int)std::distance(ev.begin(), prevEdgePos);
1690 #ifdef DEBUG_MOVEXY_ANGLE 1703 const std::vector<MSLane*>& lanes = edge->
getLanes();
1704 bool newBest =
false;
1705 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end() && bestDistance >
POSITION_EPS; ++k) {
1706 MSLane* candidateLane = *k;
1709 std::cout <<
" b at lane " << candidateLane->
getID() <<
" dist:" << dist <<
" best:" << bestDistance << std::endl;
1711 if (dist < bestDistance) {
1713 bestDistance = dist;
1714 *lane = candidateLane;
1733 for (ConstMSEdgeVector::const_iterator i = v.
getCurrentRouteEdge(); i != edges.end(); ++i) {
1738 prev = internalCand;
1741 routeOffset = (int)std::distance(edges.begin(), i);
1748 for (ConstMSEdgeVector::const_iterator i = v.
getCurrentRouteEdge(); i != edges.begin(); --i) {
1754 prev = internalCand;
1757 routeOffset = (int)std::distance(edges.begin(), i);
1766 std::cout <<
" b failed - no best route lane" << std::endl;
1774 if (!(*lane)->getEdge().isInternal()) {
1775 const std::vector<MSLane*>& lanes = (*lane)->getEdge().getLanes();
1776 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
1785 (*lane)->interpolateGeometryPosToLanePos(
1786 (*lane)->getShape().nearest_offset_to_point2D(pos,
false))));
1789 std::cout <<
" b ok lane " << (*lane)->getID() <<
" lanePos:" << lanePos << std::endl;
static double getMinAngleDiff(double angle1, double angle2)
Returns the minimum distance (clockwise/counter-clockwise) between both angles.
double getLength() const
return the length of the edge
static double gLateralResolution
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, TraCI may change this.
bool readTypeCheckingColor(tcpip::Storage &inputStorage, TraCIColor &into)
Reads the value type and a color, verifying the type.
double getWidth() const
Returns the lane's width.
Representation of a vehicle in the micro simulation.
#define VAR_EMISSIONCLASS
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
#define REQUEST_DRIVINGDIST
static int getPersonNumber(const std::string &vehicleID)
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
bool allowsContinuation
Whether this lane allows continuing the route.
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal) const
#define RESPONSE_GET_VEHICLE_VARIABLE
#define CMD_GET_VEHICLE_VARIABLE
static std::map< std::string, std::vector< MSLane * > > gVTDMap
#define VAR_ACCUMULATED_WAITING_TIME
static std::vector< TraCINextTLSData > getNextTLS(const std::string &vehicleID)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc4: Change Vehicle State)
static TraCIColor getColor(const std::string &vehicleID)
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
static std::string getLaneID(const std::string &vehicleID)
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static double getAccumulatedWaitingTime(const std::string &vehicleID)
static double getPMxEmission(const std::string &vehicleID)
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
static double getAllowedSpeed(const std::string &vehicleID)
#define VAR_ALLOWED_SPEED
static double getDistance(const std::string &vehicleID)
const double SUMO_const_laneWidth
Tag for the last element in the enum for safe int casting.
virtual double readDouble()
static double getNOxEmission(const std::string &vehicleID)
static std::vector< std::string > getVia(const std::string &vehicleID)
static double getWaitingTime(const std::string &vehicleID)
Notification
Definition of a vehicle state.
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
#define CMD_CHANGESUBLANE
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
double 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) ...
static bool getPosition(const std::string &id, Position &p)
Returns the named vehicle's position.
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
double getLength() const
Returns the lane's length.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0, bool addStops=true)
Replaces the current route by the given one.
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...
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
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.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
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...
double getPositionOnLane() const
Get the vehicle's position along the lane.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
static void setParameter(const std::string &vehicleID, const std::string &key, const std::string &value)
std::vector< const MSEdge * > ConstMSEdgeVector
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
static int getRouteIndex(const std::string &vehicleID)
virtual void writeUnsignedByte(int)
static std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction)
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.
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
static std::string getRouteID(const std::string &vehicleID)
Tag for the last element in the enum for safe int casting.
static bool getVariable(const int variable, const std::string &v, tcpip::Storage &tempMsg)
Processes a value request for the given type.
static std::vector< std::string > getIDList()
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
#define VAR_SPEED_DEVIATION
#define VAR_NOISEEMISSION
#define VAR_FUELCONSUMPTION
static double getCO2Emission(const std::string &vehicleID)
#define UNUSED_PARAMETER(x)
static int getStopState(const std::string &vehicleID)
virtual void writeInt(int)
#define WRITE_WARNING(msg)
static double getSpeedWithoutTraCI(const std::string &vehicleID)
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false, bool check=false, bool addStops=true)
Replaces the current route by the given edges.
The car-following model and parameter.
virtual int readUnsignedByte()
std::string toTaz
The vehicle's destination zone (district)
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa4: Get Vehicle Variable)
static std::string getLine(const std::string &vehicleID)
static TraCIPosition getPosition(const std::string &vehicleID)
double departSpeed
(optional) The initial speed of the vehicle
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
static double getAdaptedTraveltime(const std::string &vehicleID, const std::string &edgeID, int time)
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
static double naviDegree(const double angle)
#define VAR_PERSON_NUMBER
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
static double getNoiseEmission(const std::string &vehicleID)
void removeEffort(const MSEdge *const e)
Removes the effort information for an edge.
void setSublaneChange(double latDist)
Sets a new sublane-change request.
DepartLaneDefinition
Possible ways to choose a lane on depart.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static double getFuelConsumption(const std::string &vehicleID)
Representation of a vehicle.
static double getDrivingDistance2D(const std::string &vehicleID, double x, double y)
static bool isRouteValid(const std::string &vehicleID)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
#define REMOVE_TELEPORT_ARRIVED
static double getElectricityConsumption(const std::string &vehicleID)
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.
static int getRoutingMode(const std::string &vehicleID)
virtual void writeByte(int)
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
void setVTDControlled(MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
static double getAngle(const std::string &vehicleID)
#define VAR_EMERGENCY_DECEL
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
static int getSignalStates(const std::string &vehicleID)
static bool vtdMap_matchingRoutePosition(const Position &pos, const std::string &origID, MSVehicle &v, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
The vehicle arrived at its destination (is deleted)
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
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
#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.
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
void setChosenSpeedFactor(const double factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
static void setStop(const std::string &vehicleID, const std::string &edgeID, double endPos=1., int laneIndex=0, SUMOTime duration=4294967295u, int flags=STOP_DEFAULT, double startPos=INVALID_DOUBLE_VALUE, SUMOTime until=-1)
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
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) ...
int getRoutePosition() const
void move2side(double amount)
move position vector to side using certain ammount
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
double arrivalPos
(optional) The position the vehicle shall arrive on
static double getHCEmission(const std::string &vehicleID)
void setRoutingMode(int value)
Sets routing behavior.
DepartSpeedDefinition
Possible ways to choose the departure speed.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
void alreadyDeparted(SUMOVehicle *veh)
stops trying to emit the given vehicle (because it already departed)
static double getCOEmission(const std::string &vehicleID)
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=0)
Returns the named vehicle type or a sample from the named distribution.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
std::vector< std::string > via
List of the via-edges the vehicle must visit.
static bool vtdMap(const Position &pos, double maxRouteDistance, bool mayLeaveNetwork, const std::string &origID, const double angle, MSVehicle &v, TraCIServer &server, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
static std::string getParameter(const std::string &vehicleID, const std::string &key)
static double getSlope(const std::string &vehicleID)
#define VAR_EDGE_TRAVELTIME
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
double departPos
(optional) The position the vehicle shall depart from
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
static bool setVariable(const int cmd, const int variable, const std::string &id, TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
virtual void writeString(const std::string &s)
void removeTravelTime(const MSEdge *const e)
Removes the travel time information for an edge.
The vehicle has departed (was inserted into the network)
Influencer & getInfluencer()
Returns the velocity/lane influencer.
void scheduleVehicleRemoval(SUMOVehicle *veh)
Removes a vehicle after it has ended.
Structure representing possible vehicle parameter.
#define VAR_LANEPOSITION_LAT
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
void collectObjectsInRange(int domain, const PositionVector &shape, double range, std::set< std::string > &into)
std::string laneID
The id of the lane.
std::string toHex(const T i, std::streamsize numDigits=0)
void setTentativeLaneAndPosition(MSLane *lane, double pos, double posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
MSInsertionControl & getInsertionControl()
Returns the insertion control.
int setParameter
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
#define CMD_REROUTE_TRAVELTIME
static const MSVehicleType & getVehicleType(const std::string &vehicleID)
static double getSpeedFactor(const std::string &vehicleID)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
#define VAR_ELECTRICITYCONSUMPTION
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
double length
The length than can be driven from that lane without lane change.
int bestLaneOffset
The offset of this lane from the best lane.
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
double occupation
The traffic density along length.
const std::string SUMO_PARAM_ORIGID
const std::string & getID() const
Returns the name of the vehicle type.
static std::string getRoadID(const std::string &vehicleID)
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void setLaneChangeMode(int value)
Sets lane changing behavior.
virtual void writeDouble(double)
void setSignals(int signals)
static double getDrivingDistance(const std::string &vehicleID, const std::string &edgeID, double position, int laneIndex)
const PositionVector & getShape() const
Returns this lane's shape.
static double getLateralLanePosition(const std::string &vehicleID)
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.
static int getSpeedMode(const std::string &vehicleID)
static int getLanechangeMode(const std::string &vehicleID)
void switchOffSignal(int signal)
Switches the given signal off.
void switchOnSignal(int signal)
Switches the given signal on.
static std::string getTypeID(const std::string &vehicleID)
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
static int getLaneIndex(const std::string &vehicleID)
#define VAR_APPARENT_DECEL
const MSEdgeVector & getSuccessors() const
Returns the following edges.
#define VAR_SPEED_WITHOUT_TRACI
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
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
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.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
static void resume(const std::string &vehicleID)
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
static double getSpeed(const std::string &vehicleID)
MSLane * getLane() const
Returns the lane the vehicle is on.
Tag for the last element in the enum for safe int casting.
static double getLanePosition(const std::string &vehicleID)
DepartPosDefinition
Possible ways to choose the departure position.
static bool findCloserLane(const MSEdge *edge, const Position &pos, double &bestDistance, MSLane **lane)
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Representation of a lane in the micro simulation.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
static std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist)
static std::vector< std::string > getEdges(const std::string &vehicleID)
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.
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.
static std::vector< TraCIBestLanesData > getBestLanes(const std::string &vehicleID)
bool readTypeCheckingByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and a byte, verifying the type.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string id
The vehicle's id.
The vehicle is being teleported.
static double getEffort(const std::string &vehicleID, const std::string &edgeID, int time)
const std::string & getID() const
Returns the name of the vehicle.
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
double getSpeed() const
Returns the vehicle's current speed.
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.