05 Oct 2018

TraCI SpeedMode

The main reason for getting to know how to use TraCI was this line in the SUMO docs:

To force collisions at a set time, TraCI must be used. Besides setting the speed, it is also necessary to disable safety checks using the commands speedMode and laneChangeMode.

The TraCI documentation for the speedMode command is as follows:

This command controls how speeds set with the command setSpeed (0x40) and slowDown (0x14) are used. Per default, the vehicle may only drive slower than the speed that is deemed safe by the car following model and it may not exceed the bounds on acceleration and deceleration. Furthermore, vehicles follow the right-of-way rules when approaching an intersection and if necessary they brake hard to avoid driving across a red light. One can control this behavior using the speed mode (0xb3) command. The given integer is a bitset (bit0 is the least significant bit) with the following fields:

bit0: Regard safe speed
bit1: Regard maximum acceleration
bit2: Regard maximum deceleration
bit3: Regard right of way at intersections
bit4: Brake hard to avoid passing a red light

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

Examples:

all checks off -> [0 0 0 0 0] -> Speed Mode = 0
disable right of way check -> [1 0 1 1 1] -> Speed Mode = 23
all checks on -> [1 1 1 1 1] -> Speed Mode = 31
run a red light [0 0 1 1 1] = 7 (also requires setSpeed or slowDown) 

This seems promising.

Thank You For Reading
Andrew Vaillancourt

Undergraduate Computer Science student at The University of Manitoba