Eclipse SUMO - Simulation of Urban MObility
MSParkingArea.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2015-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A area where vehicles can park next to the road
20 /****************************************************************************/
21 #include <config.h>
22 
23 #include <cassert>
26 #include <utils/geom/Position.h>
27 #include <utils/geom/GeomHelper.h>
29 #include <microsim/MSNet.h>
30 #include <microsim/MSVehicleType.h>
31 #include "MSLane.h"
33 #include "MSParkingArea.h"
34 #include "MSGlobals.h"
35 
36 //#define DEBUG_RESERVATIONS
37 //#define DEBUG_GET_LAST_FREE_POS
38 //#define DEBUG_COND2(obj) (obj.getID() == "v.3")
39 #define DEBUG_COND2(obj) (obj.isSelected())
40 
41 
42 // ===========================================================================
43 // method definitions
44 // ===========================================================================
45 MSParkingArea::MSParkingArea(const std::string& id, const std::vector<std::string>& lines,
46  MSLane& lane, double begPos, double endPos, int capacity, double width, double length,
47  double angle, const std::string& name, bool onRoad,
48  const std::string& departPos) :
49  MSStoppingPlace(id, SUMO_TAG_PARKING_AREA, lines, lane, begPos, endPos, name),
50  myCapacity(0),
51  myOnRoad(onRoad),
52  myWidth(width),
53  myLength(length),
54  myAngle(angle),
55  myEgressBlocked(false),
56  myReservationTime(-1),
57  myReservations(0),
58  myReservationMaxLength(0),
59  myNumAlternatives(0),
60  myLastStepOccupancy(0),
61  myDepartPos(-1),
62  myDepartPosDefinition(DepartPosDefinition::DEFAULT),
63  myUpdateEvent(nullptr) {
64  // initialize unspecified defaults
65  if (myWidth == 0) {
67  }
68  const double spaceDim = capacity > 0 ? myLane.interpolateLanePosToGeometryPos((myEndPos - myBegPos) / capacity) : 7.5;
69  if (myLength == 0) {
70  myLength = spaceDim;
71  }
72  if (departPos != "") {
73  std::string error;
75  throw ProcessError(error);
76  }
78  // maybe allow other methods at a later time
79  throw ProcessError("Only a numerical departPos is supported for " + toString(myElement) + " '" + getID() + "'");
80  } else if (myDepartPos < 0 || myDepartPos > lane.getLength()) {
81  throw ProcessError("Invalid departPos for " + toString(myElement) + " '" + getID() + "'");
82  }
83  }
84 
85  const double offset = MSGlobals::gLefthand ? -1 : 1;
86  myShape = lane.getShape().getSubpart(
88  lane.interpolateLanePosToGeometryPos(endPos));
89  if (!myOnRoad) {
90  myShape.move2side((lane.getWidth() / 2. + myWidth / 2.) * offset);
91  }
92  // Initialize space occupancies if there is a road-side capacity
93  // The overall number of lots is fixed and each lot accepts one vehicle regardless of size
94  for (int i = 0; i < capacity; ++i) {
95  // calculate pos, angle and slope of parking lot space
97  double spaceAngle = GeomHelper::calculateLotSpaceAngle(myShape, i, spaceDim, myAngle);
98  double spaceSlope = GeomHelper::calculateLotSpaceSlope(myShape, i, spaceDim);
99  // add lotEntry
100  addLotEntry(pos.x(), pos.y(), pos.z(), myWidth, myLength, spaceAngle, spaceSlope);
101  // update endPos
102  mySpaceOccupancies.back().endPos = MIN2(myEndPos, myBegPos + MAX2(POSITION_EPS, spaceDim * (i + 1)));
103  }
105 }
106 
107 
109 
110 
111 void
112 MSParkingArea::addLotEntry(double x, double y, double z, double width, double length, double angle, double slope) {
113  // create LotSpaceDefinition
114  LotSpaceDefinition lsd((int)mySpaceOccupancies.size(), nullptr, x, y, z, angle, slope, width, length);
115  // If we are modelling parking set the end position to the lot position relative to the lane
116  // rather than the end of the parking area - this results in vehicles stopping nearer the space
117  // and re-entering the lane nearer the space. (If we are not modelling parking the vehicle will usually
118  // enter the space and re-enter at the end of the parking area.)
120  const double offset = this->getLane().getShape().nearest_offset_to_point2D(lsd.position);
121  if (offset < getBeginLanePosition()) {
122  lsd.endPos = getBeginLanePosition() + POSITION_EPS;
123  } else {
124  if (this->getLane().getLength() > offset) {
125  lsd.endPos = offset;
126  } else {
127  lsd.endPos = this->getLane().getLength() - POSITION_EPS;
128  }
129  }
130  // Work out the angle of the lot relative to the lane (-90 adjusts for the way the bay is drawn )
131  double relativeAngle = fmod(lsd.rotation - 90., 360) - fmod(RAD2DEG(this->getLane().getShape().rotationAtOffset(lsd.endPos)), 360) + 0.5;
132  if (relativeAngle < 0.) {
133  relativeAngle += 360.;
134  }
135  lsd.manoeuverAngle = relativeAngle;
136 
137  // if p2.y is -ve the lot is on LHS of lane relative to lane direction
138  // we need to know this because it inverts the complexity of the parking manoeuver
140  if (p2.y() < (0. + POSITION_EPS)) {
141  lsd.sideIsLHS = true;
142  } else {
143  lsd.sideIsLHS = false;
144  }
145  } else {
146  lsd.endPos = myEndPos;
147  lsd.manoeuverAngle = int(angle); // unused unless gModelParkingManoeuver is true
148  lsd.sideIsLHS = true;
149  }
150  mySpaceOccupancies.push_back(lsd);
151  myCapacity++;
153 }
154 
155 int
157  assert(myLastFreeLot >= 0);
158  assert(myLastFreeLot < (int)mySpaceOccupancies.size());
159 
161  if (lsd.sideIsLHS) {
162  return abs(int(lsd.manoeuverAngle)) % 180;
163  } else {
164  return abs(abs(int(lsd.manoeuverAngle)) % 180 - 180) % 180;
165  }
166 }
167 
168 double
170  assert(myLastFreeLot >= 0);
171  assert(myLastFreeLot < (int)mySpaceOccupancies.size());
172 
174  if (lsd.manoeuverAngle > 180.) {
175  return DEG2RAD(lsd.manoeuverAngle - 360.);
176  } else {
177  return DEG2RAD(lsd.manoeuverAngle);
178  }
179 }
180 
181 
182 double
183 MSParkingArea::getLastFreePos(const SUMOVehicle& forVehicle, double brakePos) const {
184  if (myCapacity == (int)myEndPositions.size()) {
185  // keep enough space so that parking vehicles can leave
186 #ifdef DEBUG_GET_LAST_FREE_POS
187  if (DEBUG_COND2(forVehicle)) {
188  std::cout << SIMTIME << " getLastFreePos veh=" << forVehicle.getID() << " allOccupied\n";
189  }
190 #endif
191  return myLastFreePos - forVehicle.getVehicleType().getMinGap() - POSITION_EPS;
192  } else {
193  const double minPos = MIN2(myEndPos, brakePos);
194  if (myLastFreePos >= minPos) {
195 #ifdef DEBUG_GET_LAST_FREE_POS
196  if (DEBUG_COND2(forVehicle)) {
197  std::cout << SIMTIME << " getLastFreePos veh=" << forVehicle.getID() << " brakePos=" << brakePos << " myEndPos=" << myEndPos << " using myLastFreePos=" << myLastFreePos << "\n";
198  }
199 #endif
200  return myLastFreePos;
201  } else {
202  // find free pos after minPos
203  for (const auto& lsd : mySpaceOccupancies) {
204  if (lsd.vehicle == nullptr && lsd.endPos >= minPos) {
205 #ifdef DEBUG_GET_LAST_FREE_POS
206  if (DEBUG_COND2(forVehicle)) {
207  std::cout << SIMTIME << " getLastFreePos veh=" << forVehicle.getID() << " brakePos=" << brakePos << " myEndPos=" << myEndPos << " nextFreePos=" << lsd.endPos << "\n";
208  }
209 #endif
210  return lsd.endPos;
211  }
212  }
213  // shouldn't happen. No good solution seems possible
214 #ifdef DEBUG_GET_LAST_FREE_POS
215  if (DEBUG_COND2(forVehicle)) {
216  std::cout << SIMTIME << " getLastFreePos veh=" << forVehicle.getID() << " brakePos=" << brakePos << " myEndPos=" << myEndPos << " noGoodFreePos blockedAt=" << brakePos << "\n";
217  }
218 #endif
219  return brakePos;
220  }
221  }
222 }
223 
224 Position
226  for (const auto& lsd : mySpaceOccupancies) {
227  if (lsd.vehicle == &forVehicle) {
228  return lsd.position;
229  }
230  }
231  return Position::INVALID;
232 }
233 
234 
235 double
238  return myDepartPos;
239  }
240  for (const auto& lsd : mySpaceOccupancies) {
241  if (lsd.vehicle == &forVehicle) {
242  return lsd.endPos;
243  }
244  }
245  return -1;
246 }
247 
248 
249 double
250 MSParkingArea::getVehicleAngle(const SUMOVehicle& forVehicle) const {
251  for (const auto& lsd : mySpaceOccupancies) {
252  if (lsd.vehicle == &forVehicle) {
253  return (lsd.rotation - 90.) * (double) M_PI / (double) 180.0;
254  }
255  }
256  return 0;
257 }
258 
259 double
260 MSParkingArea::getVehicleSlope(const SUMOVehicle& forVehicle) const {
261  for (const auto& lsd : mySpaceOccupancies) {
262  if (lsd.vehicle == &forVehicle) {
263  return lsd.slope;
264  }
265  }
266  return 0;
267 }
268 
269 double
270 MSParkingArea::getGUIAngle(const SUMOVehicle& forVehicle) const {
271  for (const auto& lsd : mySpaceOccupancies) {
272  if (lsd.vehicle == &forVehicle) {
273  if (lsd.manoeuverAngle > 180.) {
274  return DEG2RAD(lsd.manoeuverAngle - 360.);
275  } else {
276  return DEG2RAD(lsd.manoeuverAngle);
277  }
278  }
279  }
280  return 0.;
281 }
282 
283 int
285  for (const auto& lsd : mySpaceOccupancies) {
286  if (lsd.vehicle == &forVehicle) {
287  if (lsd.sideIsLHS) {
288  return abs(int(lsd.manoeuverAngle)) % 180;
289  } else {
290  return abs(abs(int(lsd.manoeuverAngle)) % 180 - 180) % 180;
291  }
292  }
293  }
294  return 0;
295 }
296 
297 int
299  if (veh->getPositionOnLane() > myLastFreePos) {
300  // vehicle has gone past myLastFreePos and we need to find the actual lot
301  int closestLot = 0;
302  for (int i = 0; i < (int)mySpaceOccupancies.size(); i++) {
303  const LotSpaceDefinition lsd = mySpaceOccupancies[i];
304  if (lsd.vehicle == nullptr) {
305  closestLot = i;
306  if (lsd.endPos >= veh->getPositionOnLane()) {
307  return i;
308  }
309  }
310  }
311  // for on-road parking we need to be precise
312  return myOnRoad ? -1 : closestLot;
313  }
314  if (myOnRoad && myLastFreePos - veh->getPositionOnLane() > POSITION_EPS) {
315  // for on-road parking we need to be precise
316  return -1;
317  }
318  return myLastFreeLot;
319 }
320 
321 void
323  double beg = veh->getPositionOnLane() + veh->getVehicleType().getMinGap();
324  double end = veh->getPositionOnLane() - veh->getVehicleType().getLength();
325  if (myUpdateEvent == nullptr) {
328  }
329  int lotIndex = getLotIndex(veh);
330  if (lotIndex < 0) {
331  WRITE_WARNING("Unsuitable parking position for vehicle '" + veh->getID() + "' at parkingArea '" + getID() + "' time=" + time2string(SIMSTEP));
332  lotIndex = myLastFreeLot;
333  }
334 #ifdef DEBUG_GET_LAST_FREE_POS
335  ((SUMOVehicleParameter&)veh->getParameter()).setParameter("lotIndex", toString(lotIndex));
336 #endif
337  assert(myLastFreePos >= 0);
338  assert(lotIndex < (int)mySpaceOccupancies.size());
339  mySpaceOccupancies[lotIndex].vehicle = veh;
340  myEndPositions[veh] = std::pair<double, double>(beg, end);
342  // current search ends here
343  veh->setNumberParkingReroutes(0);
344 }
345 
346 
347 void
349  assert(myEndPositions.find(what) != myEndPositions.end());
350  if (myUpdateEvent == nullptr) {
353  }
354  for (auto& lsd : mySpaceOccupancies) {
355  if (lsd.vehicle == what) {
356  lsd.vehicle = nullptr;
357  break;
358  }
359  }
360  myEndPositions.erase(myEndPositions.find(what));
362 }
363 
364 
365 SUMOTime
368  myUpdateEvent = nullptr;
369  return 0;
370 }
371 
372 
374  index(-1),
375  vehicle(nullptr),
376  rotation(0),
377  slope(0),
378  width(0),
379  length(0),
380  endPos(0),
381  manoeuverAngle(0),
382  sideIsLHS(false) {
383 }
384 
385 
386 MSParkingArea::LotSpaceDefinition::LotSpaceDefinition(int index_, SUMOVehicle* vehicle_, double x, double y, double z, double rotation_, double slope_, double width_, double length_) :
387  index(index_),
388  vehicle(vehicle_),
389  position(Position(x, y, z)),
390  rotation(rotation_),
391  slope(slope_),
392  width(width_),
393  length(length_),
394  endPos(0),
395  manoeuverAngle(0),
396  sideIsLHS(false) {
397 }
398 
399 
400 void
402  myLastFreeLot = -1;
404  myEgressBlocked = false;
405  for (auto& lsd : mySpaceOccupancies) {
406  if (lsd.vehicle == nullptr
407  || (getOccupancy() == getCapacity()
408  && lsd.vehicle->remainingStopDuration() <= 0
409  && !lsd.vehicle->isStoppedTriggered())) {
410  if (lsd.vehicle == nullptr) {
411  myLastFreeLot = lsd.index;
412  myLastFreePos = lsd.endPos;
413  } else {
414  // vehicle wants to exit the parking area
415  myLastFreeLot = lsd.index;
416  myLastFreePos = lsd.endPos - lsd.vehicle->getVehicleType().getLength() - POSITION_EPS;
417  myEgressBlocked = true;
418  }
419  break;
420  } else {
422  lsd.endPos - lsd.vehicle->getVehicleType().getLength() - NUMERICAL_EPS);
423  }
424  }
425 }
426 
427 
428 double
429 MSParkingArea::getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle& forVehicle, double brakePos) {
430  if (forVehicle.getLane() != &myLane) {
431  // for different lanes, do not consider reservations to avoid lane-order
432  // dependency in parallel simulation
433 #ifdef DEBUG_RESERVATIONS
434  if (DEBUG_COND2(forVehicle)) {
435  std::cout << SIMTIME << " pa=" << getID() << " freePosRes veh=" << forVehicle.getID() << " other lane\n";
436  }
437 #endif
438  if (myNumAlternatives > 0 && getOccupancy() == getCapacity()) {
439  // ensure that the vehicle reaches the rerouter lane
440  return MAX2(myBegPos, MIN2(POSITION_EPS, myEndPos));
441  } else {
442  return getLastFreePos(forVehicle, brakePos);
443  }
444  }
445  if (t > myReservationTime) {
446 #ifdef DEBUG_RESERVATIONS
447  if (DEBUG_COND2(forVehicle)) {
448  std::cout << SIMTIME << " pa=" << getID() << " freePosRes veh=" << forVehicle.getID() << " first reservation\n";
449  }
450 #endif
451  myReservationTime = t;
452  myReservations = 1;
454  for (const auto& lsd : mySpaceOccupancies) {
455  if (lsd.vehicle != nullptr) {
456  myReservationMaxLength = MAX2(myReservationMaxLength, lsd.vehicle->getVehicleType().getLength());
457  }
458  }
459  return getLastFreePos(forVehicle, brakePos);
460  } else {
462 #ifdef DEBUG_RESERVATIONS
463  if (DEBUG_COND2(forVehicle)) {
464  std::cout << SIMTIME << " pa=" << getID() << " freePosRes veh=" << forVehicle.getID() << " res=" << myReservations << " enough space\n";
465  }
466 #endif
467  myReservations++;
469  return getLastFreePos(forVehicle, brakePos);
470  } else {
471  if (myCapacity == 0) {
472  return getLastFreePos(forVehicle, brakePos);
473  } else {
474 #ifdef DEBUG_RESERVATIONS
475  if (DEBUG_COND2(forVehicle)) std::cout << SIMTIME << " pa=" << getID() << " freePosRes veh=" << forVehicle.getID()
476  << " res=" << myReservations << " resTime=" << myReservationTime << " reserved full, maxLen=" << myReservationMaxLength << " endPos=" << mySpaceOccupancies[0].endPos << "\n";
477 #endif
478  return (mySpaceOccupancies[0].endPos
480  - forVehicle.getVehicleType().getMinGap()
481  - NUMERICAL_EPS);
482  }
483  }
484  }
485 }
486 
487 
488 double
490  return myWidth;
491 }
492 
493 
494 double
496  return myLength;
497 }
498 
499 
500 double
502  return myAngle;
503 }
504 
505 
506 int
508  return myCapacity;
509 }
510 
511 
512 bool
514  return myOnRoad;
515 }
516 
517 
518 int
520  return (int)myEndPositions.size() - (myEgressBlocked ? 1 : 0);
521 }
522 
523 
524 int
526  return (int)myEndPositions.size();
527 }
528 
529 
530 int
532  return myLastStepOccupancy;
533 }
534 
535 void
538 }
539 
540 
541 int
543  return myNumAlternatives;
544 }
545 
546 
547 void
549  myNumAlternatives = MAX2(myNumAlternatives, alternatives);
550 }
551 
552 /****************************************************************************/
@ DEFAULT
default cursor
#define DEG2RAD(x)
Definition: GeomHelper.h:35
#define RAD2DEG(x)
Definition: GeomHelper.h:36
#define DEBUG_COND2(obj)
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
#define SIMSTEP
Definition: SUMOTime.h:59
#define SIMTIME
Definition: SUMOTime.h:60
long long int SUMOTime
Definition: SUMOTime.h:32
DepartPosDefinition
Possible ways to choose the departure position.
@ GIVEN
The position is given.
@ SUMO_TAG_PARKING_AREA
A parking area.
const double SUMO_const_laneWidth
Definition: StdDefs.h:48
T MIN2(T a, T b)
Definition: StdDefs.h:74
T MAX2(T a, T b)
Definition: StdDefs.h:80
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
static const Position calculateLotSpacePosition(const PositionVector &shape, const int index, const double spaceDim, const double angle, const double width, const double length)
calculate lotSpace position
Definition: GeomHelper.cpp:281
static double calculateLotSpaceAngle(const PositionVector &shape, const int index, const double spaceDim, const double angle)
calculate lotSpace angle
Definition: GeomHelper.cpp:320
static double calculateLotSpaceSlope(const PositionVector &shape, const int index, const double spaceDim)
calculate lotSpace slope
Definition: GeomHelper.cpp:330
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static bool gModelParkingManoeuver
whether parking simulation includes manoeuver time and any associated lane blocking
Definition: MSGlobals.h:145
static bool gLefthand
Whether lefthand-drive is being simulated.
Definition: MSGlobals.h:157
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
double getLength() const
Returns the lane's length.
Definition: MSLane.h:541
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:478
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:499
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:556
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:174
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition: MSNet.h:479
void notifyEgressBlocked()
update state so that vehicles wishing to enter cooperate with exiting vehicles
double getAngle() const
Returns the lot rectangle angle.
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
int getNumAlternatives() const
get number alternatives
int myReservations
number of reservations
int myCapacity
Stop area capacity.
int getCapacity() const
Returns the area capacity.
void enter(SUMOVehicle *veh)
Called if a vehicle enters this stop.
MSParkingArea(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, int capacity, double width, double length, double angle, const std::string &name, bool onRoad, const std::string &departPos)
Constructor.
int myLastStepOccupancy
Changes to the occupancy in the current time step.
bool myOnRoad
Whether vehicles stay on the road.
int myLastFreeLot
Last free lot number (-1 no free lot)
void setNumAlternatives(int alternatives)
set number alternatives
PositionVector myShape
The roadside shape of this parkingArea.
double getLength() const
Returns the lot rectangle length.
virtual void addLotEntry(double x, double y, double z, double width, double length, double angle, double slope)
Add a lot entry to parking area.
SUMOTime myReservationTime
track parking reservations from the lane for the current time step
double getWidth() const
Returns the lot rectangle width.
double getVehicleSlope(const SUMOVehicle &forVehicle) const
Returns the slope of parked vehicle.
int getLotIndex(const SUMOVehicle *veh) const
compute lot for this vehicle
virtual ~MSParkingArea()
Destructor.
SUMOTime updateOccupancy(SUMOTime currentTime)
Called at the end of the time step.
int getLastFreeLotAngle() const
Return the angle of myLastFreeLot - the next parking lot only expected to be called after we have est...
double myDepartPos
custom departPos
double myAngle
The default angle of each parking space.
bool parkOnRoad() const
whether vehicles park on the road
DepartPosDefinition myDepartPosDefinition
double myReservationMaxLength
reservation max length
int myNumAlternatives
the number of alternative parkingAreas that are assigned to parkingAreaRerouter
double myWidth
The default width of each parking space.
double myLength
The default length of each parking space.
void computeLastFreePos()
Computes the last free position on this stop.
int getOccupancyIncludingBlocked() const
Returns the area occupancy.
double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle &forVehicle, double brakePos)
Returns the last free position on this stop including reservatiosn from the current lane and time ste...
double getLastFreeLotGUIAngle() const
Return the GUI angle of myLastFreeLot - the angle the GUI uses to rotate into the next parking lot as...
int getManoeuverAngle(const SUMOVehicle &forVehicle) const
Return the manoeuver angle of the lot where the vehicle is parked.
int getLastStepOccupancy() const
Returns the area occupancy at the end of the last simulation step.
int getOccupancy() const
Returns the area occupancy.
double getVehicleAngle(const SUMOVehicle &forVehicle) const
Returns the angle of parked vehicle.
Command * myUpdateEvent
Event for updating the occupancy.
std::vector< LotSpaceDefinition > mySpaceOccupancies
All the spaces in this parking area.
double getInsertionPosition(const SUMOVehicle &forVehicle) const
Returns the insertion position of a parked vehicle.
Position getVehiclePosition(const SUMOVehicle &forVehicle) const
Returns the position of parked vehicle.
double getGUIAngle(const SUMOVehicle &forVehicle) const
Return the GUI angle of the lot where the vehicle is parked.
bool myEgressBlocked
whether a vehicle wants to exit but is blocked
A lane area vehicles can halt at.
const SumoXMLTag myElement
the type of stopping place
const double myBegPos
The begin position this bus stop is located at.
double getBeginLanePosition() const
Returns the begin position of this stop.
const MSLane & myLane
The lane this bus stop is located at.
std::map< const SUMOVehicle *, std::pair< double, double >, ComparatorNumericalIdLess > myEndPositions
A map from objects (vehicles) to the areas they acquire after entering the stop.
const double myEndPos
The end position this bus stop is located at.
const MSLane & getLane() const
Returns the lane this stop is located at.
double myLastFreePos
The last free position at this stop (variable)
double getLastFreePos() const
double getMinGap() const
Get the free space in front of vehicles of this class.
double getLength() const
Get vehicle's length [m].
const std::string & getID() const
Returns the id.
Definition: Named.h:74
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:293
double x() const
Returns the x-position.
Definition: Position.h:55
double z() const
Returns the z-position.
Definition: Position.h:65
double y() const
Returns the y-position.
Definition: Position.h:60
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
Position transformToVectorCoordinates(const Position &p, bool extend=false) const
return position p within the length-wise coordinate system defined by this position vector....
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
virtual void setNumberParkingReroutes(int value)=0
Structure representing possible vehicle parameter.
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
A wrapper for a Command function.
#define M_PI
Definition: odrSpiral.cpp:40
Representation of a single lot space.
const Position position
The position of the vehicle when parking in this space.
bool sideIsLHS
Whether the lot is on the LHS of the lane relative to the lane direction.
double manoeuverAngle
The angle between lane and lot through which a vehicle must manoeuver to enter the lot.
const double rotation
The rotation.
double endPos
The position along the lane that the vehicle needs to reach for entering this lot.
LotSpaceDefinition()
default constructor
const SUMOVehicle * vehicle
The last parked vehicle or 0.