55 #ifdef CHECK_MEMORY_LEAKS
57 #endif // CHECK_MEMORY_LEAKS
63 using namespace traci;
106 std::vector<std::string> ids;
109 if ((*i).second->isOnRoad()) {
110 ids.push_back((*i).first);
122 if (sumoVehicle == 0) {
160 tempMsg.
writeInt((
int)std::distance(lanes.begin(), std::find(lanes.begin(), lanes.end(), v->
getLane())));
220 if (inputStorage.
readInt() != 2) {
252 if (inputStorage.
readInt() != 2) {
302 unsigned int cnt = 0;
304 const std::vector<MSVehicle::LaneQ>& bestLanes = onRoad ? v->
getBestLanes() : std::vector<MSVehicle::LaneQ>();
305 tempContent.
writeInt((
int) bestLanes.size());
307 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
324 std::vector<std::string> bestContIDs;
326 bestContIDs.push_back((*j)->getID());
346 if (!commandDistanceRequest(server, inputStorage, tempMsg, v)) {
364 std::string warning =
"";
386 const bool shouldExist = variable !=
ADD;
388 if (sumoVehicle == 0) {
394 if (v == 0 && shouldExist) {
402 int compoundSize = inputStorage.
readInt();
403 if (compoundSize != 4 && compoundSize != 5) {
425 bool parking =
false;
426 bool triggered =
false;
427 if (compoundSize == 5) {
432 parking = ((stopFlags & 1) != 0);
433 triggered = ((stopFlags & 2) != 0);
444 const std::vector<MSLane*>& allLanes = road->
getLanes();
445 if ((laneIndex < 0) || laneIndex >= (
int)(allLanes.size())) {
449 if (!v->
addTraciStop(allLanes[laneIndex], pos, 0, waitTime, parking, triggered)) {
459 if (inputStorage.
readInt() != 0) {
463 if (!static_cast<MSVehicle*>(v)->resumeFromStopping()) {
465 std::ostringstream strs;
466 strs <<
"reached: " << sto.
reached;
467 strs <<
", duration:" << sto.
duration;
468 strs <<
", edge:" << (*sto.
edge)->getID();
469 strs <<
", startPos: " << sto.
startPos;
470 std::string posStr = strs.str();
480 if (inputStorage.
readInt() != 2) {
493 if ((laneIndex < 0) || (laneIndex >= (
int)(v->
getEdge()->
getLanes().size()))) {
497 std::vector<std::pair<SUMOTime, unsigned int> > laneTimeLine;
498 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
499 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex));
510 if (inputStorage.
readInt() != 2) {
527 std::vector<std::pair<SUMOTime, SUMOReal> > speedTimeLine;
529 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + duration, newSpeed));
568 std::vector<std::string> edgeIDs;
572 std::vector<const MSEdge*> edges;
583 int parameterCount = inputStorage.
readInt();
584 if (parameterCount == 4) {
610 }
else if (parameterCount == 2) {
630 }
else if (parameterCount == 1) {
653 int parameterCount = inputStorage.
readInt();
654 if (parameterCount == 4) {
680 }
else if (parameterCount == 2) {
700 }
else if (parameterCount == 1) {
723 if (inputStorage.
readInt() != 0) {
733 if (inputStorage.
readInt() != 0) {
752 if (inputStorage.
readInt() != 2) {
771 if (!v->
willPass(&destinationEdge)) {
776 while (v->
getEdge() != &destinationEdge) {
792 std::vector<std::pair<SUMOTime, SUMOReal> > speedTimeLine;
794 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), speed));
795 speedTimeLine.push_back(std::make_pair(
SUMOTime_MAX, speed));
826 if (inputStorage.
readInt() != 6) {
830 vehicleParams.
id = id;
853 if (vehicleParams.
depart < 0) {
854 const int proc =
static_cast<int>(-vehicleParams.
depart);
867 const int proc =
static_cast<int>(-vehicleParams.
departPos);
882 const int proc =
static_cast<int>(-vehicleParams.
departSpeed);
896 const int proc =
static_cast<int>(-vehicleParams.
departLane);
906 *params = vehicleParams;
958 if (inputStorage.
readInt() != 4) {
984 std::string origID = edgeID +
" " +
toString(laneNum);
986 edgeID =
'-' + edgeID;
995 std::cout << std::endl <<
"begin vehicle " << v->
getID() <<
" vehPos:" << vehPos <<
" lane:" << v->
getLane()->
getID() << std::endl;
998 std::cout <<
" want pos:" << pos <<
" edge:" << edgeID <<
" laneNum:" << laneNum << std::endl;
1002 MSLane* laneA, *laneB, *laneC;
1003 laneA = laneB = laneC = 0;
1004 SUMOReal lanePosA, lanePosB, lanePosC;
1005 SUMOReal bestDistanceA, bestDistanceB, bestDistanceC;
1006 bestDistanceA = bestDistanceB = bestDistanceC = 1000.;
1007 int routeOffsetA, routeOffsetB, routeOffsetC;
1008 routeOffsetA = routeOffsetB = routeOffsetC = 0;
1010 bool aFound = vtdMap_matchingEdgeLane(pos, origID, *v, server.
vtdDebug(), bestDistanceA, &laneA, lanePosA, routeOffsetA, edgesA);
1012 bool bFound = vtdMap_matchingRoutePosition(pos, origID, *v, server.
vtdDebug(), bestDistanceB, &laneB, lanePosB, routeOffsetB, edgesB);
1014 bool cFound = vtdMap_matchingNearest(pos, origID, *v, server, server.
vtdDebug(), bestDistanceC, &laneC, lanePosC, routeOffsetC, edgesC);
1017 if (cFound && (bestDistanceA > maxRouteDistance && bestDistanceC > maxRouteDistance)) {
1024 }
else if (aFound) {
1026 }
else if (cFound) {
1052 const std::map<std::string, std::vector<MSLane*> >& vtdMap = getOrBuildVTDMap();
1053 if (vtdMap.find(origID) == vtdMap.end()) {
1055 std::cout <<
" a failed - lane not in map" << std::endl;
1059 const std::vector<MSLane*>& lanes = vtdMap.find(origID)->second;
1060 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end() && bestDistance >
POSITION_EPS; ++i) {
1064 std::cout <<
" a at lane " << l->
getID() <<
" dist:" << dist <<
" best:" << bestDistance << std::endl;
1066 if (dist < bestDistance) {
1067 bestDistance = dist;
1078 std::cout <<
" a failed - no incoming lane" << std::endl;
1083 MSEdgeVector::const_iterator p = std::find(tedges.begin() + v.
getRoutePosition(), tedges.end(), &pni->
getEdge());
1084 if (p != tedges.end()) {
1088 std::cout <<
" a ok lane:" << (*lane)->getID() <<
" lanePos:" << lanePos <<
" routeOffset:" << routeOffset << std::endl;
1093 std::cout <<
" a failed - route position beyond route length" << std::endl;
1103 int lastBestRouteEdge = 0;
1104 int lastRouteEdge = 0;
1105 MSLane* bestRouteLane = 0;
1107 for (std::vector<MSLane*>::const_iterator i = bestLaneConts.begin(); i != bestLaneConts.end() && bestDistance >
POSITION_EPS; ++i) {
1108 MSEdge& e = (*i)->getEdge();
1112 const std::vector<MSLane*>& lanes = e.
getLanes();
1113 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end() && bestDistance >
POSITION_EPS; ++k) {
1117 std::cout <<
" b at lane " << cl->
getID() <<
" dist:" << dist <<
" best:" << bestDistance << std::endl;
1119 if (dist < bestDistance) {
1120 bestDistance = dist;
1122 lastBestRouteEdge = lastRouteEdge;
1126 bestRouteLane = *lane;
1131 if (bestRouteLane == 0) {
1133 std::cout <<
" b failed - no best route lane" << std::endl;
1138 routeOffset = lastBestRouteEdge;
1140 std::cout <<
" b ok lane " << bestRouteLane->
getID() <<
" lanePos:" << lanePos <<
" best:" << lastBestRouteEdge << std::endl;
1152 MSLane* nameMatchingLane = 0;
1153 SUMOReal minDistNameMatchingLane = 1 << (11);
1154 for (; minDistLane == 0 && r < 10 && nameMatchingLane == 0; ++r) {
1155 std::set<std::string> into;
1159 for (std::set<std::string>::const_iterator j = into.begin(); j != into.end(); ++j) {
1161 const std::vector<MSLane*>& lanes = e->
getLanes();
1162 for (std::vector<MSLane*>::const_iterator k = lanes.begin(); k != lanes.end(); ++k) {
1167 if (dist < minDistNameMatchingLane) {
1168 minDistNameMatchingLane = dist;
1169 nameMatchingLane = lane;
1173 if (dist < minDist) {
1180 *lane = nameMatchingLane != 0 ? nameMatchingLane : minDistLane;
1183 std::cout <<
" c failed - no matching lane" << std::endl;
1191 std::cout <<
" c ok, on same lane" << std::endl;
1195 MSEdge& destinationEdge = (*lane)->getEdge();
1196 MSEdge* routePos = &destinationEdge;
1198 routePos = &routePos->
getLanes()[0]->getLogicalPredecessorLane()->getEdge();
1204 unsigned int rindex = 0;
1206 while (!found && ((
int)(c - r) >= 0 || c + r < l)) {
1207 if ((
int)(c - r) >= 0 && route[c - r] == routePos) {
1211 if (c + r < l && route[c + r] == routePos) {
1221 std::cout <<
" c ok, on a different edge of same route" << std::endl;
1226 MSLane* firstLane = *lane;
1228 edges.push_back(&destinationEdge);
1231 edges.push_back(&firstLane->
getEdge());
1234 if (lc.size() != 0 && lc[0]->getLane() != 0) {
1235 edges.push_back(&lc[0]->getLane()->getEdge());
1238 std::cout <<
" c ok, on a different route" << std::endl;
1250 if (inputStorage.
readInt() != 2) {
1255 std::pair<const MSLane*, SUMOReal> roadPos;
1262 std::string roadID = inputStorage.
readString();
1265 pos = roadPos.first->getShape().positionAtOffset(roadPos.second);
1272 const double p1x = inputStorage.
readDouble();
1273 const double p1y = inputStorage.
readDouble();
1292 v->
getEdge(), &roadPos.first->getEdge());
1323 std::string newID = oType.
getID().find(
'@') == std::string::npos ? oType.
getID() +
"@" + veh->
getID() : oType.
getID();
1325 static_cast<MSVehicle*
>(veh)->replaceVehicleType(type);
1332 const std::map<std::string, std::vector<MSLane*> >&
1334 if (gVTDMap.size() == 0) {
1336 for (std::vector<MSEdge*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
1337 const std::vector<MSLane*>& lanes = (*i)->getLanes();
1338 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
1339 if ((*j)->knowsParameter(
"origId")) {
1340 std::string origID = (*j)->getParameter(
"origId",
"");
1341 if (gVTDMap.find(origID) == gVTDMap.end()) {
1342 gVTDMap[origID] = std::vector<MSLane*>();
1344 gVTDMap[origID].push_back(*j);
1348 if (gVTDMap.size() == 0) {
1349 gVTDMap[
"unknown"] = std::vector<MSLane*>();
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos)
Inserts the given vehicle at the given position.
static SUMOReal computeCO(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted CO given the vehicle type and state (in mg/s)
virtual const std::vector< LaneQ > & getBestLanes(bool forceRebuild=false, MSLane *startLane=0) const
Returns the description of best lanes to use in order to continue the route.
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.
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
static SUMOReal computeHC(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted HC given the vehicle type and state (in mg/s)
#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
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static const MSLane * getLaneChecking(std::string roadID, int laneIndex, SUMOReal pos)
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
static bool dictionary(std::string id, MSLane *lane)
Inserts a MSLane into the static dictionary Returns true if the key id isn't already in the dictionar...
MSEdgeVector::const_iterator MSRouteIterator
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
bool retrieveExistingTravelTime(const MSEdge *const e, const SUMOVehicle *const v, SUMOReal t, SUMOReal &value) const
Returns a travel time for an edge and time if stored.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
SUMOReal getLength() const
Returns the lane's length.
SUMOReal departSpeed
(optional) The initial speed of the vehicle
static bool processGet(traci::TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa4: Get Vehicle Variable)
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.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
Notification
Definition of a vehicle state.
const MSEdgeVector & getEdges() const
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
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 readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
bool replaceRouteEdges(const MSEdgeVector &edges, bool onInit=false)
Replaces the current route by the given edges.
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 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 distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Position getPosition(SUMOReal offset=0) const
Return current position (x/y, cartesian)
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...
bool retrieveExistingEffort(const MSEdge *const e, const SUMOVehicle *const v, SUMOReal t, SUMOReal &value) const
Returns an effort for an edge and time if stored.
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.
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
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)
The car-following model and parameter.
MSAbstractLaneChangeModel & getLaneChangeModel()
virtual int readUnsignedByte()
void addTravelTime(const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value)
Adds a travel time information for an edge and a time span.
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.
static SUMOReal computeNoise(SUMOEmissionClass c, double v, double a)
Returns the noise produced by the a vehicle of the given type at the given speed. ...
TraCI server used to control sumo by a remote TraCI client.
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
static bool vtdMap_matchingNearest(const Position &pos, const std::string &origID, MSVehicle &v, traci::TraCIServer &server, bool report, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, MSEdgeVector &edges)
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
static bool commandDistanceRequest(traci::TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage, const MSVehicle *v)
MSLane * getLogicalPredecessorLane() const
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.
static bool setVariable(const int cmd, const int variable, MSVehicleType &v, traci::TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
DepartLaneDefinition
Possible ways to choose a lane on depart.
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification)
remove the vehicle from this lane
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
bool replaceRoute(const MSRoute *route, bool onInit=false)
Replaces the current route by the given one.
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, unsigned int > > &laneTimeLine)
Sets a new lane timeline.
static bool processSet(traci::TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc4: Change Vehicle State)
ChangeRequest
Requests set via TraCI.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
A point in 2D or 3D with translation and scaling methods.
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.
static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted CO2 given the vehicle type and state (in mg/s)
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.
void setVTDControlled(MSVehicle *v, MSLane *l, SUMOReal pos, int edgeOffset, MSEdgeVector route)
The vehicle arrived at its destination (is deleted)
bool isStopped() const
Returns whether the vehicle is at a stop.
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
ChangeRequest checkForLaneChanges(SUMOTime currentTime, const MSEdge ¤tEdge, unsigned int currentLaneIndex)
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.
#define CMD_REROUTE_EFFORT
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
const int VEHPARS_COLOR_SET
virtual void writeStorage(tcpip::Storage &store)
bool isParking() const
Returns whether the vehicle is parking.
bool allowsContinuation
Whether this lane allows to continue the drive.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
#define INVALID_DOUBLE_VALUE
DepartSpeedDefinition
Possible ways to choose the departure speed.
virtual void requestLaneChange(MSVehicle::ChangeRequest request)
#define VAR_EDGE_TRAVELTIME
void push_back(const PositionVector &p)
Appends all positions from the given vector.
#define CMD_SET_POLYGON_VARIABLE
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
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.
SUMOReal getAcceleration() const
Returns the vehicle's acceleration.
#define CMD_REROUTE_TRAVELTIME
bool readTypeCheckingByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and a byte, verifying the type.
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.
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.
static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted NOx given the vehicle type and state (in mg/s)
MSRouteIterator edge
The edge in the route to stop at.
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.
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.
static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a)
Returns the amount of consumed fuel given the vehicle type and state (in ml/s)
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.
static SUMOReal computePMx(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted PMx given the vehicle type and state (in mg/s)
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...
#define VAR_SPEED_WITHOUT_TRACI
MSEdgeControl & getEdgeControl()
Returns the edge control.
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.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
void collectObjectsInRange(int domain, const PositionVector &shape, SUMOReal range, std::set< std::string > &into)
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
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.
bool readTypeCheckingColor(tcpip::Storage &inputStorage, RGBColor &into)
Reads the value type and a color, verifying the type.
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 readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
unsigned int getRoutePosition() const
virtual const std::string & getID() const =0
Get the vehicle's ID.
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
DepartDefinition
Possible ways to depart.
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.
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.
unsigned int getLaneIndex() const