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>
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 = 0;
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 // for on-road parking we need to be precise
313 return myOnRoad ? -1 : closestLot;
314 }
315 if (myOnRoad && myLastFreePos - veh->getPositionOnLane() > POSITION_EPS) {
316 // for on-road parking we need to be precise
317 return -1;
318 }
319 return myLastFreeLot;
320}
321
322void
324 double beg = veh->getPositionOnLane() + veh->getVehicleType().getMinGap();
325 double end = veh->getPositionOnLane() - veh->getVehicleType().getLength();
326 if (myUpdateEvent == nullptr) {
329 }
330 int lotIndex = getLotIndex(veh);
331 if (lotIndex < 0) {
332 WRITE_WARNING("Unsuitable parking position for vehicle '" + veh->getID() + "' at parkingArea '" + getID() + "' time=" + time2string(SIMSTEP));
333 lotIndex = myLastFreeLot;
334 }
335#ifdef DEBUG_GET_LAST_FREE_POS
336 ((SUMOVehicleParameter&)veh->getParameter()).setParameter("lotIndex", toString(lotIndex));
337#endif
338 assert(myLastFreePos >= 0);
339 assert(lotIndex < (int)mySpaceOccupancies.size());
340 mySpaceOccupancies[lotIndex].vehicle = veh;
341 myEndPositions[veh] = std::pair<double, double>(beg, end);
343 // current search ends here
345}
346
347
348void
350 assert(myEndPositions.find(what) != myEndPositions.end());
351 if (myUpdateEvent == nullptr) {
354 }
355 for (auto& lsd : mySpaceOccupancies) {
356 if (lsd.vehicle == what) {
357 lsd.vehicle = nullptr;
358 break;
359 }
360 }
361 myEndPositions.erase(myEndPositions.find(what));
363}
364
365
369 myUpdateEvent = nullptr;
370 return 0;
371}
372
373
375 index(-1),
376 vehicle(nullptr),
377 rotation(0),
378 slope(0),
379 width(0),
380 length(0),
381 endPos(0),
382 manoeuverAngle(0),
383 sideIsLHS(false) {
384}
385
386
387MSParkingArea::LotSpaceDefinition::LotSpaceDefinition(int index_, SUMOVehicle* vehicle_, double x, double y, double z, double rotation_, double slope_, double width_, double length_) :
388 index(index_),
389 vehicle(vehicle_),
390 position(Position(x, y, z)),
391 rotation(rotation_),
392 slope(slope_),
393 width(width_),
394 length(length_),
395 endPos(0),
396 manoeuverAngle(0),
397 sideIsLHS(false) {
398}
399
400
401void
403 myLastFreeLot = -1;
405 myEgressBlocked = false;
406 for (auto& lsd : mySpaceOccupancies) {
407 if (lsd.vehicle == nullptr
408 || (getOccupancy() == getCapacity()
409 && lsd.vehicle->remainingStopDuration() <= 0
410 && !lsd.vehicle->isStoppedTriggered())) {
411 if (lsd.vehicle == nullptr) {
412 myLastFreeLot = lsd.index;
413 myLastFreePos = lsd.endPos;
414 } else {
415 // vehicle wants to exit the parking area
416 myLastFreeLot = lsd.index;
417 myLastFreePos = lsd.endPos - lsd.vehicle->getVehicleType().getLength() - POSITION_EPS;
418 myEgressBlocked = true;
419 }
420 break;
421 } else {
423 lsd.endPos - lsd.vehicle->getVehicleType().getLength() - NUMERICAL_EPS);
424 }
425 }
426}
427
428
429double
431 if (forVehicle.getLane() != &myLane) {
432 // for different lanes, do not consider reservations to avoid lane-order
433 // dependency in parallel simulation
434#ifdef DEBUG_RESERVATIONS
435 if (DEBUG_COND2(forVehicle)) {
436 std::cout << SIMTIME << " pa=" << getID() << " freePosRes veh=" << forVehicle.getID() << " other lane\n";
437 }
438#endif
439 if (myNumAlternatives > 0 && getOccupancy() == getCapacity()) {
440 // ensure that the vehicle reaches the rerouter lane
441 return MAX2(myBegPos, MIN2(POSITION_EPS, myEndPos));
442 } else {
443 return getLastFreePos(forVehicle, brakePos);
444 }
445 }
446 if (t > myReservationTime) {
447#ifdef DEBUG_RESERVATIONS
448 if (DEBUG_COND2(forVehicle)) {
449 std::cout << SIMTIME << " pa=" << getID() << " freePosRes veh=" << forVehicle.getID() << " first reservation\n";
450 }
451#endif
453 myReservations = 1;
455 for (const auto& lsd : mySpaceOccupancies) {
456 if (lsd.vehicle != nullptr) {
457 myReservationMaxLength = MAX2(myReservationMaxLength, lsd.vehicle->getVehicleType().getLength());
458 }
459 }
460 return getLastFreePos(forVehicle, brakePos);
461 } else {
463#ifdef DEBUG_RESERVATIONS
464 if (DEBUG_COND2(forVehicle)) {
465 std::cout << SIMTIME << " pa=" << getID() << " freePosRes veh=" << forVehicle.getID() << " res=" << myReservations << " enough space\n";
466 }
467#endif
470 return getLastFreePos(forVehicle, brakePos);
471 } else {
472 if (myCapacity == 0) {
473 return getLastFreePos(forVehicle, brakePos);
474 } else {
475#ifdef DEBUG_RESERVATIONS
476 if (DEBUG_COND2(forVehicle)) std::cout << SIMTIME << " pa=" << getID() << " freePosRes veh=" << forVehicle.getID()
477 << " res=" << myReservations << " resTime=" << myReservationTime << " reserved full, maxLen=" << myReservationMaxLength << " endPos=" << mySpaceOccupancies[0].endPos << "\n";
478#endif
479 return (mySpaceOccupancies[0].endPos
481 - forVehicle.getVehicleType().getMinGap()
482 - NUMERICAL_EPS);
483 }
484 }
485 }
486}
487
488
489double
491 return myWidth;
492}
493
494
495double
497 return myLength;
498}
499
500
501double
503 return myAngle;
504}
505
506
507int
509 return myCapacity;
510}
511
512
513bool
515 return myOnRoad;
516}
517
518
519int
521 return (int)myEndPositions.size() - (myEgressBlocked ? 1 : 0);
522}
523
524
525int
527 return (int)myEndPositions.size();
528}
529
530
531int
533 return myLastStepOccupancy;
534}
535
536void
539}
540
541
542int
544 return myNumAlternatives;
545}
546
547
548void
551}
552
553/****************************************************************************/
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:265
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:71
T MAX2(T a, T b)
Definition: StdDefs.h:77
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:156
static bool gLefthand
Whether lefthand-drive is being simulated.
Definition: MSGlobals.h:168
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
double getLength() const
Returns the lane's length.
Definition: MSLane.h:575
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:506
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:527
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:590
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:482
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:298
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: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: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.