 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
55 #define DEBUG_COND (veh->isSelected())
79 return sumoVehicle ==
nullptr || sumoVehicle->
getLane() ==
nullptr;
83 std::vector<std::string>
85 std::vector<std::string> ids;
89 ids.push_back((*i).first);
199 Vehicle::getColor(
const std::string& vehicleID) {
269 Vehicle::getPersonCapacity(
const std::string& vehicleID) {
273 std::vector<std::string>
278 std::pair<std::string, double>
282 std::pair<const MSVehicle* const, double> leaderInfo = veh->
getLeader(dist);
283 return std::make_pair(
284 leaderInfo.first !=
nullptr ? leaderInfo.first->getID() :
"",
287 return std::make_pair(
"", -1);
329 std::vector<std::string>
331 std::vector<std::string> result;
335 result.push_back((*i)->getID());
347 std::vector<TraCIBestLanesData>
349 std::vector<TraCIBestLanesData> result;
352 const std::vector<MSVehicle::LaneQ>& bestLanes = veh->
getBestLanes();
353 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
362 if ((*j) !=
nullptr) {
366 result.push_back(bld);
373 std::vector<TraCINextTLSData>
375 std::vector<TraCINextTLSData> result;
385 if ((*link)->isTLSControlled()) {
387 ntd.
id = (*link)->getTLLogic()->getID();
388 ntd.
tlIndex = (*link)->getTLIndex();
390 ntd.
state = (char)(*link)->getState();
391 result.push_back(ntd);
394 lane = (*link)->getViaLaneOrLane();
404 for (
int i = 0; i < remainingEdges; i++) {
408 if (allowed !=
nullptr && allowed->size() != 0) {
409 for (
MSLink* link : allowed->front()->getLinkCont()) {
410 if (&link->getLane()->getEdge() == next) {
411 if (link->isTLSControlled()) {
413 ntd.
id = link->getTLLogic()->getID();
414 ntd.
tlIndex = link->getTLIndex();
416 ntd.
state = (char)link->getState();
417 result.push_back(ntd);
419 seen += allowed->front()->getLength();
432 std::vector<TraCINextStopData>
434 std::vector<TraCINextStopData> result;
436 std::list<MSVehicle::Stop> stops = veh->
getMyStops();
437 for (std::list<MSVehicle::Stop>::iterator it = stops.begin(); it != stops.end(); ++it) {
438 if (!it->collision) {
440 nsd.
lane = it->lane->getID();
441 nsd.
endPos = it->getEndPos(*veh);
443 if (it->busstop !=
nullptr) {
446 if (it->containerstop !=
nullptr) {
449 if (it->parkingarea !=
nullptr) {
452 if (it->chargingStation !=
nullptr) {
456 (it->pars.parking ? 2 : 0) +
457 (it->pars.triggered ? 4 : 0) +
458 (it->pars.containerTriggered ? 8 : 0) +
459 (it->busstop !=
nullptr ? 16 : 0) +
460 (it->containerstop !=
nullptr ? 32 : 0) +
461 (it->chargingStation !=
nullptr ? 64 : 0) +
462 (it->parkingarea !=
nullptr ? 128 : 0));
465 result.push_back(nsd);
478 result = ((stop.
reached ? 1 : 0) +
482 (stop.
busstop !=
nullptr ? 16 : 0) +
507 if (distance == std::numeric_limits<double>::max()) {
524 if (distance == std::numeric_limits<double>::max()) {
541 if (distance == std::numeric_limits<double>::max()) {
563 Vehicle::getSpeedFactor(
const std::string& vehicleID) {
592 std::vector<std::string>
614 if (tok.
size() < 3) {
615 throw TraCIException(
"Invalid device parameter '" + key +
"' for vehicle '" + vehicleID +
"'.");
620 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support device parameter '" + key +
"' (" + e.what() +
").");
623 const std::string attrName = key.substr(16);
627 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support laneChangeModel parameter '" + key +
"' (" + e.what() +
").");
630 const std::string attrName = key.substr(15);
634 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support carFollowModel parameter '" + key +
"' (" + e.what() +
").");
638 if (tok.
size() != 3) {
639 throw TraCIException(
"Invalid check for device. Expected format is 'has.DEVICENAME.device'.");
648 std::vector<std::pair<std::string, double> >
650 int dir = (1 & mode) != 0 ? -1 : 1;
651 bool queryLeaders = (2 & mode) != 0;
652 bool blockersOnly = (4 & mode) != 0;
655 std::vector<std::pair<std::string, double> > neighs;
658 #ifdef DEBUG_NEIGHBORS
660 std::cout <<
"getNeighbors() for veh '" << vehicleID <<
"': dir=" << dir
661 <<
", queryLeaders=" << queryLeaders
662 <<
", blockersOnly=" << blockersOnly << std::endl;
670 bool blocked =
false;
685 #ifdef DEBUG_NEIGHBORS
687 std::cout <<
" blocked=" << blocked << std::endl;
697 const std::shared_ptr<MSLeaderDistanceInfo> res = queryLeaders ? lcm.
getLeaders(dir) : lcm.getFollowers(dir);
698 if (res !=
nullptr && res->hasVehicles()) {
699 auto distIt = begin(res->getDistances());
700 auto vehIt = begin(res->getVehicles());
701 while (distIt != end(res->getDistances())) {
702 if (*vehIt !=
nullptr) {
703 if (neighs.size() == 0 || neighs.back().first != (*vehIt)->getID()) {
704 neighs.push_back(std::make_pair((*vehIt)->getID(), *distIt));
716 Vehicle::getEmissionClass(
const std::string& vehicleID) {
721 Vehicle::getShapeClass(
const std::string& vehicleID) {
727 Vehicle::getLength(
const std::string& vehicleID) {
733 Vehicle::getAccel(
const std::string& vehicleID) {
739 Vehicle::getDecel(
const std::string& vehicleID) {
744 double Vehicle::getEmergencyDecel(
const std::string& vehicleID) {
749 double Vehicle::getApparentDecel(
const std::string& vehicleID) {
754 double Vehicle::getActionStepLength(
const std::string& vehicleID) {
765 Vehicle::getTau(
const std::string& vehicleID) {
771 Vehicle::getImperfection(
const std::string& vehicleID) {
777 Vehicle::getSpeedDeviation(
const std::string& vehicleID) {
783 Vehicle::getVehicleClass(
const std::string& vehicleID) {
789 Vehicle::getMinGap(
const std::string& vehicleID) {
795 Vehicle::getMinGapLat(
const std::string& vehicleID) {
801 Vehicle::getMaxSpeed(
const std::string& vehicleID) {
807 Vehicle::getMaxSpeedLat(
const std::string& vehicleID) {
813 Vehicle::getLateralAlignment(
const std::string& vehicleID) {
819 Vehicle::getWidth(
const std::string& vehicleID) {
825 Vehicle::getHeight(
const std::string& vehicleID) {
832 const std::string& edgeID,
841 bool parking =
false;
842 bool triggered =
false;
843 bool containerTriggered =
false;
846 parking = ((flags & 1) != 0);
847 triggered = ((flags & 2) != 0);
848 containerTriggered = ((flags & 4) != 0);
849 if ((flags & 8) != 0) {
852 if ((flags & 16) != 0) {
855 if ((flags & 32) != 0) {
858 if ((flags & 64) != 0) {
867 if (!veh->
addTraciStopAtStoppingPlace(edgeID, durationSteps, untilStep, parking, triggered, containerTriggered, stoppingPlaceType, error)) {
878 if (pos < startPos) {
879 throw TraCIException(
"End position on lane must be after start position.");
883 if (road ==
nullptr) {
886 const std::vector<MSLane*>& allLanes = road->
getLanes();
887 if ((laneIndex < 0) || laneIndex >= (
int)(allLanes.size())) {
891 if (!veh->
addTraciStop(allLanes[laneIndex], startPos, pos, durationSteps, untilStep, parking, triggered, containerTriggered, error)) {
915 std::ostringstream strs;
916 strs <<
"reached: " << sto.
reached;
917 strs <<
", duration:" << sto.
duration;
918 strs <<
", edge:" << (*sto.
edge)->getID();
920 std::string posStr = strs.str();
921 throw TraCIException(
"Failed to resume from stopping for vehicle '" + veh->
getID() +
"', " + posStr);
930 const bool onInit =
isOnInit(vehicleID);
931 if (destEdge ==
nullptr) {
932 throw TraCIException(
"Destination edge '" + edgeID +
"' is not known.");
954 std::vector<std::pair<SUMOTime, int> > laneTimeLine;
955 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
962 std::vector<std::pair<SUMOTime, int> > laneTimeLine;
964 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
978 const std::string& routeID,
979 const std::string& typeID,
980 const std::string& depart,
981 const std::string& departLane,
982 const std::string& departPos,
983 const std::string& departSpeed,
984 const std::string& arrivalLane,
985 const std::string& arrivalPos,
986 const std::string& arrivalSpeed,
987 const std::string& fromTaz,
988 const std::string& toTaz,
989 const std::string& line,
993 if (veh !=
nullptr) {
994 throw TraCIException(
"The vehicle '" + vehicleID +
"' to add already exists.");
998 vehicleParams.
id = vehicleID;
1001 throw TraCIException(
"Invalid type '" + typeID +
"' for vehicle '" + vehicleID +
"'.");
1005 if (routeID ==
"") {
1011 if (route ==
nullptr) {
1013 if (e->getFunction() ==
EDGEFUNC_NORMAL && (e->getPermissions() & vclass) == vclass) {
1014 std::vector<std::string> edges;
1015 edges.push_back(e->getID());
1026 throw TraCIException(
"Invalid route '" + routeID +
"' for vehicle '" + vehicleID +
"'.");
1030 if (route->
getEdges().size() == 2) {
1032 if (std::find(succ.begin(), succ.end(), route->
getEdges().back()) == succ.end()) {
1036 if (fromTaz !=
"" || toTaz !=
"") {
1045 WRITE_WARNING(
"Departure time for vehicle '" + vehicleID +
"' is in the past; using current time instead.");
1067 vehicleParams.
fromTaz = fromTaz;
1068 vehicleParams.
toTaz = toTaz;
1069 vehicleParams.
line = line;
1086 const double x,
const double y,
double angle,
const int keepRoute) {
1088 const bool doKeepRoute = (keepRoute & 1) != 0 && veh->
getID() !=
"VTD_EGO";
1089 const bool mayLeaveNetwork = (keepRoute & 2) != 0;
1090 const bool ignorePermissions = (keepRoute & 4) != 0;
1093 const std::string origID = edgeID +
"_" +
toString(laneIndex);
1097 const double origAngle = angle;
1102 while (angle >= 360.) {
1105 while (angle < 0.) {
1113 std::cout <<
" wantedPos=" << pos <<
" origID=" << origID <<
" laneIndex=" << laneIndex <<
" origAngle=" << origAngle <<
" angle=" << angle <<
" keepRoute=" << keepRoute << std::endl;
1119 double lanePosLat = 0;
1120 double bestDistance = std::numeric_limits<double>::max();
1121 int routeOffset = 0;
1123 double maxRouteDistance = 100;
1133 bestDistance, &lane, lanePos, routeOffset);
1140 bestDistance, &lane, lanePos, routeOffset, edges);
1142 if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) {
1148 lanePosLat = perpDist;
1149 if (!mayLeaveNetwork) {
1157 WRITE_WARNING(
"Could not determine position on lane '" + lane->
getID() +
"' at lateral position " +
toString(-lanePosLat) +
".");
1161 lanePosLat = -lanePosLat;
1170 assert((found && lane != 0) || (!found && lane == 0));
1172 if (lane !=
nullptr) {
1181 std::cout <<
SIMTIME <<
" veh=" << vehicleID +
" moveToXYResult lane='" <<
Named::getIDSecure(lane) <<
"' lanePos=" << lanePos <<
" lanePosLat=" << lanePosLat <<
"\n";
1188 if (lane ==
nullptr) {
1189 throw TraCIException(
"Could not map vehicle '" + vehicleID +
"', no road found within " +
toString(maxRouteDistance) +
"m.");
1191 throw TraCIException(
"Could not map vehicle '" + vehicleID +
"', distance to road is " +
toString(bestDistance) +
".");
1199 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
1206 Vehicle::openGap(
const std::string& vehicleID,
double newTimeHeadway,
double newSpaceHeadway,
double duration,
double changeRate,
double maxDecel,
const std::string& referenceVehID) {
1209 if (referenceVehID !=
"") {
1213 if (newTimeHeadway == -1) {
1214 newTimeHeadway = originalTau;
1216 if (originalTau > newTimeHeadway) {
1217 WRITE_WARNING(
"Ignoring openGap(). New time headway must not be smaller than the original.");
1239 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
1241 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), speed));
1265 if (vehicleType ==
nullptr) {
1266 throw TraCIException(
"Vehicle type '" + typeID +
"' is not known");
1276 throw TraCIException(
"The route '" + routeID +
"' is not known.");
1280 WRITE_WARNING(
"Invalid route replacement for vehicle '" + veh->
getID() +
"'. " + msg);
1297 if (edges.size() > 0 && edges.back()->isInternal()) {
1298 edges.push_back(edges.back()->getLanes()[0]->getNextNormal());
1301 throw TraCIException(
"Invalid edge list for vehicle '" + veh->
getID() +
"' (" + e.what() +
")");
1317 double time,
double begSeconds,
double endSeconds) {
1320 if (edge ==
nullptr) {
1325 if (begSeconds == 0 && endSeconds == std::numeric_limits<double>::max()) {
1343 double effort,
double begSeconds,
double endSeconds) {
1346 if (edge ==
nullptr) {
1351 if (begSeconds == 0 && endSeconds == std::numeric_limits<double>::max()) {
1398 Vehicle::moveTo(
const std::string& vehicleID,
const std::string& laneID,
double position) {
1417 throw TraCIException(
"Lane '" + laneID +
"' is not on the route of vehicle '" + vehicleID +
"'.");
1420 if (veh->
getLane() !=
nullptr) {
1425 const int newRouteIndex = (int)(it - veh->
getRoute().
begin());
1437 Vehicle::setActionStepLength(
const std::string& vehicleID,
double actionStepLength,
bool resetActionOffset) {
1438 if (actionStepLength < 0.0) {
1439 WRITE_ERROR(
"Invalid action step length (<0). Ignoring command setActionStepLength().");
1443 if (actionStepLength == 0.) {
1480 if (veh->
getLane() !=
nullptr) {
1492 Vehicle::setColor(
const std::string& vehicleID,
const TraCIColor& col) {
1494 p.
color.
set((
unsigned char)col.
r, (
unsigned char)col.
g, (
unsigned char)col.
b, (
unsigned char)col.
a);
1500 Vehicle::setSpeedFactor(
const std::string& vehicleID,
double factor) {
1526 Vehicle::setLength(
const std::string& vehicleID,
double length) {
1532 Vehicle::setMaxSpeed(
const std::string& vehicleID,
double speed) {
1538 Vehicle::setVehicleClass(
const std::string& vehicleID,
const std::string& clazz) {
1544 Vehicle::setShapeClass(
const std::string& vehicleID,
const std::string& clazz) {
1550 Vehicle::setEmissionClass(
const std::string& vehicleID,
const std::string& clazz) {
1556 Vehicle::setWidth(
const std::string& vehicleID,
double width) {
1562 Vehicle::setHeight(
const std::string& vehicleID,
double height) {
1568 Vehicle::setMinGap(
const std::string& vehicleID,
double minGap) {
1574 Vehicle::setAccel(
const std::string& vehicleID,
double accel) {
1580 Vehicle::setDecel(
const std::string& vehicleID,
double decel) {
1581 VehicleType::setDecel(
Helper::getVehicle(vehicleID)->getSingularType().getID(), decel);
1586 Vehicle::setEmergencyDecel(
const std::string& vehicleID,
double decel) {
1587 VehicleType::setEmergencyDecel(
Helper::getVehicle(vehicleID)->getSingularType().getID(), decel);
1592 Vehicle::setApparentDecel(
const std::string& vehicleID,
double decel) {
1598 Vehicle::setImperfection(
const std::string& vehicleID,
double imperfection) {
1604 Vehicle::setTau(
const std::string& vehicleID,
double tau) {
1610 Vehicle::setMinGapLat(
const std::string& vehicleID,
double minGapLat) {
1616 Vehicle::setMaxSpeedLat(
const std::string& vehicleID,
double speed) {
1622 Vehicle::setLateralAlignment(
const std::string& vehicleID,
const std::string& latAlignment) {
1632 if (tok.
size() < 3) {
1633 throw TraCIException(
"Invalid device parameter '" + key +
"' for vehicle '" + vehicleID +
"'");
1638 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support device parameter '" + key +
"' (" + e.what() +
").");
1641 const std::string attrName = key.substr(16);
1645 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support laneChangeModel parameter '" + key +
"' (" + e.what() +
").");
1648 const std::string attrName = key.substr(15);
1652 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support carFollowModel parameter '" + key +
"' (" + e.what() +
").");
1656 if (tok.
size() != 3) {
1657 throw TraCIException(
"Invalid request for device status change. Expected format is 'has.DEVICENAME.device'");
1659 const std::string deviceName = tok.
get(1);
1664 throw TraCIException(
"Changing device status requires a 'true' or 'false'");
1667 throw TraCIException(
"Device removal is not supported for device of type '" + deviceName +
"'");
1672 throw TraCIException(
"Cannot create vehicle device (" + std::string(e.what()) +
").");
1687 const double l2 = veh->
getLength() * 0.5;
1694 const unsigned int nPoints = 34;
1698 #ifdef DEBUG_DYNAMIC_SHAPES
1699 std::cout <<
SIMTIME <<
" Vehicle::highlight() for vehicle '" << vehicleID <<
"'\n"
1700 <<
" circle: " << circlePV << std::endl;
1715 lyr += (type + 1) / 257.;
1721 double maxAttack = 1.0;
1722 std::vector<double> timeSpan;
1723 if (duration > 0.) {
1724 timeSpan = {0,
MIN2(maxAttack, duration / 3.), 2.*duration / 3., duration};
1727 std::vector<double> alphaSpan;
1728 if (alphaMax > 0.) {
1729 alphaSpan = {0., (double) alphaMax, (
double)(alphaMax) / 3., 0.};
1742 Vehicle::subscribe(vehicleID, std::vector<int>({
libsumo::VAR_LEADER}), beginTime, endTime);
1752 std::shared_ptr<VariableWrapper>
1792 return wrapper->
wrapColor(objID, variable, getColor(objID));
1816 return wrapper->
wrapInt(objID, variable, getPersonCapacity(objID));
1836 return wrapper->
wrapDouble(objID, variable, getSpeedFactor(objID));
1855 rp.
pos = lead.second;
static std::string getLaneID(const std::string &vehicleID)
static MSEdge * getEdge(const std::string &edgeID)
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
The car-following model and parameter.
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
static void highlight(const std::string &vehicleID, const TraCIColor &col, double size, const int alphaMax, const double duration, const int type)
TRACI_CONST int VAR_LANE_ID
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
#define UNUSED_PARAMETER(x)
void setHeight(const double &height)
Set a new value for this type's height.
static void setSpeed(const std::string &vehicleID, double speed)
static ContextSubscriptionResults myContextSubscriptionResults
TRACI_CONST int VAR_SPEEDSETMODE
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
static void setStop(const std::string &vehicleID, const std::string &edgeID, double pos=1., int laneIndex=0, double duration=INVALID_DOUBLE_VALUE, int flags=STOP_DEFAULT, double startPos=INVALID_DOUBLE_VALUE, double until=INVALID_DOUBLE_VALUE)
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive.
static void setLaneChangeMode(const std::string &vehicleID, int laneChangeMode)
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
static double getHCEmission(const std::string &vehicleID)
const std::string & getID() const
Returns the name of the vehicle type.
static SubscriptionResults mySubscriptionResults
bool hasDeparted() const
Returns whether this vehicle has already departed.
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
void setPreferredLateralAlignment(LateralAlignment latAlignment)
Set vehicle's preferred lateral alignment.
TRACI_CONST int VAR_ROUTE_INDEX
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color)
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
static std::string getRouteID(const std::string &vehicleID)
void setMinGapLat(const double &minGapLat)
Set a new value for this type's minimum lataral gap.
static TraCIPosition getPosition(const std::string &vehicleID, const bool includeZ=false)
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
void setAccel(double accel)
Set a new value for this type's acceleration.
#define WRITE_WARNING(msg)
bool reached
Information whether the stop has been reached.
std::list< Stop > getMyStops()
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
static void openGap(const std::string &vehicleID, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel=INVALID_DOUBLE_VALUE, const std::string &referenceVehID="")
double duration
The stopping duration.
Representation of a lane in the micro simulation.
bool isStopped() const
Returns whether the vehicle is at a stop.
void setDeviceParameter(const std::string &deviceName, const std::string &key, const std::string &value)
try to set the given parameter from any of the vehicles devices, raise InvalidArgument if no device p...
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
static void addDynamics(const std::string &polygonID, const std::string &trackedID="", const std::vector< double > &timeSpan=std::vector< double >(), const std::vector< double > &alphaSpan=std::vector< double >(), bool looped=false, bool rotate=true)
static double getEffort(const std::string &vehicleID, double time, const std::string &edgeID)
static MSVehicle * getVehicle(const std::string &id)
TRACI_CONST double INVALID_DOUBLE_VALUE
bool isLinkEnd(MSLinkCont::const_iterator &i) const
virtual double getImperfection() const
Get the driver's imperfection.
static double getFuelConsumption(const std::string &vehicleID)
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
TRACI_CONST int VAR_POSITION
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
static double getCO2Emission(const std::string &vehicleID)
TRACI_CONST int VAR_FUELCONSUMPTION
RGBColor color
The vehicle's color, TraCI may change this.
static std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction)
static TraCIColor makeTraCIColor(const RGBColor &color)
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=nullptr)
Returns the named vehicle type or a sample from the named distribution.
static int getStopState(const std::string &vehicleID)
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
std::string lane
The lane to stop at.
static int getSpeedMode(const std::string &vehicleID)
static bool isRouteValid(const std::string &vehicleID)
double until
The time at which the vehicle may continue its journey.
static double getSlope(const std::string &vehicleID)
SUMOTime duration
The stopping duration.
const std::pair< int, int > & getSavedState(const int dir) const
TRACI_CONST int VAR_SPEED_WITHOUT_TRACI
TRACI_CONST int VAR_ROAD_ID
MSRouteIterator end() const
Returns the end of the list of edges to pass.
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
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...
bool hasInfluencer() const
ConstMSEdgeVector::const_iterator MSRouteIterator
double z() const
Returns the z-position.
TRACI_CONST int REMOVE_PARKING
double departSpeed
(optional) The initial speed of the vehicle
static int getLaneIndex(const std::string &vehicleID)
TRACI_CONST int VAR_COLOR
double length
The overall length which may be driven when using this lane without a lane change.
static double getAccumulatedWaitingTime(const std::string &vehicleID)
static void resume(const std::string &vehicleID)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
void setVClass(SUMOVehicleClass vclass)
Set a new value for this type's vehicle class.
const int VEHPARS_FORCE_REROUTE
TRACI_CONST int VAR_SIGNALS
double getApparentDecel() const
Get the vehicle type's apparent deceleration [m/s^2] (the one regarded by its followers.
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.
int bestLaneOffset
The offset of this lane from the best lane.
static void setRouteID(const std::string &vehicleID, const std::string &routeID)
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
bool addTraciStopAtStoppingPlace(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string &errorMsg)
double getMaxSpeedLat() const
Get vehicle's maximum lateral speed [m/s].
TRACI_CONST int VAR_WAITING_TIME
MSInsertionControl & getInsertionControl()
Returns the insertion control.
double getLength() const
Returns the vehicle's length.
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.
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
static std::shared_ptr< VariableWrapper > makeWrapper()
TRACI_CONST int VAR_ALLOWED_SPEED
A structure representing the best lanes for continuing the current route starting at 'lane'.
static int getSignals(const std::string &vehicleID)
Representation of a vehicle.
static bool moveToXYMap(const Position &pos, double maxRouteDistance, bool mayLeaveNetwork, const std::string &origID, const double angle, double speed, const ConstMSEdgeVector ¤tRoute, const int routePosition, MSLane *currentLane, double currentLanePos, bool onRoad, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
static double naviDegree(const double angle)
const MSRoute & getRoute() const
Returns the current route.
bool resumeFromStopping()
std::vector< const MSEdge * > ConstMSEdgeVector
TRACI_CONST int VAR_PERSON_NUMBER
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
double getSpeedLat() const
return the lateral speed of the current lane change maneuver
virtual bool wrapRoadPosition(const std::string &objID, const int variable, const TraCIRoadPosition &value)=0
void activateGapController(double originalTau, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, MSVehicle *refVeh=nullptr)
Activates the gap control with the given parameters,.
TRACI_CONST int VAR_COEMISSION
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
static void moveTo(const std::string &vehicleID, const std::string &laneID, double position)
const ConstMSEdgeVector & getEdges() const
int tlIndex
The tls index of the controlled link.
Structure representing possible vehicle parameter.
TRACI_CONST int INVALID_INT_VALUE
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
void setMinGap(const double &minGap)
Set a new value for this type's minimum gap.
TRACI_CONST int VAR_NOISEEMISSION
const std::shared_ptr< MSLeaderDistanceInfo > getLeaders(const int dir)
Returns the neighboring, lc-relevant leaders for the last step in the requested direction.
void setWidth(const double &width)
Set a new value for this type's width.
TRACI_CONST int VAR_LEADER
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
TRACI_CONST int VAR_ROUTE_ID
static void deactivateGapControl(const std::string &vehicleID)
int getPersonCapacity() const
Get this vehicle type's person capacity.
The vehicle was teleported out of the net.
double dist
The distance to the tls.
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
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 getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
bool triggered
whether an arriving person lets the vehicle continue
double getSlope() const
Returns the slope of the road at vehicle's position.
std::string stoppingPlaceID
Id assigned to the stop.
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
virtual bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)=0
static std::vector< TraCIBestLanesData > getBestLanes(const std::string &vehicleID)
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
static double gLateralResolution
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
The vehicle got vaporized.
double getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
bool allowsContinuation
Whether this lane allows continuing the route.
TRACI_CONST int REMOVE_TELEPORT
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
static double getLateralLanePosition(const std::string &vehicleID)
static double getLastActionTime(const std::string &vehicleID)
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
static PositionVector makeRing(const double radius1, const double radius2, const Position ¢er, unsigned int nPoints)
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT() const
static double getDrivingDistance(const std::string &vehicleID, const std::string &edgeID, double position, int laneIndex=0)
bool isInternal() const
return whether this edge is an internal edge
void switchOffSignal(int signal)
Switches the given signal off.
void switchOnSignal(int signal)
Switches the given signal on.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
TRACI_CONST int VAR_NOXEMISSION
static void add(const std::string &routeID, const std::vector< std::string > &edgeIDs)
std::string line
The vehicle's line (mainly for public transport)
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 changeSublane(const std::string &vehicleID, double latDist)
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
static void setSignals(const std::string &vehicleID, int signals)
std::string get(int pos) const
returns the item at the given position
int getSpeedMode() const
return the current speed mode
static std::vector< std::string > getVia(const std::string &vehicleID)
TRACI_CONST int VAR_STOPSTATE
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
char state
The current state of the tls.
void createDevice(const std::string &deviceName)
create device of the given type
double getPMxEmissions() const
Returns PMx emission of the current state.
double getDepartPos() const
Returns this vehicle's real departure position.
static TraCIPosition getPosition3D(const std::string &vehicleID)
std::vector< double > & getParameter()
Returns the parameters of this distribution.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
std::string getDeviceParameter(const std::string &deviceName, const std::string &key) const
try to retrieve the given parameter from any of the vehicles devices, raise InvalidArgument if no dev...
double occupation
The traffic density along length.
TRACI_CONST int VAR_ACCUMULATED_WAITING_TIME
double endPos
The stopping position end.
double getPositionOnLane() const
Get the vehicle's position along the lane.
static void rerouteParkingArea(const std::string &vehicleID, const std::string &parkingAreaID)
std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
static void setParameter(const std::string &vehicleID, const std::string &key, const std::string &value)
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
virtual void setParameter(MSVehicle *veh, const std::string &key, const std::string &value) const
try to set the given parameter for this carFollowingModel
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
TRACI_CONST int VAR_ROUTE_VALID
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
TRACI_CONST int VAR_ANGLE
static double getLateralSpeed(const std::string &vehicleID)
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
static void requestToC(const std::string &vehID, double leadTime)
void setChosenSpeedFactor(const double factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
double length
The length than can be driven from that lane without lane change.
static void setRoute(const std::string &vehicleID, const std::vector< std::string > &edgeIDs)
static double getCOEmission(const std::string &vehicleID)
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
double getCOEmissions() const
Returns CO emission of the current state.
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
static LIBSUMO_SUBSCRIPTION_API void addHighlightPolygon(const std::string &objectID, const int type, const std::string &polygonID, const TraCIPositionVector &shape, const TraCIColor &color, bool fill, const std::string &polygonType, int layer, double lineWidth)
static std::vector< std::string > getIDList()
const int VEHPARS_COLOR_SET
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.
TRACI_CONST int REMOVE_VAPORIZED
The vehicle is blocked by right follower.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static bool isOnInit(const std::string &vehicleID)
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....
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
static int getRoutingMode(const std::string &vehicleID)
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
TRACI_CONST int VAR_SLOPE
std::string id
The vehicle's id.
TRACI_CONST int VAR_PMXEMISSION
double getLength() const
Returns the lane's length.
static std::string getParameter(const std::string &vehicleID, const std::string &key)
static void updateBestLanes(const std::string &vehicleID)
virtual std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key
TRACI_CONST int VAR_LASTACTIONTIME
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
double arrivalPos
(optional) The position the vehicle shall arrive on
std::string fromTaz
The vehicle's origin zone (district)
void setSublaneChange(double latDist)
Sets a new sublane-change request.
static bool moveToXYMap_matchingRoutePosition(const Position &pos, const std::string &origID, const ConstMSEdgeVector ¤tRoute, int routeIndex, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset)
TRACI_CONST int REMOVE_ARRIVED
MSAbstractLaneChangeModel & getLaneChangeModel()
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
double getAngle() const
Returns the vehicle's direction in radians.
A point in 2D or 3D with translation and scaling methods.
static std::vector< std::string > getPersonIDList(const std::string &vehicleID)
MSLane * lane
The described lane.
void setRoutingMode(int value)
Sets routing behavior.
double getHCEmissions() const
Returns HC emission of the current state.
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
TRACI_CONST int TRACI_ID_LIST
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.
void setLength(const double &length)
Set a new value for this type's length.
void sub(double dx, double dy)
Substracts the given position from this one.
static double getAcceleration(const std::string &vehicleID)
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.
const MSEdge * getNextNormal() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
double getMinGap() const
Get the free space in front of vehicles of this class.
int getSignals() const
Returns the signals.
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
A road/street connecting two junctions.
std::string laneID
The id of the lane.
static double getSpeed(const std::string &vehicleID)
MSRouteIterator edge
The edge in the route to stop at.
bool allowsContinuation
Whether this lane allows to continue the drive.
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
static void remove(const std::string &vehicleID, char reason=REMOVE_VAPORIZED)
void removeEffort(const MSEdge *const e)
Removes the effort information for an edge.
double getNOxEmissions() const
Returns NOx emission of the current state.
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
TRACI_CONST int VAR_SPEED_FACTOR
The vehicle has departed (was inserted into the network)
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs.
static std::string getTypeID(const std::string &vehicleID)
int size() const
returns the number of existing substrings
static void changeLane(const std::string &vehicleID, int laneIndex, double duration)
bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true)
Replaces the current route by the given edges.
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
int getRoutingMode() const
return the current routing mode
TRACI_CONST int VAR_DISTANCE
virtual void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this laneChangeModel. Throw exception for unsupported key
static void slowDown(const std::string &vehicleID, double speed, double duration)
static std::string getLine(const std::string &vehicleID)
void setShape(SUMOVehicleShape shape)
Set a new value for this type's shape.
const SUMOVehicleParameter::Stop pars
The stop parameter.
static void changeTarget(const std::string &vehicleID, const std::string &edgeID)
TRACI_CONST int VAR_EDGES
Definition of vehicle stop (position and duration)
double startPos
The stopping position start.
MSLane * getLane() const
Returns the lane the vehicle is on.
virtual std::string getParameter(const MSVehicle *veh, const std::string &key) const
try to get the given parameter for this carFollowingModel
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 double getAllowedSpeed(const std::string &vehicleID)
static std::vector< TraCINextStopData > getNextStops(const std::string &vehicleID)
void setMaxSpeedLat(const double &maxSpeedLat)
Set a new value for this type's maximum lateral speed.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position
MSEdge & getEdge() const
Returns the lane's edge.
static void setLine(const std::string &vehicleID, const std::string &line)
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
std::string id
The id of the next tls.
static int getRouteIndex(const std::string &vehicleID)
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
MSStoppingPlace * chargingStation
(Optional) charging station if one is assigned to the stop
Influencer & getInfluencer()
Returns the velocity/lane influencer.
TRACI_CONST int REMOVE_TELEPORT_ARRIVED
static void rerouteTraveltime(const std::string &vehicleID, const bool currentTravelTimes=true)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void rerouteEffort(const std::string &vehicleID)
const PositionVector & getShape() const
Returns this lane's shape.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
TRACI_CONST int VAR_CO2EMISSION
bool containerTriggered
whether an arriving container lets the vehicle continue
static bool isVisible(const SUMOVehicle *veh)
std::vector< MSLane * > bestContinuations
std::vector< std::string > getPersonIDList() const
Returns the list of persons.
static void setSpeedMode(const std::string &vehicleID, int speedMode)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static bool exists(std::string polyID)
Checks if a polygon of the given name exists already in the simulation.
TRACI_CONST int VAR_LANEPOSITION_LAT
std::vector< std::string > via
List of the via-edges the vehicle must visit.
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
The vehicle arrived at its destination (is deleted)
TRACI_CONST int VAR_LANECHANGE_MODE
TRACI_CONST int LAST_STEP_PERSON_ID_LIST
double getActionStepLengthSecs() const
Returns this type's default action step length in seconds.
bool hasDevice(const std::string &deviceName) const
check whether the vehicle is equiped with a device of the given type
void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static double getDrivingDistance2D(const std::string &vehicleID, double x, double y)
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
LIBSUMO_VEHICLE_TYPE_SETTER static LIBSUMO_SUBSCRIPTION_API void subscribeLeader(const std::string &vehicleID, double dist=0., double beginTime=libsumo::INVALID_DOUBLE_VALUE, double endTime=libsumo::INVALID_DOUBLE_VALUE)
static void setRemoteControlled(MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
bool addTraciStop(MSLane *const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
double getLength() const
Get vehicle's length [m].
void setLaneChangeMode(int value)
Sets lane changing behavior.
double getElectricityConsumption() const
Returns electricity consumption of the current state.
static double getNoiseEmission(const std::string &vehicleID)
TRACI_CONST int VAR_SPEED_LAT
void setApparentDecel(double apparentDecel)
Set a new value for this type's apparent deceleration.
static void setEffort(const std::string &vehicleID, const std::string &edgeID, double effort=INVALID_DOUBLE_VALUE, double begSeconds=0, double endSeconds=std::numeric_limits< double >::max())
int getRoutePosition() const
static double getAdaptedTraveltime(const std::string &vehicleID, double time, const std::string &edgeID)
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
static double getSpeedWithoutTraCI(const std::string &vehicleID)
void setSignals(int signals)
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
std::vector< MSEdge * > MSEdgeVector
TRACI_CONST int VAR_LANEPOSITION
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
TRACI_CONST int VAR_POSITION3D
TRACI_CONST int VAR_ACCELERATION
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
int getPersonNumber() const
Returns the number of persons.
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
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.
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
const std::string & getID() const
Returns the name of the vehicle.
static void setType(const std::string &vehicleID, const std::string &typeID)
static double getAngle(const std::string &vehicleID)
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
int getLaneChangeMode() const
return the current lane change mode
double getFuelConsumption() const
Returns fuel consumption of the current state.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
double getAcceleration() const
Returns the vehicle's acceleration in m/s (this is computed as the last step's mean acceleration in c...
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
double getWidth() const
Returns the lane's width.
The vehicle is blocked by right leader.
TRACI_CONST int VAR_ELECTRICITYCONSUMPTION
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
static double getNOxEmission(const std::string &vehicleID)
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
An edgeId, position and laneIndex.
static double getWaitingTime(const std::string &vehicleID)
static int getPersonNumber(const std::string &vehicleID)
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type's maximum speed.
The class responsible for building and deletion of vehicles.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
TRACI_CONST int VAR_HCEMISSION
double getSpeed() const
Returns the vehicle's current speed.
static double getPMxEmission(const std::string &vehicleID)
static int getLaneChangeMode(const std::string &vehicleID)
void removeTravelTime(const MSEdge *const e)
Removes the travel time information for an edge.
TRACI_CONST int VAR_SPEED
void setActionStepLength(double actionStepLength, bool resetActionOffset=true)
Sets the action steplength of the vehicle.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
static void setAdaptedTraveltime(const std::string &vehicleID, const std::string &edgeID, double time=INVALID_DOUBLE_VALUE, double begSeconds=0, double endSeconds=std::numeric_limits< double >::max())
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
static double getLanePosition(const std::string &vehicleID)
void deactivateGapController()
Deactivates the gap control.
std::string toTaz
The vehicle's destination zone (district)
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
static std::vector< std::pair< std::string, double > > getNeighbors(const std::string &vehicleID, const int mode)
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
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.
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
void reroute(SUMOTime t, const std::string &info, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false, const bool silent=false)
Performs a rerouting using the given router.
TRACI_CONST int VAR_PERSON_CAPACITY
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
virtual bool wrapPosition(const std::string &objID, const int variable, const TraCIPosition &value)=0
vehicles ignoring classes
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true, int routePosition=0) const
Compute the distance between 2 given edges on this route, including the length of internal lanes....
bool parking
whether the vehicle is removed from the net while stopping
static const MSVehicleType & getVehicleType(const std::string &vehicleID)
static void setRoutingMode(const std::string &vehicleID, int routingMode)
void setz(double z)
set position z
double nextOccupation
As occupation, but without the first lane.
const std::string & getID() const
Returns the id.
Notification
Definition of a vehicle state.
double getCO2Emissions() const
Returns CO2 emission of the current state.
static std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist=0.)
TRACI_CONST int VAR_LANE_INDEX
virtual bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const =0
Returns the information whether the vehicle is fully controlled via TraCI.
int getIndex() const
Returns the lane's index.
static std::vector< std::string > getRoute(const std::string &vehicleID)
static void setVia(const std::string &vehicleID, const std::vector< std::string > &via)
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
The action has not been determined.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
bool rerouteParkingArea(const std::string &parkingAreaID, std::string &errorMsg)
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
static std::vector< TraCINextTLSData > getNextTLS(const std::string &vehicleID)
The vehicle is being teleported.
virtual bool isParking() const =0
Returns the information whether the vehicle is parked.
double departPos
(optional) The position the vehicle shall depart from
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
void setTau(double tau)
Set a new value for this type's headway.
The vehicle is discarded if emission fails (not fully implemented yet)
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
assigns new values
void setEmissionClass(SUMOEmissionClass eclass)
Set a new value for this type's emission class.
static std::string getRoadID(const std::string &vehicleID)
TRACI_CONST int VAR_ROUTING_MODE
void setImperfection(double imperfection)
Set a new value for this type's imperfection.
static void changeLaneRelative(const std::string &vehicleID, int indexOffset, double duration)
static void add(const std::string &vehicleID, const std::string &routeID, const std::string &typeID="DEFAULT_VEHTYPE", const std::string &depart="now", const std::string &departLane="first", const std::string &departPos="base", const std::string &departSpeed="0", const std::string &arrivalLane="current", const std::string &arrivalPos="max", const std::string &arrivalSpeed="current", const std::string &fromTaz="", const std::string &toTaz="", const std::string &line="", int personCapacity=4, int personNumber=0)
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
The vehicle is blocked by left follower.
static double getDistance(const std::string &vehicleID)
static void moveToXY(const std::string &vehicleID, const std::string &edgeID, const int laneIndex, const double x, const double y, double angle=INVALID_DOUBLE_VALUE, const int keepRoute=1)
Representation of a vehicle in the micro simulation.
static double getElectricityConsumption(const std::string &vehicleID)
void alreadyDeparted(SUMOVehicle *veh)
stops trying to emit the given vehicle (because it already departed)