Skip to content

Commit

Permalink
Added test for #4418
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo committed Aug 14, 2018
1 parent 3e0c3ff commit 62c4b92
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/complex/traci/pythonApi/bugs/testsuite.complex
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ ticket4214

# add trip
ticket4307
ticket4418
29 changes: 29 additions & 0 deletions tests/complex/traci/pythonApi/bugs/ticket4418/input_net.net.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on Di 14 Aug 2018 14:47:49 CEST by Eclipse SUMO netedit Version 0df7906
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/netconvertConfiguration.xsd">
<output>
<output-file value="/home/leo/repos/sumo_master/mytests/slowdown_ballistic/net.net.xml"/>
</output>
<processing>
<no-turnarounds value="true"/>
<offset.disable-normalization value="true"/>
</processing>
</configuration>
-->

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

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

<edge id="E" from="gneJ0" to="gneJ1" priority="-1">
<lane id="E_0" index="0" speed="13.89" length="500.00" shape="0.00,-1.60 500.00,-1.60"/>
</edge>

<junction id="gneJ0" type="dead_end" x="0.00" y="0.00" incLanes="" intLanes="" shape="0.00,0.00 0.00,-3.20"/>
<junction id="gneJ1" type="dead_end" x="500.00" y="0.00" incLanes="E_0" intLanes="" shape="500.00,-3.20 500.00,0.00"/>

</net>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vType id="t0" sigma="0" />
<route id="r0" edges="E" />
<vehicle id="lead" depart="0" departSpeed="max" route="r0" >
<stop lane="E_0" endPos="200" duration="50" />
</vehicle>
<vehicle id="follow" depart="10" departSpeed="max" route="r0" />
</routes>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[Reported by leo at 14Aug15:15:32]
search_string:collision
search_file:errors
full_description:#4418
brief_description:#4418
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/complex/traci/pythonApi/bugs/ticket4418/runner.py
3 changes: 3 additions & 0 deletions tests/complex/traci/pythonApi/bugs/ticket4418/output.complex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Loading configuration... done.
Retrying in 1 seconds
Commanding slow down for vehicle 'follow' at time 26.0. Remaining distance: 9.75958510426, speed: 4.25464094651
64 changes: 64 additions & 0 deletions tests/complex/traci/pythonApi/bugs/ticket4418/runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2008-2018 German Aerospace Center (DLR) and others.
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v20.html
# SPDX-License-Identifier: EPL-2.0

# @file runner.py
# @author Leonhard Luecken
# @author Michael Behrisch
# @author Jakob Erdmann
# @author Daniel Krajzewicz
# @date 2011-03-04
# @version $Id$


from __future__ import print_function
from __future__ import absolute_import
import os
import sys

SUMO_HOME = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "..")
sys.path.append(os.path.join(os.environ.get("SUMO_HOME", SUMO_HOME), "tools"))

import traci # noqa
import sumolib

def step():
s = traci.simulation.getTime()
traci.simulationStep()
return s


traci.start([sumolib.checkBinary('sumo'), "-c", "sumo.sumocfg"])

lead = "lead"
follow = "follow"

stopPos = 200
slowDownDist = 10

for i in range(10000):
step()
remDist = stopPos - traci.vehicle.getLanePosition(follow)
if remDist < slowDownDist:
# stop after distance remDist (which is the stop position for the leader (mimics glosa situation in front of traffic light where this problem was observed))
# d = v*v/(2*a) => a = v*v/(2*d) => tstop = v/a = 2*d/v
speed = traci.vehicle.getSpeed(follow)
tstop = 2*remDist / speed

print("Commanding slow down for vehicle '%s' at time %s. Remaining distance: %s, speed: %s"%(follow, traci.simulation.getCurrentTime()/1000., remDist, speed))

traci.vehicle.slowDown(follow, 0, tstop*1000)
break

while traci.simulation.getMinExpectedNumber() > 0:
step()


# done
traci.close()
16 changes: 16 additions & 0 deletions tests/complex/traci/pythonApi/bugs/ticket4418/sumo.sumocfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">

<input>
<net-file value="input_net.net.xml" />
<route-files value="input_routes.rou.xml" />
</input>

<processing>
<step-method.ballistic value="true" />
</processing>

<report>
<no-step-log value="true" />
</report>

</configuration>

0 comments on commit 62c4b92

Please sign in to comment.