Skip to content

Commit

Permalink
Merge pull request #44 from cathywu/humanlanechange
Browse files Browse the repository at this point in the history
Human traffic jam
  • Loading branch information
mehtank authored Sep 15, 2016
2 parents 46502ea + 3938058 commit 855574b
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions python/loopsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,23 @@ def plot(self, show=True, save=False):
if __name__ == "__main__":
from carfns import randomChangeLaneFn, ACCFnBuilder, changeFasterLaneBuilder, MidpointFnBuilder, SwitchFn

changeFasterLane = changeFasterLaneBuilder()
# changeFasterLane = changeFasterLaneBuilder(likelihood=1, speedThreshold=2)
humanParams = {
"name" : "human",
"count" : 0,
"maxSpeed" : 40,
"accel" : 2.6,
"decel" : 4.5,
# "function" : randomChangeLaneFn,
# "function" : changeFasterLaneBuilder(),
"laneSpread" : 0,
"speedFactor" : 1.0,
"speedDev" : 0.1,
"sigma" : 0.5,
"tau" : 3, # http://www.croberts.com/respon.htm
"laneChangeModel": 'LC2013',
}
"name" : "human",
"count" : 25,
"maxSpeed" : 40,
"accel" : 2.6,
"decel" : 4.5,
# "function" : randomChangeLaneFn,
"function" : changeFasterLane,
"laneSpread" : 0,
"speedFactor" : 1.1,
"speedDev" : 0.5,
"sigma" : 0.75,
"tau" : 3, # http://www.croberts.com/respon.htm
# "laneChangeModel": 'LC2013',
}

robotParams = {
"name" : "robot",
Expand All @@ -261,13 +263,13 @@ def plot(self, show=True, save=False):

hybridParams = copy.copy(humanParams)
hybridParams["name"] = "hybrid"
hybridParams["count"] = 30
hybridParams["function"] = SwitchFn("robot", 0.5, initCarFn=randomChangeLaneFn)
hybridParams["count"] = 5
hybridParams["function"] = SwitchFn("robot", 0.5, initCarFn=changeFasterLane)

opts = {
"paramsList" : [humanParams, robotParams, hybridParams],
"simSteps" : 500,
"tag" : "Hybrid"
"tag" : "aggressiveFasterLane"
}

defaults.SIM_STEP_LENGTH = 0.5
Expand Down

0 comments on commit 855574b

Please sign in to comment.