Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-dev] Fwd: Vehicle stuck in roundabout


I am trying to do a traffic light simulation for a roundabout. The model is such that vehicles that want to turn right are on right lane, vehicles those want to go straight are on middle lane and those who want to turn left are on left lane. All the vehicles who want to turn right are working properly. But vehicles which want to go straight or turn left are stuck in the roundabout even when the traffic light is green. I am using plexe.setFixedLane to keep vehicles in a fixed lane.

Here is the simulation screenshot.
Screenshot (4).png

I have also attached the python script that I am using.

Thank You

Ankit Jatiya
#!/usr/bin/env python

import os
import sys
from math import sqrt

import random

import traci

from plexe import Plexe, ACC, CACC

if 'SUMO_HOME' in os.environ:
    tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
    sys.exit("Environment variable 'SUMO_HOME' not declared.")

SPEED = 16.6 
DISTANCE = 6  # inter-vehicle distance

def main():
    sumo_cmd = ['sumo-gui', '--duration-log.statistics','--log', 'logfile.txt', '--tripinfo-output', 'output_file.xml', '-c', 'traditional_traffic.sumo.cfg']
    plexe = Plexe()

    step = 0

    while step < 30000: #360000:  # 1 hour       

        if step % ADD_VEHICLE_STEP == 0:  # add new platoon every 500 steps
            for lane in range(LANE_NUM):
                if random.random() < 0.3:
                    vid = "v.%d.%d" %(step/ADD_VEHICLE_STEP, lane)
                    routeID = "route_%d" %lane   # route 0~11, one-to-one map with lane
                    traci.vehicle.add(vid, routeID, departPos=str(0), departSpeed=str(5), departLane=str(lane%3), typeID="vtypeauto")        
                    plexe.set_path_cacc_parameters(vid, DISTANCE, 2, 1, 0.5) #cacc: cooperative adaptive cruise control
                    plexe.set_cc_desired_speed(vid, SPEED) #cc: cruise control
                    plexe.set_acc_headway_time(vid, 1.5) #adaptive cruise control
                    plexe.use_controller_acceleration(vid, False)
                    traci.vehicle.setSpeedMode(vid, 31)      #Sets how the values set by speed and slowdown shall be treated.
                    plexe.set_active_controller(vid, ACC)
                    plexe.set_fixed_lane(vid,lane%3, False)
                    traci.vehicle.setColor(vid, (255,255,255, 255))

        step += 1


if __name__ == "__main__":

Back to the top