SUMO
Simulation of Urban MObility

- Home
- Download
- Documentation
- Wiki
- Trac
- Blog
- Contact
- SF-Project

# TraCI/Change Vehicle State

# Command 0xc4: Change Vehicle State

ubyte | string | ubyte | <value_type>
Variable | Vehicle ID | Type of the value | New Value
--- | --- | --- | ---

Changes the state of a vehicle. Because it is possible to change different values of a vehicle, the number of parameter to supply and their types differ between commands. The following values can be changed, the parameter which must be given are also shown in the table. Furthermore it is possible to change all values mentioned in TraCI/Change_VehicleType_State. If you do so, the vehicle gets a new type (named "typeid@vehid") and won't be affected by further changes to the original type.

Overview Changeable Vehicle Variables
Variable | ValueType | Description
--- | --- | ---
stop (0x12) | compound (string, double, byte, double), see below | Lets the vehicle stop at the given edge, at the given position and lane. The vehicle will stop for the given duration. Re-issuing a stop command with the same lane and position allows changing the duration.
change lane (0x13) | compound (byte, double), see below | Forces a lane change to the lane with the given index; if successful, the lane will be chosen for the given amount of time.
slow down (0x14) | compound (double, double), see below | Reduces the speed to the given for the given amount of time.
change target (0x31) | string (destination edge id) | The vehicle's destination edge is set to the given. The route is rebuilt.
speed (0x40) | double (new speed) | Sets the vehicle speed to the given value. The speed will be followed until a new is given. If -1 is given, the vehicle follows the car-following rules again.
color (0x45) | ubyte,ubyte,ubyte,ubyte (RGBA) | Sets the vehicle's color.
change route by id (0x53) | string (route id) | Assigns the named route to the vehicle, assuming a) the named route exists, and b) it starts on the edge the vehicle is currently at(1)(2).
change route (0x57) | stringList (ids of edges to pass) | Assigns the list of edges as the vehicle's new route assuming the first edge given is the one the vehicle is curently at(1)(2).
change edge travel time information (0x58) | compound (begin time, end time, edgeID, value), see below | Inserts the information about the travel time of edge "edgeID" valid from begin time to end time into the vehicle's internal edge weights container.
change edge effort information (0x59) | compound (begin time, end time, edgeID, value), see below | Inserts the information about the effort of edge "edgeID" valid from begin time to end time into the vehicle's internal edge weights container.
signal states (0x5b) | int | Sets a new state of signals, please see the comments on TraCI/Vehicle Signalling for more information.
move to (0x5c) | compound (lane ID, position along lane) | Moves the vehicle to a new position, see comments below.
reroute (compute new route) by travel time (0x90) | compound (<empty>), see below | Computes a new route using the vehicle's internal and the global edge travel time information. Replaces the current route by the found(2).
reroute (compute new route) by effort (0x91) | compound (<empty>), see below | Computes a new route using the vehicle's internal and the global edge effort information. Replaces the current route by the found(2).
speed mode (0xb3) | int bitset (see below) | Sets how the values set by speed (0x40) and slowdown (0x14) shall be treated. See below.
add (0x80) | complex (see below) | Adds the defined vehicle. See below.
remove (0x81) | complex (see below) | Removes the defined vehicle. See below.

Please note:

(1): The first occurrence of the edge is currently at is searched within the new route; the vehicle continues the route from this point in the route from. If the edge the vehicle is currently does not exist within the new route, an error is generated. (2): changing the route works only if the vehicle is not within an intersection.

The message contents are as following:

stop (0x12)

byte | integer | byte | string | byte | double | byte | byte | byte | int
value type compound | item number (always 4) | value type string | Edge ID | value type double | Position | value type byte | Lane Index | value type int | Duration [ms]
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---

change lane (0x13)

byte | integer | byte | byte | byte | int
value type compound | item number (always 2) | value type byte | Lane Index | value type int | Duration [ms]
--- | --- | --- | --- | --- | ---

slow down (0x14)

byte | integer | byte | double | byte | int
value type compound | item number (always 2) | value type double | Speed | value type int | Duration [ms]
--- | --- | --- | --- | --- | ---

change target (0x31)

byte | string
value type string | Edge ID
--- | ---

change route by id (0x54)

