TraCI/Person Value Retrieval

From Sumo
Jump to: navigation, search

Command 0xae: Get Person Variable

ubyte string
Variable Person ID

Asks for the value of a certain variable of the named person. The value returned is the state of the asked variable/value within the last simulation step. In the case the person is loaded, but outside the network - due not being yet inserted into the network or being teleported within the current time step - a default "error" value is returned.

The following variable values can be retrieved, the type of the return value is also shown in the table.

Overview Retrievable Person Variables
Variable ValueType Description Python Method
id list (0x00) stringList Returns a list of ids of all persons currently running within the scenario (the given person ID is ignored) getIDList
count (0x01) int Returns the number of persons currently running within the scenario (the given person ID is ignored) getIDCount
speed (0x40) double Returns the speed of the named person within the last step [m/s]; error value: -1001 getSpeed
position (0x42) position Returns the position(two doubles) of the named person within the last step [m,m]; error value: [-2^30, -2^30]. getPosition
position 3D (0x39) position Returns the 3D-position(three doubles) of the named vehicle (center of the front bumper) within the last step [m,m,m]; error value: [-2^30, -2^30, -2^30]. getPosition3D
angle (0x43) double Returns the angle of the named person within the last step [°]; error value: -1001 getAngle
road id (0x50) string Returns the id of the edge the named person was at within the last step; error value: "" getRoadID
type id (0x4f) string Returns the id of the type of the named person getTypeID
color (0x45) ubyte,ubyte,ubyte,ubyte Returns the person's color (RGBA). getColor
edge position (0x56) double The position of the person along the edge (in [m]); error value: -1001 getLanePosition
length (0x44) double Returns the length of the persons [m] getLength
minGap (0x4c) double Returns the offset (gap to front person if halting) of this person [m] getMinGap
width (0x4d) double Returns the width of this person [m] getWidth
waiting time (0x7a) double Returns the waiting time [s] getWaitingTime
next edge (0xc1) string Returns the next edge on the persons route while it is walking. If there is no further edge or the person is in another stage, returns the empty string. getNextEdge
remaining stages (0xc2) int Returns the number of remaining stages for the given person including the current stage. getRemainingStages
vehicle (0xc3) string Returns the id of the vehicle if the person is in stage driving and has entered a vehicle. getVehicle

Response 0xb4: Person Variable

ubyte string ubyte <return_type>
Variable Person ID Return type of the variable <VARIABLE_VALUE>

The respond to a "Command Get Person Variable".

Extended retrieval messages

Some further messages require additional parameters.

Overview Extended Variables Retrieval
Variable Request ValueType Response ValueType Description Python Method
stage (0xc0) next stage index (int) int Returns the stage type of nth next stage. Index 0 retrieves the value for the current stage. The given index must be lower than the value of 'remaining stages'. The return values have the following meaning: 0:driving, 1:waiting, 2:walking, 3:not departed getStage
edges (0x54) next stage index (int) stringList Returns the edges of the nth next stage. Index 0 retrieves the value for the current stage. The given index must be lower than the value of 'remaining stages'. For driving stages only origin and destination edge are returned. getEdges