traci._person
index
/home/delphi/gcc/sumo/tools/traci/_person.py

# -*- coding: utf-8 -*-
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
# Copyright (C) 2011-2024 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the Eclipse
# Public License 2.0 are satisfied: GNU General Public License, version 2
# or later which is available at
https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later

 
Modules
       
traci._simulation
traci.constants

 
Classes
       
builtins.object
Reservation
traci._vehicletype.VTypeDomain(traci.domain.Domain)
PersonDomain

 
class PersonDomain(traci._vehicletype.VTypeDomain)
    
Method resolution order:
PersonDomain
traci._vehicletype.VTypeDomain
traci.domain.Domain
builtins.object

Methods defined here:
__init__(self)
Initialize self.  See help(type(self)) for accurate signature.
add(self, personID, edgeID, pos, depart=-3, typeID='DEFAULT_PEDTYPE')
add(string, string, double, double, string)
Inserts a new person to the simulation at the given edge, position and
time (in s). This function should be followed by appending Stages or the person
will immediately vanish on departure.
appendDrivingStage(self, personID, toEdge, lines, stopID='')
appendDrivingStage(string, string, string, string)
Appends a driving stage to the plan of the given person
The lines parameter should be a space-separated list of line ids
appendStage(self, personID, stage)
appendStage(string, stage)
Appends a stage object to the plan of the given person
Such an object is obtainable using getStage
appendWaitingStage(self, personID, duration, description='waiting', stopID='')
appendWaitingStage(string, float, string, string)
Appends a waiting stage with duration in s to the plan of the given person
appendWalkingStage(self, personID, edges, arrivalPos, duration=-1, speed=-1, stopID='')
appendWalkingStage(string, stringList, double, double, double, string)
Appends a walking stage to the plan of the given person
The walking speed can either be specified, computed from the duration parameter (in s) or taken from the
type of the person
getAngle(self, personID)
getAngle(string) -> double
 
Returns the angle in degrees of the named person within the last step.
getEdges(self, personID, nextStageIndex=0)
getEdges(string, int) -> list(string)
 
Returns a list of all edges in the nth next stage.
For waiting stages this is a single edge
For walking stages this is the complete route
For driving stages this is [origin, destination]
 
nextStageIndex 0 retrieves value for the current stage.
nextStageIndex must be lower then value of getRemainingStages(personID)
getLaneID(self, personID)
getLaneID(string) -> string
 
Returns the id of the lane the named person was at within the last step.
If the current person stage does not provide a lane, "" is returned.
getLanePosition(self, personID)
getLanePosition(string) -> double
 
The position of the person along the lane measured in m.
getNextEdge(self, personID)
getNextEdge(string) -> string
If the person is walking, returns the next edge on the persons route
(including crossing and walkingareas). If there is no further edge or the
person is in another stage, returns the empty string.
getPosition(self, personID)
getPosition(string) -> (double, double)
 
Returns the position of the named person within the last step [m,m].
getPosition3D(self, personID)
getPosition3D(string) -> (double, double, double)
 
Returns the position of the named person within the last step [m,m,m].
getRemainingStages(self, personID)
getRemainingStages(string) -> int
Returns the number of remaining stages (at least 1)
getRoadID(self, personID)
getRoadID(string) -> string
 
Returns the id of the edge the named person was at within the last step.
getSlope(self, personID)
getSlope(string) -> double
 
Returns the slope at the current position of the person in degrees
getSpeed(self, personID)
getSpeed(string) -> double
 
Returns the speed in m/s of the named person within the last step.
getStage(self, personID, nextStageIndex=0)
getStage(string, int) -> stage
Returns the the nth stage object (type simulation.Stage)
Attribute type of this object has the following meaning:
  0 for not-yet-departed
  1 for waiting
  2 for walking
  3 for driving
  4 for access to busStop or trainStop
  5 for personTrip
