Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
SUMOVehicleClass.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 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/****************************************************************************/
22// Definitions of SUMO vehicle classes and helper functions
23/****************************************************************************/
24#pragma once
25#include <config.h>
26#include <string>
27#include <set>
28#include <limits>
33
34
35// ===========================================================================
36// enum definitions
37// ===========================================================================
42enum class SUMOVehicleShape {
44 UNKNOWN,
48 BICYCLE,
52 MOPED,
66 //PASSENGER_AUTOMATED,
68 TAXI,
72 TRUCK,
78 BUS,
86 RAIL,
94 ANT,
96 SHIP,
102 POLICE,
104 RICKSHAW,
106 CABLE_CAR,
108 AIRCRAFT,
112 SCOOTER,
114 DRONE
115};
116
117
118
142enum SUMOVehicleClass : int64_t {
145
147
148
156 SVC_ARMY = 1 << 3,
158 SVC_VIP = 1 << 4,
160
161
163
164
166
170 SVC_HOV = 1 << 7,
172 SVC_TAXI = 1 << 8,
174 SVC_BUS = 1 << 9,
176 SVC_COACH = 1 << 10,
178 SVC_DELIVERY = 1 << 11,
180 SVC_TRUCK = 1 << 12,
182 SVC_TRAILER = 1 << 13,
184 SVC_MOTORCYCLE = 1 << 14,
186 SVC_MOPED = 1 << 15,
188 SVC_BICYCLE = 1 << 16,
190 SVC_E_VEHICLE = 1 << 17,
191
193 SVC_TRAM = 1 << 18,
195 SVC_RAIL_URBAN = 1 << 19,
197 SVC_RAIL = 1 << 20,
201 SVC_RAIL_FAST = 1 << 22,
202
204 SVC_SHIP = 1 << 23,
205
206 SVC_CONTAINER = 1 << 24,
207 SVC_CABLE_CAR = 1 << 25,
208 SVC_SUBWAY = 1 << 26,
209 SVC_AIRCRAFT = 1 << 27,
210 SVC_WHEELCHAIR = 1 << 28,
211 SVC_SCOOTER = 1 << 29,
212 SVC_DRONE = 1 << 30,
213
215 SVC_CUSTOM1 = (long long int)1 << 31,
217 SVC_CUSTOM2 = (long long int)1 << 32,
219
233
236extern std::set<std::string> deprecatedVehicleClassesSeen;
238
240typedef long long int SVCPermissions;
241
243extern const SVCPermissions SVCAll;
244
247
254
257
258// ===========================================================================
259// Stop Offsets
260// ===========================================================================
261
264
265public:
267 StopOffset();
268
270 StopOffset(SVCPermissions permissions, double offset);
271
273 bool isDefined() const;
274
276 void reset();
277
280
282 std::string getExceptions() const;
283
285 double getOffset() const;
286
288 void setPermissions(const SVCPermissions permissions);
289
291 void setExceptions(const std::string permissions);
292
294 void setOffset(const double offset);
295
297 bool operator==(StopOffset const& other) const;
298
300 bool operator!=(StopOffset const& other) const;
301
302private:
305
307 double myOffset;
308};
309
310// ===========================================================================
311// method declarations
312// ===========================================================================
313
314// ---------------------------------------------------------------------------
315// abstract vehicle class / purpose
316// ---------------------------------------------------------------------------
317
323extern const std::string& getVehicleClassNames(SVCPermissions permissions, bool expand = false);
324
326extern int getNumVehicleClasses();
327
332extern const std::vector<std::string>& getVehicleClassNamesList(SVCPermissions permissions);
333
339extern SUMOVehicleClass getVehicleClassID(const std::string& name);
340
345extern SVCPermissions getVehicleClassCompoundID(const std::string& name);
346
354extern SVCPermissions parseVehicleClasses(const std::string& allowedS);
355
357extern bool canParseVehicleClasses(const std::string& classes);
358
363extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS, const MMVersion& networkVersion = NETWORK_VERSION);
364
369extern SVCPermissions parseVehicleClasses(const std::vector<std::string>& allowedS);
370
376extern SVCPermissions extraDisallowed(SVCPermissions disallowed, const MMVersion& networkVersion);
377
380
383
384// ---------------------------------------------------------------------------
385// vehicle shape class
386// ---------------------------------------------------------------------------
387
392extern std::string getVehicleShapeName(SUMOVehicleShape id);
393
398extern SUMOVehicleShape getVehicleShapeID(const std::string& name);
399
401extern bool canParseVehicleShape(const std::string& shape);
402
407extern bool isRailway(SVCPermissions permissions);
408
413extern bool isRailwayOrShared(SVCPermissions permissions);
414
419extern bool isTram(SVCPermissions permissions);
420
425extern bool isBikepath(SVCPermissions permissions);
426
431extern bool isWaterway(SVCPermissions permissions);
432
437extern bool isAirway(SVCPermissions permissions);
438
443extern bool isForbidden(SVCPermissions permissions);
444
449extern bool isSidewalk(SVCPermissions permissions);
450
455extern bool isForVulnerableModes(SVCPermissions permissions);
456
461extern bool noVehicles(SVCPermissions permissions);
462
469
470// ---------------------------------------------------------------------------
471// default vehicle type parameter
472// ---------------------------------------------------------------------------
473extern const std::string DEFAULT_VTYPE_ID;
474extern const std::string DEFAULT_PEDTYPE_ID;
475extern const std::string DEFAULT_BIKETYPE_ID;
476extern const std::string DEFAULT_CONTAINERTYPE_ID;
477extern const std::string DEFAULT_TAXITYPE_ID;
478extern const std::string DEFAULT_RAILTYPE_ID;
479extern const std::set<std::string> DEFAULT_VTYPES;
480
481extern const double DEFAULT_VEH_PROB; // !!! does this belong here?
482extern const double DEFAULT_VEH_MASS;
483extern const double DEFAULT_VEH_WIDTH;
484extern const double DEFAULT_VEH_HEIGHT;
485extern const double DEFAULT_VEH_SHUT_OFF_STOP;
486
487extern const double DEFAULT_PEDESTRIAN_SPEED;
488extern const double DEFAULT_BICYCLE_SPEED;
489
490extern const double DEFAULT_CONTAINER_TRANSHIP_SPEED;
SVCPermissions extraDisallowed(SVCPermissions disallowed, const MMVersion &networkVersion)
Interprets disallowed vehicles depending on network version.
bool canParseVehicleShape(const std::string &shape)
Checks whether the given string contains only known vehicle shape.
const double DEFAULT_VEH_HEIGHT
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
const double DEFAULT_VEH_SHUT_OFF_STOP
const SVCPermissions SVCAll
all VClasses are allowed
int SUMOEmissionClass
bool isForVulnerableModes(SVCPermissions permissions)
Returns whether an edge with the given permissions allows only vulnerable road users.
std::set< std::string > deprecatedVehicleClassesSeen
const std::string DEFAULT_TAXITYPE_ID
const double DEFAULT_VEH_PROB
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a (exclusive) railway edge.
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
double getDefaultVehicleLength(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default vehicle length This put into a function so it can be used by NBVehicle.
const std::string DEFAULT_RAILTYPE_ID
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a waterway edge.
bool isAirway(SVCPermissions permissions)
Returns whether an edge with the given permissions is an airway edge.
bool isTram(SVCPermissions permissions)
Returns whether an edge with the given permissions is a tram edge.
const SUMOEmissionClass EMISSION_CLASS_UNSPECIFIED
emission class not specified
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings
const std::vector< std::string > & getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
const std::string DEFAULT_PEDTYPE_ID
const double DEFAULT_VEH_MASS
const std::set< std::string > DEFAULT_VTYPES
bool isRailwayOrShared(SVCPermissions permissions)
Returns whether an edge with the given permissions is a railway edge or a shared road/rail edge.
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
bool isForbidden(SVCPermissions permissions)
Returns whether an edge with the given permissions is a forbidden edge.
void clearParseVehicleClassesCache()
resets parsing cache
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings
int getNumVehicleClasses()
returns the number of (non-grouping) vehicle classes
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
SUMOVehicleShape
Definition of vehicle classes to differ between different appearances.
@ RICKSHAW
render as a rickshaw
@ BUS
render as a bus
@ RAIL_CARGO
render as a cargo train
@ CABLE_CAR
render as a cable car
@ EMERGENCY
render as an emergency vehicle
@ RAIL
render as a rail
@ PASSENGER_VAN
render as a van
@ PASSENGER
render as a passenger vehicle
@ SCOOTER
render as a scooter
@ RAIL_CAR
render as a (city) rail without locomotive
@ SHIP
render as a arbitrary ship
@ DELIVERY
render as a delivery vehicle
@ BICYCLE
render as a bicycle
@ BICYCLE_CARGO
render as a front-loading cargo bicycle
@ MOTORCYCLE
render as a motorcycle
@ UNKNOWN
not defined
@ BUS_TROLLEY
render as a trolley bus
@ TAXI
automated car (with cruise controllers)
@ E_VEHICLE
render as a (futuristic) e-vehicle
@ ANT
render as a giant ant
@ TRUCK
render as a transport vehicle
@ AIRCRAFT
render as aircraft
@ FIREBRIGADE
render as a fire brigade
@ PASSENGER_HATCHBACK
render as a hatchback passenger vehicle ("Fliessheck")
@ MOPED
render as a moped
@ BUS_FLEXIBLE
render as a flexible city bus
@ TRUCK_1TRAILER
render as a transport vehicle with one trailer
@ PASSENGER_SEDAN
render as a sedan passenger vehicle ("Stufenheck")
@ WHEELCHAIR
render as a wheelchair
@ DRONE
render as a drone
@ BUS_COACH
render as a coach
@ POLICE
render as a police car
@ PASSENGER_WAGON
render as a wagon passenger vehicle ("Combi")
@ TRUCK_SEMITRAILER
render as a semi-trailer transport vehicle ("Sattelschlepper")
@ PEDESTRIAN
render as a pedestrian
const double DEFAULT_PEDESTRIAN_SPEED
const double DEFAULT_BICYCLE_SPEED
bool isSidewalk(SVCPermissions permissions)
Returns whether an edge with the given permissions is a sidewalk.
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
const double DEFAULT_VEH_WIDTH
bool noVehicles(SVCPermissions permissions)
Returns whether an edge with the given permissions forbids vehicles.
const std::string DEFAULT_VTYPE_ID
bool isBikepath(SVCPermissions permissions)
Returns whether an edge with the given permissions is a bicycle edge.
const std::string DEFAULT_CONTAINERTYPE_ID
SVCPermissions getVehicleClassCompoundID(const std::string &name)
Returns the OR'ed id of the compound class given by its name.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_SHIP
is an arbitrary ship
@ SVC_PRIVATE
private vehicles
@ SVC_VIP
vip vehicles
@ SVC_HOV
vehicle is a HOV
@ SVC_TRUCK
vehicle is a large transport vehicle
@ SVC_ROAD_CLASSES
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_CUSTOM2
is a user-defined type
@ SVC_WHEELCHAIR
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_COACH
vehicle is a coach
@ SVC_CABLE_CAR
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_CONTAINER
@ SVC_SCOOTER
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_TRAILER
vehicle is a large transport vehicle
@ SVC_CUSTOM1
is a user-defined type
@ SVC_ARMY
army vehicles
@ SVC_DRONE
@ SVC_RAIL_ELECTRIC
rail vehicle that requires electrified tracks
@ SVC_NON_ROAD
@ SVC_DELIVERY
vehicle is a small delivery vehicle
@ SVC_NON_ROAD_RAIL
classes which (normally) do not drive on normal roads
@ SVC_RAIL_URBAN
vehicle is a city rail
@ SVC_MOTORCYCLE
vehicle is a motorcycle
@ SVC_EMERGENCY
public emergency vehicles
@ SVC_MOPED
vehicle is a moped
@ SVC_AUTHORITY
authorities vehicles
@ SVC_VULNERABLE
@ SVC_ROAD_MOTOR_CLASSES
classes which drive on roads
@ SVC_TRAM
vehicle is a light rail
@ SVC_PUBLIC_CLASSES
public transport
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_E_VEHICLE
is an electric vehicle
@ SVC_AIRCRAFT
@ SVC_SUBWAY
@ SVC_PEDESTRIAN
pedestrian
const double DEFAULT_CONTAINER_TRANSHIP_SPEED
const SUMOVehicleClass SUMOVehicleClass_MAX
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand=false)
Returns the ids of the given classes, divided using a ' '.
const std::string DEFAULT_BIKETYPE_ID
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
Definition StdDefs.h:71
const MMVersion NETWORK_VERSION(1, 20)
stop offset
void setOffset(const double offset)
set offset
StopOffset()
constructor
bool isDefined() const
check if stopOffset was defined
void reset()
reset stopOffset
SVCPermissions getPermissions() const
get permissions
void setExceptions(const std::string permissions)
set exceptions (used in netedit)
SVCPermissions myPermissions
permissions (allowed)
double myOffset
offset
std::string getExceptions() const
get exceptions (used in netedit)
void setPermissions(const SVCPermissions permissions)
update permissions
bool operator==(StopOffset const &other) const
comparator
bool operator!=(StopOffset const &other) const
comparator
double getOffset() const
get offset