Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Works with only using traci


In my scenario, I want to operate the vehicle`s movement(lane changing, speed) only as a function value calculated directly.

A total of 6 vehicles are going straight at a constant speed of 30m/s, and using only the calculated function velue, the traci command is used to change lanes and speed.


def run():

    """execute the TraCI control loop"""

    step = 0

    traci.vehicle.setLaneChangeMode("vehicle_0", 0b001000000000)

    traci.vehicle.setSpeedMode("vehicle_0", 0)

    traci.vehicle.setSpeed("vehicle_0", 108/ 3.6)

    traci.vehicle.setLaneChangeMode("vehicle_1", 0b001000000000)

    traci.vehicle.setSpeedMode("vehicle_1", 0)

    traci.vehicle.setSpeed("vehicle_1", 108/ 3.6)

    traci.vehicle.setLaneChangeMode("vehicle_2", 0b001000000000)

    traci.vehicle.setSpeedMode("vehicle_2", 0)

    traci.vehicle.setSpeed("vehicle_2", 108/ 3.6)

    traci.vehicle.setLaneChangeMode("vehicle_3", 0b001000000000)

    traci.vehicle.setSpeedMode("vehicle_3", 0)

    traci.vehicle.setSpeed("vehicle_3", 108/ 3.6)

    traci.vehicle.setLaneChangeMode("vehicle_4", 0b001000000000)

    traci.vehicle.setSpeedMode("vehicle_4", 0)

    traci.vehicle.setSpeed("vehicle_4", 108/ 3.6)

    traci.vehicle.setLaneChangeMode("vehicle_5", 0b001000000000)

    traci.vehicle.setSpeedMode("vehicle_5", 0)

    traci.vehicle.setSpeed("vehicle_5", 108/ 3.6)

    while traci.simulation.getMinExpectedNumber() > 0:




Calculate function values

Controlling the vehicle using the traci command



        step += 1




The above code was used to limit vehicle speed and lane change. I am going to use traci by using the above function( run() ) in the main function.

if the vehicle is operated using the traci command(to be coded) inside the solid line, can the vehicle data be received without being affected by sumo functions(car-following model, lane changing model, etc..)?


I really want the vehicle to act only as i commanded it. Maybe I need to add more or is there any other way?


Thank you.

Back to the top