Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Unexplainable behaviour for lane change mode

I am attaching the other relevant files associated with the above Python code!

Thank you.

Sincerely,
Hriday


On Mon, 21 Feb 2022 at 12:26, Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
Looks buggy. Please provide all relevant files for reproducing your scenario.

Am Fr., 18. Feb. 2022 um 14:31 Uhr schrieb Hriday Sanghvi via sumo-user <sumo-user@xxxxxxxxxxx>:
Hello,

As per my understanding, the "duration" argument in the change lane command would keep attempting to change lane to the target lane until the end of that duration or if another TraCI change lane command overrides it. If I set my Lane change mode to 0 (all safety checks and any control by SUMO is gone), then I would expect the below code to get all the vehicles to the end (with collisions).

I have attached a short video to show the behaviour that is observed. Not sure why the vehicles closest to the blockage do not turn to the free lane? (even though their indicator is yellow and shows that they want to change lane?)

My TraCI code:

step = 0
GHOST_POS = 750.0
END = 86400.0
BLOCK_LENGTH = 300

traci.vehicle.add(vehID='ghost', routeID='r0', typeID='veh', depart=0, departLane=0, departPos=GHOST_POS, departSpeed='random', arrivalLane='current', arrivalPos=GHOST_POS)
traci.vehicle.setColor(vehID='ghost',color=(255,0,0))
traci.vehicle.setLength(vehID='ghost',length=BLOCK_LENGTH)

traci.vehicle.setStop(vehID='ghost', edgeID='1f2', pos=GHOST_POS, duration=10, until=END)# flags=0, startPos=0, until=120)

# duration - min duration for stopping
# until - timestep at which the route continues

lane_ids = list(traci.lane.getIDList())

BLOCKED_LANE = 0
FREE_LANE = 1
LC_MODE = 0 # 512 # 1621 # 0 # 512 # 256 # 1109 #
S_MODE = 0
NUMBER_OF_VEH = 100
LC_MAX_DURATION = END

def take_step(step=1):

    lane_info = dict()
    for li in lane_ids:

        lane_info[li] = {
            'mean_speed' : traci.lane.getLastStepMeanSpeed(laneID=li),
            'vehicle_ids' : traci.lane.getLastStepVehicleIDs(laneID=li),
        }

    for vh in lane_info['1f2_1']['vehicle_ids']: # free lane
        if vh == 'ghost':
            continue
        traci.vehicle.setLaneChangeMode(vehID=vh, lcm=LC_MODE)

        traci.vehicle.changeLane(vehID=vh, laneIndex=BLOCKED_LANE, duration=LC_MAX_DURATION)
        print('Vehicle {} will try to move to BLOCKED lane'.format(vh))
 

    for vh in lane_info['1f2_0']['vehicle_ids']: # blocked lane
        if vh == 'ghost':
            continue
       
        traci.vehicle.setLaneChangeMode(vehID=vh, lcm=LC_MODE)
        traci.vehicle.changeLane(vehID=vh, laneIndex=FREE_LANE, duration=LC_MAX_DURATION)
        print('Vehicle {} will try to move to FREE lane'.format(vh))
 

arrived = 0
while arrived < NUMBER_OF_VEH:

    print('################ SIM TIME: {} ##################'.format(traci.simulation.getTime()))
    print('################ SIM STEP COUNT: {} ################'.format(step))
    step+=1
    print('\n')

    take_step(step)
   
    print('Arrived: {}'.format(arrived))
    traci.simulationStep()
 
traci.close()

Thank you.

Sincerely,
Hriday
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
        <additional>
            <laneData id="lanedata" file="../data/lanemeandata-output.xml" />
        </additional>
<routes>
    <!-- <vType id="veh" length="5" maxSpeed="30" lcStrategic="1" lcCooperative="1" lcSpeedGain="1" lcKeepRight="1" lcOvertakeRight="0" lcOpposite="1" lcSpeedGainLookahead="0" lcCooperativeRoundabout="1" lcSublane="1" lcPushy="0" /> -->
    <!-- <vType id="idmAlternative" length="5" minGap="2" carFollowModel="IDM" tau="1.0" .../> -->

    <vType id="veh" length="5" />
    <!-- accel="4.0" decel="4.0" -->
    <route id="r0" color="1,1,0" edges="1f2" />

    <flow id="f" color="0,1,0"  begin="0" number="100" vehsPerHour="10000" type="veh" route="r0" departLane="random" departSpeed="random" arrivalLane="random" />

