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.
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: -2^30 |
|
lateral speed (0x32) |
double |
Returns the lateral speed of the named vehicle within the last step [m/s]; error value: -2^30 |
|
acceleration (0x72) |
double |
Returns the acceleration in the previous time step [m/s^2] |
|
position (0x42) |
position |
Returns the position(two doubles) of the named vehicle (center of the front bumper) within the last step [m,m]; error value: [-2^30, -2^30]. |
|
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]. |
|
angle (0x43) |
double |
Returns the angle of the named vehicle within the last step [°]; error value: -2^30 |
|
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: -2^30 |
|
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). This does not return the currently visible color in the GUI but the color value set in the XML file or via TraCI. |
|
lane position (0x56) |
double |
The position of the vehicle along the lane (the distance from the front bumper to the start of the lane in [m]); error value: -2^30 |
|
distance (0x84) |
double |
The distance, the vehicle has already driven [m]); error value: -2^30 |
|
signal states (0x5b) |
int |
An integer encoding the state of a vehicle's signals, see TraCI/Vehicle Signalling for more information. |
|
routing mode (0x89) |
int |
An integer encoding the current routing mode (0: default, 1: aggregated) |
|
TaxiFleet (0x20) |
stringList |
Return the list of all taxis with the given mode:(-1: all, 0 : empty, 1 : pickup,2 : occupied, 3: pickup+occupied). Note: vehicles that are in state pickup+occupied (due to ride sharing) will also be returned when requesting mode 1 or 2 |
|
CO2 emissions |
double |
Vehicle's CO2 emissions in mg/s during this time step, to get the value for one step multiply with the step length; error value: -2^30 |
|
CO emissions |
double |
Vehicle's CO emissions in mg/s during this time step, to get the value for one step multiply with the step length; error value: -2^30 |
|
HC emissions |
double |
Vehicle's HC emissions in mg/s during this time step, to get the value for one step multiply with the step length; error value: -2^30 |
|
PMx emissions |
double |
Vehicle's PMx emissions in mg/s during this time step, to get the value for one step multiply with the step length; error value: -2^30 |
|
NOx emissions |
double |
Vehicle's NOx emissions in mg/s during this time step, to get the value for one step multiply with the step length; error value: -2^30 |
|
fuel consumption |
double |
Vehicle's fuel consumption in ml/s during this time step, to get the value for one step multiply with the step length; error value: -2^30 |
|
noise emission |
double |
Noise generated by the vehicle in dBA; error value: -2^30 |
|
electricity consumption (id 0x71) |
double |
Vehicle's electricity consumption in Wh/s during this time step, to get the value for one step multiply with the step length; error value: -2^30 |
|
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 + 8 * containerTriggered + 16 * atBusStop + 32 * atContainerStop + 64 * atChargingStation + 128 * atParkingArea |
getStopState |
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 desired time headway 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] |
|
width (0x4d) |
double |
Returns the width of this vehicle [m] |
|
height (0xbc) |
double |
Returns the height of this vehicle [m] |
|
person capacity (0x38) |
int |
Returns the total number of persons that can ride in this vehicle |
|
waiting time (0x7a) |
double |
Returns the consecutive time in where this vehicle was standing [s] (voluntary stopping is excluded) |
|
accumulated waiting time (0x87) |
double |
Returns the accumulated waiting time [s] within the previous time interval of default length 100 s. (length is configurable per option --waiting-time-memory given to the main application) |
|
next TLS (0x70) |
complex |
Returns upcoming traffic lights, along with distance and state |
|
next stops (0x73) |
complex |
Returns the list of upcoming stops, each as compound (laneID, endPos, ID, flags, duration, until). If flag 1 is set (stop reached), duration encodes the remaining duration. Negative values indicate being blocked from re-entering traffic after a parking stop. |
|
person id list (0x1a) |
stringList |
Returns the list of persons which includes those defined using attribute 'personNumber' as well as |
|
speed mode (0xb3) |
int bitset (see below) |
Retrieves how the values set by speed (0x40) and slowdown (0x14) shall be treated. See the set speedmode command for details. |
|
lane change mode (0xb6) |
int bitset (see below) |
Get information on how lane changing in general and lane changing requests by TraCI are performed. |
|
slope (0x36) |
double |
Retrieves the slope at the current vehicle position in degrees |
|
allowed speed (0xb7) |
double |
Returns the maximum allowed speed on the current lane regarding speed factor in m/s for this vehicle. |
|
line (0xbd) |
string |
Returns the line information of this vehicle. |
|
Person Number(0x67) |
int |
Returns the total number of persons which includes those defined using attribute 'personNumber' as well as <person>-objects which are riding in this vehicle. |
|
via edges(0xbe) |
stringList |
Returns the ids of via edges for this vehicle. |
|
speed without TraCI (0xb1) |
double |
Returns the speed that the vehicle would drive if not speed-influencing command such as setSpeed or slowDown was given. |
|
valid route (0x92) |
bool |
Returns whether the current vehicle route is connected for the vehicle class of the given vehicle. |
|
lateral lane position (0xb8) |
double |
Returns the lateral position of the vehicle on its current lane measured in m. |
|
max lateral speed (0xba) |
double |
Returns the maximum lateral speed in m/s of this vehicle. |
|
lateral gap (0xbb) |
double |
Returns the desired lateral gap of this vehicle at 50km/h in m. |
|
lateral alignment (0xb9) |
string |
Returns the preferred lateral alignment of the vehicle. |
|
parameter (0x7e) |
string |
||
action step length (0x7d) |
double |
Returns the current action step length for the vehicle in s. |
|
last action time (0x7f) |
double |
Returns the time of the last action step in s. |
|
stops (0x74) |
complex |
Returns the list of the next or last n stops as StopData objects. |
|
timeLoss (0x8c) |
double |
Returns the accumulated timeLoss of the vehicle in 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".
next stops (0x73)
byte | int | ... |
---|---|---|
value type compound | number of following stop information | stop information |
Each stop information is:
byte | string | byte | double | byte | string | byte | integer | byte | double | byte | double |
---|---|---|---|---|---|---|---|---|---|---|---|
value type string | lane-id | value type double | endPos | value type string | stoppingPlaceID | value type integer | stopFlags (bit set, see setStop()) | value type double | duration in seconds | value type double | until in seconds |
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.
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 within the given range. 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 returned distance is measured from the ego vehicle front bumper + minGap to the back bumper of the leader vehicle. |
|
distance request (0x83) |
compound (see Command 0x83: Distance Request) |
double, see below |
Returns the distance between the current vehicle position and the specified position (for the given distance type) |
|
change lane information (0x13) |
compound , see below |
int, int see below |
Return whether the vehicle could change lanes in the specified direction (right: -1, left: 1. sublane-change within current lane: 0). |
|
neighboring vehicles (0xbf) |
byte , see below |
stringList see below |
Returns a list of IDs for neighboring vehicle relevant to lane changing (>1 elements only possible for sublane model) |
getNeighbors, getLeftFollowers, getLeftLeaders, getRightFollowers, getRightLeaders |
followSpeed (0x1c) |
compound, see below |
double |
Return the follow speed computed by the carFollowModel of vehicle |
|
secureGap (0x1e) |
compound, see below |
double |
Return the secure gap computed by the carFollowModel of vehicle |
|
stopSpeed (0x1e) |
compound, see below |
double |
Return the safe speed for stopping at gap computed by the carFollowModel of vehicle |
The request message contents are as following:
edge travel time information (0x58)#
byte | int | byte | double | byte | string |
---|---|---|---|---|---|
value type compound | number of elements (always=2) | value type double | requested time (in s) | value type string | edge id |
edge effort information (0x59)#
byte | int | byte | double | byte | string |
---|---|---|---|---|---|
value type compound | number of elements (always=2) | value type double | requested time (in s) | value type string | edge id |
leader (0x68)#
byte | double |
---|---|
value type double | minimum look ahead distance (in m) |
next TLS (0x70)#
byte | int | byte | int | byte | string | byte | int | byte | double | byte | byte |
---|---|---|---|---|---|---|---|---|---|---|---|
value type compound | number of elements | value type integer | number of traffic light links ahead | value type string | TLS id | value type int | TLS link index | value type double | distance to TLS | value type byte | link state |
The last 4 items occur multiple times according to the number of traffic lights ahead (2nd return value)
change lane information (0x13)#
byte | int |
---|---|
value type compound | change direction (-1:right, 0:sublane-change within current lane or 1:left) |
The result consists of two integer values. The first value returns the state as computed by the lane change model and the second value returns the state after requests where incorporated (see changeLane, setLaneChangeMode). Each value is a bitset with the following meaning:
- 2^0: stay
- 2^1: left
- 2^2: right
- 2^3: strategic
- 2^4: cooperative
- 2^5: speedGain
- 2^6: keepRight
- 2^7: TraCI
- 2^8: urgent
- 2^9: blocked by left leader
- 2^10: blocked by left follower
- 2^11: blocked by right leader
- 2^12: blocked by right follower
- 2^13: overlapping
- 2^14: insufficient space
- 2^15: sublane
neighboring vehicles (0xbf)#
byte | ubyte |
---|---|
value type ubyte | mode (bitset) |
The mode's bits specify which neighboring vehicles should be returned:
- 2^0: right neighbors (else: left)
- 2^1: neighbors ahead (else: behind)
- 2^2: only neighbors blocking a potential lane change (else: all)
The returned string list contains the IDs of all corresponding neighboring vehicles.
followSpeed (0x1c)#
byte | int | double | double | double | double | string |
---|---|---|---|---|---|---|
value type compound | 5 | speed | gap | leaderSpeed | leaderMaxDecel | leaderID |
The leaderID is optional. Only a few car follow models such as CACC may require the identity of the leader to return the correct value The returned value is the safe follow speed in m/s
secureGap (0x1e)#
byte | int | double | double | double | string |
---|---|---|---|---|---|
value type compound | 4 | speed | leaderSpeed | leaderMaxDecel | leaderID |
The leaderID is optional. Only a few car follow models such as CACC may require the identity of the leader to return the correct value The returned value is the safe gap for following the given leader in m.
stopSpeed (0x1d)#
byte | int | double | double |
---|---|---|---|
value type compound | 2 | speed | gap |
The returned value is the safe speed in m/s for stopping after gap when braking from the given speed.
Device and LaneChangeModel Parameter Retrieval 0x7e#
Vehicles supports retrieval of device parameters using the generic parameter retrieval call.
Supported Device Parameters#
- device.battery.energyConsumed
- device.battery.energyCharged
- device.battery.actualBatteryCapacity
- device.battery.maximumBatteryCapacity
- device.battery.chargingStationId
- device.battery.vehicleMass
- device.battery.totalEnergyConsumed
- device.battery.totalEnergyRegenerated
- device.person.IDList
- device.container.IDList
- device.rerouting.period (returns individual rerouting period in seconds)
- device.rerouting.edge:EDGE_ID (returns assumed travel time for rerouting where EDGE_ID is the id of a network edge)
- device.driverstate.awareness
- device.driverstate.errorState
- device.driverstate.errorTimeScale
- device.driverstate.errorNoiseIntensity
- device.driverstate.minAwareness
- device.driverstate.initialAwareness
- device.driverstate.errorTimeScaleCoefficient
- device.driverstate.errorNoiseIntensityCoefficient
- device.driverstate.speedDifferenceErrorCoefficient
- device.driverstate.headwayErrorCoefficient
- device.driverstate.speedDifferenceChangePerceptionThreshold
- device.driverstate.headwayChangePerceptionThreshold
- device.driverstate.maximalReactionTime
- device.driverstate.originalReactionTime
- device.driverstate.actionStepLength
- device.taxi.state
- device.taxi.customers
- device.taxi.occupiedTime
- device.taxi.occupiedDistance
- device.taxi.currentCustomers
- device.example.customValue1 (return the value of option --device.example.parameter)
- device.example.customValue2 (return the value of vehicle parameter example)
- device.example.meaningOfLife (return 42)
- has.DEVICENAME.device (returns "true" or "false" depending on whether a device with DEVICENAME is equipped)
Caution
If the vehicles does not carry the respective device an error is returned when retrieving parameters with the device. prefix. This happens when requesting device.person.IDList for a vehicle that has not carried any persons up to that point. Either check for existence or handle the error (i.e. by catching TraCIException in the python client).
Supported LaneChangeModel Parameters#
- laneChangeModel.<ATTRNAME> (where <ATTRNAME> is one of the parameters supported by the laneChangeModel of the vehicle. i.e. lcStrategic)
Supported carFollowModel Parameters#
Some carFollowModels permit access to further vehicle-specific parameters.
- carFollowModel.caccCommunicationsOverride (only CACC)
Supported further Parameters#
- parking.rerouteCount: number of times vehicle rerouted to another parkingArea during the current search
- parking.memory.IDList: all parkingAreas considered so far
- parking.memory.score: latest scores for the list of considered parkingAreas (smaller is better)
- parking.memory.blockedAtTime: times for the list of considered parkingAreas indicating the last time the area was found to be blocked (possibly via remote information)
- parking.memory.blockedAtTimeLocal: times for the list of considered parkingAreas indicating the last time the area was found to be blocked (upon physically visiting that area)