nextStageIndex 0 retrieves value for the current stage.
nextStageIndex must be lower then value of getRemainingStages(personID)
getTaxiReservations(self, onlyNew=0)
getTaxiReservations(int) -> list(Stage)
Returns all reservations. If onlyNew is 1, each reservation is returned
only once
getTypeID(self, personID)
getTypeID(string) -> string
 
Returns the id of the type of the named person.
getVehicle(self, personID)
getVehicle(string) -> string
Returns the id of the current vehicle if the person is in stage driving
and has entered a vehicle.
Return the empty string otherwise
getWaitingTime(self, personID)
getWaitingTime(string) -> double
The waiting time of a person is defined as the time (in seconds) spent with a
speed below 0.1m/s since the last time it was faster than 0.1m/s.
(basically, the waiting time of a person is reset to 0 every time it moves).
moveTo(self, personID, laneID, pos, posLat=-1073741824.0)
moveTo(string, string, double, double) -> None
 
Move a person to a new position along its current route.
moveToXY(self, personID, edgeID, x, y, angle=-1073741824.0, keepRoute=1, matchThreshold=100)
Place person at the given x,y coordinates and force its angle to
the given value (for drawing).
If the angle is set to INVALID_DOUBLE_VALUE, the vehicle assumes the
natural angle of the edge on which it is driving.
If keepRoute is set to 1, the closest position
within the existing route is taken. If keepRoute is set to 0, the vehicle may move to
any edge in the network but its route then only consists of that edge.
If keepRoute is set to 2 the person has all the freedom of keepRoute=0
but in addition to that may even move outside the road network.
edgeID is an optional placement hint to resolve ambiguities.
The command fails if no suitable target position is found within the
distance given by matchThreshold.
remove(self, personID, reason=3)
Remove person with the given ID for the give reason.
Reasons are defined in module constants and start with REMOVE_
removeStage(self, personID, nextStageIndex)
removeStage(string, int)
Removes the nth next stage
nextStageIndex must be lower then value of getRemainingStages(personID)
nextStageIndex 0 immediately aborts the current stage and proceeds to the next stage
removeStages(self, personID)
removeStages(string)
Removes all stages of the person. If no new phases are appended,
the person will be removed from the simulation in the next simulationStep().
replaceStage(self, personID, stageIndex, stage)
replaceStage(string, int, stage)
Replaces the nth subsequent stage with the given stage object
Such an object is obtainable using getStage
rerouteTraveltime(self, personID)
rerouteTraveltime(string) -> None Reroutes a pedestrian (walking person).
setSpeed(self, personID, speed)
setSpeed(string, double) -> None
 
Sets the maximum speed in m/s for the named person for subsequent step.
setType(self, personID, typeID)
setType(string, string) -> None
 
Sets the id of the type for the named person.
splitTaxiReservation(self, reservationID, personIDs)
splitTaxiReservation(string, list(string)) -> string
Splits given list of person ids from the reservation with the given id
and creates a new reservation for these persons. Returns the new
reservation id

Methods inherited from traci._vehicletype.VTypeDomain:
getAccel(self, typeID)
getAccel(string) -> double
 
Returns the maximum acceleration in m/s^2 of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getActionStepLength(self, typeID)
getActionStepLength(string) -> double
 
Returns the action step length for this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getApparentDecel(self, typeID)
getApparentDecel(string) -> double
 
Returns the apparent deceleration in m/s^2 of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getBoardingDuration(self, typeID)
getBoardingDuration(string) -> double
 
Returns the boarding duration of this type
getColor(self, typeID)
getColor(string) -> (integer, integer, integer, integer)
 
Returns the color of this type.
If called in the context of a person or vehicle, it will return their specific color if it has been set.
Use the respective object ID as typeID value in said context.
getDecel(self, typeID)
getDecel(string) -> double
 
Returns the maximal comfortable deceleration in m/s^2 of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getEmergencyDecel(self, typeID)
getEmergencyDecel(string) -> double
 
