57 #ifdef CHECK_MEMORY_LEAKS
59 #endif // CHECK_MEMORY_LEAKS
108 std::vector<std::string> ids;
111 if ((*i).second->isOnRoad()) {
112 ids.push_back((*i).first);
124 if (sumoVehicle == 0) {
168 tempMsg.
writeInt((
int)std::distance(lanes.begin(), std::find(lanes.begin(), lanes.end(), v->
getLane())));
229 std::pair<const MSVehicle* const, SUMOReal> leaderInfo = v->
getLeader(dist);
233 tempMsg.
writeString(leaderInfo.first != 0 ? leaderInfo.first->getID() :
"");
246 if (inputStorage.
readInt() != 2) {
278 if (inputStorage.
readInt() != 2) {
328 unsigned int cnt = 0;
330 const std::vector<MSVehicle::LaneQ>& bestLanes = onRoad ? v->
getBestLanes() : std::vector<MSVehicle::LaneQ>();
331 tempContent.
writeInt((
int) bestLanes.size());
333 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
350 std::vector<std::string> bestContIDs;
352 bestContIDs.push_back((*j)->getID());
407 std::string warning =
"";
429 const bool shouldExist = variable !=
ADD && variable !=
ADD_FULL;
431 if (sumoVehicle == 0) {
437 if (v == 0 && shouldExist) {
445 int compoundSize = inputStorage.
readInt();
446 if (compoundSize != 4 && compoundSize != 5) {
468 bool parking =
false;
469 bool triggered =
false;
470 if (compoundSize == 5) {
475 parking = ((stopFlags & 1) != 0);
476 triggered = ((stopFlags & 2) != 0);
487 const std::vector<MSLane*>& allLanes = road->
getLanes();
488 if ((laneIndex < 0) || laneIndex >= (
int)(allLanes.size())) {
492 if (!v->
addTraciStop(allLanes[laneIndex], pos, 0, waitTime, parking, triggered)) {
502 if (inputStorage.
readInt() != 0) {
506 if (!static_cast<MSVehicle*>(v)->hasStops()) {
510 if (!static_cast<MSVehicle*>(v)->resumeFromStopping()) {
512 std::ostringstream strs;
513 strs <<
"reached: " << sto.
reached;
514 strs <<
", duration:" << sto.
duration;
515 strs <<
", edge:" << (*sto.
edge)->getID();
516 strs <<
", startPos: " << sto.
startPos;
517 std::string posStr = strs.str();
527 if (inputStorage.
readInt() != 2) {
540 if ((laneIndex < 0) || (laneIndex >= (
int)(v->
getEdge()->
getLanes().size()))) {
544 std::vector<std::pair<SUMOTime, unsigned int> > laneTimeLine;
545 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
546 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex));
554 if (inputStorage.
readInt() != 2) {
571 std::vector<std::pair<SUMOTime, SUMOReal> > speedTimeLine;
573 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + duration, newSpeed));
603 if (vehicleType == 0) {
624 std::vector<std::string> edgeIDs;
628 std::vector<const MSEdge*> edges;
639 int parameterCount = inputStorage.
readInt();
640 if (parameterCount == 4) {
666 }
else if (parameterCount == 2) {
686 }
else if (parameterCount == 1) {
709 int parameterCount = inputStorage.
readInt();
710 if (parameterCount == 4) {
736 }
else if (parameterCount == 2) {
756 }
else if (parameterCount == 1) {
779 if (inputStorage.
readInt() != 0) {
789 if (inputStorage.
readInt() != 0) {
808 if (inputStorage.
readInt() != 2) {
827 if (!v->
willPass(&destinationEdge)) {
832 while (v->
getEdge() != &destinationEdge) {
848 std::vector<std::pair<SUMOTime, SUMOReal> > speedTimeLine;
850 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), speed));
869 int laneChangeMode = 0;
892 if (inputStorage.
readInt() != 6) {
896 vehicleParams.
id = id;
919 if (vehicleParams.
depart < 0) {
920 const int proc =
static_cast<int>(-vehicleParams.
depart);
935 const int proc =
static_cast<int>(-vehicleParams.
departPos);
950 const int proc =
static_cast<int>(-vehicleParams.
departSpeed);
964 const int proc =
static_cast<int>(-vehicleParams.
departLane);
990 if (inputStorage.
readInt() != 14) {
994 vehicleParams.
id = id;
1005 std::string vTypeID;
1136 if (inputStorage.
readInt() != 4) {
1150 double x = 0, y = 0;
1162 std::string origID = edgeID +
" " +
toString(laneNum);
1164 edgeID =
'-' + edgeID;
1173 std::cout << std::endl <<
"begin vehicle " << v->
getID() <<
" vehPos:" << vehPos <<
" lane:" << v->
getLane()->
getID() << std::endl;
1176 std::cout <<
" want pos:" << pos <<
" edge:" << edgeID <<
" laneNum:" << laneNum << std::endl;
1180 MSLane* laneA, *laneB, *laneC;
1181 laneA = laneB = laneC = 0;
1182 SUMOReal lanePosA, lanePosB, lanePosC;
1183 SUMOReal bestDistanceA, bestDistanceB, bestDistanceC;
1184 bestDistanceA = bestDistanceB = bestDistanceC = 1000.;
1185 int routeOffsetA, routeOffsetB, routeOffsetC;
1186 routeOffsetA = routeOffsetB = routeOffsetC = 0;
1195 if (cFound && (bestDistanceA > maxRouteDistance && bestDistanceC > maxRouteDistance)) {
1202 }
else if (aFound) {
1204 }
else if (cFound) {
1239 const std::map<std::string, std::vector<MSLane*> >& vtdMap =
getOrBuildVTDMap();
1240 if (vtdMap.find(origID) == vtdMap.end()) {
1242 std::cout <<
" a failed - lane not in map" << std::endl;
1246 const std::vector<MSLane*>& lanes = vtdMap.find(origID)->second;
1247 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end() && bestDistance >
POSITION_EPS; ++i) {
1251 std::cout <<
" a at lane " << l->
getID() <<
" dist:" << dist <<
" best:" << bestDistance << std::endl;
1253 if (dist < bestDistance) {
1254 bestDistance = dist;
1265 std::cout <<
" a failed - no incoming lane" << std::endl;
1270 MSEdgeVector::const_iterator p = std::find(tedges.begin() + v.
getRoutePosition(), tedges.end(), &pni->
getEdge());
1271 if (p != tedges.end()) {
1275 std::cout <<
" a ok lane:" << (*lane)->getID() <<
" lanePos:" << lanePos <<
" routeOffset:" << routeOffset << std::endl;
1280 std::cout <<
" a failed - route position beyond route length" << std::endl;
1291 int lastBestRouteEdge = 0;
1292 int lastRouteEdge = 0;
1293 MSLane* bestRouteLane = 0;
1295 for (std::vector<MSLane*>::const_iterator i = bestLaneConts.begin(); i != bestLaneConts.end() && bestDistance >
POSITION_EPS; ++i) {
1296 MSEdge& e = (*i)->getEdge();
1300 const std::vector<MSLane*>& lanes = e.
getLanes();
1301 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end() && bestDistance >
POSITION_EPS; ++k) {
1305 std::cout <<
" b at lane " << cl->
getID() <<
" dist:" << dist <<
" best:" << bestDistance << std::endl;
1307 if (dist < bestDistance) {
1308 bestDistance = dist;
1310 lastBestRouteEdge = lastRouteEdge;
1314 bestRouteLane = *lane;
1319 if (bestRouteLane == 0) {
1321 std::cout <<
" b failed - no best route lane" << std::endl;
1326 routeOffset = lastBestRouteEdge;
1328 std::cout <<
" b ok lane " << bestRouteLane->
getID() <<
" lanePos:" << lanePos <<
" best:" << lastBestRouteEdge << std::endl;
1341 MSLane* nameMatchingLane = 0;
1342 SUMOReal minDistNameMatchingLane = 1 << (11);
1343 for (; minDistLane == 0 && r < 10 && nameMatchingLane == 0; ++r) {
1344 std::set<std::string> into;
1348 for (std::set<std::string>::const_iterator j = into.begin(); j != into.end(); ++j) {
1350 const std::vector<MSLane*>& lanes = e->
getLanes();
1351 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end(); ++k) {
1356 if (dist < minDistNameMatchingLane) {
1357 minDistNameMatchingLane = dist;
1358 nameMatchingLane = lane;
1362 if (dist < minDist) {
1369 *lane = nameMatchingLane != 0 ? nameMatchingLane : minDistLane;
1372 std::cout <<
" c failed - no matching lane" << std::endl;
1380 std::cout <<
" c ok, on same lane" << std::endl;
1384 MSEdge& destinationEdge = (*lane)->getEdge();
1385 MSEdge* routePos = &destinationEdge;
1387 routePos = &routePos->
getLanes()[0]->getLogicalPredecessorLane()->getEdge();
1393 unsigned int rindex = 0;
1395 while (!found && ((
int)(c - r) >= 0 || c + r < l)) {
1396 if ((
int)(c - r) >= 0 && route[c - r] == routePos) {
1400 if (c + r < l && route[c + r] == routePos) {
1410 std::cout <<
" c ok, on a different edge of same route" << std::endl;
1415 MSLane* firstLane = *lane;
1417 edges.push_back(&destinationEdge);
1420 edges.push_back(&firstLane->
getEdge());
1423 if (lc.size() != 0 && lc[0]->getLane() != 0) {
1424 edges.push_back(&lc[0]->getLane()->getEdge());
1427 std::cout <<
" c ok, on a different route" << std::endl;
1439 if (inputStorage.
readInt() != 2) {
1444 std::pair<const MSLane*, SUMOReal> roadPos;
1451 std::string roadID = inputStorage.
readString();
1454 pos = roadPos.first->getShape().positionAtOffset(roadPos.second);
1461 const double p1x = inputStorage.
readDouble();
1462 const double p1y = inputStorage.
readDouble();
1481 v->
getEdge(), &roadPos.first->getEdge());
1512 std::string newID = oType.
getID().find(
'@') == std::string::npos ? oType.
getID() +
"@" + veh->
getID() : oType.
getID();
1514 static_cast<MSVehicle*
>(veh)->replaceVehicleType(type);
1521 const std::map<std::string, std::vector<MSLane*> >&
1525 for (std::vector<MSEdge*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
1526 const std::vector<MSLane*>& lanes = (*i)->getLanes();
1527 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
1528 if ((*j)->knowsParameter(
"origId")) {
1529 std::string origID = (*j)->getParameter(
"origId",
"");
1531 gVTDMap[origID] = std::vector<MSLane*>();
1533 gVTDMap[origID].push_back(*j);
1538 gVTDMap[
"unknown"] = std::vector<MSLane*>();
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos)
Inserts the given vehicle at the given position.
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 setChosenSpeedFactor(SUMOReal factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
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.
#define VAR_EMISSIONCLASS
void reroute(SUMOTime t, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, bool withTaz=false)
Performs a rerouting using the given router.
static bool vtdMap_matchingRoutePosition(const Position &pos, const std::string &origID, MSVehicle &v, bool report, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, MSEdgeVector &edges)
#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
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.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc4: Change Vehicle State)
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...
bool readTypeCheckingColor(tcpip::Storage &inputStorage, RGBColor &into)
Reads the value type and a color, verifying the type.
MSEdgeVector::const_iterator MSRouteIterator
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
unsigned int personCapacity
The vehicle's capacity (persons)
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()
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID)
Returns the named vehicle type or a sample from the named distribution.
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.
const MSEdgeVector & getEdges() const
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.
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.
unsigned int getPersonNumber() const
Returns the number of persons.
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.
unsigned int personNumber
The number of persons in the vehicle.
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)
SUMOReal getDistanceBetween(SUMOReal fromPos, SUMOReal toPos, const MSEdge *fromEdge, const MSEdge *toEdge) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
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.
Tag for the last element in the enum for safe int casting.
SUMOReal x() const
Returns the x-position.
#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.
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
virtual void writeInt(int)
The car-following model and parameter.
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.
unsigned char blue() const
Returns the blue-amount of the color.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, const MSVehicleType *type)
Builds a vehicle, increases the number of built vehicles.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
static void parseEdgesList(const std::string &desc, std::vector< const MSEdge * > &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
MSLane * lane
The described lane.
#define VAR_PERSON_NUMBER
MSLane * getLogicalPredecessorLane() const
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.
bool addTraciStop(MSLane *lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered)
Representation of a vehicle.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
#define REMOVE_TELEPORT_ARRIVED
std::vector< const MSEdge * > MSEdgeVector
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, unsigned int > > &laneTimeLine)
Sets a new lane timeline.
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.
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
unsigned char alpha() const
Returns the alpha-amount of the color.
virtual void writeByte(int)
const MSEdge * succEdge(unsigned int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
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.
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
SUMOReal distance(const Position &p) const
virtual void writeStringList(const std::vector< std::string > &s)
SUMOTime depart
The vehicle's departure time.
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()
void setVTDControlled(MSVehicle *v, MSLane *l, SUMOReal pos, int edgeOffset, MSEdgeVector route)
#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
virtual void writeStorage(tcpip::Storage &store)
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.
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.
bool allowsContinuation
Whether this lane allows to continue the drive.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
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)
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
void push_back(const PositionVector &p)
Appends all positions from the given vector.
static bool vtdMap_matchingNearest(const Position &pos, const std::string &origID, MSVehicle &v, TraCIServer &server, bool report, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, MSEdgeVector &edges)
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
bool replaceRouteEdges(MSEdgeVector &edges, bool onInit=false)
Replaces the current route by the given edges.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
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
MSRouteIterator end() const
Returns the end of the list of edges to pass.
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) ...
SUMOReal y() const
Returns the y-position.
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
void set(SUMOReal x, SUMOReal y)
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
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...
const std::string & getID() const
Returns the name of the vehicle type.
static bool vtdMap_matchingEdgeLane(const Position &pos, const std::string &origID, MSVehicle &v, bool report, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, MSEdgeVector &edges)
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const std::vector< MSEdge * > &prohibited=std::vector< MSEdge * >()) const
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)
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
unsigned size() const
Returns the number of edges to pass.
const PositionVector & getShape() const
Returns this lane's shape.
const std::vector< MSEdge * > & getEdges() const
Returns loaded edges.
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
bool hasValidRoute(std::string &msg) const
Validates the current route.
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.
virtual void 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...
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
#define VAR_SPEED_WITHOUT_TRACI
MSEdgeControl & getEdgeControl()
Returns the edge control.
#define VAR_LANECHANGE_MODE
bool retrieveExistingEffort(const MSEdge *const e, const SUMOReal t, SUMOReal &value) const
Returns an effort for an edge and time if stored.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
The vehicle was teleported out of the net.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
The class responsible for building and deletion of vehicles.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
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.
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
The edge is an internal edge.
static const std::map< std::string, std::vector< MSLane * > > & getOrBuildVTDMap()
SUMOReal interpolateGeometryPosToLanePos(SUMOReal geometryPos) const
Tag for the last element in the enum for safe int casting.
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.
SUMOReal startPos
The stopping position start.
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.
unsigned int getRoutePosition() const
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.
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.
The vehicle is being teleported.
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
const std::string & getID() const
Returns the name of the vehicle.
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.