![]() |
Eclipse SUMO - Simulation of Urban MObility
|
C++ TraCI client API implementation. More...
#include <Helper.h>
Data Structures | |
class | LaneUtility |
class | SubscriptionWrapper |
class | VehicleStateListener |
Static Public Member Functions | |
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 if the filters rather demand searching along the road network than considering a geometric range. More... | |
static void | cleanup () |
static void | clearVehicleStates () |
static void | collectObjectsInRange (int domain, const PositionVector &shape, double range, std::set< std::string > &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 MSEdge * | getEdge (const std::string &edgeID) |
static const MSLane * | getLaneChecking (const std::string &edgeID, int laneIndex, double pos) |
static MSVehicle * | getVehicle (const std::string &id) |
static const std::vector< std::string > & | getVehicleStateChanges (const MSNet::VehicleState state) |
static const MSVehicleType & | getVehicleType (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 void | postProcessRemoteControl () |
static void | registerVehicleStateListener () |
static void | setRemoteControlled (MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t) |
static void | setRemoteControlled (MSPerson *p, 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 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 ¤tRoute, const int routePosition, MSLane *currentLane, double currentLanePos, bool onRoad, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges) |
static bool | moveToXYMap_matchingRoutePosition (const Position &pos, const std::string &origID, const ConstMSEdgeVector ¤tRoute, int routeIndex, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset) |
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 | 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_QUAL * | myLaneTree |
A storage of lanes. More... | |
static std::map< int, NamedRTree * > | myObjects |
A storage of objects. More... | |
static std::map< std::string, MSPerson * > | myRemoteControlledPersons |
static std::map< std::string, MSVehicle * > | myRemoteControlledVehicles |
static std::vector< Subscription > | mySubscriptions |
The list of known, still valid subscriptions. 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... | |
|
privatedelete |
invalidated standard constructor
|
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 if the filters rather demand searching along the road network than considering a geometric range.
[in] | s | Subscription which holds the filter specification to be applied |
Definition at line 484 of file Helper.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterDownstreamDist, libsumo::Subscription::filterLanes, libsumo::Subscription::filterUpstreamDist, libsumo::Subscription::filterVClasses, libsumo::Subscription::filterVTypes, MSLink::getApproaching(), MSVehicle::getBestLanesContinuation(), MSLane::getEdge(), MSLane::getFollower(), Named::getID(), MSBaseVehicle::getID(), MSVehicleType::getID(), MSLane::getIndex(), MSVehicle::getLane(), MSEdge::getLanes(), MSLane::getLeader(), MSBaseVehicle::getLength(), MSLane::getLength(), MSEdge::getLength(), MSEdge::getOppositeEdge(), MSLane::getParallelLane(), MSVehicle::getPositionOnLane(), MSLane::getSurroundingVehicles(), MSLane::getUpcomingLinks(), MSVehicleType::getVehicleClass(), MSLane::getVehiclesInRange(), MSBaseVehicle::getVehicleType(), libsumo::Subscription::id, MSVehicle::isOnRoad(), MAX2(), libsumo::Subscription::range, SIMTIME, libsumo::SUBS_FILTER_DOWNSTREAM_DIST, libsumo::SUBS_FILTER_LANES, 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, toString(), and WRITE_WARNING.
Referenced by TraCIServer::processSingleSubscription().
|
static |
Definition at line 359 of file Helper.cpp.
Referenced by MSNet::clearAll().
|
static |
Definition at line 384 of file Helper.cpp.
Referenced by libsumo::Simulation::step().
|
static |
Definition at line 425 of file Helper.cpp.
References libsumo::CMD_GET_EDGE_VARIABLE, libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::CMD_GET_LANE_VARIABLE, libsumo::CMD_GET_PERSON_VARIABLE, libsumo::CMD_GET_POI_VARIABLE, libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::CMD_GET_VEHICLE_VARIABLE, MSLane::fill(), PositionVector::getBoxBoundary(), Boundary::grow(), LANE_RTREE_QUAL, MSLane::visit(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().
Referenced by TraCIServer::processSingleSubscription().
|
static |
Definition at line 307 of file Helper.cpp.
References MSLane::allowsVehicleClass(), libsumo::CMD_GET_LANE_VARIABLE, MSLane::dictionary(), PositionVector::distance2D(), Boundary::distanceTo2D(), GeoConvHelper::getConvBoundary(), GeoConvHelper::getFinal(), Boundary::getHeight(), MSLane::getShape(), Boundary::getWidth(), MSLane::interpolateGeometryPosToLanePos(), and MAX2().
Referenced by TraCIServerAPI_Simulation::commandDistanceRequest(), TraCIServerAPI_Simulation::commandPositionConversion(), libsumo::Simulation::convertRoad(), libsumo::Simulation::getDistance2D(), and libsumo::Vehicle::getDrivingDistance2D().
|
static |
Definition at line 1018 of file Helper.cpp.
References MSLane::allowsVehicleClass(), PositionVector::distance2D(), Named::getID(), MSEdge::getLanes(), MSLane::getShape(), and POSITION_EPS.
|
static |
Definition at line 392 of file Helper.cpp.
References libsumo::CMD_SUBSCRIBE_EDGE_CONTEXT, libsumo::CMD_SUBSCRIBE_INDUCTIONLOOP_CONTEXT, libsumo::CMD_SUBSCRIBE_JUNCTION_CONTEXT, libsumo::CMD_SUBSCRIBE_LANE_CONTEXT, libsumo::CMD_SUBSCRIBE_PERSON_CONTEXT, libsumo::CMD_SUBSCRIBE_POI_CONTEXT, libsumo::CMD_SUBSCRIBE_POLYGON_CONTEXT, and libsumo::CMD_SUBSCRIBE_VEHICLE_CONTEXT.
Referenced by TraCIServer::processSingleSubscription().
|
staticprivate |
Adds lane coverage information from newLaneCoverage into aggregatedLaneCoverage.
Definition at line 206 of file Helper.cpp.
|
static |
Definition at line 280 of file Helper.cpp.
References MSEdge::dictionary().
Referenced by libsumo::Vehicle::getAdaptedTraveltime(), libsumo::Vehicle::getDrivingDistance(), and libsumo::Vehicle::getEffort().
|
static |
Definition at line 290 of file Helper.cpp.
References MSEdge::dictionary(), MSEdge::getLanes(), and MSLane::getLength().
Referenced by TraCIServerAPI_Simulation::commandDistanceRequest(), TraCIServerAPI_Simulation::commandPositionConversion(), libsumo::Simulation::convert2D(), libsumo::Simulation::convert3D(), and libsumo::Simulation::getDistanceRoad().
|
static |
Definition at line 339 of file Helper.cpp.
References MSNet::getInstance(), MSVehicleControl::getVehicle(), and MSNet::getVehicleControl().
Referenced by libsumo::Vehicle::changeLane(), libsumo::Vehicle::changeLaneRelative(), libsumo::Vehicle::changeSublane(), libsumo::Vehicle::changeTarget(), libsumo::Vehicle::deactivateGapControl(), libsumo::Vehicle::getAcceleration(), libsumo::Vehicle::getAccumulatedWaitingTime(), libsumo::Vehicle::getAdaptedTraveltime(), libsumo::Vehicle::getAllowedSpeed(), libsumo::Vehicle::getAngle(), libsumo::Vehicle::getBestLanes(), libsumo::Vehicle::getCO2Emission(), libsumo::Vehicle::getCOEmission(), libsumo::Vehicle::getDistance(), libsumo::Vehicle::getDrivingDistance(), libsumo::Vehicle::getDrivingDistance2D(), libsumo::Vehicle::getEffort(), libsumo::Vehicle::getElectricityConsumption(), libsumo::Vehicle::getFuelConsumption(), libsumo::Vehicle::getHCEmission(), libsumo::Vehicle::getLaneChangeMode(), libsumo::Vehicle::getLaneChangeState(), libsumo::Vehicle::getLaneID(), libsumo::Vehicle::getLaneIndex(), libsumo::Vehicle::getLanePosition(), libsumo::Vehicle::getLastActionTime(), libsumo::Vehicle::getLateralLanePosition(), libsumo::Vehicle::getLateralSpeed(), libsumo::Vehicle::getLeader(), libsumo::Vehicle::getLine(), libsumo::Vehicle::getNeighbors(), libsumo::Vehicle::getNextStops(), libsumo::Vehicle::getNextTLS(), libsumo::Vehicle::getNoiseEmission(), libsumo::Vehicle::getNOxEmission(), libsumo::Vehicle::getParameter(), libsumo::Vehicle::getPersonIDList(), libsumo::Vehicle::getPersonNumber(), libsumo::Vehicle::getPMxEmission(), libsumo::Vehicle::getPosition(), libsumo::Vehicle::getRoadID(), libsumo::Vehicle::getRoute(), libsumo::Vehicle::getRouteID(), libsumo::Vehicle::getRouteIndex(), libsumo::Vehicle::getRoutingMode(), libsumo::Vehicle::getSignals(), libsumo::Vehicle::getSlope(), libsumo::Vehicle::getSpeed(), libsumo::Vehicle::getSpeedMode(), libsumo::Vehicle::getSpeedWithoutTraCI(), libsumo::Vehicle::getStopState(), libsumo::Vehicle::getVia(), libsumo::Vehicle::getWaitingTime(), libsumo::Vehicle::highlight(), libsumo::Vehicle::isRouteValid(), libsumo::Vehicle::moveTo(), libsumo::Vehicle::moveToXY(), libsumo::Vehicle::openGap(), libsumo::Vehicle::remove(), libsumo::Vehicle::rerouteEffort(), libsumo::Vehicle::rerouteParkingArea(), libsumo::Vehicle::rerouteTraveltime(), libsumo::Vehicle::resume(), libsumo::Vehicle::setAdaptedTraveltime(), libsumo::Vehicle::setEffort(), libsumo::Vehicle::setLaneChangeMode(), libsumo::Vehicle::setLine(), libsumo::Vehicle::setParameter(), libsumo::Vehicle::setRoute(), libsumo::Vehicle::setRouteID(), libsumo::Vehicle::setRoutingMode(), libsumo::Vehicle::setSignals(), libsumo::Vehicle::setSpeed(), libsumo::Vehicle::setSpeedMode(), libsumo::Vehicle::setStop(), libsumo::Vehicle::setType(), libsumo::Vehicle::setVia(), libsumo::Vehicle::slowDown(), libsumo::Vehicle::storeShape(), and libsumo::Vehicle::updateBestLanes().
|
static |
Definition at line 378 of file Helper.cpp.
Referenced by libsumo::Simulation::getArrivedIDList(), libsumo::Simulation::getArrivedNumber(), libsumo::Simulation::getCollidingVehiclesIDList(), libsumo::Simulation::getCollidingVehiclesNumber(), libsumo::Simulation::getDepartedIDList(), libsumo::Simulation::getDepartedNumber(), libsumo::Simulation::getEmergencyStoppingVehiclesIDList(), libsumo::Simulation::getEmergencyStoppingVehiclesNumber(), libsumo::Simulation::getEndingTeleportIDList(), libsumo::Simulation::getEndingTeleportNumber(), libsumo::Simulation::getLoadedIDList(), libsumo::Simulation::getLoadedNumber(), libsumo::Simulation::getParkingEndingVehiclesIDList(), libsumo::Simulation::getParkingEndingVehiclesNumber(), libsumo::Simulation::getParkingStartingVehiclesIDList(), libsumo::Simulation::getParkingStartingVehiclesNumber(), libsumo::Simulation::getStartingTeleportIDList(), libsumo::Simulation::getStartingTeleportNumber(), libsumo::Simulation::getStopEndingVehiclesIDList(), libsumo::Simulation::getStopEndingVehiclesNumber(), libsumo::Simulation::getStopStartingVehiclesIDList(), and libsumo::Simulation::getStopStartingVehiclesNumber().
|
static |
Definition at line 353 of file Helper.cpp.
Referenced by libsumo::Vehicle::getLastActionTime(), libsumo::Vehicle::getNeighbors(), libsumo::Vehicle::getPersonNumber(), and libsumo::Vehicle::getTypeID().
|
staticprivate |
Definition at line 147 of file Helper.cpp.
References libsumo::Subscription::activeFilters, libsumo::CMD_GET_EDGE_VARIABLE, libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::CMD_GET_LANE_VARIABLE, libsumo::CMD_GET_LANEAREA_VARIABLE, libsumo::CMD_GET_MULTIENTRYEXIT_VARIABLE, libsumo::CMD_GET_PERSON_VARIABLE, libsumo::CMD_GET_POI_VARIABLE, libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::CMD_GET_ROUTE_VARIABLE, libsumo::CMD_GET_SIM_VARIABLE, libsumo::CMD_GET_TL_VARIABLE, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::Subscription::commandId, libsumo::Subscription::contextDomain, libsumo::Subscription::id, libsumo::LAST_STEP_VEHICLE_NUMBER, libsumo::Subscription::range, libsumo::SUBS_FILTER_NO_RTREE, libsumo::TRACI_ID_LIST, libsumo::VAR_LANEPOSITION, libsumo::VAR_ROAD_ID, and libsumo::Subscription::variables.
|
static |
Definition at line 133 of file Helper.cpp.
Referenced by libsumo::Simulation::step().
|
static |
Definition at line 274 of file Helper.cpp.
References libsumo::TraCIPosition::x, libsumo::TraCIPosition::y, and libsumo::TraCIPosition::z.
|
static |
Definition at line 234 of file Helper.cpp.
Referenced by libsumo::Polygon::add(), and libsumo::Polygon::setShape().
|
static |
Definition at line 258 of file Helper.cpp.
References libsumo::TraCIColor::a, libsumo::TraCIColor::b, libsumo::TraCIColor::g, and libsumo::TraCIColor::r.
Referenced by libsumo::Polygon::add(), libsumo::POI::add(), libsumo::Polygon::setColor(), libsumo::POI::setColor(), and libsumo::VehicleType::setSpeedDeviation().
|
static |
Definition at line 247 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::Polygon::getColor(), libsumo::POI::getColor(), libsumo::VehicleType::getIDCount(), and libsumo::Vehicle::getRouteIndex().
|
static |
Definition at line 264 of file Helper.cpp.
References libsumo::INVALID_DOUBLE_VALUE, Position::x(), libsumo::TraCIPosition::x, Position::y(), libsumo::TraCIPosition::y, Position::z(), and libsumo::TraCIPosition::z.
Referenced by libsumo::Simulation::convert2D(), libsumo::Simulation::convert3D(), libsumo::Simulation::convertGeo(), libsumo::Junction::getPosition(), libsumo::Person::getPosition(), libsumo::POI::getPosition(), libsumo::Vehicle::getPosition(), and libsumo::Person::getPosition3D().
|
static |
helper functions
Definition at line 224 of file Helper.cpp.
Referenced by libsumo::Polygon::getShape(), libsumo::Junction::getShape(), libsumo::POI::highlight(), libsumo::Vehicle::highlight(), and TraCIServerAPI_Polygon::processSet().
|
static |
Definition at line 822 of file Helper.cpp.
References MSLane::allowsVehicleClass(), libsumo::Helper::LaneUtility::angleDiff, libsumo::CMD_GET_EDGE_VARIABLE, MSEdge::dictionary(), libsumo::Helper::LaneUtility::dist, PositionVector::distance2D(), PositionVector::extrapolate2D(), FAR_AWAY, MSLane::getEdge(), Named::getID(), Named::getIDSecure(), MSEdge::getLanes(), MSLane::getLength(), MSEdge::getLength(), MSLane::getLogicalPredecessorLane(), GeomHelper::getMinAngleDiff(), Parameterised::getParameter(), MSLane::getShape(), MSEdge::getSuccessors(), gPrecision, libsumo::Helper::LaneUtility::ID, libsumo::INVALID_DOUBLE_VALUE, GeomHelper::INVALID_OFFSET, MSEdge::isInternal(), MAX2(), MIN2(), GeomHelper::naviDegree(), PositionVector::nearest_offset_to_point25D(), PositionVector::nearest_offset_to_point2D(), libsumo::Helper::LaneUtility::nextEdge, libsumo::Helper::LaneUtility::onRoute, POSITION_EPS, libsumo::Helper::LaneUtility::prevEdge, PositionVector::rotationAtOffset(), libsumo::Helper::LaneUtility::sameEdge, SIMTIME, SPEED2DIST, SUMO_const_laneWidth, and SUMO_PARAM_ORIGID.
Referenced by libsumo::Person::moveToXY(), and libsumo::Vehicle::moveToXY().
|
static |
Definition at line 1045 of file Helper.cpp.
References MSEdge::getInternalFollowingEdge(), MAX2(), MIN2(), POSITION_EPS, and SUMO_PARAM_ORIGID.
Referenced by libsumo::Person::moveToXY(), and libsumo::Vehicle::moveToXY().
|
static |
Definition at line 801 of file Helper.cpp.
References MSNet::getInstance(), and WRITE_WARNING.
Referenced by MSNet::simulationStep().
|
static |
Definition at line 370 of file Helper.cpp.
References MSNet::addVehicleStateListener(), MSNet::getInstance(), and MSNet::hasInstance().
Referenced by libsumo::Simulation::load().
|
static |
Definition at line 786 of file Helper.cpp.
References MSBaseVehicle::getID(), MSVehicle::getInfluencer(), and MSVehicle::Influencer::setRemoteControlled().
Referenced by libsumo::Person::moveToXY(), and libsumo::Vehicle::moveToXY().
|
static |
Definition at line 793 of file Helper.cpp.
References MSTransportable::getID(), MSPerson::getInfluencer(), and MSPerson::Influencer::setRemoteControlled().
|
static |
Definition at line 121 of file Helper.cpp.
References libsumo::INVALID_DOUBLE_VALUE, STEPS2TIME, SUMOTime_MAX, and TIME2STEPS.
Referenced by libsumo::Simulation::subscribe().
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |