Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add emergencydecel_warning_threshold parameter #967

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions flow/core/kernel/simulation/traci.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ def start_simulation(self, network, sim_params):
sumo_call.append("--lateral-resolution")
sumo_call.append(str(sim_params.lateral_resolution))

# disable emergencydecel warning (if requested)
if sim_params.emergencydecel_warning_threshold is not None:
sumo_call.append("--emergencydecel.warning-threshold")
sumo_call.append(str(sim_params.emergencydecel_warning_threshold))

# add the emission path to the sumo command (if requested)
if sim_params.emission_path is not None:
ensure_dir(sim_params.emission_path)
Expand Down
5 changes: 5 additions & 0 deletions flow/core/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ class SumoParams(SimParams):
width of the divided sublanes within a lane, defaults to None (i.e.
no sublanes). If this value is specified, the vehicle in the
network cannot use the "LC2013" lane change model.
emergencydecel_warning_threshold: float, optional
Sets the fraction of emergency decel capability that must be used
to trigger a warning.; default: 1
no_step_log : bool, optional
specifies whether to add sumo's step logs to the log file, and
print them into the terminal during runtime, defaults to True
Expand Down Expand Up @@ -595,6 +598,7 @@ def __init__(self,
sim_step=0.1,
emission_path=None,
lateral_resolution=None,
emergencydecel_warning_threshold=1,
no_step_log=True,
render=False,
save_render=False,
Expand All @@ -616,6 +620,7 @@ def __init__(self,
sight_radius, show_radius, pxpm, force_color_update)
self.port = port
self.lateral_resolution = lateral_resolution
self.emergencydecel_warning_threshold = emergencydecel_warning_threshold
self.no_step_log = no_step_log
self.seed = seed
self.overtake_right = overtake_right
Expand Down
2 changes: 2 additions & 0 deletions tests/fast_tests/test_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_params(self):
sim_step=0.125,
emission_path=None,
lateral_resolution=None,
emergencydecel_warning_threshold=1,
no_step_log=False,
render=True,
save_render=True,
Expand All @@ -104,6 +105,7 @@ def test_params(self):
self.assertEqual(params.sim_step, 0.125)
self.assertEqual(params.emission_path, None)
self.assertEqual(params.lateral_resolution, None)
self.assertEqual(params.emergencydecel_warning_threshold, 1)
self.assertEqual(params.no_step_log, False)
self.assertEqual(params.render, True)
self.assertEqual(params.save_render, True)
Expand Down