57 const double range,
const int domain)
80 #define LANE_RTREE_QUAL RTree<MSLane*, MSLane, float, 2, LaneStoringVisitor>
82 inline float LANE_RTREE_QUAL::RectSphericalVolume(Rect* a_rect) {
84 const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
85 const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
86 return .78539816f * (extent0 * extent0 + extent1 * extent1);
90 inline LANE_RTREE_QUAL::Rect LANE_RTREE_QUAL::CombineRect(Rect* a_rectA, Rect* a_rectB) {
91 ASSERT(a_rectA && a_rectB);
93 newRect.m_min[0] =
rtree_min(a_rectA->m_min[0], a_rectB->m_min[0]);
94 newRect.m_max[0] =
rtree_max(a_rectA->m_max[0], a_rectB->m_max[0]);
95 newRect.m_min[1] =
rtree_min(a_rectA->m_min[1], a_rectB->m_min[1]);
96 newRect.m_max[1] =
rtree_max(a_rectA->m_max[1], a_rectB->m_max[1]);
108 static void subscribe(
const int commandId,
const std::string&
id,
const std::vector<int>& variables,
110 const int contextDomain = 0,
const double range = 0.);
136 static double getDrivingDistance(std::pair<const MSLane*, double>& roadPos1, std::pair<const MSLane*, double>& roadPos2);
161 std::set<std::string>& objIDs,
162 std::set<const SUMOTrafficObject*>& vehs,
163 const std::vector<const MSLane*>& lanes,
164 double posOnLane,
double posLat,
bool isDownstream);
184 static bool moveToXYMap(
const Position& pos,
double maxRouteDistance,
bool mayLeaveNetwork,
const std::string& origID,
185 const double angle,
double speed,
const ConstMSEdgeVector& currentRoute,
const int routePosition,
186 const MSLane* currentLane,
double currentLanePos,
bool onRoad,
SUMOVehicleClass vClass,
bool setLateralPos,
192 double& bestDistance,
MSLane** lane,
double& lanePos,
int& routeOffset);
198 LaneUtility(
double dist_,
double perpendicularDist_,
double lanePos_,
double angleDiff_,
bool ID_,
199 bool onRoute_,
bool sameEdge_,
const MSEdge* prevEdge_,
const MSEdge* nextEdge_) :
220 void setParams(
const std::vector<unsigned char>* params);
225 bool wrapDouble(
const std::string& objID,
const int variable,
const double value);
226 bool wrapInt(
const std::string& objID,
const int variable,
const int value);
227 bool wrapString(
const std::string& objID,
const int variable,
const std::string& value);
228 bool wrapStringList(
const std::string& objID,
const int variable,
const std::vector<std::string>& value);
236 const std::vector<unsigned char>*
myParams =
nullptr;
250 static void fuseLaneCoverage(std::shared_ptr<LaneCoverageInfo> aggregatedLaneCoverage,
const std::shared_ptr<LaneCoverageInfo> newLaneCoverage);
269 static std::map<int, std::shared_ptr<VariableWrapper> >
myWrapper;
std::map< const MSLane *, std::pair< double, double > > LaneCoverageInfo
std::vector< const MSEdge * > ConstMSEdgeVector
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
LaneStoringVisitor(const LaneStoringVisitor &src)
invalidated copy constructor
~LaneStoringVisitor()
Destructor.
std::set< const Named * > & myObjects
The container.
void add(const MSLane *const l) const
Adds the given object to the container.
const PositionVector & myShape
LaneStoringVisitor & operator=(const LaneStoringVisitor &src)
invalidated assignment operator
LaneStoringVisitor(std::set< const Named * > &objects, const PositionVector &shape, const double range, const int domain)
Constructor.
The base class for microscopic and mesoscopic vehicles.
A road/street connecting two junctions.
Representation of a lane in the micro simulation.
Interface for objects listening to vehicle state changes.
VehicleState
Definition of a vehicle state.
Representation of a vehicle in the micro simulation.
The car-following model and parameter.
A point in 2D or 3D with translation and scaling methods.
Representation of a vehicle, person, or container.
Representation of a vehicle.
LaneUtility(double dist_, double perpendicularDist_, double lanePos_, double angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge *prevEdge_, const MSEdge *nextEdge_)
const std::vector< unsigned char > * getParams() const
void setContext(const std::string &refID)
SubscriptionResults & myResults
bool wrapDouble(const std::string &objID, const int variable, const double value)
const std::vector< unsigned char > * myParams
bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)
bool wrapInt(const std::string &objID, const int variable, const int value)
bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)
bool wrapPosition(const std::string &objID, const int variable, const TraCIPosition &value)
bool wrapString(const std::string &objID, const int variable, const std::string &value)
void setParams(const std::vector< unsigned char > *params)
bool wrapRoadPosition(const std::string &objID, const int variable, const TraCIRoadPosition &value)
ContextSubscriptionResults & myContextResults
SubscriptionWrapper(VariableWrapper::SubscriptionHandler handler, SubscriptionResults &into, ContextSubscriptionResults &context)
SubscriptionResults * myActiveResults
SubscriptionWrapper & operator=(const SubscriptionWrapper &s)=delete
Invalidated assignment operator.
std::map< MSNet::VehicleState, std::vector< std::string > > myVehicleStateChanges
Changes in the states of simulated vehicles.
void vehicleStateChanged(const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="")
Called if a vehicle changes its state.
C++ TraCI client API implementation.
static Position makePosition(const TraCIPosition &position)
static MSEdge * getEdge(const std::string &edgeID)
static void postProcessRemoteControl()
static double getDrivingDistance(std::pair< const MSLane *, double > &roadPos1, std::pair< const MSLane *, double > &roadPos2)
static void collectObjectsInRange(int domain, const PositionVector &shape, double range, std::set< const Named * > &into)
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
static LANE_RTREE_QUAL * myLaneTree
A storage of lanes.
static void findObjectShape(int domain, const std::string &id, PositionVector &shape)
static PositionVector makePositionVector(const TraCIPositionVector &vector)
static void fuseLaneCoverage(std::shared_ptr< LaneCoverageInfo > aggregatedLaneCoverage, const std::shared_ptr< LaneCoverageInfo > newLaneCoverage)
Adds lane coverage information from newLaneCoverage into aggregatedLaneCoverage.
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 void debugPrint(const SUMOTrafficObject *veh)
static MSPerson * getPerson(const std::string &id)
static void subscribe(const int commandId, const std::string &id, const std::vector< int > &variables, const double beginTime, const double endTime, const libsumo::TraCIResults ¶ms, const int contextDomain=0, const double range=0.)
Helper()=delete
invalidated standard constructor
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
static void registerVehicleStateListener()
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 clearVehicleStates()
static void clearSubscriptions()
static MSBaseVehicle * getVehicle(const std::string &id)
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 TraCIColor makeTraCIColor(const RGBColor &color)
static void applySubscriptionFilterFieldOfVision(const Subscription &s, std::set< std::string > &objIDs)
static Subscription * myLastContextSubscription
The last context subscription.
static void setRemoteControlled(MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
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 std::map< std::string, MSVehicle * > myRemoteControlledVehicles
static const MSVehicleType & getVehicleType(const std::string &vehicleID)
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)
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
static SUMOTrafficObject * getTrafficObject(int domain, const std::string &id)
static VehicleStateListener myVehicleStateListener
Changes in the states of simulated vehicles.
static std::vector< Subscription > mySubscriptions
The list of known, still valid subscriptions.
static void handleSingleSubscription(const Subscription &s)
static const std::vector< std::string > & getVehicleStateChanges(const MSNet::VehicleState state)
static void collectObjectIDsInRange(int domain, const PositionVector &shape, double range, std::set< std::string > &into)
static void handleSubscriptions(const SUMOTime t)
static void addSubscriptionParam(double param)
static Subscription * addSubscriptionFilter(SubscriptionFilterType filter)
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
static RGBColor makeRGBColor(const TraCIColor &color)
static std::map< std::string, MSPerson * > myRemoteControlledPersons
static bool needNewSubscription(libsumo::Subscription &s, std::vector< Subscription > &subscriptions, libsumo::Subscription *&modifiedSubscription)
static bool findCloserLane(const MSEdge *edge, const Position &pos, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane)
Representation of a subscription.
bool(* SubscriptionHandler)(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition of a method to be called for serving an associated commandID.
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
std::vector< TraCIPosition > TraCIPositionVector
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
SubscriptionFilterType
Filter types for context subscriptions.
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
An edgeId, position and laneIndex.