Returns the maximal physically possible deceleration in m/s^2 of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getEmissionClass(self, typeID)
getEmissionClass(string) -> string
 
Returns the emission class of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getHeight(self, typeID)
getHeight(string) -> double
 
Returns the height in m of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getImpatience(self, typeID)
getImpatience(string) -> double
 
Returns the Impatience of this type
getImperfection(self, typeID)
getImperfection(string) -> double
 
Returns the driver's imperfection for this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getLateralAlignment(self, typeID)
getLateralAlignment(string) -> string
 
Returns The preferred lateral alignment of the type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getLength(self, typeID)
getLength(string) -> double
 
Returns the length in m of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getMaxSpeed(self, typeID)
getMaxSpeed(string) -> double
 
Returns the maximum speed in m/s of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getMaxSpeedLat(self, typeID)
getMaxSpeedLat(string) -> double
 
Returns the maximum lateral speed in m/s of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getMinGap(self, typeID)
getMinGap(string) -> double
 
Returns the offset (gap to front vehicle if halting) of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getMinGapLat(self, typeID)
getMinGapLat(string) -> double
 
Returns The desired lateral gap of this type at 50km/h in m
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getPersonCapacity(self, typeID)
getPersonCapacity(string) -> int
 
Returns the person capacity of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getShapeClass(self, typeID)
getShapeClass(string) -> string
 
Returns the shape class of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getSpeedDeviation(self, typeID)
getSpeedDeviation(string) -> double
 
Returns the maximum speed deviation of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getSpeedFactor(self, typeID)
getSpeedFactor(string) -> double
 
Returns the speed factor of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getTau(self, typeID)
getTau(string) -> double
 
Returns the driver's desired headway in s for this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getVehicleClass(self, typeID)
getVehicleClass(string) -> string
 
Returns the class of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
getWidth(self, typeID)
getWidth(string) -> double
 
Returns the width in m of this type.
If called in the context of a person or vehicle, it will return the value for their current type.
Use the respective object ID as typeID value in said context.
setAccel(self, typeID, accel)
setAccel(string, double) -> None
 
Sets the maximum acceleration in m/s^2 of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setActionStepLength(self, typeID, actionStepLength, resetActionOffset=True)
setActionStepLength(string, double, bool) -> None
 
Sets the action step length for this type. If resetActionOffset == True (default), the
next action point is scheduled immediately for all vehicles of the type.
If resetActionOffset == False, the interval between the last and the next action point is
updated to match the given value for all vehicles of the type, or if the latter is smaller
than the time since the last action point, the next action follows immediately.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setApparentDecel(self, typeID, decel)
setApparentDecel(string, double) -> None
 
Sets the apparent deceleration in m/s^2 of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setBoardingDuration(self, typeID, boardingDuration)
setBoardingDuration(string, double) -> None
 
Sets the boarding duration of the this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setColor(self, typeID, color)
setColor(string, (integer, integer, integer, integer)) -> None
 
Sets the color of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setDecel(self, typeID, decel)
setDecel(string, double) -> None
 
Sets the maximal comfortable deceleration in m/s^2 of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setEmergencyDecel(self, typeID, decel)
setEmergencyDecel(string, double) -> None
 
Sets the maximal physically possible deceleration in m/s^2 of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setEmissionClass(self, typeID, clazz)
setEmissionClass(string, string) -> None
 
Sets the emission class of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setHeight(self, typeID, height)
setHeight(string, double) -> None
 
Sets the height in m of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setImpatience(self, typeID, impatience)
setImpatience(string, double) -> None
 
Sets the impatience of the this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setImperfection(self, typeID, imperfection)
setImperfection(string, double) -> None
 
Sets the driver imperfection of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setLateralAlignment(self, typeID, latAlignment)
setLateralAlignment(string, string) -> None
 
Sets the preferred lateral alignment of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setLength(self, typeID, length)
setLength(string, double) -> None
 
Sets the length in m of the this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setMaxSpeed(self, typeID, speed)
setMaxSpeed(string, double) -> None
 
