Skip to content

Commit

Permalink
Merge pull request #43 from mehtank/addedrobots
Browse files Browse the repository at this point in the history
Be clearer about what's a roadway speed limit vs a vehicle's maximum …
cathywu authored Sep 15, 2016
2 parents bea814b + 7a56335 commit 46502ea
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions python/loopsim.py
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ def ensure_dir(path):
class LoopSim:

def __init__(self, name, length, numLanes,
maxSpeed=defaults.SPEED_LIMIT, port=defaults.PORT):
speedLimit=defaults.SPEED_LIMIT, port=defaults.PORT):
self.name = "%s-%dm%dl" % (name, length, numLanes)
self.length = length
self.numLanes = numLanes
@@ -53,7 +53,7 @@ def __init__(self, name, length, numLanes,
self.netfn = makenet(self.name,
length=self.length,
lanes=self.numLanes,
maxSpeed=maxSpeed,
speedLimit=speedLimit,
path=self.net_path)
self.port = port

8 changes: 5 additions & 3 deletions python/makecirc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from lxml import etree

import config as defaults


E = etree.Element

@@ -13,7 +15,7 @@ def makexml(name, nsl):
def printxml(t, fn):
etree.ElementTree(t).write(fn, pretty_print=True, encoding='UTF-8', xml_declaration=True)

def makenet(base, length, lanes, maxSpeed=40, path=""):
def makenet(base, length, lanes, speedLimit=defaults.SPEED_LIMIT, path=""):
import subprocess
import sys

@@ -41,7 +43,7 @@ def makenet(base, length, lanes, maxSpeed=40, path=""):
printxml(x, path+edgfn)

x = makexml("types", "http://sumo.dlr.de/xsd/types_file.xsd")
x.append(E("type", id="edgeType", numLanes=repr(lanes), speed=repr(maxSpeed)))
x.append(E("type", id="edgeType", numLanes=repr(lanes), speed=repr(speedLimit)))
printxml(x, path+typfn)

x = makexml("configuration", "http://sumo.dlr.de/xsd/netconvertConfiguration.xsd")
@@ -158,5 +160,5 @@ def outputs(name, prefix="data/"):
if __name__ == "__main__":
base = "circtest"
netfn = makenet(base, length=1000, lanes=3)
cfgfn, outs = makecirc(base, netfn=netfn, maxspeed=30, typelist=["human", "robot"], maxt=3000)
cfgfn, outs = makecirc(base, netfn=netfn, speedlimit=30, typelist=["human", "robot"], maxt=3000)
print cfgfn

0 comments on commit 46502ea

Please sign in to comment.