</routes>
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2022-01-18 12:42:40 by Eclipse SUMO netconvert Version 1.9.2
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/netconvertConfiguration.xsd";>

    <input>
        <node-files value="nodes.xml"/>
        <edge-files value="edges.xml"/>
        <connection-files value="connections.con.xml"/>
    </input>

    <output>
        <output-file value="network.net.xml"/>
    </output>

    <report>
        <aggregate-warnings value="5"/>
    </report>

</configuration>
-->

<net version="1.9" junctionCornerDetail="5" limitTurnSpeed="5.50" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd";>

    <location netOffset="500.00,0.00" convBoundary="0.00,0.00,1000.00,0.00" origBoundary="-500.00,0.00,500.00,0.00" projParameter="!"/>

    <edge id="1f2" from="1" to="2" priority="-1">
        <lane id="1f2_0" index="0" speed="13.89" length="1000.00" shape="0.00,-4.80 1000.00,-4.80"/>
        <lane id="1f2_1" index="1" speed="13.89" length="1000.00" shape="0.00,-1.60 1000.00,-1.60"/>
    </edge>

    <junction id="1" type="dead_end" x="0.00" y="0.00" incLanes="" intLanes="" shape="0.00,0.00 0.00,-6.40"/>
    <junction id="2" type="dead_end" x="1000.00" y="0.00" incLanes="1f2_0 1f2_1" intLanes="" shape="1000.00,-6.40 1000.00,0.00"/>

</net>
<edges>

  <edge id="1f2" from="1" to="2" numLanes="2" />

</edges>
<nodes>

  <!-- <node id="crossing_0" x="0.0" y="0.0" type="priority"/>
  <node id="crossing_1" x="0.0" y="+300.0" type="priority"/> -->

  <node id="1" x="-500.0" y="0.0" type="priority"/>
  <node id="2" x="+500.0" y="0.0" type="priority"/>
  <!-- <node id="3" x="-300.0" y="0.0" type="priority"/>

  <node id="4" x="+300.0" y="+300.0" type="priority"/>
  <node id="5" x="-300.0" y="+300.0" type="priority"/>
  <node id="6" x="0.0" y="+600.0" type="priority"/> -->

</nodes>
<viewsettings>
    <!-- <viewport y="0" x="-30" zoom="500"/> -->
    <viewport x="555" y="-5" zoom="200"/>
    <delay value="200"/>
    <scheme name="custom">
        <vehicles vehicleQuality="2"></vehicles>
    </scheme> 
</viewsettings>
<?xml version="1.0" encoding="UTF-8"?>

<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd";>

    <input>
        <net-file value="network.net.xml"/>
        <route-files value="routes.rou.xml"/>
        <gui-settings-file value="sumo.settings.xml"/>
        <additional-files value="lanemeanoutput.add.xml"/>

    </input>

    <time>
        <begin value="0.0"/>
        <step-length value="1"/>
    </time>

    <report>
        <!-- Silent -->
        <verbose value="false"/>
        <no-step-log value="true"/>
        <duration-log.statistics value="false"/>
        <duration-log.disable value="true"/>
        <no-warnings value="false"/>
    </report>

    <processing>
        <collision.action value="warn"/>
        <collision.mingap-factor value="0.0"/>
        <collision.check-junctions value="true"/>
        <time-to-teleport value="-1" />
        <lateral-resolution value="3.2" />
    </processing>

    <output>
        <output-prefix value="TIME"/>
        
        <collision-output value="../data/collision-output.xml"/>
        <vtk-output value="../data/vtk-output.xml"/>
        <fcd-output value="../data/fcd-output.xml"/>
        <summary-output value="../data/summary-output.xml"/>
        <full-output value="../data/full-output.xml"/>
        <tripinfo-output value="../data/tripinfo-output.xml"/>
        <statistic-output value="../data/statistic-output.xml"/>
        <lanechange-output value="../data/lanechange-output.xml"/>
        
        <!-- <tripinfo-output.write-unfinished value="true"/> -->

        <fcd-output.acceleration value="true"/>
        <fcd-output.max-leader-distance value="150.0"/>
        <fcd-output.params value="period=-1"/>
    </output>
    

        <!-- <collision-output value="../collisions.xml"/> -->
    <!-- <fcd-device>
        <device.fcd.period value="-1"/>
    </fcd-device> -->


</configuration>

Back to the top