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-2023 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>
29#include <microsim/MSNet.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// ===========================================================================
45MSParkingArea::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 myRoadSideCapacity(capacity),
51 myCapacity(0),
52 myOnRoad(onRoad),
53 myWidth(width),
54 myLength(length),
55 myAngle(angle),
56 myEgressBlocked(false),
57 myReservationTime(-1),
58 myReservations(0),
59 myReservationMaxLength(0),
60 myNumAlternatives(0),
61 myLastStepOccupancy(0),
62 myDepartPos(-1),
63 myDepartPosDefinition(DepartPosDefinition::DEFAULT),
64 myUpdateEvent(nullptr) {
65 // initialize unspecified defaults
66 if (myWidth == 0) {
68 }
69 const double spaceDim = capacity > 0 ? myLane.interpolateLanePosToGeometryPos((myEndPos - myBegPos) / capacity) : 7.5;
70 if (myLength == 0) {
71 myLength = spaceDim;
72 }
73 if (departPos != "") {
74 std::string error;
76 throw ProcessError(error);
77 }
79 // maybe allow other methods at a later time
80 throw ProcessError("Only a numerical departPos is supported for " + toString(myElement) + " '" + getID() + "'");
81 } else if (myDepartPos < 0 || myDepartPos > lane.getLength()) {
82 throw ProcessError("Invalid departPos for " + toString(myElement) + " '" + getID() + "'");
83 }
84 }
85
86 const double offset = MSGlobals::gLefthand ? -1 : 1;
90 if (!myOnRoad) {
91 myShape.move2side((lane.getWidth() / 2. + myWidth / 2.) * offset);
92 }
93 // Initialize space occupancies if there is a road-side capacity
94 // The overall number of lots is fixed and each lot accepts one vehicle regardless of size
95 for (int i = 0; i < capacity; ++i) {
96 // calculate pos, angle and slope of parking lot space
98 double spaceAngle = GeomHelper::calculateLotSpaceAngle(myShape, i, spaceDim, myAngle);
99 double spaceSlope = GeomHelper::calculateLotSpaceSlope(myShape, i, spaceDim);
100 // add lotEntry
101 addLotEntry(pos.x(), pos.y(), pos.z(), myWidth, myLength, spaceAngle, spaceSlope);
102 // update endPos
103 mySpaceOccupancies.back().endPos = MIN2(myEndPos, myBegPos + MAX2(POSITION_EPS, spaceDim * (i + 1)));
104 }
106}
107
108
110
111
112void
113MSParkingArea::addLotEntry(double x, double y, double z, double width, double length, double angle, double slope) {
114 // create LotSpaceDefinition
115 LotSpaceDefinition lsd((int)mySpaceOccupancies.size(), nullptr, x, y, z, angle, slope, width, length);
116 // If we are modelling parking set the end position to the lot position relative to the lane
117 // rather than the end of the parking area - this results in vehicles stopping nearer the space
118 // and re-entering the lane nearer the space. (If we are not modelling parking the vehicle will usually
119 // enter the space and re-enter at the end of the parking area.)
121 const double offset = this->getLane().getShape().nearest_offset_to_point2D(lsd.position);
122 if (offset < getBeginLanePosition()) {
123 lsd.endPos = getBeginLanePosition() + POSITION_EPS;
124 } else {
125 if (this->getLane().getLength() > offset) {
126 lsd.endPos = offset;
127 } else {
128 lsd.endPos = this->getLane().getLength() - POSITION_EPS;
129 }
130 }
131 // Work out the angle of the lot relative to the lane (-90 adjusts for the way the bay is drawn )
132 double relativeAngle = fmod(lsd.rotation - 90., 360) - fmod(RAD2DEG(this->getLane().getShape().rotationAtOffset(lsd.endPos)), 360) + 0.5;
133 if (relativeAngle < 0.) {
134 relativeAngle += 360.;
135 }
136 lsd.manoeuverAngle = relativeAngle;
137
138 // if p2.y is -ve the lot is on LHS of lane relative to lane direction
139 // we need to know this because it inverts the complexity of the parking manoeuver
141 if (p2.y() < (0. + POSITION_EPS)) {
142 lsd.sideIsLHS = true;
143 } else {
144 lsd.sideIsLHS = false;
145 }
146 } else {
147 lsd.endPos = myEndPos;
148 lsd.manoeuverAngle = int(angle); // unused unless gModelParkingManoeuver is true
149 lsd.sideIsLHS = true;
150 }
151 mySpaceOccupancies.push_back(lsd);
152 myCapacity++;
154}
155
156int
158 assert(myLastFreeLot >= 0);
159 assert(myLastFreeLot < (int)mySpaceOccupancies.size());
160
162 if (lsd.sideIsLHS) {
163 return abs(int(lsd.manoeuverAngle)) % 180;
164 } else {
165 return abs(abs(int(lsd.manoeuverAngle)) % 180 - 180) % 180;
166 }
167}
168
169double
171 assert(myLastFreeLot >= 0);
172 assert(myLastFreeLot < (int)mySpaceOccupancies.size());
173
175 if (lsd.manoeuverAngle > 180.) {
176 return DEG2RAD(lsd.manoeuverAngle - 360.);
177 } else {
178 return DEG2RAD(lsd.manoeuverAngle);
179 }
180}
181
182
183double
184MSParkingArea::getLastFreePos(const SUMOVehicle& forVehicle, double brakePos) const {
185 if (myCapacity == (int)myEndPositions.size()) {
186 // keep enough space so that parking vehicles can leave
187#ifdef DEBUG_GET_LAST_FREE_POS
188 if (DEBUG_COND2(forVehicle)) {
189 std::cout << SIMTIME << " getLastFreePos veh=" << forVehicle.getID() << " allOccupied\n";
190 }
191#endif
192 return myLastFreePos - forVehicle.getVehicleType().getMinGap() - POSITION_EPS;
193 } else {
194 const double minPos = MIN2(myEndPos, brakePos);
195 if (myLastFreePos >= minPos) {
196#ifdef DEBUG_GET_LAST_FREE_POS
197 if (DEBUG_COND2(forVehicle)) {
198 std::cout << SIMTIME << " getLastFreePos veh=" << forVehicle.getID() << " brakePos=" << brakePos << " myEndPos=" << myEndPos << " using myLastFreePos=" << myLastFreePos << "\n";
199 }
200#endif
201 return myLastFreePos;
202 } else {
203 // find free pos after minPos
204 for (const auto& lsd : mySpaceOccupancies) {
205 if (lsd.vehicle == nullptr && lsd.endPos >= minPos) {
206#ifdef DEBUG_GET_LAST_FREE_POS
207 if (DEBUG_COND2(forVehicle)) {
208 std::cout << SIMTIME << " getLastFreePos veh=" << forVehicle.getID() << " brakePos=" << brakePos << " myEndPos=" << myEndPos << " nextFreePos=" << lsd.endPos << "\n";
209 }
210#endif
211 return lsd.endPos;
212 }
213 }
214 // shouldn't happen. No good solution seems possible
215#ifdef DEBUG_GET_LAST_FREE_POS
216 if (DEBUG_COND2(forVehicle)) {
217 std::cout << SIMTIME << " getLastFreePos veh=" << forVehicle.getID() << " brakePos=" << brakePos << " myEndPos=" << myEndPos << " noGoodFreePos blockedAt=" << brakePos << "\n";
218 }
219#endif
220 return brakePos;
221 }
222 }
223}
224
227 for (const auto& lsd : mySpaceOccupancies) {
228 if (lsd.vehicle == &forVehicle) {
229 return lsd.position;
230 }
231 }
232 return Position::INVALID;
233}
234
235
236double
239 return myDepartPos;
240 }
241 for (const auto& lsd : mySpaceOccupancies) {
242 if (lsd.vehicle == &forVehicle) {
243 return lsd.endPos;
244 }
245 }
246 return -1;
247}
248
249
250double
252 for (const auto& lsd : mySpaceOccupancies) {
253 if (lsd.vehicle == &forVehicle) {
254 return (lsd.rotation - 90.) * (double) M_PI / (double) 180.0;
255 }
256 }
257 return 0;
258}
259
260double
262 for (const auto& lsd : mySpaceOccupancies) {
263 if (lsd.vehicle == &forVehicle) {
264 return lsd.slope;
265 }
266 }
267 return 0;
268}
269
270double
271MSParkingArea::getGUIAngle(const SUMOVehicle& forVehicle) const {
272 for (const auto& lsd : mySpaceOccupancies) {
273 if (lsd.vehicle == &forVehicle) {
274 if (lsd.manoeuverAngle > 180.) {
275 return DEG2RAD(lsd.manoeuverAngle - 360.);
276 } else {
277 return DEG2RAD(lsd.manoeuverAngle);
278 }
279 }
280 }
281 return 0.;
282}
283
284int
286 for (const auto& lsd : mySpaceOccupancies) {
287 if (lsd.vehicle == &forVehicle) {
288 if (lsd.sideIsLHS) {
289 return abs(int(lsd.manoeuverAngle)) % 180;
290 } else {
291 return abs(abs(int(lsd.manoeuverAngle)) % 180 - 180) % 180;
292 }
293 }
294 }
295 return 0;
296}
297
298int
300 if (veh->getPositionOnLane() > myLastFreePos) {
301 // vehicle has gone past myLastFreePos and we need to find the actual lot
302 int closestLot = -1;
303 for (int i = 0; i < (int)mySpaceOccupancies.size(); i++) {
305 if (lsd.vehicle == nullptr) {
306 closestLot = i;
307 if (lsd.endPos >= veh->getPositionOnLane()) {
308 return i;
309 }
310 }
311 }
312 return 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
321void
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
344}
345
346
347void
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
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
386MSParkingArea::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
400void
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
428double
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
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
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
488double
490 return myWidth;
491}
492
493
494double
496 return myLength;
497}
498
499
500double
502 return myAngle;
503}
504
505
506int
508 return myCapacity;
509}
510
511
512bool
514 return myOnRoad;
515}
516
517
518int
520 return (int)myEndPositions.size() - (myEgressBlocked ? 1 : 0);
521}
522
523
524int
526 return (int)myEndPositions.size();
527}
528
529
530int
532 return myLastStepOccupancy;
533}
534
535void
538}
539
540
541int
543 return myNumAlternatives;
544}
545
546
547void
550}
551
552/****************************************************************************/
long long int SUMOTime
Definition: GUI.h:36
@ 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:267
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
#define SIMSTEP
Definition: SUMOTime.h:60
#define SIMTIME
Definition: SUMOTime.h:61
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:76
T MAX2(T a, T b)
Definition: StdDefs.h:82
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:157
static bool gLefthand
Whether lefthand-drive is being simulated.
Definition: MSGlobals.h:169
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
double getLength() const
Returns the lane's length.
Definition: MSLane.h:593
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:545
virtual const PositionVector & getShape(bool) const
Definition: MSLane.h:293
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:622
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:183
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Definition: MSNet.h:481
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 total 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:300
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 MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Representation of a vehicle.
Definition: SUMOVehicle.h:62
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:45
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.