TraCI/Vehicle Value Retrieval

generated on 2015-09-02 00:02:08.043860 from the wiki page for TraCI/Vehicle_Value_Retrieval for SUMO 0.24.0

Command 0xa4: Get Vehicle Variable

ubyte string
Variable Vehicle ID

Asks for the value of a certain variable of the named vehicle. The value returned is the state of the asked variable/value within the last simulation step. In the case the vehicle 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 Vehicle Variables
Variable ValueType Description
id list (0x00) stringList Returns a list of ids of all vehicles currently running within the scenario (the given vehicle ID is ignored)
count (0x01) int Returns the number of vehicles currently running within the scenario (the given vehicle ID is ignored)
speed (0x40) double Returns the speed of the named vehicle within the last step [m/s]; error value: -1001
position (0x42) position Returns the position(two doubles) of the named vehicle within the last step [m,m]; error value: [-1001,-1001]
angle (0x43) double Returns the angle of the named vehicle within the last step [°]; error value: -1001
road id (0x50) string Returns the id of the edge the named vehicle was at within the last step; error value: ""
lane id (0x51) string Returns the id of the lane the named vehicle was at within the last step; error value: ""
lane index (0x52) int Returns the index of the lane the named vehicle was at within the last step; error value: -1001
type id (0x4f) string Returns the id of the type of the named vehicle
route id (0x53) string Returns the id of the route of the named vehicle
route index (0x69) int Returns the index of the current edge within the vehicles route or -1 if the vehicle has not yet departed
edges (0x54) stringList Returns the ids of the edges the vehicle's route is made of
color (0x45) ubyte,ubyte,ubyte,ubyte Returns the vehicle's color (RGBA).
lane position (0x56) double The position of the vehicle along the lane (in [m]); error value: -1001
signal states (0x5b) int An integer encoding the state of a vehicle's signals, see TraCI/Vehicle Signalling for more information.
CO2 emissions (id 0x60) double Vehicle's CO2 emissions in mg during this time step; error value: -1001
CO emissions (id 0x61) double Vehicle's CO emissions in mg during this time step; error value: -1001
HC emissions (id 0x62) double Vehicle's HC emissions in mg during this time step; error value: -1001
PMx emissions (id 0x63) double Vehicle's PMx emissions in mg during this time step; error value: -1001
NOx emissions (id 0x64) double Vehicle's NOx emissions in mg during this time step; error value: -1001
fuel consumption (id 0x65) double Vehicle's fuel consumption in ml during this time step; error value: -1001
noise emission (id 0x66) double Noise generated by the vehicle in dBA; error value: -1001
best lanes (id 0xb2) complex For each lane on the current edge, the sequences of lanes that would be followed from that lane without lane-change as well as information regarding lane-change desirability are returned (see below).
stop state (id 0xb5) ubyte value = 1 * stopped + 2 * parking + 4 * triggered
length (0x44) double Returns the length of the vehicles [m]
vmax (0x41) double Returns the maximum speed of the vehicle [m/s]
accel (0x46) double Returns the maximum acceleration possibility of this vehicle [m/s^2]
decel (0x47) double Returns the maximum deceleration possibility of this vehicle [m/s^2]
tau (0x48) double Returns the driver's reaction time for this vehicle [s]
sigma(0x5d) double Returns the driver's imperfection (dawdling) [0,1]
speedFactor(0x5e) double Returns the road speed multiplier for this vehicle [double]
speedDev(0x5f) double Returns the deviation of speedFactor for this vehicle [double]
vClass (0x49) string Returns the permission class of this vehicle
emission_class (0x4a) string Returns the emission class of this vehicle
shape (0x4b) string Returns the shape class of this vehicle
minGap (0x4c) double Returns the offset (gap to front vehicle if halting) of this vehicle [m]
gui width (0x4d) double Returns the width of this vehicle [m]
waiting time (0x7a) double Returns the waiting time [s]

Response 0xb4: Vehicle Variable

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

The respond to a "Command Get Vehicle Variable".

best lanes (0xb2)

byte int ...
value type compound number of following edge information edge information

Each edge information is:

byte string byte double byte double byte byte (signed) byte byte (unsigned) byte stringList
value type string lane-id value type double length value type double occupation value type byte offset to best lane value type ubyte 0: lane may not be used for continuing drive, 1: it may be used value type stringlist list of best subsequent lanes


Extended retrieval messages

Some further messages require additional parameters.

Overview Extended Variables Retrieval
Variable Request ValueType Response ValueType Description
edge travel time information (0x58) compound (time, edgeID), see below double Returns the edge travel time for the given time as stored in the vehicle's internal container. If such a value does not exist, -1 is returned.
edge effort information (0x59) compound (time, edgeID), see below double Returns the edge effort for the given time as stored in the vehicle's internal container. If such a value does not exist, -1 is returned.
leader (0x68) double, see below compound (string, double) Returns the id of the leading vehicle and its distance, if the string is empty, no leader was found. Only vehicles ahead on the currently list of best lanes are considered (see above). This means, the leader is only valid until the next lane-change maneuver.


The request message contents are as following:

edge travel time information (0x58)

byte int byte int byte string
value type compound number of elements (always=2) value type integer requested time (in s) value type string edge id


edge effort information (0x59)

byte int byte int byte string
value type compound number of elements (always=2) value type integer requested time (in s) value type string edge id

leader (0x68)

byte double
value type double maximum look ahead distance (in m)

This page was last modified on 18 June 2015, at 00:05.