47#define FAR_AWAY 1000.0
63std::vector<std::string>
66 std::vector<std::string> ids;
69 ids.push_back(i->first);
83Person::getPosition(
const std::string& personID,
const bool includeZ) {
89Person::getPosition3D(
const std::string& personID) {
95Person::getAngle(
const std::string& personID) {
101Person::getSlope(
const std::string& personID) {
102 MSPerson* person = getPerson(personID);
104 const MSLane* lane = getSidewalk<MSEdge, MSLane>(person->
getEdge());
105 if (lane ==
nullptr) {
114Person::getSpeed(
const std::string& personID) {
115 return getPerson(personID)->getSpeed();
120Person::getRoadID(
const std::string& personID) {
121 return getPerson(personID)->getEdge()->getID();
126Person::getLaneID(
const std::string& personID) {
132Person::getLanePosition(
const std::string& personID) {
133 return getPerson(personID)->getEdgePos();
136std::vector<TraCIReservation>
137Person::getTaxiReservations(
int onlyNew) {
138 std::vector<TraCIReservation> result;
140 if (dispatcher !=
nullptr) {
142 if (traciDispatcher ==
nullptr) {
143 throw TraCIException(
"device.taxi.dispatch-algorithm 'traci' has not been loaded");
146 if (filterReservation(onlyNew, res, result)) {
153 if (includeRunning) {
155 filterReservation(onlyNew, res, result);
164Person::reservation_by_id_sorter::operator()(
const TraCIReservation& r1,
const TraCIReservation& r2)
const {
165 return r1.id < r2.id;
170Person::splitTaxiReservation(std::string reservationID,
const std::vector<std::string>& personIDs) {
172 if (dispatcher !=
nullptr) {
174 if (traciDispatcher !=
nullptr) {
178 throw TraCIException(
"device.taxi.dispatch-algorithm 'traci' has not been loaded");
182Person::filterReservation(
int onlyNew,
const Reservation* res, std::vector<libsumo::TraCIReservation>& reservations) {
183 if (onlyNew != 0 && (onlyNew & res->
state) == 0) {
186 std::vector<std::string> personIDs;
188 personIDs.push_back(p->getID());
190 std::sort(personIDs.begin(), personIDs.end());
191 reservations.push_back(TraCIReservation(res->
id,
207Person::getColor(
const std::string& personID) {
208 const RGBColor& col = getPerson(personID)->getParameter().color;
211 tcol.g = col.
green();
213 tcol.a = col.
alpha();
219Person::getTypeID(
const std::string& personID) {
220 return getPerson(personID)->getVehicleType().getID();
225Person::getWaitingTime(
const std::string& personID) {
226 return getPerson(personID)->getWaitingSeconds();
231Person::getNextEdge(
const std::string& personID) {
232 return getPerson(personID)->getNextEdge();
236std::vector<std::string>
237Person::getEdges(
const std::string& personID,
int nextStageIndex) {
240 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
243 throw TraCIException(
"The negative stage index must refer to a valid previous stage.");
245 std::vector<std::string> edgeIDs;
248 edgeIDs.push_back(e->getID());
256Person::getStage(
const std::string& personID,
int nextStageIndex) {
260 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
263 throw TraCIException(
"The negative stage index " +
toString(nextStageIndex) +
" must refer to a valid previous stage.");
271 result.edges.push_back(e->getID());
275 if (destinationStop !=
nullptr) {
276 result.destStop = destinationStop->
getID();
280 if (result.length == -1.) {
302 const std::set<std::string> lines = drivingStage->
getLines();
303 for (
auto line = lines.begin(); line != lines.end(); line++) {
304 if (line != lines.begin()) {
307 result.line += *line;
313 result.departPos = walkingStage->getDepartPos();
318 if (waitingStage->getPlannedDuration() > 0) {
319 result.travelTime =
STEPS2TIME(waitingStage->getPlannedDuration());
331Person::getRemainingStages(
const std::string& personID) {
332 return getPerson(personID)->getNumRemainingStages();
337Person::getVehicle(
const std::string& personID) {
338 const SUMOVehicle* veh = getPerson(personID)->getVehicle();
339 if (veh ==
nullptr) {
348Person::getParameter(
const std::string& personID,
const std::string& param) {
349 return getPerson(personID)->getParameter().getParameter(param,
"");
357Person::getEmissionClass(
const std::string& personID) {
363Person::getShapeClass(
const std::string& personID) {
369Person::getLength(
const std::string& personID) {
370 return getPerson(personID)->getVehicleType().getLength();
375Person::getSpeedFactor(
const std::string& personID) {
376 return getPerson(personID)->getChosenSpeedFactor();
381Person::getAccel(
const std::string& personID) {
382 return getPerson(personID)->getVehicleType().getCarFollowModel().getMaxAccel();
387Person::getDecel(
const std::string& personID) {
388 return getPerson(personID)->getVehicleType().getCarFollowModel().getMaxDecel();
392double Person::getEmergencyDecel(
const std::string& personID) {
393 return getPerson(personID)->getVehicleType().getCarFollowModel().getEmergencyDecel();
397double Person::getApparentDecel(
const std::string& personID) {
398 return getPerson(personID)->getVehicleType().getCarFollowModel().getApparentDecel();
402double Person::getActionStepLength(
const std::string& personID) {
403 return getPerson(personID)->getVehicleType().getActionStepLengthSecs();
408Person::getTau(
const std::string& personID) {
409 return getPerson(personID)->getVehicleType().getCarFollowModel().getHeadwayTime();
414Person::getImperfection(
const std::string& personID) {
415 return getPerson(personID)->getVehicleType().getCarFollowModel().getImperfection();
420Person::getSpeedDeviation(
const std::string& personID) {
421 return getPerson(personID)->getVehicleType().getSpeedFactor().getParameter()[1];
426Person::getVehicleClass(
const std::string& personID) {
427 return toString(getPerson(personID)->getVehicleType().getVehicleClass());
432Person::getMinGap(
const std::string& personID) {
433 return getPerson(personID)->getVehicleType().getMinGap();
438Person::getMinGapLat(
const std::string& personID) {
439 return getPerson(personID)->getVehicleType().getMinGapLat();
444Person::getMaxSpeed(
const std::string& personID) {
445 return getPerson(personID)->getMaxSpeed();
450Person::getMaxSpeedLat(
const std::string& personID) {
451 return getPerson(personID)->getVehicleType().getMaxSpeedLat();
456Person::getLateralAlignment(
const std::string& personID) {
457 return toString(getPerson(personID)->getVehicleType().getPreferredLateralAlignment());
462Person::getWidth(
const std::string& personID) {
463 return getPerson(personID)->getVehicleType().getWidth();
468Person::getHeight(
const std::string& personID) {
469 return getPerson(personID)->getVehicleType().getHeight();
474Person::getMass(
const std::string& personID) {
475 return getPerson(personID)->getVehicleType().getMass();
480Person::getPersonCapacity(
const std::string& personID) {
481 return getPerson(personID)->getVehicleType().getPersonCapacity();
486Person::getBoardingDuration(
const std::string& personID) {
487 return STEPS2TIME(getPerson(personID)->getVehicleType().getBoardingDuration(
true));
492Person::getImpatience(
const std::string& personID) {
493 return getPerson(personID)->getImpatience();
498Person::setSpeed(
const std::string& personID,
double speed) {
499 getPerson(personID)->setSpeed(speed);
504Person::setType(
const std::string& personID,
const std::string& typeID) {
506 if (vehicleType ==
nullptr) {
507 throw TraCIException(
"The vehicle type '" + typeID +
"' is not known.");
509 getPerson(personID)->replaceVehicleType(vehicleType);
514Person::add(
const std::string& personID,
const std::string& edgeID,
double pos,
double departInSecs,
const std::string typeID) {
517 p = getPerson(personID);
518 }
catch (TraCIException&) {
523 throw TraCIException(
"The person " + personID +
" to add already exists.");
528 vehicleParams.
id = personID;
532 throw TraCIException(
"Invalid type '" + typeID +
"' for person '" + personID +
"'");
537 throw TraCIException(
"Invalid edge '" + edgeID +
"' for person: '" + personID +
"'");
540 if (departInSecs < 0.) {
541 const int proc = (int) - departInSecs;
543 throw TraCIException(
"Invalid departure time." +
toString(depart) +
" " +
toString(proc));
549 WRITE_WARNINGF(
TL(
"Departure time=% for person '%' is in the past; using current time=% instead."),
552 vehicleParams.
depart = depart;
557 throw TraCIException(
"Invalid departure position.");
566 plan->push_back(
new MSStageWaiting(edge,
nullptr, 0, depart, pos,
"awaiting departure",
true));
574 throw TraCIException(e.what());
579Person::convertTraCIStage(
const TraCIStage& stage,
const std::string personID) {
581 if (!stage.destStop.empty()) {
584 throw TraCIException(
"Invalid stopping place id '" + stage.destStop +
"' for person: '" + personID +
"'");
587 switch (stage.type) {
589 if (stage.edges.empty()) {
590 throw TraCIException(
"The stage should have at least one edge");
592 std::string toId = stage.edges.back();
595 throw TraCIException(
"Invalid edge '" + toId +
"' for person: '" + personID +
"'");
602 if (stage.line.empty()) {
603 throw TraCIException(
"Empty lines parameter for person: '" + personID +
"'");
605 double arrivalPos = stage.arrivalPos;
622 throw TraCIException(e.what());
625 throw TraCIException(
"Empty edge list for walking stage of person '" + personID +
"'.");
627 double arrivalPos = stage.arrivalPos;
628 if (fabs(arrivalPos) > edges.back()->getLength()) {
629 throw TraCIException(
"Invalid arrivalPos for walking stage of person '" + personID +
"'.");
631 if (arrivalPos < 0) {
632 arrivalPos += edges.back()->getLength();
639 if (stage.travelTime < 0) {
640 throw TraCIException(
"Duration for person: '" + personID +
"' must not be negative");
650 throw TraCIException(e.what());
652 if ((edges.size() == 0 && bs ==
nullptr) || edges.size() > 1) {
653 throw TraCIException(
"A trip should be defined with a destination edge or a destination stop for person '" + personID +
"'.");
655 const MSEdge* to =
nullptr;
658 if (edges.size() > 0 && to != edges.back()) {
659 throw TraCIException(
"Mismatching destination edge and destination stop edge for person '" + personID +
"'.");
668 if (vType ==
nullptr) {
669 throw TraCIException(
"The vehicle type '" + vtypeid +
"' in a trip for person '" + personID +
"' is not known.");
673 if (stage.line.empty()) {
676 std::string errorMsg;
678 throw TraCIException(errorMsg);
682 double arrivalPos = stage.arrivalPos;
684 if (fabs(arrivalPos) > to->
getLength()) {
685 throw TraCIException(
"Invalid arrivalPos for walking stage of person '" + personID +
"'.");
687 if (arrivalPos < 0) {
693 std::string group = stage.intended;
695 const double speed = -1;
697 duration, modeSet, stage.vType, speed, walkfactor, group,
707Person::appendStage(
const std::string& personID,
const TraCIStage& stage) {
709 MSStage* personStage = convertTraCIStage(stage, personID);
715Person::replaceStage(
const std::string& personID,
const int stageIndex,
const TraCIStage& stage) {
718 throw TraCIException(
"Specified stage index: is not valid for person " + personID);
720 MSStage* personStage = convertTraCIStage(stage, personID);
729Person::appendDrivingStage(
const std::string& personID,
const std::string& toEdge,
const std::string& lines,
const std::string& stopID) {
733 throw TraCIException(
"Invalid edge '" + toEdge +
"' for person: '" + personID +
"'");
735 if (lines.size() == 0) {
736 throw TraCIException(
"Empty lines parameter for person: '" + personID +
"'");
742 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
750Person::appendWaitingStage(
const std::string& personID,
double duration,
const std::string& description,
const std::string& stopID) {
753 throw TraCIException(
"Duration for person: '" + personID +
"' must not be negative");
759 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
767Person::appendWalkingStage(
const std::string& personID,
const std::vector<std::string>& edgeIDs,
double arrivalPos,
double duration,
double speed,
const std::string& stopID) {
773 throw TraCIException(e.what());
776 throw TraCIException(
"Empty edge list for walking stage of person '" + personID +
"'.");
778 if (fabs(arrivalPos) > edges.back()->getLength()) {
779 throw TraCIException(
"Invalid arrivalPos for walking stage of person '" + personID +
"'.");
781 if (arrivalPos < 0) {
782 arrivalPos += edges.back()->getLength();
788 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
796Person::removeStage(
const std::string& personID,
int nextStageIndex) {
799 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
801 if (nextStageIndex < 0) {
802 throw TraCIException(
"The stage index may not be negative.");
809Person::rerouteTraveltime(
const std::string& personID) {
812 throw TraCIException(
"Person '" + personID +
"' has no remaining stages.");
822 throw TraCIException(
"Person '" + personID +
"' cannot reroute after the current stop.");
828 int nextIndex = firstIndex + 1;
840 if (newEdges.empty()) {
841 throw TraCIException(
"Could not find new route for person '" + personID +
"'.");
844 assert(!oldEdges.empty());
846 oldEdges.erase(oldEdges.begin());
849 if (newEdges == oldEdges && (firstIndex + 1 == nextIndex)) {
852 if (newEdges.front() != from) {
854 newEdges.insert(newEdges.begin(), from);
856 p->
replaceWalk(newEdges, departPos, firstIndex, nextIndex);
861Person::moveTo(
const std::string& personID,
const std::string& laneID,
double pos,
double posLat) {
865 throw TraCIException(
"Unknown lane '" + laneID +
"'.");
871 throw TraCIException(
"Invalid lateral position " +
toString(posLat) +
" on lane '" + laneID +
"'.");
881 throw TraCIException(
"Command moveTo is not supported for person '" + personID +
"' while " + p->
getCurrentStageDescription() +
".");
887Person::moveToXY(
const std::string& personID,
const std::string& edgeID,
const double x,
const double y,
double angle,
const int keepRoute,
double matchThreshold) {
889 const bool doKeepRoute = (keepRoute & 1) != 0;
890 const bool mayLeaveNetwork = (keepRoute & 2) != 0;
891 const bool ignorePermissions = (keepRoute & 4) != 0;
895 const double origAngle = angle;
900 while (angle >= 360.) {
910 std::cout <<
" want pos:" << pos <<
" edgeID:" << edgeID <<
" origAngle:" << origAngle <<
" angle:" << angle <<
" keepRoute:" << keepRoute << std::endl;
916 double lanePosLat = 0;
917 double bestDistance = std::numeric_limits<double>::max();
920 double maxRouteDistance = matchThreshold;
942 ev, routeIndex, vClass,
true,
943 bestDistance, &lane, lanePos, routeOffset);
947 speed, ev, routeIndex, currentLane, p->
getEdgePos(), currentLane !=
nullptr,
949 bestDistance, &lane, lanePos, routeOffset, edges);
950 if (edges.size() != 0 && ev.size() > 1) {
953 assert(lane !=
nullptr);
956 if (routeIndex == 0) {
963 if (origEdge->
getToJunction() == ev[routeIndex - 1]->getToJunction() || origEdge->
getToJunction() == ev[routeIndex - 1]->getFromJunction()) {
973 const MSEdge* newEdge = edges[0];
974 if (edges[0]->getFromJunction() == originalTarget || edges[0]->getToJunction() == originalTarget) {
976 edges[routeIndex] = newEdge;
980 if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) {
985 lanePosLat = perpDist;
986 if (!mayLeaveNetwork) {
998 lanePosLat = -lanePosLat;
1006 assert((found && lane != 0) || (!found && lane == 0));
1037 throw TraCIException(
"Command moveToXY is not supported for person '" + personID +
"' while " + p->
getCurrentStageDescription() +
".");
1041 if (lane ==
nullptr) {
1042 throw TraCIException(
"Could not map person '" + personID +
"' no road found within " +
toString(maxRouteDistance) +
"m.");
1044 throw TraCIException(
"Could not map person '" + personID +
"' distance to road is " +
toString(bestDistance) +
".");
1053Person::setParameter(
const std::string& personID,
const std::string& key,
const std::string& value) {
1056 throw TraCIException(
"Person '" + personID +
"' does not support device parameters\n");
1058 throw TraCIException(
"Person '" + personID +
"' does not support laneChangeModel parameters\n");
1060 throw TraCIException(
"Person '" + personID +
"' does not support carFollowModel parameters\n");
1067 throw TraCIException(e.what());
1070 throw TraCIException(
"Person '" + personID +
"' does not support chanigng device status\n");
1078Person::setLength(
const std::string& personID,
double length) {
1079 getPerson(personID)->getSingularType().setLength(length);
1084Person::setMaxSpeed(
const std::string& personID,
double speed) {
1085 getPerson(personID)->getSingularType().setMaxSpeed(speed);
1090Person::setVehicleClass(
const std::string& personID,
const std::string& clazz) {
1096Person::setShapeClass(
const std::string& personID,
const std::string& clazz) {
1102Person::setEmissionClass(
const std::string& personID,
const std::string& clazz) {
1108Person::setWidth(
const std::string& personID,
double width) {
1109 getPerson(personID)->getSingularType().setWidth(width);
1114Person::setHeight(
const std::string& personID,
double height) {
1115 getPerson(personID)->getSingularType().setHeight(height);
1120Person::setMass(
const std::string& personID,
double mass) {
1121 getPerson(personID)->getSingularType().setMass(mass);
1126Person::setMinGap(
const std::string& personID,
double minGap) {
1127 getPerson(personID)->getSingularType().setMinGap(minGap);
1132Person::setAccel(
const std::string& personID,
double accel) {
1133 getPerson(personID)->getSingularType().setAccel(accel);
1138Person::setDecel(
const std::string& personID,
double decel) {
1139 getPerson(personID)->getSingularType().setDecel(decel);
1144Person::setEmergencyDecel(
const std::string& personID,
double decel) {
1145 getPerson(personID)->getSingularType().setEmergencyDecel(decel);
1150Person::setApparentDecel(
const std::string& personID,
double decel) {
1151 getPerson(personID)->getSingularType().setApparentDecel(decel);
1156Person::setImperfection(
const std::string& personID,
double imperfection) {
1157 getPerson(personID)->getSingularType().setImperfection(imperfection);
1162Person::setBoardingDuration(
const std::string& personID,
double boardingDuration) {
1168Person::setImpatience(
const std::string& personID,
double impatience) {
1175Person::setTau(
const std::string& personID,
double tau) {
1176 getPerson(personID)->getSingularType().setTau(tau);
1181Person::setMinGapLat(
const std::string& personID,
double minGapLat) {
1182 getPerson(personID)->getSingularType().setMinGapLat(minGapLat);
1187Person::setMaxSpeedLat(
const std::string& personID,
double speed) {
1188 getPerson(personID)->getSingularType().setMaxSpeedLat(speed);
1193Person::setLateralAlignment(
const std::string& personID,
const std::string& latAlignment) {
1197 getPerson(personID)->getSingularType().setPreferredLateralAlignment(lad, lao);
1199 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)");
1205Person::setSpeedFactor(
const std::string& personID,
double factor) {
1206 getPerson(personID)->setChosenSpeedFactor(factor);
1211Person::setActionStepLength(
const std::string& personID,
double actionStepLength,
bool resetActionOffset) {
1216Person::remove(
const std::string& personID,
char ) {
1217 MSPerson* person = getPerson(personID);
1227Person::setColor(
const std::string& personID,
const TraCIColor& c) {
1229 p.
color.
set((
unsigned char)c.r, (
unsigned char)c.g, (
unsigned char)c.b, (
unsigned char)c.a);
1238Person::getPerson(
const std::string& personID) {
1245 shape.push_back(getPerson(
id)->getPosition());
1249std::shared_ptr<VariableWrapper>
1250Person::makeWrapper() {
1251 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
1256Person::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
1259 return wrapper->wrapStringList(objID, variable, getIDList());
1261 return wrapper->wrapInt(objID, variable, getIDCount());
1263 return wrapper->wrapPosition(objID, variable, getPosition(objID));
1265 return wrapper->wrapPosition(objID, variable, getPosition(objID,
true));
1267 return wrapper->wrapDouble(objID, variable, getAngle(objID));
1269 return wrapper->wrapDouble(objID, variable, getSlope(objID));
1271 return wrapper->wrapDouble(objID, variable, getSpeed(objID));
1273 return wrapper->wrapString(objID, variable, getRoadID(objID));
1275 return wrapper->wrapString(objID, variable, getLaneID(objID));
1277 return wrapper->wrapDouble(objID, variable, getLanePosition(objID));
1279 return wrapper->wrapColor(objID, variable, getColor(objID));
1281 return wrapper->wrapDouble(objID, variable, getWaitingTime(objID));
1283 return wrapper->wrapDouble(objID, variable, getImpatience(objID));
1285 return wrapper->wrapString(objID, variable, getTypeID(objID));
1287 return wrapper->wrapDouble(objID, variable, getSpeedFactor(objID));
1289 return wrapper->wrapString(objID, variable, getNextEdge(objID));
1291 return wrapper->wrapInt(objID, variable, getRemainingStages(objID));
1293 return wrapper->wrapString(objID, variable, getVehicle(objID));
1296 return wrapper->wrapDouble(objID, variable, getMaxSpeed(objID));
1299 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
1302 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
1307 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)
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.
bool isWalkingArea() const
return whether this edge is walking area
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.
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
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
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
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.
virtual double getEdgePos() const
Return the position on the edge.
SUMOVehicleClass getVClass() const
Returns the object's access class.
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.
void removeStage(int next, bool stayInSim=true)
removes the nth next stage
bool isPerson() const
Whether it is a person.
Position getPosition(const double) const
Return current position (x/y, cartesian)
double getArrivalPos() const
returns the final arrival pos
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
int getNumStages() const
Return the total number stages in this person's plan.
MSStageType getCurrentStageType() const
the current stage type 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
Returns the current edge.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
double getMaxSpeed() const
Returns the maximum speed (the minimum of desired and physical maximum speed)
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, std::vector< const E * > &into, bool allEdges=false)
Builds the route between the given edges using the minimum effort at the given time The definition of...
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 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 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 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, bool setLateralPos, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST double INVALID_DOUBLE_VALUE
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_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 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 STAGE_DRIVING
TRACI_CONST int VAR_STAGES_REMAINING
std::set< const MSTransportable * > persons