261 if (inputStorage.
readInt() != 2) {
283 if (inputStorage.
readInt() != 2) {
320 tempContent.
writeInt((
int) bestLanes.size());
322 for (std::vector<TraCI_Vehicle::BestLanesData>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
350 const int cnt = 1 + (int)nextTLS.size() * 4;
353 tempMsg.
writeInt((
int)nextTLS.size());
354 for (std::vector<TraCI_Vehicle::NextTLSData>::iterator it = nextTLS.begin(); it != nextTLS.end(); ++it) {
378 if (inputStorage.
readInt() != 2) {
390 std::string roadID = inputStorage.
readString();
455 std::string paramName =
"";
480 std::string warning =
"";
510 std::cout <<
SIMTIME <<
" processSet veh=" <<
id <<
"\n";
512 const bool shouldExist = variable !=
ADD && variable !=
ADD_FULL;
514 if (sumoVehicle == 0) {
520 if (v == 0 && shouldExist) {
523 const bool onInit = v == 0 || v->
getLane() == 0;
530 int compoundSize = inputStorage.
readInt();
531 if (compoundSize < 4 || compoundSize > 7) {
553 if (compoundSize >= 5) {
559 if (compoundSize >= 6) {
569 if (compoundSize >= 7) {
582 if (inputStorage.
readInt() != 0) {
593 if (inputStorage.
readInt() != 2) {
606 if ((laneIndex < 0) || (laneIndex >= (
int)(v->
getEdge()->
getLanes().size()))) {
610 std::vector<std::pair<SUMOTime, int> > laneTimeLine;
611 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
612 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex));
660 if (inputStorage.
readInt() != 2) {
677 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
679 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + duration, newSpeed));
715 if (vehicleType == 0) {
744 std::vector<std::string> edgeIDs;
759 int parameterCount = inputStorage.
readInt();
760 if (parameterCount == 4) {
762 int begTime = 0, endTime = 0;
786 }
else if (parameterCount == 2) {
806 }
else if (parameterCount == 1) {
829 int parameterCount = inputStorage.
readInt();
830 if (parameterCount == 4) {
832 int begTime = 0, endTime = 0;
856 }
else if (parameterCount == 2) {
876 }
else if (parameterCount == 1) {
899 if (inputStorage.
readInt() != 0) {
909 if (inputStorage.
readInt() != 0) {
934 if (inputStorage.
readInt() != 2) {
953 if (!v->
willPass(&destinationEdge)) {
962 while (v->
getEdge() != &destinationEdge) {
982 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
984 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), speed));
999 int laneChangeMode = 0;
1022 if (inputStorage.
readInt() != 6) {
1026 vehicleParams.
id = id;
1028 std::string vTypeID;
1037 std::string routeID;
1050 const int proc = -depart;
1058 WRITE_WARNING(
"Departure time for vehicle '" +
id +
"' is in the past; using current time instead.");
1060 vehicleParams.
depart = depart;
1069 const int proc =
static_cast<int>(-vehicleParams.
departPos);
1084 const int proc =
static_cast<int>(-vehicleParams.
departSpeed);
1098 const int proc =
static_cast<int>(-vehicleParams.
departLane);
1124 if (inputStorage.
readInt() != 14) {
1128 vehicleParams.
id = id;
1130 std::string routeID;
1139 std::string vTypeID;
1272 const int numArgs = inputStorage.
readInt();
1273 if (numArgs != 5 && numArgs != 6) {
1289 double origAngle = 0;
1301 bool keepRoute = v->
getID() !=
"VTD_EGO";
1302 bool mayLeaveNetwork =
false;
1308 keepRoute = (keepRouteFlag == 1);
1309 mayLeaveNetwork = (keepRouteFlag == 2);
1312 const std::string origID = edgeID +
"_" +
toString(laneNum);
1315 double angle = origAngle;
1319 while (angle >= 360.) {
1322 while (angle < 0.) {
1330 std::cout <<
" want pos:" << pos <<
" origID:" << origID <<
" laneNum:" << laneNum <<
" origAngle:" << origAngle <<
" angle:" << angle <<
" keepRoute:" << keepRoute << std::endl;
1336 double lanePosLat = 0;
1338 int routeOffset = 0;
1340 double maxRouteDistance = 100;
1349 found =
vtdMap(pos, maxRouteDistance, origID, angle, *v, server, bestDistance, &lane, lanePos, routeOffset, edges);
1351 if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) {
1356 lanePosLat = perpDist;
1357 if (!mayLeaveNetwork) {
1365 lanePosLat = -lanePosLat;
1369 assert((found && lane != 0) || (!found && lane == 0));
1410 std::vector<std::string> edgeIDs;
1472 std::set<std::string> into;
1474 shape.push_back(pos);
1477 std::map<MSLane*, LaneUtility> lane2utility;
1479 for (std::set<std::string>::const_iterator j = into.begin(); j != into.end(); ++j) {
1481 const MSEdge* prevEdge = 0;
1482 const MSEdge* nextEdge = 0;
1484 bool onRoute =
false;
1488 #ifdef DEBUG_MOVEXY_ANGLE 1489 std::cout <<
"Ego on normal" << std::endl;
1500 ConstMSEdgeVector::const_iterator edgePos = std::find(ev.begin() + routePosition, ev.end(), e);
1501 onRoute = edgePos != ev.end();
1502 if (edgePos == ev.end() - 1 && v.
getEdge() == e) {
1508 nextEdge = !onRoute || edgePos == ev.end() - 1 ? 0 : *(edgePos + 1);
1509 #ifdef DEBUG_MOVEXY_ANGLE 1510 std::cout <<
"normal:" << e->
getID() <<
" prev:" << prevEdge->
getID() <<
" next:";
1511 if (nextEdge != 0) {
1512 std::cout << nextEdge->
getID();
1514 std::cout << std::endl;
1517 #ifdef DEBUG_MOVEXY_ANGLE 1518 std::cout <<
"Ego on internal" << std::endl;
1526 prevEdge = l == 0 ? 0 : &l->
getEdge();
1530 ConstMSEdgeVector::const_iterator prevEdgePos = std::find(ev.begin() + v.
getRoutePosition(), ev.end(), prevEdge);
1535 if (prevEdgePos != ev.end() && (prevEdgePos + 1) != ev.end()) {
1536 onRoute = *(prevEdgePos + 1) == nextEdge;
1538 #ifdef DEBUG_MOVEXY_ANGLE 1539 std::cout <<
"internal:" << e->
getID() <<
" prev:" << prevEdge->
getID() <<
" next:" << nextEdge->getID() << std::endl;
1545 const std::vector<MSLane*>& lanes = e->
getLanes();
1546 const bool perpendicular =
false;
1547 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end(); ++k) {
1550 double langle = 180.;
1551 double dist = 1000.;
1565 #ifdef DEBUG_MOVEXY_ANGLE 1566 std::cout << lane->
getID() <<
" lAngle:" << langle <<
" lLength=" << lane->
getLength()
1567 <<
" angleDiff:" << angleDiff
1568 <<
" off:" << off <<
" dist=" << dist <<
"\n";
1574 onRoute, sameEdge, prevEdge, nextEdge);
1582 double bestValue = 0;
1584 for (std::map<MSLane*, LaneUtility>::iterator i = lane2utility.begin(); i != lane2utility.end(); ++i) {
1587 double distN = u.
dist > 999 ? -10 : 1. - (u.
dist / maxDist);
1588 double angleDiffN = 1. - (u.
angleDiff / 180.);
1589 double idN = u.
ID ? 1 : 0;
1590 double onRouteN = u.
onRoute ? 1 : 0;
1592 double value = (distN * .5
1598 std::cout <<
" x; l:" << l->
getID() <<
" d:" << u.
dist <<
" dN:" << distN <<
" aD:" << angleDiffN <<
1599 " ID:" << idN <<
" oRN:" << onRouteN <<
" sEN:" << sameEdgeN <<
" value:" << value << std::endl;
1601 if (value > bestValue || bestLane == 0) {
1607 if (bestLane == 0) {
1610 const LaneUtility& u = lane2utility.find(bestLane)->second;
1611 bestDistance = u.
dist;
1617 ConstMSEdgeVector::const_iterator prevEdgePos = std::find(ev.begin(), ev.end(), prevEdge);
1618 routeOffset = (int)std::distance(ev.begin(), prevEdgePos);
1631 #ifdef DEBUG_MOVEXY_ANGLE 1644 const std::vector<MSLane*>& lanes = edge->
getLanes();
1645 bool newBest =
false;
1646 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end() && bestDistance >
POSITION_EPS; ++k) {
1647 MSLane* candidateLane = *k;
1650 std::cout <<
" b at lane " << candidateLane->
getID() <<
" dist:" << dist <<
" best:" << bestDistance << std::endl;
1652 if (dist < bestDistance) {
1654 bestDistance = dist;
1655 *lane = candidateLane;
1674 for (ConstMSEdgeVector::const_iterator i = v.
getCurrentRouteEdge(); i != edges.end(); ++i) {
1679 prev = internalCand;
1682 routeOffset = (int)std::distance(edges.begin(), i);
1689 for (ConstMSEdgeVector::const_iterator i = v.
getCurrentRouteEdge(); i != edges.begin(); --i) {
1695 prev = internalCand;
1698 routeOffset = (int)std::distance(edges.begin(), i);
1707 std::cout <<
" b failed - no best route lane" << std::endl;
1716 const std::vector<MSLane*>& lanes = (*lane)->getEdge().getLanes();
1717 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
1726 (*lane)->interpolateGeometryPosToLanePos(
1727 (*lane)->getShape().nearest_offset_to_point2D(pos,
false))));
1730 std::cout <<
" b ok lane " << (*lane)->getID() <<
" lanePos:" << lanePos << std::endl;
1752 std::string newID = oType.
getID().find(
'@') == std::string::npos ? oType.
getID() +
"@" + veh->
getID() : oType.
getID();
1754 static_cast<MSVehicle*
>(veh)->replaceVehicleType(type);
static double getMinAngleDiff(double angle1, double angle2)
Returns the minimum distance (clockwise/counter-clockwise) between both angles.
int getRoutePosition() const
static double gLateralResolution
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
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.
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.
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
#define VAR_EMISSIONCLASS
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
#define REQUEST_DRIVINGDIST
static int getPersonNumber(const std::string &vehicleID)
const ConstMSEdgeVector & getEdges() const
#define RESPONSE_GET_VEHICLE_VARIABLE
static MSVehicleType & getSingularType(SUMOVehicle *const veh)
#define CMD_GET_VEHICLE_VARIABLE
static std::map< std::string, std::vector< MSLane * > > gVTDMap
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) ...
double nextOccupation
The traffic density along length.
bool hasDeparted() const
Returns whether this vehicle has already departed.
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)
MSLane * getLane() const
Returns the lane the vehicle is on.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
static std::string getLaneID(const std::string &vehicleID)
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
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
double getPositionOnLane() const
Get the vehicle's position along the lane.
Tag for the last element in the enum for safe int casting.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
virtual double readDouble()
int bestLaneOffset
The offset of this lane from the best lane.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
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
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 knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
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.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
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.
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
double getLength() const
Returns the lane's length.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
const PositionVector & getShape() const
Returns this lane's shape.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
const MSRoute & getRoute() const
Returns the current route.
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...
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
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.
std::string laneID
The id of the lane.
static int getRouteIndex(const std::string &vehicleID)
const std::string & getID() const
Returns the id.
virtual void writeUnsignedByte(int)
static std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction)
EdgeBasicFunction
Defines possible edge types.
double getLength() const
return the length of the edge
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()
#define VAR_SPEED_DEVIATION
#define VAR_NOISEEMISSION
#define VAR_FUELCONSUMPTION
double getWidth() const
Returns the lane's width.
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::vector< BestLanesData > getBestLanes(const std::string &vehicleID)
static std::string getLine(const std::string &vehicleID)
static TraCIPosition getPosition(const std::string &vehicleID)
double departSpeed
(optional) The initial speed of the vehicle
A road/street connecting two junctions.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
static MSVehicleType * buildSingularType(const std::string &id, const MSVehicleType *from)
Duplicates the microsim vehicle type giving it a the given id.
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
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
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
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)
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)
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.
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.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
#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
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
bool allowsContinuation
Whether this lane allows continuing the route.
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)
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
virtual void writeStorage(tcpip::Storage &store)
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
void move2side(double amount)
move position vector to side using certain ammount
double length
The length than can be driven from that lane without lane change.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::string line
The vehicle's line (mainly for public transport)
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal) const
#define INVALID_DOUBLE_VALUE
double arrivalPos
(optional) The position the vehicle shall arrive on
static double getHCEmission(const std::string &vehicleID)
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)
std::vector< std::string > via
List of the via-edges the vehicle must visit.
static std::string getParameter(const std::string &vehicleID, const std::string &key)
static double getSlope(const std::string &vehicleID)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
#define VAR_EDGE_TRAVELTIME
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
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.
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
void collectObjectsInRange(int domain, const PositionVector &shape, double range, std::set< std::string > &into)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
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 MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
const std::string & getID() const
Returns the name of the vehicle type.
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.
const std::string SUMO_PARAM_ORIGID
const MSEdgeVector & getSuccessors() const
Returns the following edges.
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.
static bool vtdMap(const Position &pos, double maxRouteDistance, const std::string &origID, const double angle, MSVehicle &v, TraCIServer &server, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
void setLaneChangeMode(int value)
Sets lane changing behavior.
virtual void writeDouble(double)
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
void setSignals(int signals)
static double getDrivingDistance(const std::string &vehicleID, const std::string &edgeID, double position, int laneIndex)
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
static double getLateralLanePosition(const std::string &vehicleID)
static int getSpeedMode(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_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.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
The vehicle was teleported out of the net.
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
static void resume(const std::string &vehicleID)
double getSpeed() const
Returns the vehicle's current speed.
static double getSpeed(const std::string &vehicleID)
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
The edge is an internal edge.
Tag for the last element in the enum for safe int casting.
static double getLanePosition(const std::string &vehicleID)
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.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static bool findCloserLane(const MSEdge *edge, const Position &pos, double &bestDistance, MSLane **lane)
const std::string & getID() const
Returns the name of the vehicle.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Representation of a lane in the micro simulation.
static std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist)
static std::vector< NextTLSData > getNextTLS(const std::string &vehicleID)
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.
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.
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)
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
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.