Sets the maximum speed in m/s of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setMaxSpeedLat(self, typeID, speed)
setMaxSpeedLat(string, double) -> None
 
Sets the maximum lateral speed of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setMinGap(self, typeID, minGap)
setMinGap(string, double) -> None
 
Sets the offset (gap to front vehicle if halting) of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setMinGapLat(self, typeID, minGapLat)
setMinGapLat(string, double) -> None
 
Sets the minimum lateral gap at 50km/h of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setShapeClass(self, typeID, shapeClass)
setShapeClass(string, string) -> None
 
Sets the shape class of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setSpeedFactor(self, typeID, factor)
setSpeedFactor(string, double) -> None
 
Sets the speed factor of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setTau(self, typeID, tau)
setTau(string, double) -> None
 
Sets the driver's tau-parameter (reaction time or anticipation time depending on the car-following model) in s
for this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setVehicleClass(self, typeID, clazz)
setVehicleClass(string, string) -> None
 
Sets the class of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.
setWidth(self, typeID, width)
setWidth(string, double) -> None
 
Sets the width in m of this type.
If called in the context of a person or vehicle, it will change the value just for the single instance.
Use the respective object ID as typeID value in said context.

Methods inherited from traci.domain.Domain:
getAllContextSubscriptionResults(self)
getAllSubscriptionResults(self)
getAllSubscriptionResults() -> dict(string: dict(integer: <value_type>))
 
Returns the subscription results for the last time step and all objects of the domain.
It is not possible to retrieve older subscription results than the ones
from the last time step.
getContextSubscriptionResults(self, objectID)
getIDCount(self)
getIDCount() -> integer
 
Returns the number of currently loaded objects.
getIDList(self)
getIDList() -> list(string)
 
Returns a list of all objects in the network.
getParameter(self, objectID, key)
getParameter(string, string) -> string
 
Returns the value of the given parameter for the given objectID
getParameterWithKey(self, objectID, key)
getParameterWithKey(string, string) -> (string, string)
 
Returns the (key, value) tuple of the given parameter for the given objectID
getSubscriptionResults(self, objectID)
getSubscriptionResults(string) -> dict(integer: <value_type>)
 
Returns the subscription results for the last time step and the given object.
If the object id is unknown or the subscription did for any reason return no data,
'None' is returned.
It is not possible to retrieve older subscription results than the ones
from the last time step.
setParameter(self, objectID, key, value)
setParameter(string, string, string) -> None
 
Sets the value of the given parameter to value for the given objectID
subscribe(self, objectID, varIDs=None, begin=-1073741824.0, end=-1073741824.0, parameters=None)
subscribe(string, list(integer), double, double, map(string->tuple)) -> None
 
Subscribe to one or more object values for the given interval.
subscribeContext(self, objectID, domain, dist, varIDs=None, begin=-1073741824.0, end=-1073741824.0, parameters=None)
subscribeContext(string, int, double, list(integer), double, double) -> None
 
Subscribe to objects of the given domain (specified as domain=traci.constants.CMD_GET_<DOMAIN>_VARIABLE),
which are closer than dist to the object specified by objectID.
subscribeParameterWithKey(self, objectID, key, begin=-1073741824.0, end=-1073741824.0)
subscribeParameterWithKey(string, string) -> None
 
Subscribe for a generic parameter with the given key.
unsubscribe(self, objectID)
unsubscribe(string) -> None
 
Unsubscribe from receiving object values.
unsubscribeContext(self, objectID, domain, dist)

Data descriptors inherited from traci.domain.Domain:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Reservation(builtins.object)
    Reservation(id, persons, group, fromEdge, toEdge, departPos, arrivalPos, depart, reservationTime, state)
 

 
  Methods defined here:
__attr_repr__(self, attrname, default='')
__init__(self, id, persons, group, fromEdge, toEdge, departPos, arrivalPos, depart, reservationTime, state)
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 262144)