Eclipse SUMO - Simulation of Urban MObility
libsumo::Helper Class Reference

C++ TraCI client API implementation. More...

#include <Helper.h>

Collaboration diagram for libsumo::Helper:
[legend]

Data Structures

class  LaneUtility
 
class  SubscriptionWrapper
 
class  TransportableStateListener
 
class  VehicleStateListener
 

Static Public Member Functions

static SubscriptionaddSubscriptionFilter (SubscriptionFilterType filter)
 
static void applySubscriptionFilterFieldOfVision (const Subscription &s, std::set< std::string > &objIDs)
 
static void applySubscriptionFilterLanes (const Subscription &s, std::set< const SUMOTrafficObject * > &vehs, std::vector< int > &filterLanes, double downstreamDist, double upstreamDist, bool disregardOppositeDirection)
 Apply the subscription filter "lanes": Only return vehicles on list of lanes relative to ego vehicle. Search all predecessor and successor lanes along the road network up until upstreamDist and downstreamDist, respectively,. More...
 
static void applySubscriptionFilterLateralDistance (const Subscription &s, std::set< const SUMOTrafficObject * > &vehs, double downstreamDist, double upstreamDist, double lateralDist)
 Apply the subscription filter "lateral distance": Only return vehicles within the given lateral distance. Search myRoute (right-most lane) upstream and bestLanesCont downstream up until upstreamDist and downstreamDist, respectively. More...
 
static void applySubscriptionFilterLateralDistanceSinglePass (const Subscription &s, std::set< std::string > &objIDs, std::set< const SUMOTrafficObject * > &vehs, const std::vector< const MSLane * > &lanes, double posOnLane, double posLat, bool isDownstream)
 
static void applySubscriptionFilters (const Subscription &s, std::set< std::string > &objIDs)
 Filter the given ID-Set (which was obtained from an R-Tree search) according to the filters set by the subscription or firstly build the object ID list if the filters rather demand searching along the road network than considering a geometric range. More...
 
static void applySubscriptionFilterTurn (const Subscription &s, std::set< const SUMOTrafficObject * > &vehs)
 Apply the subscription filter "turn": Gather upcoming junctions and vialanes within downstream distance and find approaching foes within foeDistToJunction. More...
 
static TraCINextStopData buildStopData (const SUMOVehicleParameter::Stop &stopPar)
 
static SUMOVehicleParameter::Stop buildStopParameters (const std::string &edgeOrStoppingPlaceID, double pos, int laneIndex, double startPos, int flags, double duration, double until)
 
static void cleanup ()
 
static void clearStateChanges ()
 
static void clearSubscriptions ()
 
static void collectObjectIDsInRange (int domain, const PositionVector &shape, double range, std::set< std::string > &into)
 
static void collectObjectsInRange (int domain, const PositionVector &shape, double range, std::set< const Named * > &into)
 
static std::pair< MSLane *, double > convertCartesianToRoadMap (const Position &pos, const SUMOVehicleClass vClass)
 
static void findObjectShape (int domain, const std::string &id, PositionVector &shape)
 
static MSCalibrator::AspiredState getCalibratorState (const MSCalibrator *c)
 
static double getDrivingDistance (std::pair< const MSLane *, double > &roadPos1, std::pair< const MSLane *, double > &roadPos2)
 
static MSEdgegetEdge (const std::string &edgeID)
 
static const MSLanegetLaneChecking (const std::string &edgeID, int laneIndex, double pos)
 
static MSPersongetPerson (const std::string &id)
 
static MSStoppingPlacegetStoppingPlace (const std::string &id, const SumoXMLTag type)
 
static MSTLLogicControl::TLSLogicVariantsgetTLS (const std::string &id)
 
static SUMOTrafficObjectgetTrafficObject (int domain, const std::string &id)
 
static const std::vector< std::string > & getTransportableStateChanges (const MSNet::TransportableState state)
 
static MSBaseVehiclegetVehicle (const std::string &id)
 
static const std::vector< std::string > & getVehicleStateChanges (const MSNet::VehicleState state)
 
static const MSVehicleTypegetVehicleType (const std::string &vehicleID)
 
static void handleSubscriptions (const SUMOTime t)
 
static Position makePosition (const TraCIPosition &position)
 
static PositionVector makePositionVector (const TraCIPositionVector &vector)
 
static RGBColor makeRGBColor (const TraCIColor &color)
 
static TraCIColor makeTraCIColor (const RGBColor &color)
 
static TraCIPosition makeTraCIPosition (const Position &position, const bool includeZ=false)
 
static TraCIPositionVector makeTraCIPositionVector (const PositionVector &positionVector)
 helper functions More...
 
static bool needNewSubscription (libsumo::Subscription &s, std::vector< Subscription > &subscriptions, libsumo::Subscription *&modifiedSubscription)
 
static int postProcessRemoteControl ()
 return number of remote-controlled entities More...
 
static void registerStateListener ()
 
static void setRemoteControlled (MSPerson *p, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
 
static void setRemoteControlled (MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
 
static void subscribe (const int commandId, const std::string &id, const std::vector< int > &variables, const double beginTime, const double endTime, const libsumo::TraCIResults &params, const int contextDomain=0, const double range=0.)
 
functions for moveToXY
static bool moveToXYMap (const Position &pos, double maxRouteDistance, bool mayLeaveNetwork, const std::string &origID, const double angle, double speed, const ConstMSEdgeVector &currentRoute, const int routePosition, const MSLane *currentLane, double currentLanePos, bool onRoad, SUMOVehicleClass vClass, bool setLateralPos, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
 
static bool moveToXYMap_matchingRoutePosition (const Position &pos, const std::string &origID, const ConstMSEdgeVector &currentRoute, int routeIndex, SUMOVehicleClass vClass, bool setLateralPos, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset)
 
static bool findCloserLane (const MSEdge *edge, const Position &pos, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane)
 

Private Member Functions

 Helper ()=delete
 invalidated standard constructor More...
 

Static Private Member Functions

static void debugPrint (const SUMOTrafficObject *veh)
 
static void fuseLaneCoverage (std::shared_ptr< LaneCoverageInfo > aggregatedLaneCoverage, const std::shared_ptr< LaneCoverageInfo > newLaneCoverage)
 Adds lane coverage information from newLaneCoverage into aggregatedLaneCoverage. More...
 
static void handleSingleSubscription (const Subscription &s)
 

Static Private Attributes

static LANE_RTREE_QUALmyLaneTree
 A lookup tree of lanes. More...
 
static SubscriptionmyLastContextSubscription = nullptr
 The last context subscription. More...
 
static std::map< std::string, MSPerson * > myRemoteControlledPersons
 
static std::map< std::string, MSVehicle * > myRemoteControlledVehicles
 
static std::vector< SubscriptionmySubscriptions
 The list of known, still valid subscriptions. More...
 
static TransportableStateListener myTransportableStateListener
 Changes in the states of simulated transportables. More...
 
static VehicleStateListener myVehicleStateListener
 Changes in the states of simulated vehicles. More...
 
static std::map< int, std::shared_ptr< VariableWrapper > > myWrapper
 Map of commandIds -> their executors; applicable if the executor applies to the method footprint. More...
 

Detailed Description

C++ TraCI client API implementation.

Definition at line 56 of file Helper.h.

Constructor & Destructor Documentation

◆ Helper()

libsumo::Helper::Helper ( )
privatedelete

invalidated standard constructor

Member Function Documentation

◆ addSubscriptionFilter()

◆ applySubscriptionFilterFieldOfVision()

void libsumo::Helper::applySubscriptionFilterFieldOfVision ( const Subscription s,
std::set< std::string > &  objIDs 
)
static

◆ applySubscriptionFilterLanes()

void libsumo::Helper::applySubscriptionFilterLanes ( const Subscription s,
std::set< const SUMOTrafficObject * > &  vehs,
std::vector< int > &  filterLanes,
double  downstreamDist,
double  upstreamDist,
bool  disregardOppositeDirection 
)
static

Apply the subscription filter "lanes": Only return vehicles on list of lanes relative to ego vehicle. Search all predecessor and successor lanes along the road network up until upstreamDist and downstreamDist, respectively,.

Parameters
[in]sSubscription which holds the filter specification to be applied.
[in/out]vehs Set of SUMO traffic objects into which the result is inserted.
[in]filterLanesLane offsets to consider.
[in]downstreamDistDownstream distance.
[in]upstreamDistUpstream distance.
[in]disregardOppositeDirectionWhether vehicles on opposite lanes shall be taken into account.

Definition at line 1064 of file Helper.cpp.

References libsumo::Subscription::contextDomain, debugPrint(), fuseLaneCoverage(), MSLane::getEdge(), Named::getID(), MSLane::getIndex(), MSVehicle::getLane(), MSEdge::getLanes(), MSBaseVehicle::getLength(), MSLane::getLength(), MSEdge::getOppositeEdge(), MSLane::getParallelLane(), MSVehicle::getPositionOnLane(), MSLane::getSurroundingVehicles(), getVehicle(), MSLane::getVehiclesInRange(), libsumo::Subscription::id, libsumo::Subscription::isVehicleToVehicleContextSubscription(), MAX2(), SIMTIME, TL, toHex(), and WRITE_WARNINGF.

Referenced by applySubscriptionFilters().

Here is the caller graph for this function:

◆ applySubscriptionFilterLateralDistance()

void libsumo::Helper::applySubscriptionFilterLateralDistance ( const Subscription s,
std::set< const SUMOTrafficObject * > &  vehs,
double  downstreamDist,
double  upstreamDist,
double  lateralDist 
)
static

Apply the subscription filter "lateral distance": Only return vehicles within the given lateral distance. Search myRoute (right-most lane) upstream and bestLanesCont downstream up until upstreamDist and downstreamDist, respectively.

Parameters
[in]sSubscription which holds the filter specification to be applied.
[in/out]vehs Set of SUMO traffic objects into which the result is inserted.
[in]downstreamDistDownstream distance.
[in]upstreamDistUpstream distance.
[in]lateralDistLateral distance.

Definition at line 1266 of file Helper.cpp.

References applySubscriptionFilterLateralDistanceSinglePass(), collectObjectIDsInRange(), libsumo::Subscription::commandId, libsumo::Subscription::contextDomain, findObjectShape(), Named::getID(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicle::getLateralPositionOnLane(), MSVehicleType::getLength(), MSLane::getOppositePos(), MSLane::getParallelOpposite(), MSVehicle::getPastLanesUntil(), MSVehicle::getPositionOnLane(), MSVehicle::getUpcomingLanesUntil(), getVehicle(), MSBaseVehicle::getVehicleType(), libsumo::Subscription::id, MSAbstractLaneChangeModel::isOpposite(), MAX2(), and MAX3().

Referenced by applySubscriptionFilters().

Here is the caller graph for this function:

◆ applySubscriptionFilterLateralDistanceSinglePass()

void libsumo::Helper::applySubscriptionFilterLateralDistanceSinglePass ( const Subscription s,
std::set< std::string > &  objIDs,
std::set< const SUMOTrafficObject * > &  vehs,
const std::vector< const MSLane * > &  lanes,
double  posOnLane,
double  posLat,
bool  isDownstream 
)
static

◆ applySubscriptionFilters()

void libsumo::Helper::applySubscriptionFilters ( const Subscription s,
std::set< std::string > &  objIDs 
)
static

Filter the given ID-Set (which was obtained from an R-Tree search) according to the filters set by the subscription or firstly build the object ID list if the filters rather demand searching along the road network than considering a geometric range.

Parameters
[in]sSubscription which holds the filter specification to be applied
[in/out]objIDs Set of object IDs that is to be filtered. Result is stored in place.
Note
Currently this assumes that the objects are vehicles.

Definition at line 884 of file Helper.cpp.

References libsumo::Subscription::activeFilters, applySubscriptionFilterFieldOfVision(), applySubscriptionFilterLanes(), applySubscriptionFilterLateralDistance(), applySubscriptionFilterTurn(), debugPrint(), libsumo::Subscription::filterDownstreamDist, libsumo::Subscription::filterLanes, libsumo::Subscription::filterLateralDist, libsumo::Subscription::filterUpstreamDist, libsumo::Subscription::filterVClasses, libsumo::Subscription::filterVTypes, MSVehicle::getBestLanesContinuation(), MSLane::getEdge(), MSLane::getFollower(), MSVehicleType::getID(), Named::getID(), MSLane::getIndex(), MSVehicle::getLane(), SUMOTrafficObject::getLane(), MSEdge::getLanes(), MSLane::getLeader(), MSBaseVehicle::getLength(), MSEdge::getLength(), MSEdge::getOppositeEdge(), MSLane::getParallelLane(), MSVehicle::getPositionOnLane(), getVehicle(), MSVehicleType::getVehicleClass(), MSBaseVehicle::getVehicleType(), libsumo::Subscription::id, MSVehicle::isOnRoad(), MAX2(), libsumo::Subscription::range, SIMTIME, libsumo::SUBS_FILTER_DOWNSTREAM_DIST, libsumo::SUBS_FILTER_FIELD_OF_VISION, libsumo::SUBS_FILTER_LANES, libsumo::SUBS_FILTER_LATERAL_DIST, libsumo::SUBS_FILTER_LEAD_FOLLOW, libsumo::SUBS_FILTER_MANEUVER, libsumo::SUBS_FILTER_NO_RTREE, libsumo::SUBS_FILTER_NOOPPOSITE, libsumo::SUBS_FILTER_TURN, libsumo::SUBS_FILTER_UPSTREAM_DIST, libsumo::SUBS_FILTER_VCLASS, libsumo::SUBS_FILTER_VTYPE, TL, toString(), and WRITE_WARNINGF.

Referenced by handleSingleSubscription(), and TraCIServer::processSingleSubscription().

Here is the caller graph for this function:

◆ applySubscriptionFilterTurn()

void libsumo::Helper::applySubscriptionFilterTurn ( const Subscription s,
std::set< const SUMOTrafficObject * > &  vehs 
)
static

Apply the subscription filter "turn": Gather upcoming junctions and vialanes within downstream distance and find approaching foes within foeDistToJunction.

Parameters
[in]sSubscription which holds the filter specification to be applied.
[in/out]vehs Set of SUMO traffic objects into which the result is inserted.

Definition at line 1162 of file Helper.cpp.

References libsumo::Subscription::contextDomain, libsumo::Subscription::filterDownstreamDist, libsumo::Subscription::filterFoeDistToJunction, MSLink::getApproaching(), MSVehicle::getBestLanesContinuation(), Named::getID(), MSVehicle::getLane(), MSVehicle::getPositionOnLane(), MSLane::getUpcomingLinks(), getVehicle(), MSLane::getVehiclesSecure(), libsumo::Subscription::id, MSLane::isInternal(), libsumo::Subscription::isVehicleToVehicleContextSubscription(), MSLane::releaseVehicles(), TL, toHex(), and WRITE_WARNINGF.

Referenced by applySubscriptionFilters().

Here is the caller graph for this function:

◆ buildStopData()

◆ buildStopParameters()

SUMOVehicleParameter::Stop libsumo::Helper::buildStopParameters ( const std::string &  edgeOrStoppingPlaceID,
double  pos,
int  laneIndex,
double  startPos,
int  flags,
double  duration,
double  until 
)
static

Definition at line 537 of file Helper.cpp.

References SUMOVehicleParameter::Stop::busstop, SUMOVehicleParameter::Stop::chargingStation, SUMOVehicleParameter::Stop::containerstop, SUMOVehicleParameter::Stop::containerTriggered, MSEdge::dictionary(), SUMOVehicleParameter::Stop::duration, SUMOVehicleParameter::Stop::edge, SUMOVehicleParameter::Stop::endPos, MSStoppingPlace::getBeginLanePosition(), MSLane::getEdge(), MSStoppingPlace::getEndLanePosition(), Named::getID(), MSNet::getInstance(), MSStoppingPlace::getLane(), MSEdge::getLanes(), MSNet::getStoppingPlace(), SUMOVehicleParameter::Stop::index, libsumo::INVALID_DOUBLE_VALUE, SUMOVehicleParameter::Stop::lane, MAX2(), OFFROAD, SUMOVehicleParameter::Stop::overheadWireSegment, SUMOVehicleParameter::Stop::parametersSet, SUMOVehicleParameter::Stop::parking, SUMOVehicleParameter::Stop::parkingarea, SUMOVehicleParameter::Stop::startPos, STOP_CONTAINER_TRIGGER_SET, STOP_DURATION_SET, STOP_END_SET, STOP_INDEX_FIT, STOP_PARKING_SET, STOP_START_SET, STOP_TRIGGER_SET, STOP_UNTIL_SET, SUMO_TAG_BUS_STOP, SUMO_TAG_CHARGING_STATION, SUMO_TAG_CONTAINER_STOP, SUMO_TAG_NOTHING, SUMO_TAG_OVERHEAD_WIRE_SEGMENT, SUMO_TAG_PARKING_AREA, SUMOTime_MAX, TIME2STEPS, toString(), SUMOVehicleParameter::Stop::triggered, and SUMOVehicleParameter::Stop::until.

Referenced by LIBSUMO_NAMESPACE::Vehicle::insertStop(), LIBSUMO_NAMESPACE::Vehicle::replaceStop(), and LIBSUMO_NAMESPACE::Vehicle::setStop().

Here is the caller graph for this function:

◆ cleanup()

void libsumo::Helper::cleanup ( )
static

Definition at line 677 of file Helper.cpp.

References clearStateChanges(), clearSubscriptions(), and myLaneTree.

Referenced by MSNet::clearAll().

Here is the caller graph for this function:

◆ clearStateChanges()

void libsumo::Helper::clearStateChanges ( )
static

Definition at line 713 of file Helper.cpp.

References libsumo::Helper::TransportableStateListener::myTransportableStateChanges, myTransportableStateListener, libsumo::Helper::VehicleStateListener::myVehicleStateChanges, and myVehicleStateListener.

Referenced by cleanup(), LIBSUMO_NAMESPACE::Simulation::loadState(), and LIBSUMO_NAMESPACE::Simulation::step().

Here is the caller graph for this function:

◆ clearSubscriptions()

void libsumo::Helper::clearSubscriptions ( )
static

Definition at line 203 of file Helper.cpp.

References myLastContextSubscription, and mySubscriptions.

Referenced by cleanup(), LIBSUMO_NAMESPACE::Simulation::close(), and LIBSUMO_NAMESPACE::Simulation::loadState().

Here is the caller graph for this function:

◆ collectObjectIDsInRange()

void libsumo::Helper::collectObjectIDsInRange ( int  domain,
const PositionVector shape,
double  range,
std::set< std::string > &  into 
)
static

Definition at line 804 of file Helper.cpp.

References collectObjectsInRange().

Referenced by applySubscriptionFilterLateralDistance(), handleSingleSubscription(), and TraCIServer::processSingleSubscription().

Here is the caller graph for this function:

◆ collectObjectsInRange()

◆ convertCartesianToRoadMap()

◆ debugPrint()

void libsumo::Helper::debugPrint ( const SUMOTrafficObject veh)
staticprivate

Definition at line 97 of file Helper.cpp.

References SUMOTrafficObject::getEdge(), Named::getID(), and SUMOTrafficObject::isVehicle().

Referenced by applySubscriptionFilterLanes(), and applySubscriptionFilters().

Here is the caller graph for this function:

◆ findCloserLane()

bool libsumo::Helper::findCloserLane ( const MSEdge edge,
const Position pos,
SUMOVehicleClass  vClass,
double &  bestDistance,
MSLane **  lane 
)
static

Definition at line 1679 of file Helper.cpp.

References MSEdge::getLanes(), MSEdge::getNumLanes(), and MSEdge::isInternal().

Referenced by moveToXYMap_matchingRoutePosition().

Here is the caller graph for this function:

◆ findObjectShape()

◆ fuseLaneCoverage()

void libsumo::Helper::fuseLaneCoverage ( std::shared_ptr< LaneCoverageInfo aggregatedLaneCoverage,
const std::shared_ptr< LaneCoverageInfo newLaneCoverage 
)
staticprivate

Adds lane coverage information from newLaneCoverage into aggregatedLaneCoverage.

Parameters
[in/out]aggregatedLaneCoverage - aggregated lane coverage info, to which the new will be added
[in]newLaneCoverage- new lane coverage to be added
Todo:
Disjunct ranges are not handled (LaneCoverageInfo definition would need to allow several intervals per lane) but the intermediate range is simply assimilated.

Definition at line 319 of file Helper.cpp.

References MAX2(), and MIN2().

Referenced by applySubscriptionFilterLanes().

Here is the caller graph for this function:

◆ getCalibratorState()

MSCalibrator::AspiredState libsumo::Helper::getCalibratorState ( const MSCalibrator c)
static

Definition at line 724 of file Helper.cpp.

References MSCalibrator::getCurrentStateInterval().

Referenced by LIBSUMO_NAMESPACE::Calibrator::getBegin(), LIBSUMO_NAMESPACE::Calibrator::getEnd(), LIBSUMO_NAMESPACE::Calibrator::getRouteID(), LIBSUMO_NAMESPACE::Calibrator::getSpeed(), LIBSUMO_NAMESPACE::Calibrator::getTypeID(), and LIBSUMO_NAMESPACE::Calibrator::getVehsPerHour().

Here is the caller graph for this function:

◆ getDrivingDistance()

double libsumo::Helper::getDrivingDistance ( std::pair< const MSLane *, double > &  roadPos1,
std::pair< const MSLane *, double > &  roadPos2 
)
static

Definition at line 455 of file Helper.cpp.

References SUMOAbstractRouter< E, V >::compute(), MSRoute::getDistanceBetween(), MSNet::getInstance(), MSNet::getRouterTT(), libsumo::INVALID_DOUBLE_VALUE, and SIMSTEP.

Referenced by TraCIServerAPI_Simulation::commandDistanceRequest(), LIBSUMO_NAMESPACE::Simulation::getDistance2D(), and LIBSUMO_NAMESPACE::Simulation::getDistanceRoad().

Here is the caller graph for this function:

◆ getEdge()

MSEdge * libsumo::Helper::getEdge ( const std::string &  edgeID)
static

Definition at line 393 of file Helper.cpp.

References MSEdge::dictionary().

Referenced by LIBSUMO_NAMESPACE::Vehicle::getAdaptedTraveltime(), and LIBSUMO_NAMESPACE::Vehicle::getEffort().

Here is the caller graph for this function:

◆ getLaneChecking()

const MSLane * libsumo::Helper::getLaneChecking ( const std::string &  edgeID,
int  laneIndex,
double  pos 
)
static

◆ getPerson()

MSPerson * libsumo::Helper::getPerson ( const std::string &  id)
static

Definition at line 491 of file Helper.cpp.

References MSTransportableControl::get(), MSNet::getInstance(), and MSNet::getPersonControl().

Referenced by LIBSUMO_NAMESPACE::Person::getPerson(), and getTrafficObject().

Here is the caller graph for this function:

◆ getStoppingPlace()

MSStoppingPlace * libsumo::Helper::getStoppingPlace ( const std::string &  id,
const SumoXMLTag  type 
)
static

Definition at line 527 of file Helper.cpp.

References MSNet::getInstance(), MSNet::getStoppingPlace(), and toString().

Referenced by findObjectShape(), LIBSUMO_NAMESPACE::BusStop::getBusStop(), LIBSUMO_NAMESPACE::ChargingStation::getChargingStation(), and LIBSUMO_NAMESPACE::ParkingArea::getParkingArea().

Here is the caller graph for this function:

◆ getTLS()

MSTLLogicControl::TLSLogicVariants & libsumo::Helper::getTLS ( const std::string &  id)
static

Definition at line 518 of file Helper.cpp.

References MSTLLogicControl::get(), MSNet::getInstance(), and MSNet::getTLSControl().

Referenced by LIBSUMO_NAMESPACE::TrafficLight::addConstraint(), LIBSUMO_NAMESPACE::TrafficLight::getAllProgramLogics(), LIBSUMO_NAMESPACE::TrafficLight::getBlockingVehicles(), LIBSUMO_NAMESPACE::TrafficLight::getConstraints(), LIBSUMO_NAMESPACE::TrafficLight::getConstraintsByFoe(), LIBSUMO_NAMESPACE::TrafficLight::getControlledJunctions(), LIBSUMO_NAMESPACE::TrafficLight::getControlledLanes(), LIBSUMO_NAMESPACE::TrafficLight::getControlledLinks(), LIBSUMO_NAMESPACE::TrafficLight::getNextSwitch(), LIBSUMO_NAMESPACE::TrafficLight::getPhase(), LIBSUMO_NAMESPACE::TrafficLight::getPhaseDuration(), LIBSUMO_NAMESPACE::TrafficLight::getPhaseName(), LIBSUMO_NAMESPACE::TrafficLight::getPriorityVehicles(), LIBSUMO_NAMESPACE::TrafficLight::getProgram(), LIBSUMO_NAMESPACE::TrafficLight::getRedYellowGreenState(), LIBSUMO_NAMESPACE::TrafficLight::getRivalVehicles(), LIBSUMO_NAMESPACE::TrafficLight::getServedPersonCount(), LIBSUMO_NAMESPACE::TrafficLight::getSpentDuration(), LIBSUMO_NAMESPACE::TrafficLight::removeConstraints(), LIBSUMO_NAMESPACE::TrafficLight::setPhase(), LIBSUMO_NAMESPACE::TrafficLight::setPhaseDuration(), LIBSUMO_NAMESPACE::TrafficLight::setPhaseName(), LIBSUMO_NAMESPACE::TrafficLight::setProgram(), LIBSUMO_NAMESPACE::TrafficLight::setProgramLogic(), LIBSUMO_NAMESPACE::TrafficLight::setRedYellowGreenState(), and LIBSUMO_NAMESPACE::TrafficLight::swapConstraints().

Here is the caller graph for this function:

◆ getTrafficObject()

SUMOTrafficObject * libsumo::Helper::getTrafficObject ( int  domain,
const std::string &  id 
)
static

Definition at line 501 of file Helper.cpp.

References libsumo::CMD_GET_PERSON_VARIABLE, libsumo::CMD_GET_VEHICLE_VARIABLE, getPerson(), getVehicle(), and toString().

Referenced by applySubscriptionFilterFieldOfVision(), and applySubscriptionFilterLateralDistanceSinglePass().

Here is the caller graph for this function:

◆ getTransportableStateChanges()

const std::vector< std::string > & libsumo::Helper::getTransportableStateChanges ( const MSNet::TransportableState  state)
static

◆ getVehicle()

MSBaseVehicle * libsumo::Helper::getVehicle ( const std::string &  id)
static

Definition at line 477 of file Helper.cpp.

References MSNet::getInstance(), MSVehicleControl::getVehicle(), and MSNet::getVehicleControl().

Referenced by applySubscriptionFilterFieldOfVision(), applySubscriptionFilterLanes(), applySubscriptionFilterLateralDistance(), applySubscriptionFilters(), applySubscriptionFilterTurn(), LIBSUMO_NAMESPACE::Vehicle::changeLane(), LIBSUMO_NAMESPACE::Vehicle::changeLaneRelative(), LIBSUMO_NAMESPACE::Vehicle::changeSublane(), LIBSUMO_NAMESPACE::Vehicle::changeTarget(), LIBSUMO_NAMESPACE::Vehicle::deactivateGapControl(), LIBSUMO_NAMESPACE::Vehicle::dispatchTaxi(), LIBSUMO_NAMESPACE::Vehicle::getAcceleration(), LIBSUMO_NAMESPACE::Vehicle::getAccumulatedWaitingTime(), LIBSUMO_NAMESPACE::Vehicle::getAdaptedTraveltime(), LIBSUMO_NAMESPACE::Vehicle::getAllowedSpeed(), LIBSUMO_NAMESPACE::Vehicle::getAngle(), LIBSUMO_NAMESPACE::Vehicle::getBestLanes(), LIBSUMO_NAMESPACE::Vehicle::getCO2Emission(), LIBSUMO_NAMESPACE::Vehicle::getCOEmission(), LIBSUMO_NAMESPACE::Vehicle::getDepartDelay(), LIBSUMO_NAMESPACE::Vehicle::getDeparture(), LIBSUMO_NAMESPACE::Vehicle::getDistance(), LIBSUMO_NAMESPACE::Vehicle::getDrivingDistance(), LIBSUMO_NAMESPACE::Vehicle::getDrivingDistance2D(), LIBSUMO_NAMESPACE::Vehicle::getEffort(), LIBSUMO_NAMESPACE::Vehicle::getElectricityConsumption(), LIBSUMO_NAMESPACE::Vehicle::getFollower(), LIBSUMO_NAMESPACE::Vehicle::getFollowSpeed(), LIBSUMO_NAMESPACE::Vehicle::getFuelConsumption(), LIBSUMO_NAMESPACE::Vehicle::getHCEmission(), LIBSUMO_NAMESPACE::Vehicle::getJunctionFoes(), LIBSUMO_NAMESPACE::Vehicle::getLaneChangeMode(), LIBSUMO_NAMESPACE::Vehicle::getLaneChangeState(), LIBSUMO_NAMESPACE::Vehicle::getLaneID(), LIBSUMO_NAMESPACE::Vehicle::getLaneIndex(), LIBSUMO_NAMESPACE::Vehicle::getLanePosition(), LIBSUMO_NAMESPACE::Vehicle::getLastActionTime(), LIBSUMO_NAMESPACE::Vehicle::getLateralLanePosition(), LIBSUMO_NAMESPACE::Vehicle::getLateralSpeed(), LIBSUMO_NAMESPACE::Vehicle::getLeader(), LIBSUMO_NAMESPACE::Vehicle::getLine(), LIBSUMO_NAMESPACE::Vehicle::getNeighbors(), LIBSUMO_NAMESPACE::Vehicle::getNextLinks(), LIBSUMO_NAMESPACE::Vehicle::getNextTLS(), LIBSUMO_NAMESPACE::Vehicle::getNoiseEmission(), LIBSUMO_NAMESPACE::Vehicle::getNOxEmission(), LIBSUMO_NAMESPACE::Vehicle::getPersonIDList(), LIBSUMO_NAMESPACE::Vehicle::getPersonNumber(), LIBSUMO_NAMESPACE::Vehicle::getPMxEmission(), LIBSUMO_NAMESPACE::Vehicle::getPosition(), LIBSUMO_NAMESPACE::Vehicle::getRoadID(), LIBSUMO_NAMESPACE::Vehicle::getRoute(), LIBSUMO_NAMESPACE::Vehicle::getRouteID(), LIBSUMO_NAMESPACE::Vehicle::getRouteIndex(), LIBSUMO_NAMESPACE::Vehicle::getRoutingMode(), LIBSUMO_NAMESPACE::Vehicle::getSecureGap(), LIBSUMO_NAMESPACE::Vehicle::getSignals(), LIBSUMO_NAMESPACE::Vehicle::getSlope(), LIBSUMO_NAMESPACE::Vehicle::getSpeed(), LIBSUMO_NAMESPACE::Vehicle::getSpeedMode(), LIBSUMO_NAMESPACE::Vehicle::getSpeedWithoutTraCI(), LIBSUMO_NAMESPACE::Vehicle::getStopArrivalDelay(), LIBSUMO_NAMESPACE::Vehicle::getStopDelay(), LIBSUMO_NAMESPACE::Vehicle::getStopParameter(), LIBSUMO_NAMESPACE::Vehicle::getStops(), LIBSUMO_NAMESPACE::Vehicle::getStopSpeed(), LIBSUMO_NAMESPACE::Vehicle::getStopState(), LIBSUMO_NAMESPACE::Vehicle::getTimeLoss(), getTrafficObject(), getVehicleType(), LIBSUMO_NAMESPACE::Vehicle::getVia(), LIBSUMO_NAMESPACE::Vehicle::getWaitingTime(), LIBSUMO_NAMESPACE::Vehicle::highlight(), LIBSUMO_NAMESPACE::Vehicle::insertStop(), LIBSUMO_NAMESPACE::Vehicle::isRouteValid(), LIBSUMO_NAMESPACE::Vehicle::moveTo(), LIBSUMO_NAMESPACE::Vehicle::moveToXY(), LIBSUMO_NAMESPACE::Vehicle::openGap(), postProcessRemoteControl(), LIBSUMO_NAMESPACE::Vehicle::remove(), LIBSUMO_NAMESPACE::Vehicle::replaceStop(), LIBSUMO_NAMESPACE::Vehicle::rerouteEffort(), LIBSUMO_NAMESPACE::Vehicle::rerouteParkingArea(), LIBSUMO_NAMESPACE::Vehicle::rerouteTraveltime(), LIBSUMO_NAMESPACE::Vehicle::resume(), LIBSUMO_NAMESPACE::Vehicle::setAcceleration(), LIBSUMO_NAMESPACE::Vehicle::setAdaptedTraveltime(), LIBSUMO_NAMESPACE::Vehicle::setEffort(), LIBSUMO_NAMESPACE::Vehicle::setLaneChangeMode(), LIBSUMO_NAMESPACE::Vehicle::setLateralLanePosition(), LIBSUMO_NAMESPACE::Vehicle::setLine(), LIBSUMO_NAMESPACE::Vehicle::setPreviousSpeed(), LIBSUMO_NAMESPACE::Vehicle::setRoute(), LIBSUMO_NAMESPACE::Vehicle::setRouteID(), LIBSUMO_NAMESPACE::Vehicle::setRoutingMode(), LIBSUMO_NAMESPACE::Vehicle::setSignals(), LIBSUMO_NAMESPACE::Vehicle::setSpeed(), LIBSUMO_NAMESPACE::Vehicle::setSpeedMode(), LIBSUMO_NAMESPACE::Vehicle::setStop(), LIBSUMO_NAMESPACE::Vehicle::setStopParameter(), LIBSUMO_NAMESPACE::Vehicle::setType(), LIBSUMO_NAMESPACE::Vehicle::setVia(), LIBSUMO_NAMESPACE::Vehicle::slowDown(), LIBSUMO_NAMESPACE::Vehicle::storeShape(), LIBSUMO_NAMESPACE::Vehicle::updateBestLanes(), and LIBSUMO_NAMESPACE::TrafficLight::updateConstraints().

◆ getVehicleStateChanges()

const std::vector< std::string > & libsumo::Helper::getVehicleStateChanges ( const MSNet::VehicleState  state)
static

Definition at line 701 of file Helper.cpp.

References libsumo::Helper::VehicleStateListener::myVehicleStateChanges, and myVehicleStateListener.

Referenced by LIBSUMO_NAMESPACE::Simulation::getArrivedIDList(), LIBSUMO_NAMESPACE::Simulation::getArrivedNumber(), LIBSUMO_NAMESPACE::Simulation::getCollidingVehiclesIDList(), LIBSUMO_NAMESPACE::Simulation::getCollidingVehiclesNumber(), LIBSUMO_NAMESPACE::Simulation::getDepartedIDList(), LIBSUMO_NAMESPACE::Simulation::getDepartedNumber(), LIBSUMO_NAMESPACE::Simulation::getEmergencyStoppingVehiclesIDList(), LIBSUMO_NAMESPACE::Simulation::getEmergencyStoppingVehiclesNumber(), LIBSUMO_NAMESPACE::Simulation::getEndingTeleportIDList(), LIBSUMO_NAMESPACE::Simulation::getEndingTeleportNumber(), LIBSUMO_NAMESPACE::Simulation::getLoadedIDList(), LIBSUMO_NAMESPACE::Simulation::getLoadedNumber(), LIBSUMO_NAMESPACE::Simulation::getParkingEndingVehiclesIDList(), LIBSUMO_NAMESPACE::Simulation::getParkingEndingVehiclesNumber(), LIBSUMO_NAMESPACE::Simulation::getParkingStartingVehiclesIDList(), LIBSUMO_NAMESPACE::Simulation::getParkingStartingVehiclesNumber(), LIBSUMO_NAMESPACE::Simulation::getStartingTeleportIDList(), LIBSUMO_NAMESPACE::Simulation::getStartingTeleportNumber(), LIBSUMO_NAMESPACE::Simulation::getStopEndingVehiclesIDList(), LIBSUMO_NAMESPACE::Simulation::getStopEndingVehiclesNumber(), LIBSUMO_NAMESPACE::Simulation::getStopStartingVehiclesIDList(), LIBSUMO_NAMESPACE::Simulation::getStopStartingVehiclesNumber(), and handleSubscriptions().

Here is the caller graph for this function:

◆ getVehicleType()

const MSVehicleType & libsumo::Helper::getVehicleType ( const std::string &  vehicleID)
static

Definition at line 512 of file Helper.cpp.

References getVehicle(), and MSBaseVehicle::getVehicleType().

Referenced by LIBSUMO_NAMESPACE::Vehicle::getTypeID().

Here is the caller graph for this function:

◆ handleSingleSubscription()

void libsumo::Helper::handleSingleSubscription ( const Subscription s)
staticprivate

Definition at line 232 of file Helper.cpp.

References libsumo::Subscription::activeFilters, applySubscriptionFilters(), libsumo::CMD_GET_BUSSTOP_VARIABLE, libsumo::CMD_GET_CALIBRATOR_VARIABLE, libsumo::CMD_GET_CHARGINGSTATION_VARIABLE, libsumo::CMD_GET_EDGE_VARIABLE, libsumo::CMD_GET_GUI_VARIABLE, libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::CMD_GET_LANE_VARIABLE, libsumo::CMD_GET_LANEAREA_VARIABLE, libsumo::CMD_GET_MEANDATA_VARIABLE, libsumo::CMD_GET_MULTIENTRYEXIT_VARIABLE, libsumo::CMD_GET_OVERHEADWIRE_VARIABLE, libsumo::CMD_GET_PARKINGAREA_VARIABLE, libsumo::CMD_GET_PERSON_VARIABLE, libsumo::CMD_GET_POI_VARIABLE, libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::CMD_GET_REROUTER_VARIABLE, libsumo::CMD_GET_ROUTE_VARIABLE, libsumo::CMD_GET_ROUTEPROBE_VARIABLE, libsumo::CMD_GET_SIM_VARIABLE, libsumo::CMD_GET_TL_VARIABLE, libsumo::CMD_GET_VARIABLESPEEDSIGN_VARIABLE, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_GET_VEHICLETYPE_VARIABLE, collectObjectIDsInRange(), libsumo::Subscription::commandId, libsumo::Subscription::contextDomain, libsumo::VariableWrapper::empty(), findObjectShape(), libsumo::Subscription::id, libsumo::LAST_STEP_VEHICLE_NUMBER, myWrapper, libsumo::Subscription::parameters, libsumo::Subscription::range, libsumo::VariableWrapper::setContext(), libsumo::SUBS_FILTER_NO_RTREE, libsumo::TRACI_ID_LIST, libsumo::VAR_LANEPOSITION, libsumo::VAR_ROAD_ID, and libsumo::Subscription::variables.

Referenced by handleSubscriptions(), and subscribe().

Here is the caller graph for this function:

◆ handleSubscriptions()

◆ makePosition()

Position libsumo::Helper::makePosition ( const TraCIPosition position)
static

◆ makePositionVector()

PositionVector libsumo::Helper::makePositionVector ( const TraCIPositionVector vector)
static

Definition at line 347 of file Helper.cpp.

References libsumo::TraCIPositionVector::value, libsumo::TraCIPosition::x, and libsumo::TraCIPosition::y.

Referenced by LIBSUMO_NAMESPACE::Polygon::add(), and LIBSUMO_NAMESPACE::Polygon::setShape().

Here is the caller graph for this function:

◆ makeRGBColor()

RGBColor libsumo::Helper::makeRGBColor ( const TraCIColor color)
static

Definition at line 371 of file Helper.cpp.

References libsumo::TraCIColor::a, libsumo::TraCIColor::b, libsumo::TraCIColor::g, and libsumo::TraCIColor::r.

Referenced by LIBSUMO_NAMESPACE::POI::add(), LIBSUMO_NAMESPACE::Polygon::add(), LIBSUMO_NAMESPACE::POI::setColor(), and LIBSUMO_NAMESPACE::Polygon::setColor().

Here is the caller graph for this function:

◆ makeTraCIColor()

TraCIColor libsumo::Helper::makeTraCIColor ( const RGBColor color)
static

Definition at line 360 of file Helper.cpp.

References libsumo::TraCIColor::a, RGBColor::alpha(), libsumo::TraCIColor::b, RGBColor::blue(), libsumo::TraCIColor::g, RGBColor::green(), libsumo::TraCIColor::r, and RGBColor::red().

Referenced by LIBSUMO_NAMESPACE::POI::getColor(), and LIBSUMO_NAMESPACE::Polygon::getColor().

Here is the caller graph for this function:

◆ makeTraCIPosition()

◆ makeTraCIPositionVector()

TraCIPositionVector libsumo::Helper::makeTraCIPositionVector ( const PositionVector positionVector)
static

helper functions

Definition at line 337 of file Helper.cpp.

References makeTraCIPosition(), and libsumo::TraCIPositionVector::value.

Referenced by LIBSUMO_NAMESPACE::Junction::getShape(), LIBSUMO_NAMESPACE::Polygon::getShape(), LIBSUMO_NAMESPACE::POI::highlight(), LIBSUMO_NAMESPACE::Vehicle::highlight(), and TraCIServerAPI_Polygon::processSet().

Here is the caller graph for this function:

◆ moveToXYMap()

bool libsumo::Helper::moveToXYMap ( const Position pos,
double  maxRouteDistance,
bool  mayLeaveNetwork,
const std::string &  origID,
const double  angle,
double  speed,
const ConstMSEdgeVector currentRoute,
const int  routePosition,
const MSLane currentLane,
double  currentLanePos,
bool  onRoad,
SUMOVehicleClass  vClass,
bool  setLateralPos,
double &  bestDistance,
MSLane **  lane,
double &  lanePos,
int &  routeOffset,
ConstMSEdgeVector edges 
)
static

◆ moveToXYMap_matchingRoutePosition()

bool libsumo::Helper::moveToXYMap_matchingRoutePosition ( const Position pos,
const std::string &  origID,
const ConstMSEdgeVector currentRoute,
int  routeIndex,
SUMOVehicleClass  vClass,
bool  setLateralPos,
double &  bestDistance,
MSLane **  lane,
double &  lanePos,
int &  routeOffset 
)
static

◆ needNewSubscription()

bool libsumo::Helper::needNewSubscription ( libsumo::Subscription s,
std::vector< Subscription > &  subscriptions,
libsumo::Subscription *&  modifiedSubscription 
)
static

Definition at line 178 of file Helper.cpp.

References libsumo::Subscription::beginTime, libsumo::Subscription::commandId, libsumo::Subscription::contextDomain, libsumo::Subscription::endTime, libsumo::Subscription::id, libsumo::Subscription::parameters, libsumo::Subscription::range, and libsumo::Subscription::variables.

Referenced by TraCIServer::initialiseSubscription(), and subscribe().

Here is the caller graph for this function:

◆ postProcessRemoteControl()

int libsumo::Helper::postProcessRemoteControl ( )
static

return number of remote-controlled entities

Definition at line 1392 of file Helper.cpp.

References nlohmann::detail::get(), MSNet::getInstance(), getVehicle(), myRemoteControlledPersons, myRemoteControlledVehicles, TL, and WRITE_WARNINGF.

Referenced by MSNet::postMoveStep().

Here is the caller graph for this function:

◆ registerStateListener()

void libsumo::Helper::registerStateListener ( )
static

Definition at line 692 of file Helper.cpp.

References MSNet::addTransportableStateListener(), MSNet::addVehicleStateListener(), MSNet::getInstance(), MSNet::hasInstance(), myTransportableStateListener, and myVehicleStateListener.

Referenced by NLBuilder::init(), and GUILoadThread::run().

Here is the caller graph for this function:

◆ setRemoteControlled() [1/2]

void libsumo::Helper::setRemoteControlled ( MSPerson p,
Position  xyPos,
MSLane l,
double  pos,
double  posLat,
double  angle,
int  edgeOffset,
ConstMSEdgeVector  route,
SUMOTime  t 
)
static

◆ setRemoteControlled() [2/2]

void libsumo::Helper::setRemoteControlled ( MSVehicle v,
Position  xyPos,
MSLane l,
double  pos,
double  posLat,
double  angle,
int  edgeOffset,
ConstMSEdgeVector  route,
SUMOTime  t 
)
static

Definition at line 1377 of file Helper.cpp.

References Named::getID(), MSVehicle::getInfluencer(), myRemoteControlledVehicles, and MSVehicle::Influencer::setRemoteControlled().

Referenced by LIBSUMO_NAMESPACE::Person::moveToXY(), and LIBSUMO_NAMESPACE::Vehicle::moveToXY().

Here is the caller graph for this function:

◆ subscribe()

void libsumo::Helper::subscribe ( const int  commandId,
const std::string &  id,
const std::vector< int > &  variables,
const double  beginTime,
const double  endTime,
const libsumo::TraCIResults params,
const int  contextDomain = 0,
const double  range = 0. 
)
static

Field Documentation

◆ myLaneTree

LANE_RTREE_QUAL * libsumo::Helper::myLaneTree
staticprivate

A lookup tree of lanes.

Definition at line 277 of file Helper.h.

Referenced by cleanup(), and collectObjectsInRange().

◆ myLastContextSubscription

Subscription * libsumo::Helper::myLastContextSubscription = nullptr
staticprivate

The last context subscription.

Definition at line 265 of file Helper.h.

Referenced by addSubscriptionFilter(), clearSubscriptions(), and subscribe().

◆ myRemoteControlledPersons

std::map< std::string, MSPerson * > libsumo::Helper::myRemoteControlledPersons
staticprivate

Definition at line 280 of file Helper.h.

Referenced by postProcessRemoteControl(), and setRemoteControlled().

◆ myRemoteControlledVehicles

std::map< std::string, MSVehicle * > libsumo::Helper::myRemoteControlledVehicles
staticprivate

Definition at line 279 of file Helper.h.

Referenced by postProcessRemoteControl(), and setRemoteControlled().

◆ mySubscriptions

std::vector< Subscription > libsumo::Helper::mySubscriptions
staticprivate

The list of known, still valid subscriptions.

Definition at line 262 of file Helper.h.

Referenced by clearSubscriptions(), handleSubscriptions(), and subscribe().

◆ myTransportableStateListener

Helper::TransportableStateListener libsumo::Helper::myTransportableStateListener
staticprivate

Changes in the states of simulated transportables.

Definition at line 274 of file Helper.h.

Referenced by clearStateChanges(), getTransportableStateChanges(), and registerStateListener().

◆ myVehicleStateListener

Helper::VehicleStateListener libsumo::Helper::myVehicleStateListener
staticprivate

Changes in the states of simulated vehicles.

Definition at line 271 of file Helper.h.

Referenced by clearStateChanges(), getVehicleStateChanges(), and registerStateListener().

◆ myWrapper

std::map< int, std::shared_ptr< VariableWrapper > > libsumo::Helper::myWrapper
staticprivate

Map of commandIds -> their executors; applicable if the executor applies to the method footprint.

Definition at line 268 of file Helper.h.

Referenced by handleSingleSubscription(), and handleSubscriptions().


The documentation for this class was generated from the following files: