From 1197a42c7cd177d1e7db1e204f69b0e523e0ddbb Mon Sep 17 00:00:00 2001 From: Seven Date: Fri, 28 Aug 2020 00:09:48 +0800 Subject: [PATCH 1/2] Ref: fix base_controller bug --- flow/controllers/base_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/controllers/base_controller.py b/flow/controllers/base_controller.py index 3c9985360..7631f9c0c 100755 --- a/flow/controllers/base_controller.py +++ b/flow/controllers/base_controller.py @@ -283,7 +283,7 @@ def safe_velocity(self, env): h = env.k.vehicle.get_headway(self.veh_id) dv = lead_vel - this_vel - v_safe = 2 * h / env.sim_step + dv - this_vel * (2 * self.delay) + v_safe = lead_vel + (h - lead_vel * self.delay) / (self.delay + (lead_vel+this_vel) / (2 * self.max_deaccel)) # check for speed limit FIXME: this is not called # this_edge = env.k.vehicle.get_edge(self.veh_id) From 7f534f3330bf57a7a9455d91941d0e74bf4e9526 Mon Sep 17 00:00:00 2001 From: Seven Date: Fri, 28 Aug 2020 00:14:52 +0800 Subject: [PATCH 2/2] Ref: fix base_controller bug --- flow/controllers/base_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/controllers/base_controller.py b/flow/controllers/base_controller.py index 7631f9c0c..8f3744d94 100755 --- a/flow/controllers/base_controller.py +++ b/flow/controllers/base_controller.py @@ -283,7 +283,7 @@ def safe_velocity(self, env): h = env.k.vehicle.get_headway(self.veh_id) dv = lead_vel - this_vel - v_safe = lead_vel + (h - lead_vel * self.delay) / (self.delay + (lead_vel+this_vel) / (2 * self.max_deaccel)) + v_safe = lead_vel + (h - lead_vel * self.delay) / (self.delay + (lead_vel+this_vel) / (2 * self.max_deaccel)) - 1e-3 # check for speed limit FIXME: this is not called # this_edge = env.k.vehicle.get_edge(self.veh_id)