48#define FAR_AWAY 1000.0
64std::vector<std::string>
67 std::vector<std::string> ids;
70 ids.push_back(i->first);
84Person::getPosition(
const std::string& personID,
const bool includeZ) {
90Person::getPosition3D(
const std::string& personID) {
96Person::getAngle(
const std::string& personID) {
102Person::getSlope(
const std::string& personID) {
103 MSPerson* person = getPerson(personID);
105 const MSLane* lane = getSidewalk<MSEdge, MSLane>(person->
getEdge());
106 if (lane ==
nullptr) {
115Person::getArrivalPos(
const std::string& personID) {
116 return getPerson(personID)->getArrivalPos();
121Person::getSpeed(
const std::string& personID) {
122 return getPerson(personID)->getSpeed();
127Person::getRoadID(
const std::string& personID) {
128 return getPerson(personID)->getEdge()->getID();
133Person::getLaneID(
const std::string& personID) {
139Person::getLanePosition(
const std::string& personID) {
140 return getPerson(personID)->getEdgePos();
145Person::getWalkingDistance(
const std::string& personID,
const std::string& edgeID,
double pos,
int laneIndex) {
152 auto it = std::find(edges.begin(), edges.end(), &lane->
getEdge());
153 if (it == edges.end()) {
155 throw TraCIException(
TLF(
"Edge '%' does not occur within the remaining walk of person '%'.", edgeID, personID));
158 edges.erase(it + 1, edges.end());
162 if (distance == std::numeric_limits<double>::max()) {
168 throw TraCIException(
TLF(
"Person '%' is not walking", personID));
174Person::getWalkingDistance2D(
const std::string& personID,
double x,
double y) {
177 return getWalkingDistance(personID, roadPos.first->getEdge().getID(), roadPos.second, roadPos.first->getIndex());
182std::vector<TraCIReservation>
183Person::getTaxiReservations(
int onlyNew) {
184 std::vector<TraCIReservation> result;
186 if (dispatcher !=
nullptr) {
188 if (filterReservation(onlyNew, res, result)) {
195 if (includeRunning) {
197 filterReservation(onlyNew, res, result);
206Person::reservation_by_id_sorter::operator()(
const TraCIReservation& r1,
const TraCIReservation& r2)
const {
207 return r1.id < r2.id;
212Person::splitTaxiReservation(std::string reservationID,
const std::vector<std::string>& personIDs) {
214 if (dispatcher !=
nullptr) {
216 if (traciDispatcher !=
nullptr) {
220 throw TraCIException(
"device.taxi.dispatch-algorithm 'traci' has not been loaded");
224Person::filterReservation(
int onlyNew,
const Reservation* res, std::vector<libsumo::TraCIReservation>& reservations) {
225 if (onlyNew != 0 && (onlyNew & res->
state) == 0) {
228 std::vector<std::string> personIDs;
230 personIDs.push_back(p->getID());
232 std::sort(personIDs.begin(), personIDs.end());
233 reservations.push_back(TraCIReservation(res->
id,
249Person::getColor(
const std::string& personID) {
250 const RGBColor& col = getPerson(personID)->getParameter().color;
253 tcol.g = col.
green();
255 tcol.a = col.
alpha();
261Person::getTypeID(
const std::string& personID) {
262 return getPerson(personID)->getVehicleType().getID();
267Person::getWaitingTime(
const std::string& personID) {
268 return getPerson(personID)->getWaitingSeconds();
273Person::getNextEdge(
const std::string& personID) {
274 return getPerson(personID)->getNextEdge();
278std::vector<std::string>
279Person::getEdges(
const std::string& personID,
int nextStageIndex) {
282 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
285 throw TraCIException(
"The negative stage index must refer to a valid previous stage.");
287 std::vector<std::string> edgeIDs;
290 edgeIDs.push_back(e->getID());
298Person::getStage(
const std::string& personID,
int nextStageIndex) {
302 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
305 throw TraCIException(
"The negative stage index " +
toString(nextStageIndex) +
" must refer to a valid previous stage.");
313 result.edges.push_back(e->getID());
317 if (destinationStop !=
nullptr) {
318 result.destStop = destinationStop->
getID();
322 if (result.length == -1.) {
344 const std::set<std::string> lines = drivingStage->
getLines();
345 for (
auto line = lines.begin(); line != lines.end(); line++) {
346 if (line != lines.begin()) {
349 result.line += *line;
355 result.departPos = walkingStage->getDepartPos();
360 if (waitingStage->getPlannedDuration() > 0) {
361 result.travelTime =
STEPS2TIME(waitingStage->getPlannedDuration());
373Person::getRemainingStages(
const std::string& personID) {
374 return getPerson(personID)->getNumRemainingStages();
379Person::getVehicle(
const std::string& personID) {
380 const SUMOVehicle* veh = getPerson(personID)->getVehicle();
381 if (veh ==
nullptr) {
390Person::getParameter(
const std::string& personID,
const std::string& param) {
391 return getPerson(personID)->getParameter().getParameter(param,
"");
399Person::getEmissionClass(
const std::string& personID) {
405Person::getShapeClass(
const std::string& personID) {
411Person::getLength(
const std::string& personID) {
412 return getPerson(personID)->getVehicleType().getLength();
417Person::getSpeedFactor(
const std::string& personID) {
418 return getPerson(personID)->getChosenSpeedFactor();
423Person::getAccel(
const std::string& personID) {
424 return getPerson(personID)->getVehicleType().getCarFollowModel().getMaxAccel();
429Person::getDecel(
const std::string& personID) {
430 return getPerson(personID)->getVehicleType().getCarFollowModel().getMaxDecel();
434double Person::getEmergencyDecel(
const std::string& personID) {
435 return getPerson(personID)->getVehicleType().getCarFollowModel().getEmergencyDecel();
439double Person::getApparentDecel(
const std::string& personID) {
440 return getPerson(personID)->getVehicleType().getCarFollowModel().getApparentDecel();
444double Person::getActionStepLength(
const std::string& personID) {
445 return getPerson(personID)->getVehicleType().getActionStepLengthSecs();
450Person::getTau(
const std::string& personID) {
451 return getPerson(personID)->getVehicleType().getCarFollowModel().getHeadwayTime();
456Person::getImperfection(
const std::string& personID) {
457 return getPerson(personID)->getVehicleType().getCarFollowModel().getImperfection();
462Person::getSpeedDeviation(
const std::string& personID) {
463 return getPerson(personID)->getVehicleType().getSpeedFactor().getParameter(1);
468Person::getVehicleClass(
const std::string& personID) {
469 return toString(getPerson(personID)->getVehicleType().getVehicleClass());
474Person::getMinGap(
const std::string& personID) {
475 return getPerson(personID)->getVehicleType().getMinGap();
480Person::getMinGapLat(
const std::string& personID) {
481 return getPerson(personID)->getVehicleType().getMinGapLat();
486Person::getMaxSpeed(
const std::string& personID) {
487 return getPerson(personID)->getMaxSpeed();
492Person::getMaxSpeedLat(
const std::string& personID) {
493 return getPerson(personID)->getVehicleType().getMaxSpeedLat();
498Person::getLateralAlignment(
const std::string& personID) {
499 return toString(getPerson(personID)->getVehicleType().getPreferredLateralAlignment());
504Person::getWidth(
const std::string& personID) {
505 return getPerson(personID)->getVehicleType().getWidth();
510Person::getHeight(
const std::string& personID) {
511 return getPerson(personID)->getVehicleType().getHeight();
516Person::getMass(
const std::string& personID) {
517 return getPerson(personID)->getVehicleType().getMass();
522Person::getPersonCapacity(
const std::string& personID) {
523 return getPerson(personID)->getVehicleType().getPersonCapacity();
528Person::getBoardingDuration(
const std::string& personID) {
529 return STEPS2TIME(getPerson(personID)->getVehicleType().getBoardingDuration(
true));
534Person::getImpatience(
const std::string& personID) {
535 return getPerson(personID)->getImpatience();
540Person::setSpeed(
const std::string& personID,
double speed) {
541 getPerson(personID)->setSpeed(speed);
546Person::setType(
const std::string& personID,
const std::string& typeID) {
548 if (vehicleType ==
nullptr) {
549 throw TraCIException(
"The vehicle type '" + typeID +
"' is not known.");
551 getPerson(personID)->replaceVehicleType(vehicleType);
556Person::add(
const std::string& personID,
const std::string& edgeID,
double pos,
double departInSecs,
const std::string typeID) {
559 p = getPerson(personID);
560 }
catch (TraCIException&) {
565 throw TraCIException(
"The person " + personID +
" to add already exists.");
570 vehicleParams.
id = personID;
574 throw TraCIException(
"Invalid type '" + typeID +
"' for person '" + personID +
"'");
579 throw TraCIException(
"Invalid edge '" + edgeID +
"' for person: '" + personID +
"'");
582 if (departInSecs < 0.) {
583 const int proc = (int) - departInSecs;
585 throw TraCIException(
"Invalid departure time." +
toString(depart) +
" " +
toString(proc));
591 WRITE_WARNINGF(
TL(
"Departure time=% for person '%' is in the past; using current time=% instead."),
594 vehicleParams.
depart = depart;
599 throw TraCIException(
"Invalid departure position.");
608 plan->push_back(
new MSStageWaiting(edge,
nullptr, 0, depart, pos,
"awaiting departure",
true));
616 throw TraCIException(e.what());
621Person::convertTraCIStage(
const TraCIStage& stage,
const std::string personID) {
623 if (!stage.destStop.empty()) {
626 throw TraCIException(
"Invalid stopping place id '" + stage.destStop +
"' for person: '" + personID +
"'");
629 switch (stage.type) {
631 if (stage.edges.empty()) {
632 throw TraCIException(
"The stage should have at least one edge");
634 std::string toId = stage.edges.back();
637 throw TraCIException(
"Invalid edge '" + toId +
"' for person: '" + personID +
"'");
644 if (stage.line.empty()) {
645 throw TraCIException(
"Empty lines parameter for person: '" + personID +
"'");
647 double arrivalPos = stage.arrivalPos;
664 throw TraCIException(e.what());
667 throw TraCIException(
"Empty edge list for walking stage of person '" + personID +
"'.");
669 double arrivalPos = stage.arrivalPos;
670 if (fabs(arrivalPos) > edges.back()->getLength()) {
671 throw TraCIException(
"Invalid arrivalPos for walking stage of person '" + personID +
"'.");
673 if (arrivalPos < 0) {
674 arrivalPos += edges.back()->getLength();
681 if (stage.travelTime < 0) {
682 throw TraCIException(
"Duration for person: '" + personID +
"' must not be negative");
692 throw TraCIException(e.what());
694 if ((edges.size() == 0 && bs ==
nullptr) || edges.size() > 1) {
695 throw TraCIException(
"A trip should be defined with a destination edge or a destination stop for person '" + personID +
"'.");
697 const MSEdge* to =
nullptr;
700 if (edges.size() > 0 && to != edges.back()) {
701 throw TraCIException(
"Mismatching destination edge and destination stop edge for person '" + personID +
"'.");
710 if (vType ==
nullptr) {
711 throw TraCIException(
"The vehicle type '" + vtypeid +
"' in a trip for person '" + personID +
"' is not known.");
715 if (stage.line.empty()) {
718 std::string errorMsg;
720 throw TraCIException(errorMsg);
724 double arrivalPos = stage.arrivalPos;
726 if (fabs(arrivalPos) > to->
getLength()) {
727 throw TraCIException(
"Invalid arrivalPos for walking stage of person '" + personID +
"'.");
729 if (arrivalPos < 0) {
735 std::string group = stage.intended;
737 const double speed = -1;
739 duration, modeSet, stage.vType, speed, walkfactor, group,
749Person::appendStage(
const std::string& personID,
const TraCIStage& stage) {
751 MSStage* personStage = convertTraCIStage(stage, personID);
757Person::replaceStage(
const std::string& personID,
const int stageIndex,
const TraCIStage& stage) {
760 throw TraCIException(
"Specified stage index: is not valid for person " + personID);
762 MSStage* personStage = convertTraCIStage(stage, personID);
771Person::appendDrivingStage(
const std::string& personID,
const std::string& toEdge,
const std::string& lines,
const std::string& stopID) {
775 throw TraCIException(
"Invalid edge '" + toEdge +
"' for person: '" + personID +
"'");
777 if (lines.size() == 0) {
778 throw TraCIException(
"Empty lines parameter for person: '" + personID +
"'");
784 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
792Person::appendWaitingStage(
const std::string& personID,
double duration,
const std::string& description,
const std::string& stopID) {
795 throw TraCIException(
"Duration for person: '" + personID +
"' must not be negative");
801 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
809Person::appendWalkingStage(
const std::string& personID,
const std::vector<std::string>& edgeIDs,
double arrivalPos,
double duration,
double speed,
const std::string& stopID) {
815 throw TraCIException(e.what());
818 throw TraCIException(
"Empty edge list for walking stage of person '" + personID +
"'.");
820 if (fabs(arrivalPos) > edges.back()->getLength()) {
821 throw TraCIException(
"Invalid arrivalPos for walking stage of person '" + personID +
"'.");
823 if (arrivalPos < 0) {
824 arrivalPos += edges.back()->getLength();
830 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
838Person::removeStage(
const std::string& personID,
int nextStageIndex) {
841 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
843 if (nextStageIndex < 0) {
844 throw TraCIException(
"The stage index may not be negative.");
851Person::rerouteTraveltime(
const std::string& personID) {
854 throw TraCIException(
"Person '" + personID +
"' has no remaining stages.");
864 throw TraCIException(
"Person '" + personID +
"' cannot reroute after the current stop.");
870 int nextIndex = firstIndex + 1;
882 if (newEdges.empty()) {
883 throw TraCIException(
"Could not find new route for person '" + personID +
"'.");
886 assert(!oldEdges.empty());
888 oldEdges.erase(oldEdges.begin());
891 if (newEdges == oldEdges && (firstIndex + 1 == nextIndex)) {
894 if (newEdges.front() != from) {
896 newEdges.insert(newEdges.begin(), from);
898 p->
replaceWalk(newEdges, departPos, firstIndex, nextIndex);
903Person::moveTo(
const std::string& personID,
const std::string& laneID,
double pos,
double posLat) {
907 throw TraCIException(
"Unknown lane '" + laneID +
"'.");
913 throw TraCIException(
"Invalid lateral position " +
toString(posLat) +
" on lane '" + laneID +
"'.");
923 throw TraCIException(
"Command moveTo is not supported for person '" + personID +
"' while " + p->
getCurrentStageDescription() +
".");
929Person::moveToXY(
const std::string& personID,
const std::string& edgeID,
const double x,
const double y,
double angle,
const int keepRoute,
double matchThreshold) {
931 const bool doKeepRoute = (keepRoute & 1) != 0;
932 const bool mayLeaveNetwork = (keepRoute & 2) != 0;
933 const bool ignorePermissions = (keepRoute & 4) != 0;
937 const double origAngle = angle;
942 while (angle >= 360.) {
951 std::cout <<
" want pos:" << pos <<
" edgeID:" << edgeID <<
" origAngle:" << origAngle <<
" angle:" << angle <<
" keepRoute:" << keepRoute << std::endl;
957 double lanePosLat = 0;
958 double bestDistance = std::numeric_limits<double>::max();
961 double maxRouteDistance = matchThreshold;
983 ev, routeIndex, vClass,
true,
984 bestDistance, &lane, lanePos, routeOffset);
985 if (bestDistance > maxRouteDistance) {
992 speed, ev, routeIndex, currentLane, p->
getEdgePos(), currentLane !=
nullptr,
994 bestDistance, &lane, lanePos, routeOffset, edges);
995 if (edges.size() != 0 && ev.size() > 1) {
998 assert(lane !=
nullptr);
1001 if (routeIndex == 0) {
1008 if (origEdge->
getToJunction() == ev[routeIndex - 1]->getToJunction() || origEdge->
getToJunction() == ev[routeIndex - 1]->getFromJunction()) {
1018 const MSEdge* newEdge = edges[0];
1019 if (edges[0]->getFromJunction() == originalTarget || edges[0]->getToJunction() == originalTarget) {
1021 edges[routeIndex] = newEdge;
1025 if (found || mayLeaveNetwork) {
1030 lanePosLat = perpDist;
1031 if (!mayLeaveNetwork) {
1043 lanePosLat = -lanePosLat;
1051 assert((found && lane !=
nullptr) || (!found && lane ==
nullptr));
1082 throw TraCIException(
"Command moveToXY is not supported for person '" + personID +
"' while " + p->
getCurrentStageDescription() +
".");
1086 if (lane ==
nullptr) {
1087 throw TraCIException(
"Could not map person '" + personID +
"' no road found within " +
toString(maxRouteDistance) +
"m.");
1089 throw TraCIException(
"Could not map person '" + personID +
"' distance to road is " +
toString(bestDistance) +
".");
1098Person::setParameter(
const std::string& personID,
const std::string& key,
const std::string& value) {
1101 throw TraCIException(
"Person '" + personID +
"' does not support device parameters\n");
1103 throw TraCIException(
"Person '" + personID +
"' does not support laneChangeModel parameters\n");
1105 throw TraCIException(
"Person '" + personID +
"' does not support carFollowModel parameters\n");
1112 throw TraCIException(e.what());
1115 throw TraCIException(
"Person '" + personID +
"' does not support chanigng device status\n");
1123Person::setLength(
const std::string& personID,
double length) {
1124 getPerson(personID)->getSingularType().setLength(length);
1129Person::setMaxSpeed(
const std::string& personID,
double speed) {
1130 getPerson(personID)->getSingularType().setMaxSpeed(speed);
1135Person::setVehicleClass(
const std::string& personID,
const std::string& clazz) {
1141Person::setShapeClass(
const std::string& personID,
const std::string& clazz) {
1147Person::setEmissionClass(
const std::string& personID,
const std::string& clazz) {
1153Person::setWidth(
const std::string& personID,
double width) {
1154 getPerson(personID)->getSingularType().setWidth(width);
1159Person::setHeight(
const std::string& personID,
double height) {
1160 getPerson(personID)->getSingularType().setHeight(height);
1165Person::setMass(
const std::string& personID,
double mass) {
1166 getPerson(personID)->getSingularType().setMass(mass);
1171Person::setMinGap(
const std::string& personID,
double minGap) {
1172 getPerson(personID)->getSingularType().setMinGap(minGap);
1177Person::setAccel(
const std::string& personID,
double accel) {
1178 getPerson(personID)->getSingularType().setAccel(accel);
1183Person::setDecel(
const std::string& personID,
double decel) {
1184 getPerson(personID)->getSingularType().setDecel(decel);
1189Person::setEmergencyDecel(
const std::string& personID,
double decel) {
1190 getPerson(personID)->getSingularType().setEmergencyDecel(decel);
1195Person::setApparentDecel(
const std::string& personID,
double decel) {
1196 getPerson(personID)->getSingularType().setApparentDecel(decel);
1201Person::setImperfection(
const std::string& personID,
double imperfection) {
1202 getPerson(personID)->getSingularType().setImperfection(imperfection);
1207Person::setBoardingDuration(
const std::string& personID,
double boardingDuration) {
1213Person::setImpatience(
const std::string& personID,
double impatience) {
1220Person::setTau(
const std::string& personID,
double tau) {
1221 getPerson(personID)->getSingularType().setTau(tau);
1226Person::setMinGapLat(
const std::string& personID,
double minGapLat) {
1227 getPerson(personID)->getSingularType().setMinGapLat(minGapLat);
1232Person::setMaxSpeedLat(
const std::string& personID,
double speed) {
1233 getPerson(personID)->getSingularType().setMaxSpeedLat(speed);
1238Person::setLateralAlignment(
const std::string& personID,
const std::string& latAlignment) {
1242 getPerson(personID)->getSingularType().setPreferredLateralAlignment(lad, lao);
1244 throw TraCIException(
"Unknown value '" + latAlignment +
"' when setting latAlignment for person '" + personID +
"';\n must be one of (\"right\", \"center\", \"arbitrary\", \"nice\", \"compact\", \"left\" or a float)");
1250Person::setSpeedFactor(
const std::string& personID,
double factor) {
1251 getPerson(personID)->setChosenSpeedFactor(factor);
1256Person::setActionStepLength(
const std::string& personID,
double actionStepLength,
bool resetActionOffset) {
1261Person::remove(
const std::string& personID,
char ) {
1262 MSPerson* person = getPerson(personID);
1272Person::setColor(
const std::string& personID,
const TraCIColor& c) {
1274 p.
color.
set((
unsigned char)c.r, (
unsigned char)c.g, (
unsigned char)c.b, (
unsigned char)c.a);
1283Person::getPerson(
const std::string& personID) {
1290 shape.push_back(getPerson(
id)->getPosition());
1294std::shared_ptr<VariableWrapper>
1295Person::makeWrapper() {
1296 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
1301Person::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
1304 return wrapper->wrapStringList(objID, variable, getIDList());
1306 return wrapper->wrapInt(objID, variable, getIDCount());
1308 return wrapper->wrapPosition(objID, variable, getPosition(objID));
1310 return wrapper->wrapPosition(objID, variable, getPosition(objID,
true));
1312 return wrapper->wrapDouble(objID, variable, getAngle(objID));
1314 return wrapper->wrapDouble(objID, variable, getSlope(objID));
1316 return wrapper->wrapDouble(objID, variable, getSpeed(objID));
1318 return wrapper->wrapString(objID, variable, getRoadID(objID));
1320 return wrapper->wrapString(objID, variable, getLaneID(objID));
1322 return wrapper->wrapDouble(objID, variable, getLanePosition(objID));
1324 return wrapper->wrapDouble(objID, variable, getArrivalPos(objID));
1326 return wrapper->wrapColor(objID, variable, getColor(objID));
1328 return wrapper->wrapDouble(objID, variable, getWaitingTime(objID));
1330 return wrapper->wrapDouble(objID, variable, getImpatience(objID));
1332 return wrapper->wrapString(objID, variable, getTypeID(objID));
1334 return wrapper->wrapDouble(objID, variable, getSpeedFactor(objID));
1336 return wrapper->wrapString(objID, variable, getNextEdge(objID));
1338 return wrapper->wrapStringList(objID, variable, getEdges(objID,
StoHelp::readTypedInt(*paramData)));
1342 return wrapper->wrapInt(objID, variable, getRemainingStages(objID));
1344 return wrapper->wrapString(objID, variable, getVehicle(objID));
1347 return wrapper->wrapDouble(objID, variable, getMaxSpeed(objID));
1349 TraCIRoadPosition roadPos;
1352 return wrapper->wrapDouble(objID, variable, getWalkingDistance(objID, roadPos.edgeID, roadPos.pos, roadPos.laneIndex));
1354 return wrapper->wrapDouble(objID, variable, getWalkingDistance2D(objID, pos.
x(), pos.
y()));
1361 return wrapper->wrapReservationVector(objID, variable, getTaxiReservations(
StoHelp::readTypedInt(*paramData)));
1365 return libsumo::VehicleType::handleVariable(getTypeID(objID), variable, wrapper, paramData);
std::vector< const MSEdge * > ConstMSEdgeVector
#define WRITE_WARNINGF(...)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
constexpr SUMOTime TIME2STEPS(double x)
LatAlignmentDefinition
Possible ways to choose the lateral alignment, i.e., how vehicles align themselves within their lane.
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ GIVEN
The position is given.
const long long int VEHPARS_COLOR_SET
DepartDefinition
Possible ways to depart.
@ DEF_MAX
Tag for the last element in the enum for safe int casting.
@ SUMO_TAG_BUS_STOP
A bus stop.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
static double naviDegree(const double angle)
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
static MSDispatch * getDispatchAlgorithm()
A dispatch algorithm that services customers in reservation order and always sends the closest availa...
std::string splitReservation(std::string resID, std::vector< std::string > personIDs)
split existing reservations and return the new reservation id
An algorithm that performs distpach for a taxi fleet.
std::vector< Reservation * > getReservations()
retrieve all reservations
virtual std::vector< const Reservation * > getRunningReservations()
retrieve all reservations that were already dispatched and are still active
A road/street connecting two junctions.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
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.
bool isNormal() const
return whether this edge is an internal edge
const MSJunction * getToJunction() const
double getLength() const
return the length of the edge
const MSJunction * getFromJunction() const
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....
static double gLateralResolution
The base class for an intersection.
Representation of a lane in the micro simulation.
bool isWalkingArea() const
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
double interpolateLanePosToGeometryPos(double lanePos) const
virtual const PositionVector & getShape(bool) const
MSEdge & getEdge() const
Returns the lane's edge.
double getWidth() const
Returns the lane's width.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSPedestrianRouter & getPedestrianRouter(int rngIndex, const Prohibitions &prohibited={}) const
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
static const double SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk
static const double UNSPECIFIED_POS_LAT
the default lateral offset for persons when starting a walk
void replaceWalk(const ConstMSEdgeVector &newEdges, double departPos, int firstIndex, int nextIndex)
set new walk and replace the stages with relative indices in the interval [firstIndex,...
SUMOTime getIntendedDepart() const
std::string getIntendedVehicleID() const
const std::set< std::string > & getLines() const
std::string getVehicleType() const
const MSEdge * getDestination() const
returns the destination edge
virtual ConstMSEdgeVector getEdges() const
the edges of the current stage
virtual double getArrivalPos() const
SUMOTime getDeparted() const
get departure time of stage
virtual std::string getStageDescription(const bool isPerson) const =0
return (brief) string representation of the current stage
SUMOTime getArrived() const
get arrival time of stage
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
MSStageType getStageType() const
virtual double getDistance() const =0
get travel distance in this stage
ConstMSEdgeVector getEdges() const
the edges of the current stage
const std::vector< const MSEdge * > & getRoute() const
MSTransportableStateAdapter * getPState() const
const std::vector< constMSEdge * >::iterator getRouteStep() const
int getRoutePosition() const
return index of current edge within route
A lane area vehicles can halt at.
double getEndLanePosition() const
Returns the end position of this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
constVehIt loadedBegin() const
Returns the begin of the internal transportables map.
int size() const
Returns the number of known transportables.
constVehIt loadedEnd() const
Returns the end of the internal transportables map.
std::map< std::string, MSTransportable * >::const_iterator constVehIt
Definition of the internal transportables map iterator.
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, SumoRNG *rng) const
Builds a new person.
bool add(MSTransportable *transportable)
Adds a single transportable, returns false if an id clash occurred.
Position getPosition(const double) const override
Return current position (x/y, cartesian)
virtual double getEdgePos() const
Return the position on the edge.
std::string getCurrentStageDescription() const
Returns the current stage description as a string.
const MSEdge * getArrivalEdge() const
returns the final arrival edge
MSStageType getStageType(int next) const
the stage type for the nth next stage
MSStage * getNextStage(int offset) const
Return the next (or previous) stage denoted by the offset.
void setJunctionModelParameter(const std::string &key, const std::string &value)
set individual junction model paramete (not type related)
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
MSStage * getCurrentStage() const
Return the current stage.
SUMOVehicleClass getVClass() const override
Returns the object's access class.
double getMaxSpeed() const override
Returns the maximum speed (the minimum of desired and physical maximum speed)
void removeStage(int next, bool stayInSim=true)
removes the nth next stage
const SUMOVTypeParameter & getVTypeParameter() const override
Returns the object's "vehicle" type parameter.
bool isPerson() const override
Whether it is a person.
double getArrivalPos() const
returns the final arrival pos
int getNumStages() const
Return the total number stages in this person's plan.
MSStageType getCurrentStageType() const
the current stage type of the transportable
const SUMOVehicleParameter & getParameter() const override
Returns the vehicle's parameter (including departure definition)
const MSVehicleType & getVehicleType() const override
Returns the object's "vehicle" type.
virtual double getAngle() const override
return the current angle of the transportable
void appendStage(MSStage *stage, int next=-1)
Appends the given stage to the current plan.
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
const MSEdge * getEdge() const override
Returns the current edge.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
virtual void moveTo(MSPerson *p, MSLane *lane, double lanePos, double lanePosLat, SUMOTime t)
try to move transportable to the given position
The class responsible for building and deletion of vehicles.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
The car-following model and parameter.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
void setBoardingDuration(SUMOTime duration, bool isPerson=true)
Set a new value for this type's boardingDuration.
void setImpatience(const double impatience)
Set a new value for this type's impatience.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
const std::string & getID() const
Returns the id.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static OptionsCont & getOptions()
Retrieves the options.
double compute(const E *from, const E *to, double departPos, double arrivalPos, double speed, SUMOTime msTime, const N *onlyNode, const SUMOVTypeParameter &pars, std::vector< const E * > &into, bool allEdges=false) const
Builds the route between the given edges using the minimum effort at the given time The definition of...
double recomputeWalkCosts(const std::vector< const E * > &edges, double speed, double fromPos, double toPos, SUMOTime msTime, const SUMOVTypeParameter &pars, double &length) const
C++ TraCI client API implementation.
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
A point in 2D or 3D with translation and scaling methods.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double x() const
Returns the x-position.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
double y() const
Returns the y-position.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
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)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
unsigned char red() const
Returns the red-amount of the color.
unsigned char alpha() const
Returns the alpha-amount of the color.
unsigned char green() const
Returns the green-amount of the color.
unsigned char blue() const
Returns the blue-amount of the color.
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
assigns new values
static bool parseLatAlignment(const std::string &val, double &lao, LatAlignmentDefinition &lad)
Parses and validates a given latAlignment value.
Representation of a vehicle.
Structure representing possible vehicle parameter.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
SVCPermissions modes
The modes a person or container can use.
double departPos
(optional) The position the vehicle shall depart from
RGBColor color
The vehicle's color, TraCI may change this.
std::string id
The vehicle's id.
static bool parsePersonModes(const std::string &modes, const std::string &element, const std::string &id, SVCPermissions &modeSet, std::string &error)
Validates a given person modes value.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
static SUMOTime processActionStepLength(double given)
Checks and converts given value for the action step length from seconds to miliseconds assuring it be...
std::vector< std::string > getVector()
return vector of strings
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
static bool moveToXYMap_matchingRoutePosition(const Position &pos, const std::string &origID, const ConstMSEdgeVector ¤tRoute, int routeIndex, SUMOVehicleClass vClass, bool setLateralPos, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset)
static MSPerson * getPerson(const std::string &id)
static int readDistanceRequest(tcpip::Storage &data, TraCIRoadPosition &roadPos, Position &pos)
static MSBaseVehicle * getVehicle(const std::string &id)
static void setRemoteControlled(MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
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, const MSLane *currentLane, double currentLanePos, bool onRoad, SUMOVehicleClass vClass, double currentAngle, bool setLateralPos, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
static std::vector< std::string > readTypedStringList(tcpip::Storage &ret, const std::string &error="")
static int readTypedInt(tcpip::Storage &ret, const std::string &error="")
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
TRACI_CONST double INVALID_DOUBLE_VALUE
TRACI_CONST int VAR_EDGES
TRACI_CONST int POSITION_ROADMAP
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_IMPATIENCE
TRACI_CONST int STAGE_TRIP
TRACI_CONST int VAR_VEHICLE
TRACI_CONST int VAR_WAITING_TIME
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_ROAD_ID
TRACI_CONST int VAR_TAXI_RESERVATIONS
TRACI_CONST int VAR_SPEED_FACTOR
TRACI_CONST int VAR_ANGLE
TRACI_CONST int VAR_STAGE
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_POSITION
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int STAGE_WAITING
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_SLOPE
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_LANEPOSITION
TRACI_CONST int VAR_LANE_ID
TRACI_CONST int VAR_ARRIVALPOS
TRACI_CONST int STAGE_WALKING
TRACI_CONST int VAR_POSITION3D
TRACI_CONST int VAR_SPEED
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_NEXT_EDGE
TRACI_CONST int DISTANCE_REQUEST
TRACI_CONST int STAGE_DRIVING
TRACI_CONST int VAR_STAGES_REMAINING
TRACI_CONST int SPLIT_TAXI_RESERVATIONS
std::set< const MSTransportable *, ComparatorNumericalIdLess > persons