![]() |
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 (Position pos) |
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 const std::vector< std::string > & | getVehicleStateChanges (const MSNet::VehicleState state) |
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, 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, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset) |
static bool | findCloserLane (const MSEdge *edge, const Position &pos, 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 437 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(), libsumo::Vehicle::getVehicle(), 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 314 of file Helper.cpp.
Referenced by MSNet::clearAll().
|
static |
Definition at line 337 of file Helper.cpp.
Referenced by libsumo::Simulation::step().
|
static |
Definition at line 378 of file Helper.cpp.
References CMD_GET_EDGE_VARIABLE, CMD_GET_INDUCTIONLOOP_VARIABLE, CMD_GET_JUNCTION_VARIABLE, CMD_GET_LANE_VARIABLE, CMD_GET_PERSON_VARIABLE, CMD_GET_POI_VARIABLE, CMD_GET_POLYGON_VARIABLE, 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().
XXX use rtree instead
Definition at line 290 of file Helper.cpp.
References MSEdge::dictionary(), MSNet::getEdgeControl(), MSEdgeControl::getEdgeNames(), and MSNet::getInstance().
Referenced by TraCIServerAPI_Simulation::commandDistanceRequest(), TraCIServerAPI_Simulation::commandPositionConversion(), libsumo::Simulation::convertRoad(), libsumo::Simulation::getDistance2D(), and libsumo::Vehicle::getDrivingDistance2D().
|
static |
Definition at line 962 of file Helper.cpp.
References PositionVector::distance2D(), Named::getID(), MSEdge::getLanes(), MSLane::getShape(), and POSITION_EPS.
|
static |
Definition at line 345 of file Helper.cpp.
References CMD_SUBSCRIBE_EDGE_CONTEXT, CMD_SUBSCRIBE_INDUCTIONLOOP_CONTEXT, CMD_SUBSCRIBE_JUNCTION_CONTEXT, CMD_SUBSCRIBE_LANE_CONTEXT, CMD_SUBSCRIBE_PERSON_CONTEXT, CMD_SUBSCRIBE_POI_CONTEXT, CMD_SUBSCRIBE_POLYGON_CONTEXT, and CMD_SUBSCRIBE_VEHICLE_CONTEXT.
Referenced by TraCIServer::processSingleSubscription().
|
staticprivate |
Adds lane coverage information from newLaneCoverage into aggregatedLaneCoverage.
Definition at line 192 of file Helper.cpp.
|
static |
Definition at line 263 of file Helper.cpp.
References MSEdge::dictionary().
Referenced by libsumo::Vehicle::getAdaptedTraveltime(), libsumo::Vehicle::getDrivingDistance(), and libsumo::Vehicle::getEffort().
|
static |
Definition at line 273 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 331 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().
|
staticprivate |
Definition at line 142 of file Helper.cpp.
References libsumo::Subscription::activeFilters, CMD_GET_EDGE_VARIABLE, CMD_GET_INDUCTIONLOOP_VARIABLE, CMD_GET_JUNCTION_VARIABLE, CMD_GET_LANE_VARIABLE, CMD_GET_LANEAREA_VARIABLE, CMD_GET_MULTIENTRYEXIT_VARIABLE, CMD_GET_PERSON_VARIABLE, CMD_GET_POI_VARIABLE, CMD_GET_POLYGON_VARIABLE, CMD_GET_ROUTE_VARIABLE, CMD_GET_SIM_VARIABLE, CMD_GET_TL_VARIABLE, CMD_GET_VEHICLE_VARIABLE, CMD_GET_VEHICLETYPE_VARIABLE, libsumo::Subscription::commandId, libsumo::Subscription::contextDomain, libsumo::Subscription::id, LAST_STEP_VEHICLE_NUMBER, libsumo::Subscription::range, libsumo::SUBS_FILTER_NO_RTREE, TRACI_ID_LIST, and libsumo::Subscription::variables.
|
static |
Definition at line 131 of file Helper.cpp.
Referenced by libsumo::Simulation::step().
|
static |
Definition at line 257 of file Helper.cpp.
References libsumo::TraCIPosition::x, libsumo::TraCIPosition::y, and libsumo::TraCIPosition::z.
|
static |
Definition at line 220 of file Helper.cpp.
Referenced by libsumo::Polygon::add(), and libsumo::Polygon::setShape().
|
static |
Definition at line 241 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 230 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 247 of file Helper.cpp.
References Position::INVALID, 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::Person::getPosition(), libsumo::Junction::getPosition(), libsumo::POI::getPosition(), and libsumo::Vehicle::getPosition().
|
static |
helper functions
Definition at line 210 of file Helper.cpp.
Referenced by libsumo::Polygon::getShape(), libsumo::Junction::getShape(), and TraCIServerAPI_Polygon::processSet().
|
static |
Definition at line 775 of file Helper.cpp.
References libsumo::Helper::LaneUtility::angleDiff, CMD_GET_EDGE_VARIABLE, MSEdge::dictionary(), libsumo::Helper::LaneUtility::dist, PositionVector::distance2D(), FAR_AWAY, MSLane::getEdge(), Named::getID(), Named::getIDSecure(), MSEdge::getLanes(), MSLane::getLength(), MSEdge::getLength(), MSLane::getLogicalPredecessorLane(), GeomHelper::getMinAngleDiff(), Parameterised::getParameter(), MSLane::getShape(), MSEdge::getSuccessors(), libsumo::Helper::LaneUtility::ID, INVALID_DOUBLE_VALUE, GeomHelper::INVALID_OFFSET, MSEdge::isInternal(), MAX2(), MIN2(), GeomHelper::naviDegree(), PositionVector::nearest_offset_to_point2D(), libsumo::Helper::LaneUtility::nextEdge, libsumo::Helper::LaneUtility::onRoute, libsumo::Helper::LaneUtility::prevEdge, PositionVector::rotationAtOffset(), libsumo::Helper::LaneUtility::sameEdge, SPEED2DIST, SUMO_const_laneWidth, and SUMO_PARAM_ORIGID.
Referenced by libsumo::Person::moveToXY(), and libsumo::Vehicle::moveToXY().
|
static |
Definition at line 986 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 754 of file Helper.cpp.
References MSNet::getInstance(), and WRITE_WARNING.
Referenced by MSNet::simulationStep().
|
static |
Definition at line 325 of file Helper.cpp.
References MSNet::addVehicleStateListener(), and MSNet::getInstance().
Referenced by libsumo::Simulation::load().
|
static |
Definition at line 739 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 746 of file Helper.cpp.
References MSTransportable::getID(), MSPerson::getInfluencer(), and MSPerson::Influencer::setRemoteControlled().
|
static |
Definition at line 119 of file Helper.cpp.
References INVALID_DOUBLE_VALUE, STEPS2TIME, SUMOTime_MAX, and TIME2STEPS.
Referenced by libsumo::Simulation::subscribe().
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |