43 #define FAR_AWAY 1000.0
59 std::vector<std::string>
62 std::vector<std::string> ids;
65 ids.push_back(i->first);
73 Person::getIDCount() {
79 Person::getPosition(
const std::string& personID,
const bool includeZ) {
85 Person::getPosition3D(
const std::string& personID) {
91 Person::getAngle(
const std::string& personID) {
97 Person::getSlope(
const std::string& personID) {
98 MSPerson* person = getPerson(personID);
100 const MSLane* lane = getSidewalk<MSEdge, MSLane>(person->
getEdge());
101 if (lane ==
nullptr) {
110 Person::getSpeed(
const std::string& personID) {
111 return getPerson(personID)->getSpeed();
116 Person::getRoadID(
const std::string& personID) {
117 return getPerson(personID)->getEdge()->getID();
122 Person::getLaneID(
const std::string& personID) {
128 Person::getLanePosition(
const std::string& personID) {
129 return getPerson(personID)->getEdgePos();
132 std::vector<TraCIReservation>
133 Person::getTaxiReservations(
int stateFilter) {
134 std::vector<TraCIReservation> result;
136 if (dispatcher !=
nullptr) {
138 if (traciDispatcher ==
nullptr) {
139 throw TraCIException(
"device.taxi.dispatch-algorithm 'traci' has not been loaded");
142 if (filterReservation(stateFilter, res, result)) {
149 if (includeRunning) {
151 filterReservation(stateFilter, res, result);
160 Person::reservation_by_id_sorter::operator()(
const TraCIReservation& r1,
const TraCIReservation& r2)
const {
161 return r1.id < r2.id;
166 Person::splitTaxiReservation(std::string reservationID,
const std::vector<std::string>& personIDs) {
168 if (dispatcher !=
nullptr) {
170 if (traciDispatcher !=
nullptr) {
174 throw TraCIException(
"device.taxi.dispatch-algorithm 'traci' has not been loaded");
178 Person::filterReservation(
int stateFilter,
const Reservation* res, std::vector<libsumo::TraCIReservation>& reservations) {
179 if (stateFilter != 0 && stateFilter != res->
state) {
182 std::vector<std::string> personIDs;
184 personIDs.push_back(p->
getID());
186 std::sort(personIDs.begin(), personIDs.end());
187 reservations.push_back(TraCIReservation(res->
id,
203 Person::getColor(
const std::string& personID) {
204 const RGBColor& col = getPerson(personID)->getParameter().color;
207 tcol.g = col.
green();
209 tcol.a = col.
alpha();
215 Person::getTypeID(
const std::string& personID) {
216 return getPerson(personID)->getVehicleType().getID();
221 Person::getWaitingTime(
const std::string& personID) {
222 return getPerson(personID)->getWaitingSeconds();
227 Person::getNextEdge(
const std::string& personID) {
228 return getPerson(personID)->getNextEdge();
232 std::vector<std::string>
233 Person::getEdges(
const std::string& personID,
int nextStageIndex) {
236 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
239 throw TraCIException(
"The negative stage index must refer to a valid previous stage.");
241 std::vector<std::string> edgeIDs;
242 for (
auto& e : p->
getEdges(nextStageIndex)) {
244 edgeIDs.push_back(e->getID());
252 Person::getStage(
const std::string& personID,
int nextStageIndex) {
256 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
259 throw TraCIException(
"The negative stage index " +
toString(nextStageIndex) +
" must refer to a valid previous stage.");
267 result.edges.push_back(e->getID());
271 if (destinationStop !=
nullptr) {
272 result.destStop = destinationStop->
getID();
276 if (result.length == -1.) {
292 const std::set<std::string> lines = drivingStage->
getLines();
293 for (
auto line = lines.begin(); line != lines.end(); line++) {
294 if (line != lines.begin()) {
297 result.line += *line;
303 result.departPos = walkingStage->getDepartPos();
308 if (waitingStage->getDuration() > 0) {
309 result.travelTime =
STEPS2TIME(waitingStage->getDuration());
321 Person::getRemainingStages(
const std::string& personID) {
322 return getPerson(personID)->getNumRemainingStages();
327 Person::getVehicle(
const std::string& personID) {
328 const SUMOVehicle* veh = getPerson(personID)->getVehicle();
329 if (veh ==
nullptr) {
338 Person::getParameter(
const std::string& personID,
const std::string& param) {
339 return getPerson(personID)->getParameter().getParameter(param,
"");
347 Person::getEmissionClass(
const std::string& personID) {
353 Person::getShapeClass(
const std::string& personID) {
359 Person::getLength(
const std::string& personID) {
360 return getPerson(personID)->getVehicleType().getLength();
365 Person::getSpeedFactor(
const std::string& personID) {
366 return getPerson(personID)->getSpeedFactor();
371 Person::getAccel(
const std::string& personID) {
372 return getPerson(personID)->getVehicleType().getCarFollowModel().getMaxAccel();
377 Person::getDecel(
const std::string& personID) {
378 return getPerson(personID)->getVehicleType().getCarFollowModel().getMaxDecel();
382 double Person::getEmergencyDecel(
const std::string& personID) {
383 return getPerson(personID)->getVehicleType().getCarFollowModel().getEmergencyDecel();
387 double Person::getApparentDecel(
const std::string& personID) {
388 return getPerson(personID)->getVehicleType().getCarFollowModel().getApparentDecel();
392 double Person::getActionStepLength(
const std::string& personID) {
393 return getPerson(personID)->getVehicleType().getActionStepLengthSecs();
398 Person::getTau(
const std::string& personID) {
399 return getPerson(personID)->getVehicleType().getCarFollowModel().getHeadwayTime();
404 Person::getImperfection(
const std::string& personID) {
405 return getPerson(personID)->getVehicleType().getCarFollowModel().getImperfection();
410 Person::getSpeedDeviation(
const std::string& personID) {
411 return getPerson(personID)->getVehicleType().getSpeedFactor().getParameter()[1];
416 Person::getVehicleClass(
const std::string& personID) {
417 return toString(getPerson(personID)->getVehicleType().getVehicleClass());
422 Person::getMinGap(
const std::string& personID) {
423 return getPerson(personID)->getVehicleType().getMinGap();
428 Person::getMinGapLat(
const std::string& personID) {
429 return getPerson(personID)->getVehicleType().getMinGapLat();
434 Person::getMaxSpeed(
const std::string& personID) {
435 return getPerson(personID)->getVehicleType().getMaxSpeed();
440 Person::getMaxSpeedLat(
const std::string& personID) {
441 return getPerson(personID)->getVehicleType().getMaxSpeedLat();
446 Person::getLateralAlignment(
const std::string& personID) {
447 return toString(getPerson(personID)->getVehicleType().getPreferredLateralAlignment());
452 Person::getWidth(
const std::string& personID) {
453 return getPerson(personID)->getVehicleType().getWidth();
458 Person::getHeight(
const std::string& personID) {
459 return getPerson(personID)->getVehicleType().getHeight();
464 Person::getPersonCapacity(
const std::string& personID) {
465 return getPerson(personID)->getVehicleType().getPersonCapacity();
470 Person::setSpeed(
const std::string& personID,
double speed) {
471 getPerson(personID)->setSpeed(speed);
476 Person::setType(
const std::string& personID,
const std::string& typeID) {
478 if (vehicleType ==
nullptr) {
479 throw TraCIException(
"The vehicle type '" + typeID +
"' is not known.");
481 getPerson(personID)->replaceVehicleType(vehicleType);
486 Person::add(
const std::string& personID,
const std::string& edgeID,
double pos,
double departInSecs,
const std::string typeID) {
489 p = getPerson(personID);
490 }
catch (TraCIException&) {
495 throw TraCIException(
"The person " + personID +
" to add already exists.");
500 vehicleParams.
id = personID;
504 throw TraCIException(
"Invalid type '" + typeID +
"' for person '" + personID +
"'");
509 throw TraCIException(
"Invalid edge '" + edgeID +
"' for person: '" + personID +
"'");
512 if (departInSecs < 0.) {
513 const int proc = (int) - departInSecs;
515 throw TraCIException(
"Invalid departure time." +
toString(depart) +
" " +
toString(proc));
522 +
"' is in the past; using current time=" +
time2string(vehicleParams.
depart) +
" instead.");
524 vehicleParams.
depart = depart;
529 throw TraCIException(
"Invalid departure position.");
538 plan->push_back(
new MSStageWaiting(edge,
nullptr, 0, depart, pos,
"awaiting departure",
true));
546 throw TraCIException(e.what());
551 Person::convertTraCIStage(
const TraCIStage& stage,
const std::string personID) {
553 if (!stage.destStop.empty()) {
558 throw TraCIException(
"Invalid stopping place id '" + stage.destStop +
"' for person: '" + personID +
"'");
565 switch (stage.type) {
567 if (stage.edges.empty()) {
568 throw TraCIException(
"The stage should have at least one edge");
570 std::string toId = stage.edges.back();
573 throw TraCIException(
"Invalid edge '" + toId +
"' for person: '" + personID +
"'");
580 if (stage.line.empty()) {
581 throw TraCIException(
"Empty lines parameter for person: '" + personID +
"'");
583 double arrivalPos = stage.arrivalPos;
600 throw TraCIException(e.what());
603 throw TraCIException(
"Empty edge list for walking stage of person '" + personID +
"'.");
605 double arrivalPos = stage.arrivalPos;
606 if (fabs(arrivalPos) > edges.back()->getLength()) {
607 throw TraCIException(
"Invalid arrivalPos for walking stage of person '" + personID +
"'.");
609 if (arrivalPos < 0) {
610 arrivalPos += edges.back()->getLength();
618 if (stage.travelTime < 0) {
619 throw TraCIException(
"Duration for person: '" + personID +
"' must not be negative");
630 Person::appendStage(
const std::string& personID,
const TraCIStage& stage) {
632 MSStage* personStage = convertTraCIStage(stage, personID);
638 Person::replaceStage(
const std::string& personID,
const int stageIndex,
const TraCIStage& stage) {
641 throw TraCIException(
"Specified stage index: is not valid for person " + personID);
643 MSStage* personStage = convertTraCIStage(stage, personID);
652 Person::appendDrivingStage(
const std::string& personID,
const std::string& toEdge,
const std::string& lines,
const std::string& stopID) {
656 throw TraCIException(
"Invalid edge '" + toEdge +
"' for person: '" + personID +
"'");
658 if (lines.size() == 0) {
659 throw TraCIException(
"Empty lines parameter for person: '" + personID +
"'");
665 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
673 Person::appendWaitingStage(
const std::string& personID,
double duration,
const std::string& description,
const std::string& stopID) {
676 throw TraCIException(
"Duration for person: '" + personID +
"' must not be negative");
682 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
690 Person::appendWalkingStage(
const std::string& personID,
const std::vector<std::string>& edgeIDs,
double arrivalPos,
double duration,
double speed,
const std::string& stopID) {
696 throw TraCIException(e.what());
699 throw TraCIException(
"Empty edge list for walking stage of person '" + personID +
"'.");
701 if (fabs(arrivalPos) > edges.back()->getLength()) {
702 throw TraCIException(
"Invalid arrivalPos for walking stage of person '" + personID +
"'.");
704 if (arrivalPos < 0) {
705 arrivalPos += edges.back()->getLength();
714 throw TraCIException(
"Invalid stopping place id '" + stopID +
"' for person: '" + personID +
"'");
722 Person::removeStage(
const std::string& personID,
int nextStageIndex) {
725 throw TraCIException(
"The stage index must be lower than the number of remaining stages.");
727 if (nextStageIndex < 0) {
728 throw TraCIException(
"The stage index may not be negative.");
735 Person::rerouteTraveltime(
const std::string& personID) {
738 throw TraCIException(
"Person '" + personID +
"' has no remaining stages.");
748 throw TraCIException(
"Person '" + personID +
"' cannot reroute after the current stop.");
754 int nextIndex = firstIndex + 1;
766 if (newEdges.empty()) {
767 throw TraCIException(
"Could not find new route for person '" + personID +
"'.");
770 assert(!oldEdges.empty());
772 oldEdges.erase(oldEdges.begin());
775 if (newEdges == oldEdges && (firstIndex + 1 == nextIndex)) {
778 if (newEdges.front() != from) {
780 newEdges.insert(newEdges.begin(), from);
782 p->
reroute(newEdges, departPos, firstIndex, nextIndex);
787 Person::moveTo(
const std::string& personID,
const std::string& edgeID,
double ) {
791 throw TraCIException(
"Unknown edge '" + edgeID +
"'.");
806 throw TraCIException(
"Command moveTo is not supported for person '" + personID +
"' while " + p->
getCurrentStageDescription() +
".");
812 Person::moveToXY(
const std::string& personID,
const std::string& edgeID,
const double x,
const double y,
double angle,
const int keepRoute,
double matchThreshold) {
814 const bool doKeepRoute = (keepRoute & 1) != 0;
815 const bool mayLeaveNetwork = (keepRoute & 2) != 0;
816 const bool ignorePermissions = (keepRoute & 4) != 0;
820 const double origAngle = angle;
825 while (angle >= 360.) {
835 std::cout <<
" want pos:" << pos <<
" edgeID:" << edgeID <<
" origAngle:" << origAngle <<
" angle:" << angle <<
" keepRoute:" << keepRoute << std::endl;
841 double lanePosLat = 0;
842 double bestDistance = std::numeric_limits<double>::max();
845 double maxRouteDistance = matchThreshold;
867 ev, routeIndex, vClass,
true,
868 bestDistance, &lane, lanePos, routeOffset);
872 speed, ev, routeIndex, currentLane, p->
getEdgePos(), currentLane !=
nullptr,
874 bestDistance, &lane, lanePos, routeOffset, edges);
875 if (edges.size() != 0 && ev.size() > 1) {
878 assert(lane !=
nullptr);
881 if (routeIndex == 0) {
888 if (origEdge->
getToJunction() == ev[routeIndex - 1]->getToJunction() || origEdge->
getToJunction() == ev[routeIndex - 1]->getFromJunction()) {
898 const MSEdge* newEdge = edges[0];
899 if (edges[0]->getFromJunction() == originalTarget || edges[0]->getToJunction() == originalTarget) {
901 edges[routeIndex] = newEdge;
905 if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) {
910 lanePosLat = perpDist;
911 if (!mayLeaveNetwork) {
919 WRITE_WARNING(
"Could not determine position on lane '" + lane->
getID() +
" at lateral position " +
toString(-lanePosLat) +
".");
923 lanePosLat = -lanePosLat;
931 assert((found && lane != 0) || (!found && lane == 0));
964 throw TraCIException(
"Command moveToXY is not supported for person '" + personID +
"' while " + p->
getCurrentStageDescription() +
".");
968 if (lane ==
nullptr) {
969 throw TraCIException(
"Could not map person '" + personID +
"' no road found within " +
toString(maxRouteDistance) +
"m.");
971 throw TraCIException(
"Could not map person '" + personID +
"' distance to road is " +
toString(bestDistance) +
".");
980 Person::setParameter(
const std::string& personID,
const std::string& key,
const std::string& value) {
986 Person::setLength(
const std::string& personID,
double length) {
987 getPerson(personID)->getSingularType().setLength(length);
992 Person::setMaxSpeed(
const std::string& personID,
double speed) {
993 getPerson(personID)->getSingularType().setMaxSpeed(speed);
998 Person::setVehicleClass(
const std::string& personID,
const std::string& clazz) {
1004 Person::setShapeClass(
const std::string& personID,
const std::string& clazz) {
1010 Person::setEmissionClass(
const std::string& personID,
const std::string& clazz) {
1016 Person::setWidth(
const std::string& personID,
double width) {
1017 getPerson(personID)->getSingularType().setWidth(width);
1022 Person::setHeight(
const std::string& personID,
double height) {
1023 getPerson(personID)->getSingularType().setHeight(height);
1028 Person::setMinGap(
const std::string& personID,
double minGap) {
1029 getPerson(personID)->getSingularType().setMinGap(minGap);
1034 Person::setAccel(
const std::string& personID,
double accel) {
1035 getPerson(personID)->getSingularType().setAccel(accel);
1040 Person::setDecel(
const std::string& personID,
double decel) {
1041 getPerson(personID)->getSingularType().setDecel(decel);
1046 Person::setEmergencyDecel(
const std::string& personID,
double decel) {
1047 getPerson(personID)->getSingularType().setEmergencyDecel(decel);
1052 Person::setApparentDecel(
const std::string& personID,
double decel) {
1053 getPerson(personID)->getSingularType().setApparentDecel(decel);
1058 Person::setImperfection(
const std::string& personID,
double imperfection) {
1059 getPerson(personID)->getSingularType().setImperfection(imperfection);
1064 Person::setTau(
const std::string& personID,
double tau) {
1065 getPerson(personID)->getSingularType().setTau(tau);
1070 Person::setMinGapLat(
const std::string& personID,
double minGapLat) {
1071 getPerson(personID)->getSingularType().setMinGapLat(minGapLat);
1076 Person::setMaxSpeedLat(
const std::string& personID,
double speed) {
1077 getPerson(personID)->getSingularType().setMaxSpeedLat(speed);
1082 Person::setLateralAlignment(
const std::string& personID,
const std::string& latAlignment) {
1086 getPerson(personID)->getSingularType().setPreferredLateralAlignment(lad, lao);
1088 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)");
1094 Person::setSpeedFactor(
const std::string& personID,
double factor) {
1095 getPerson(personID)->setSpeedFactor(factor);
1100 Person::setActionStepLength(
const std::string& personID,
double actionStepLength,
bool resetActionOffset) {
1105 Person::remove(
const std::string& personID,
char ) {
1106 MSPerson* person = getPerson(personID);
1116 Person::setColor(
const std::string& personID,
const TraCIColor& c) {
1118 p.
color.
set((
unsigned char)c.r, (
unsigned char)c.g, (
unsigned char)c.b, (
unsigned char)c.a);
1127 Person::getPerson(
const std::string& personID) {
1134 shape.push_back(getPerson(
id)->getPosition());
1138 std::shared_ptr<VariableWrapper>
1139 Person::makeWrapper() {
1140 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
1145 Person::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
1148 return wrapper->wrapStringList(objID, variable, getIDList());
1150 return wrapper->wrapInt(objID, variable, getIDCount());
1152 return wrapper->wrapPosition(objID, variable, getPosition(objID));
1154 return wrapper->wrapPosition(objID, variable, getPosition(objID,
true));
1156 return wrapper->wrapDouble(objID, variable, getAngle(objID));
1158 return wrapper->wrapDouble(objID, variable, getSlope(objID));
1160 return wrapper->wrapDouble(objID, variable, getSpeed(objID));
1162 return wrapper->wrapString(objID, variable, getRoadID(objID));
1164 return wrapper->wrapString(objID, variable, getLaneID(objID));
1166 return wrapper->wrapDouble(objID, variable, getLanePosition(objID));
1168 return wrapper->wrapColor(objID, variable, getColor(objID));
1170 return wrapper->wrapDouble(objID, variable, getWaitingTime(objID));
1172 return wrapper->wrapString(objID, variable, getTypeID(objID));
1174 return wrapper->wrapDouble(objID, variable, getSpeedFactor(objID));
1176 return wrapper->wrapString(objID, variable, getNextEdge(objID));
1178 return wrapper->wrapInt(objID, variable, getRemainingStages(objID));
1180 return wrapper->wrapString(objID, variable, getVehicle(objID));
1183 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
1186 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
1191 return libsumo::VehicleType::handleVariable(getTypeID(objID), variable, wrapper, paramData);
std::vector< const MSEdge * > ConstMSEdgeVector
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t)
convert SUMOTime to string
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.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
const int VEHPARS_COLOR_SET
@ GIVEN
The position is given.
DepartDefinition
Possible ways to depart.
@ DEPART_DEF_MAX
Tag for the last element in the enum for safe int casting.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_PARKING_AREA
A parking area.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
#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)
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
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 std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSJunction * getFromJunction() const
double getLength() const
return the length of the edge
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....
const MSJunction * getToJunction() const
static double gLateralResolution
The base class for an intersection.
Representation of a lane in the micro simulation.
MSEdge & getEdge() const
Returns the lane's edge.
const PositionVector & getShape() const
Returns this lane's shape.
double interpolateLanePosToGeometryPos(double lanePos) const
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).
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
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.
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
virtual MSTransportableControl & getPersonControl()
Returns the person control.
void reroute(ConstMSEdgeVector &newEdges, double departPos, int firstIndex, int nextIndex)
set new walk and replace the stages with relative indices in the interval [firstIndex,...
const std::set< std::string > & getLines() const
SUMOTime getIntendedDepart() const
std::string getIntendedVehicleID() const
std::string getVehicleType() const
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
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
SUMOTime getArrived() const
get arrival time of stage
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 * >::iterator getRouteStep() const
const std::vector< const MSEdge * > & getRoute() const
A lane area vehicles can halt at.
double getEndLanePosition() const
Returns the end position of this stop.
std::map< std::string, MSTransportable * >::const_iterator constVehIt
Definition of the internal transportables map iterator.
constVehIt loadedBegin() const
Returns the begin of the internal transportables map.
void forceDeparture()
register forced (traci) departure
int size() const
Returns the number of known transportables.
constVehIt loadedEnd() const
Returns the end of the internal transportables map.
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.
const MSEdge * getArrivalEdge() const
returns the final arrival edge
std::string getCurrentStageDescription() const
Returns the current stage description as a string.
MSStageType getStageType(int next) const
the stage type for the nth next stage
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
void removeStage(int next, bool stayInSim=true)
removes the nth next stage
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
bool isPerson() const
Whether it is a person.
ConstMSEdgeVector getEdges(int next) const
Return the edges of the nth next stage.
Position getPosition(const double) const
Return current position (x/y, cartesian)
double getArrivalPos() const
returns the final arrival pos
int getNumStages() const
Return the total number stages in this persons plan.
MSStageType getCurrentStageType() const
the current stage type of the transportable
const MSEdge * getEdge() const
Returns the current edge.
MSStage * getCurrentStage() const
Return the current stage.
MSStage * getNextStage(int next) const
Return the current stage.
void appendStage(MSStage *stage, int next=-1)
Appends the given stage to the current plan.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
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.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
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 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
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 ammount
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.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
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.
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 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 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_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 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< MSTransportable * > persons