byte | string
value type string | Route ID
--- | ---

change route (0x57)

byte | int | string
value type string list | number of elements | Edge ID
--- | --- | ---

change edge travel time information (0x58)

This command can be sent using 4, 2, or 1 parameters. In the first form, it adds a new override of edge information to the list of existing overrides for the given vehicle, valid from begin time to end time. In the second form, it adds a new override that is valid throughout the simulation, replacing an earlier one for the same edge. In the third form, it removes as earlier override for the given edge, valid throughout the simulation.

byte | int | byte | int | byte | int | byte | string | byte | double
value type compound | number of elements (always=4) | value type integer | begin time (in s) | value type integer | end time (in s) | value type string | edge id | value type double | travel time value (in s)
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---

byte | int | byte | string | byte | double
value type compound | number of elements (always=2) | value type string | edge id | value type double | travel time value (in s)
--- | --- | --- | --- | --- | ---

byte | int | byte | string
value type compound | number of elements (always=1) | value type string | edge id
--- | --- | --- | ---

change edge effort information (0x59)

This command can be sent using 4, 2, or 1 parameters. In the first form, it adds a new override of edge information to the list of existing overrides for the given vehicle, valid from begin time to end time. In the second form, it adds a new override that is valid throughout the simulation, replacing an earlier one for the same edge. In the third form, it removes as earlier override for the given edge, valid throughout the simulation.

byte | int | byte | int | byte | int | byte | string | byte | double
value type compound | number of elements (always=4) | value type integer | begin time (in s) | value type integer | end time (in s) | value type string | edge id | value type double | effort value (abstract)
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---

byte | int | byte | string | byte | double
value type compound | number of elements (always=2) | value type string | edge id | value type double | effort value (abstract)
--- | --- | --- | --- | --- | ---

byte | int | byte | string
value type compound | number of elements (always=1) | value type string | edge id
--- | --- | --- | ---

reroute (compute new route) by travel time (0x90)

byte | int
value type compound | number of elements (always=0)
--- | ---

reroute (compute new route) by effort (0x91)

byte | int
value type compound | number of elements (always=0)
--- | ---

reroute (compute new route) by effort (0x91)

byte | int | byte | string | byte | double
value type compound | number of elements (always=2) | value type string | lane ID | value type double | Position along the lane.
--- | --- | --- | --- | --- | ---

The vehicle will be renamed from its lane and moved to the given position on the given lane. No collision checks are done, this means that moving the vehicle may cause in collisions or in situations yielding in such. The vehicle keeps its speed - in the next time step it is at given position + speed. Note that the lane must be a part of the following route, this means it must be either a part of the edge the vehicle is currently on or a part of an edge the vehicle will pass in future; setting a new route before moving the vehicle if needed should work.

speed mode (0xb3)

Per default, the vehicle is using the given speed regarding the safe gap, the maximum acceleration, and the maximum deceleration. One can control this behavior using the speed mode (0xb3) command, the given integer is a bitset with the following fields:

- bit0: Regard safe speed
- bit1: Regard maximum acceleration
- bit2: Regard maximum deceleration

Setting the bit enables the check (the according value is regarded), keeping the bit==zero disables the check.

add (0x80)

byte | int | byte | string | byte | string | byte | int | byte | double | byte | double | byte | byte
value type compound | number of elements (always=6) | value type string | vehicle type ID (must exist) | value type string | route ID (must exist) | value type integer | depart time | value type double | depart position | value type double | depart speed | value type byte | depart lane
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---

Note:
Please note that the values are not checked in a very elaborated way. Make sure they are correct before sending.

If zero or a negative departure speed is set, one of the following fixed speed settings will be used:

    *  0: DEPART_SPEED_DEFAULT
    * -2: DEPART_SPEED_RANDOM
    * -3: DEPART_SPEED_MAX

remove (0x81)

byte | byte
value type byte | reason
--- | ---

The following reasons may be given:

- 0: NOTIFICATION_TELEPORT
- 1: NOTIFICATION_PARKING
- 2: NOTIFICATION_ARRIVED
- 3: NOTIFICATION_VAPORIZED
- 4: NOTIFICATION_TELEPORT_ARRIVED

This page was last modified on 2 May 2013, at 13:24.