32#define DEBUGCOND(PED) ((PED)->getPerson()->isSelected())
60 const auto& it = std::find(pedestrians.begin(), pedestrians.end(), p);
61 if (it != pedestrians.end()) {
65 pedestrians.erase(it);
73 double oncomingGap, std::vector<const MSPerson*>* collectBlockers) {
75 const double leaderFrontDist = (ped->getDirection() ==
FORWARD ? vehCenter - ped->getEdgePos(0) : ped->getEdgePos(0) - vehCenter) - vehWidth * 0.5;
76 const double leaderBackDist = leaderFrontDist + ped->getPerson()->getVehicleType().getLength();
77#ifdef DEBUG_INTERACTING
79 std::cout <<
SIMTIME <<
" lane=" << lane->
getID() <<
" dir=" << ped->getDirection() <<
" pX=" << ped->getEdgePos(0) <<
" pL=" << ped->getPerson()->getVehicleType().getLength()
80 <<
" vehCenter=" << vehCenter
81 <<
" vehWidth=" << vehWidth
82 <<
" lBD=" << leaderBackDist
83 <<
" lFD=" << leaderFrontDist
87 if (leaderBackDist >= -vehWidth
88 && (leaderFrontDist < 0
90 || (leaderFrontDist <= oncomingGap && ped->getWaitingTime() <
TIME2STEPS(2.0)))) {
96 if (collectBlockers ==
nullptr) {
99 collectBlockers->push_back(ped->getPerson());
102 if (collectBlockers ==
nullptr) {
105 return collectBlockers->size() > 0;
132 double relX2 = ped->getEdgePos(0) - (ped->getDirection() ==
FORWARD ? 0 : stopTime * ped->getPerson()->getMaxSpeed());
133 double dist = ((relX2 - minPos) * (bidi ? -1 : 1)
134 - (ped->getDirection() ==
FORWARD ? ped->getPerson()->getVehicleType().getLength() : 0));
135 const bool aheadOfVehicle = bidi ? ped->getEdgePos(0) < minPos : ped->getEdgePos(0) > minPos;
136 if (aheadOfVehicle && dist < result.second) {
137 const double center = ped->getLatOffset() + 0.5 * lane->
getWidth();
138 const double halfWidth = 0.5 * ped->getPerson()->getVehicleType().getWidth();
139 const bool overlap = (center + halfWidth > minRight && center - halfWidth < maxLeft);
140#ifdef DEBUG_INTERACTING
142 std::cout <<
" nextBlocking lane=" << lane->
getID() <<
" bidi=" << bidi
143 <<
" minPos=" << minPos <<
" minRight=" << minRight <<
" maxLeft=" << maxLeft
144 <<
" stopTime=" << stopTime
145 <<
" ped=" << ped->getID()
146 <<
" pedX=" << ped->getEdgePos(0)
147 <<
" relX2=" << relX2
148 <<
" center=" << center
149 <<
" pedLeft=" << center + halfWidth
150 <<
" pedRight=" << center - halfWidth
151 <<
" overlap=" << overlap
156 result.first = ped->getPerson();
157 result.second = dist;
180#ifdef DEBUG_CROSSING_APPROACH
std::pair< const MSPerson *, double > PersonDist
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Representation of a lane in the micro simulation.
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
double getWidth() const
Returns the lane's width.
static bool ignoreFoe(const SUMOTrafficObject *ego, const SUMOTrafficObject *foe)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
bool hasInternalLinks() const
return whether the network contains internal links
std::vector< MSPModel_InteractingState * > Pedestrians
bool usingInternalLanes()
whether movements on intersections are modelled /
Pedestrians & getPedestrians(const MSLane *lane)
retrieves the pedestrian vector for the given lane (may be empty)
PersonDist nextBlocking(const MSLane *lane, double minPos, double minRight, double maxLeft, double stopTime=0, bool bidi=false)
returns the next pedestrian beyond minPos that is laterally between minRight and maxLeft or nullptr
ActiveLanes myActiveLanes
store of all lanes which have pedestrians on them
bool myAmActive
whether an event for pedestrian processing was added
static Pedestrians noPedestrians
empty pedestrian vector
static bool usingInternalLanesStatic()
int myNumActivePedestrians
the total number of active pedestrians
virtual void remove(MSTransportableStateAdapter *state)
remove the specified person from the pedestrian simulation
bool blockedAtDist(const SUMOTrafficObject *ego, const MSLane *lane, double vehCenter, double vehWidth, double oncomingGap, std::vector< const MSPerson * > *collectBlockers)
whether a pedestrian is blocking the crossing of lane for the given vehicle bondaries
bool hasPedestrians(const MSLane *lane)
whether the given lane has pedestrians on it
virtual void clearState()
Resets pedestrians when quick-loading state.
static void unregisterCrossingApproach(const MSPModel_InteractingState &ped, const MSLane *crossing)
unregister pedestrian approach with the junction model
Container for pedestrian state and individual position update function.
virtual const MSLane * getNextCrossing() const
placeholder function for the accessing the next crossing
MSPerson * getPerson() const
return the represented person
abstract base class for managing callbacks to retrieve various state information from the model
virtual const MSLane * getLane() const
the current lane of the transportable
const std::string & getID() const
Returns the id.
Representation of a vehicle, person, or container.