 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
46 typedef std::map<const MSLane*, std::pair<double, double> >
LaneCoverageInfo;
56 const double range,
const int domain)
79 #define LANE_RTREE_QUAL RTree<MSLane*, MSLane, float, 2, LaneStoringVisitor>
81 inline float LANE_RTREE_QUAL::RectSphericalVolume(Rect* a_rect) {
83 const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
84 const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
85 return .78539816f * (extent0 * extent0 + extent1 * extent1);
89 inline LANE_RTREE_QUAL::Rect LANE_RTREE_QUAL::CombineRect(Rect* a_rectA, Rect* a_rectB) {
90 ASSERT(a_rectA && a_rectB);
92 newRect.m_min[0] =
rtree_min(a_rectA->m_min[0], a_rectB->m_min[0]);
93 newRect.m_max[0] =
rtree_max(a_rectA->m_max[0], a_rectB->m_max[0]);
94 newRect.m_min[1] =
rtree_min(a_rectA->m_min[1], a_rectB->m_min[1]);
95 newRect.m_max[1] =
rtree_max(a_rectA->m_max[1], a_rectB->m_max[1]);
107 static void subscribe(
const int commandId,
const std::string&
id,
const std::vector<int>& variables,
108 const double beginTime,
const double endTime,
const int contextDomain = 0,
const double range = 0.);
164 static bool moveToXYMap(
const Position& pos,
double maxRouteDistance,
bool mayLeaveNetwork,
const std::string& origID,
const double angle,
165 double speed,
const ConstMSEdgeVector& currentRoute,
const int routePosition,
MSLane* currentLane,
double currentLanePos,
bool onRoad,
172 double& bestDistance,
MSLane** lane,
double& lanePos,
int& routeOffset);
178 LaneUtility(
double dist_,
double perpendicularDist_,
double lanePos_,
double angleDiff_,
bool ID_,
179 bool onRoute_,
bool sameEdge_,
const MSEdge* prevEdge_,
const MSEdge* nextEdge_) :
201 bool wrapDouble(
const std::string& objID,
const int variable,
const double value);
202 bool wrapInt(
const std::string& objID,
const int variable,
const int value);
203 bool wrapString(
const std::string& objID,
const int variable,
const std::string& value);
204 bool wrapStringList(
const std::string& objID,
const int variable,
const std::vector<std::string>& value);
225 static void fuseLaneCoverage(std::shared_ptr<LaneCoverageInfo> aggregatedLaneCoverage,
const std::shared_ptr<LaneCoverageInfo> newLaneCoverage);
239 static std::map<int, std::shared_ptr<VariableWrapper> >
myWrapper;
static MSEdge * getEdge(const std::string &edgeID)
The car-following model and parameter.
static void handleSubscriptions(const SUMOTime t)
static Position makePosition(const TraCIPosition &position)
static std::map< int, NamedRTree * > myObjects
A storage of objects.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
LaneUtility(double dist_, double perpendicularDist_, double lanePos_, double angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge *prevEdge_, const MSEdge *nextEdge_)
void vehicleStateChanged(const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="")
Called if a vehicle changes its state.
static LANE_RTREE_QUAL * myLaneTree
A storage of lanes.
Representation of a lane in the micro simulation.
static MSVehicle * getVehicle(const std::string &id)
static TraCIColor makeTraCIColor(const RGBColor &color)
SubscriptionWrapper(VariableWrapper::SubscriptionHandler handler, SubscriptionResults &into, ContextSubscriptionResults &context)
void setContext(const std::string &refID)
Interface for objects listening to vehicle state changes.
const PositionVector & myShape
static PositionVector makePositionVector(const TraCIPositionVector &vector)
static RGBColor makeRGBColor(const TraCIColor &color)
static std::map< std::string, MSVehicle * > myRemoteControlledVehicles
Helper()=delete
invalidated standard constructor
bool wrapRoadPosition(const std::string &objID, const int variable, const TraCIRoadPosition &value)
Representation of a vehicle.
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)
std::vector< const MSEdge * > ConstMSEdgeVector
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.)
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
static bool needNewSubscription(libsumo::Subscription &s, std::vector< Subscription > &subscriptions, libsumo::Subscription *&modifiedSubscription)
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 th...
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
ContextSubscriptionResults & myContextResults
bool wrapString(const std::string &objID, const int variable, const std::string &value)
std::set< std::string > & myIDs
The container.
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
SubscriptionResults * myActiveResults
~LaneStoringVisitor()
Destructor.
Representation of a subscription.
LaneStoringVisitor & operator=(const LaneStoringVisitor &src)
invalidated assignment operator
bool wrapInt(const std::string &objID, const int variable, const int value)
static void fuseLaneCoverage(std::shared_ptr< LaneCoverageInfo > aggregatedLaneCoverage, const std::shared_ptr< LaneCoverageInfo > newLaneCoverage)
Adds lane coverage information from newLaneCoverage into aggregatedLaneCoverage.
VehicleState
Definition of a vehicle state.
SubscriptionResults & myResults
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)
A point in 2D or 3D with translation and scaling methods.
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
bool(* SubscriptionHandler)(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition of a method to be called for serving an associated commandID.
A road/street connecting two junctions.
bool wrapPosition(const std::string &objID, const int variable, const TraCIPosition &value)
static void postProcessRemoteControl()
std::map< MSNet::VehicleState, std::vector< std::string > > myVehicleStateChanges
Changes in the states of simulated vehicles.
C++ TraCI client API implementation.
static void applySubscriptionFilterFieldOfVision(const Subscription &s, std::set< std::string > &objIDs)
static void collectObjectsInRange(int domain, const PositionVector &shape, double range, std::set< std::string > &into)
static void clearSubscriptions()
static VehicleStateListener myVehicleStateListener
Changes in the states of simulated vehicles.
static void setRemoteControlled(MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
static std::map< std::string, MSPerson * > myRemoteControlledPersons
static void handleSingleSubscription(const Subscription &s)
bool wrapDouble(const std::string &objID, const int variable, const double value)
static void findObjectShape(int domain, const std::string &id, PositionVector &shape)
bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)
An edgeId, position and laneIndex.
static const std::vector< std::string > & getVehicleStateChanges(const MSNet::VehicleState state)
static bool findCloserLane(const MSEdge *edge, const Position &pos, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane)
static std::vector< Subscription > mySubscriptions
The list of known, still valid subscriptions.
bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)
std::map< const MSLane *, std::pair< double, double > > LaneCoverageInfo
static const MSVehicleType & getVehicleType(const std::string &vehicleID)
SubscriptionWrapper & operator=(const SubscriptionWrapper &s)=delete
Invalidated assignment operator.
static std::map< int, std::shared_ptr< VariableWrapper > > myWrapper
Map of commandIds -> their executors; applicable if the executor applies to the method footprint.
static void registerVehicleStateListener()
LaneStoringVisitor(std::set< std::string > &ids, const PositionVector &shape, const double range, const int domain)
Constructor.
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
void add(const MSLane *const l) const
Adds the given object to the container.
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
static void clearVehicleStates()
Representation of a vehicle in the micro simulation.