def __init__(self, veh_id, car_following_params, v_des=15, danger_edges=None, control_length=None, no_control_edges=None): """Instantiate FollowerStopper.""" BaseController.__init__(self, veh_id, car_following_params, delay=0.0, fail_safe='safe_velocity') # desired speed of the vehicle self.v_des = v_des # maximum achievable acceleration by the vehicle self.max_accel = car_following_params.controller_params['accel'] # other parameters self.dx_1_0 = 4.5 self.dx_2_0 = 5.25 self.dx_3_0 = 6.0 self.d_1 = 1.5 self.d_2 = 1.0 self.d_3 = 0.5 self.danger_edges = danger_edges if danger_edges else {} self.control_length = control_length self.no_control_edges = no_control_edges
def __init__(self, veh_id, car_following_params, alpha=1.5, beta=20.0, s0=2.0, s_star=2.0, vM=30.0, time_delay=0, noise=0, fail_safe=None): """Instantiate an Optimal Vehicle Model controller.""" BaseController.__init__( self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.veh_id = veh_id self.vM = vM self.alpha = alpha self.beta = beta self.vM = vM self.s0 = s0 self.s_star = s_star
def __init__(self, veh_id, v0=30, T=1, a=1, b=1.5, delta=4, s0=2, time_delay=0.0, dt=0.1, noise=0, fail_safe=None, car_following_params=None): """Instantiate an IDM controller.""" BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.v0 = v0 self.T = T self.a = a self.b = b self.delta = delta self.s0 = s0 self.dt = dt
def __init__(self, veh_id, car_following_params, alpha=.5, beta=20, h_st=2, h_go=10, v_max=32, want_max_accel=False, time_delay=0, noise=0, fail_safe=None, display_warnings=True): """Instantiate an Bando controller.""" BaseController.__init__( self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise, display_warnings=display_warnings, ) self.veh_id = veh_id self.v_max = v_max self.alpha = alpha self.beta = beta self.h_st = h_st self.h_go = h_go self.want_max_accel = want_max_accel
def __init__(self, veh_id, car_following_params, k_1=0.3, k_2=0.4, h=1, tau=0.1, a=0, time_delay=0.0, noise=0, fail_safe=None): """Instantiate a Linear Adaptive Cruise controller.""" BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.veh_id = veh_id self.k_1 = k_1 self.k_2 = k_2 self.h = h self.tau = tau self.a = a
def __init__(self, veh_id, sumo_cf_params, time_delay=0, fail_safe=None): """Instantiates an RL Controller. Vehicles with this controller are provided with actions by an rl agent, and perform their actions accordingly. Attributes ---------- veh_id: str Vehicle ID for SUMO identification acc_max: float, optional max acceleration (default: 15) tau: float, optional time delay (default: 0) dt: float, optional timestep (default: 0.1) fail_safe: str, optional type of flow-imposed failsafe the vehicle should posses, defaults to no failsafe (None) """ BaseController.__init__(self, veh_id, sumo_cf_params, delay=time_delay, fail_safe=fail_safe)
def __init__(self, veh_id, car_following_params, k_d=1, k_v=1, k_c=1, d_des=1, v_des=8, time_delay=0.0, noise=0, fail_safe=None, display_warnings=True): """Instantiate a Bilateral car-following model controller.""" BaseController.__init__( self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise, display_warnings=display_warnings, ) self.veh_id = veh_id self.k_d = k_d self.k_v = k_v self.k_c = k_c self.d_des = d_des self.v_des = v_des
def __init__(self, veh_id, car_following_params, k_d=1, k_v=1, k_c=1, d_des=1, v_des=8, time_delay=0.0, noise=0, fail_safe=None): """Instantiate a CFM controller.""" BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.veh_id = veh_id self.k_d = k_d self.k_v = k_v self.k_c = k_c self.d_des = d_des self.v_des = v_des
def __init__(self, veh_id, car_following_params, v_max=30, adaptation=0.65, h_st=5, time_delay=0.0, noise=0, fail_safe=None, display_warnings=True): """Instantiate a Linear OVM controller.""" BaseController.__init__( self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise, display_warnings=display_warnings, ) self.veh_id = veh_id # 4.8*1.85 for case I, 3.8*1.85 for case II, per Nakayama self.v_max = v_max # TAU in Traffic Flow Dynamics textbook self.adaptation = adaptation self.h_st = h_st
def __init__(self, veh_id, car_following_params, alpha=1, beta=1, h_st=2, h_go=15, v_max=30, time_delay=0, noise=0, fail_safe=None, display_warnings=True): """Instantiate an Optimal Vehicle Model controller.""" BaseController.__init__( self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise, display_warnings=display_warnings, ) self.veh_id = veh_id self.v_max = v_max self.alpha = alpha self.beta = beta self.h_st = h_st self.h_go = h_go
def __init__(self, veh_id, t_c, d_s, lambda_a, r_go, max_accel, max_deaccel, desire_v, d_nudge, discount, debug=False, time_delay=0.0, noise=0, fail_safe=None, car_following_params=None): """Instantiate an IDM controller.""" BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.t_c = t_c self.d_s = d_s self.lambda_a = lambda_a self.r_go = r_go self.max_accel = max_accel self.max_deaccel = max_deaccel self.desire_v = desire_v self.d_nudge = d_nudge self.discount = discount self.go_action = False self.less_threshold = 0 self.debug = debug
def __init__(self, veh_id, sumo_cf_params, v_des=15, danger_edges=None): """Inspired by Dan Work's... work: Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Parameters ---------- veh_id: str unique vehicle identifier v_des: float, optional desired speed of the vehicles (m/s) """ BaseController.__init__(self, veh_id, sumo_cf_params, delay=1.0, fail_safe='safe_velocity') # desired speed of the vehicle self.v_des = v_des # maximum achievable acceleration by the vehicle self.max_accel = sumo_cf_params.controller_params['accel'] # other parameters self.dx_1_0 = 4.5 self.dx_2_0 = 5.25 self.dx_3_0 = 6.0 self.d_1 = 1.5 self.d_2 = 1.0 self.d_3 = 0.5 self.danger_edges = danger_edges if danger_edges else {}
def __init__(self, veh_id, sumo_cf_params): """Inspired by Dan Work's... work: Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Parameters ---------- veh_id : str unique vehicle identifier sumo_cf_params : SumoCarFollowingParams object defining sumo-specific car-following parameters """ BaseController.__init__(self, veh_id, sumo_cf_params, delay=1.0) # maximum achievable acceleration by the vehicle self.max_accel = sumo_cf_params.controller_params['accel'] # history used to determine AV desired velocity self.v_history = [] # other parameters self.gamma = 2 self.g_l = 7 self.g_u = 30 self.v_catch = 1 # values that are updated by using their old information self.alpha = 0 self.beta = 1 - 0.5 * self.alpha self.U = 0 self.v_target = 0 self.v_cmd = 0
def __init__(self, veh_id, car_following_params=None, v0=30, acc=1.5, b=-1, b_l=-1, s0=2, tau=1, delay=0, noise=0, fail_safe=None): """Instantiate a Gipps' controller.""" BaseController.__init__(self, veh_id, car_following_params, delay=delay, fail_safe=fail_safe, noise=noise) self.v_desired = v0 self.acc = acc self.b = b self.b_l = b_l self.s0 = s0 self.tau = tau
def __init__(self, veh_id, car_following_params): """Instantiate an RL Controller.""" BaseController.__init__( self, veh_id, car_following_params) self._idm_controller = IDMController(veh_id, car_following_params=car_following_params)
def __init__(self, veh_id, alpha=1, beta=1, h_st=2, h_go=15, v_max=30, accel_max=15, decel_max=-5, tau=0.5, dt=0.1, noise=0): """ Instantiates an Optimal Vehicle Model controller. Attributes ---------- veh_id: str Vehicle ID for SUMO identification alpha: float, optional gain on desired velocity to current velocity difference (default: 0.6) beta: float, optional gain on lead car velocity and self velocity difference (default: 0.9) h_st: float, optional headway for stopping (default: 5) h_go: float, optional headway for full speed (default: 35) v_max: float, optional max velocity (default: 30) accel_max: float, optional max acceleration (default: 15) decel_max: float, optional max deceleration (default: -5) tau: float, optional time delay (default: 0.5) dt: float, optional timestep (default: 0.1) noise: float, optional std dev of normal perturbation to the acceleration (default: 0) """ controller_params = { "delay": tau / dt, "max_deaccel": decel_max, "noise": noise } BaseController.__init__(self, veh_id, controller_params) self.accel_queue = collections.deque() self.decel_max = decel_max self.accel_max = accel_max self.veh_id = veh_id self.v_max = v_max self.alpha = alpha self.beta = beta self.h_st = h_st self.h_go = h_go self.tau = tau self.dt = dt
def __init__(self, veh_id, car_following_params): """Instantiates an RL Controller. Attributes ---------- veh_id: str Vehicle ID for SUMO identification """ BaseController.__init__(self, veh_id, car_following_params)
def __init__(self, veh_id, v0=30, T=1, a=1, b=1.5, delta=4, s0=2, s1=0, decel_max=-5, dt=0.1, noise=0): """ Instantiates an Intelligent Driver Model (IDM) controller Attributes ---------- veh_id: str Vehicle ID for SUMO identification v0: float, optional desirable velocity, in m/s (default: 30) T: float, optional safe time headway, in s (default: 1) a: float, optional maximum acceleration, in m/s2 (default: 1) b: float, optional comfortable deceleration, in m/s2 (default: 1.5) delta: float, optional acceleration exponent (default: 4) s0: float, optional linear jam distance, in m (default: 2) s1: float, optional nonlinear jam distance, in m (default: 0) decel_max: float, optional max deceleration, in m/s2 (default: -5) dt: float, optional timestep, in s (default: 0.1) noise: float, optional std dev of normal perturbation to the acceleration (default: 0) """ tau = T # the time delay is taken to be the safe time headway controller_params = { "delay": tau / dt, "max_deaccel": decel_max, "noise": noise } BaseController.__init__(self, veh_id, controller_params) self.v0 = v0 self.T = T self.a = a self.b = b self.delta = delta self.s0 = s0 self.s1 = s1 self.max_deaccel = decel_max self.dt = dt
def __init__(self, veh_id, v0=30, T=1, a=1, b=1.5, delta=4, s0=2, s1=0, time_delay=0.0, dt=0.1, noise=0, fail_safe=None, sumo_cf_params=None): """Instantiates an Intelligent Driver Model (IDM) controller Attributes ---------- veh_id: str Vehicle ID for SUMO identification sumo_cf_params: SumoCarFollowingParams see parent class v0: float, optional desirable velocity, in m/s (default: 30) T: float, optional safe time headway, in s (default: 1) b: float, optional comfortable deceleration, in m/s2 (default: 1.5) delta: float, optional acceleration exponent (default: 4) s0: float, optional linear jam distance, in m (default: 2) s1: float, optional nonlinear jam distance, in m (default: 0) dt: float, optional timestep, in s (default: 0.1) noise: float, optional std dev of normal perturbation to the acceleration (default: 0) fail_safe: str, optional type of flow-imposed failsafe the vehicle should posses, defaults to no failsafe (None) """ BaseController.__init__(self, veh_id, sumo_cf_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.v0 = v0 self.T = T self.a = a self.b = b self.delta = delta self.s0 = s0 self.s1 = s1 self.dt = dt
def __init__(self, veh_id, k_d=1, k_v=1, k_c=1, d_des=1, v_des=8, accel_max=15, decel_max=-5, tau=0.5, dt=0.1, noise=0): """ Instantiates a Bilateral car-following model controller. Looks ahead and behind. Attributes ---------- veh_id: str Vehicle ID for SUMO identification k_d: float, optional gain on distances to lead/following cars (default: 1) k_v: float, optional gain on vehicle velocity differences (default: 1) k_c: float, optional gain on difference from desired velocity to current (default: 1) d_des: float, optional desired headway (default: 1) v_des: float, optional desired velocity (default: 8) accel_max: float, optional max acceleration (default: 15) decel_max: float max deceleration (default: -5) tau: float, optional time delay (default: 0.5) dt: float, optional timestep (default: 0.1) noise: float, optional std dev of normal perturbation to the acceleration (default: 0) """ controller_params = { "delay": tau / dt, "max_deaccel": decel_max, "noise": noise } BaseController.__init__(self, veh_id, controller_params) self.veh_id = veh_id self.k_d = k_d self.k_v = k_v self.k_c = k_c self.d_des = d_des self.v_des = v_des self.accel_max = accel_max self.accel_queue = collections.deque()
def __init__(self, veh_id, sumo_cf_params, k_d=1, k_v=1, k_c=1, d_des=1, v_des=8, time_delay=0.0, noise=0, fail_safe=None): """Instantiates a Bilateral car-following model controller. Looks ahead and behind. Attributes ---------- veh_id: str Vehicle ID for SUMO identification sumo_cf_params: SumoCarFollowingParams see parent class k_d: float, optional gain on distances to lead/following cars (default: 1) k_v: float, optional gain on vehicle velocity differences (default: 1) k_c: float, optional gain on difference from desired velocity to current (default: 1) d_des: float, optional desired headway (default: 1) v_des: float, optional desired velocity (default: 8) time_delay: float, optional time delay (default: 0.5) noise: float, optional std dev of normal perturbation to the acceleration (default: 0) fail_safe: str, optional type of flow-imposed failsafe the vehicle should posses, defaults to no failsafe (None) """ BaseController.__init__(self, veh_id, sumo_cf_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.veh_id = veh_id self.k_d = k_d self.k_v = k_v self.k_c = k_c self.d_des = d_des self.v_des = v_des
def __init__(self, veh_id, sumo_cf_params, alpha=1, beta=1, h_st=2, h_go=15, v_max=30, time_delay=0, noise=0, fail_safe=None): """Instantiates an Optimal Vehicle Model controller. Attributes ---------- veh_id: str Vehicle ID for SUMO identification sumo_cf_params: SumoCarFollowingParams see parent class alpha: float, optional gain on desired velocity to current velocity difference (default: 0.6) beta: float, optional gain on lead car velocity and self velocity difference (default: 0.9) h_st: float, optional headway for stopping (default: 5) h_go: float, optional headway for full speed (default: 35) v_max: float, optional max velocity (default: 30) time_delay: float, optional time delay (default: 0.5) noise: float, optional std dev of normal perturbation to the acceleration (default: 0) fail_safe: str, optional type of flow-imposed failsafe the vehicle should posses, defaults to no failsafe (None) """ BaseController.__init__(self, veh_id, sumo_cf_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.veh_id = veh_id self.v_max = v_max self.alpha = alpha self.beta = beta self.h_st = h_st self.h_go = h_go
def __init__(self, veh_id, v_max=30, accel_max=15, decel_max=-5, adaptation=0.65, h_st=5, tau=0.5, dt=0.1, noise=0): """ Instantiates a Linear OVM controller Attributes ---------- veh_id: str Vehicle ID for SUMO identification v_max: float, optional max velocity (default: 30) accel_max: float, optional max acceleration (default: 15) decel_max: float, optional max deceleration (default: -5) adaptation: float adaptation constant (default: 0.65) h_st: float, optional headway for stopping (default: 5) tau: float, optional time delay (default: 0.5) dt: float, optional timestep (default: 0.1) noise: float, optional std dev of normal perturbation to the acceleration (default: 0) """ controller_params = { "delay": tau / dt, "max_deaccel": decel_max, "noise": noise } BaseController.__init__(self, veh_id, controller_params) self.accel_queue = collections.deque() self.decel_max = decel_max self.acc_max = accel_max self.veh_id = veh_id # 4.8*1.85 for case I, 3.8*1.85 for case II, per Nakayama self.v_max = v_max # TAU in Traffic Flow Dynamics textbook self.adaptation = adaptation self.h_st = h_st self.delay_time = tau self.dt = dt
def __init__(self, veh_id, sumo_cf_params, time_delay=0, fail_safe=None): """Instantiates an RL Controller. Attributes ---------- veh_id: str Vehicle ID for SUMO identification fail_safe: str, optional type of flow-imposed failsafe the vehicle should posses, defaults to no failsafe (None) """ BaseController.__init__(self, veh_id, sumo_cf_params, delay=time_delay, fail_safe=fail_safe)
def __init__(self, veh_id, car_following_params, v_des=13.336, Penetration_rate=0.05, danger_edges=None, control_length=None, no_control_edges=None): """Instantiate FollowerStopper.""" BaseController.__init__(self, veh_id, car_following_params, delay=1.0, fail_safe='safe_velocity') # desired speed of the vehicle # self.v_des = v_des # self.entry_headway = solve TRAFFIC_FLOW # self.TRAFFIC_FLOW = solve TRAFFIC_FLOW #Design parameters self.d0 = 2.5 self.a = 0.2 self.b = 0.001 self.v_max = 30 #self.TRAFFIC_INFLOW_speed = 11 # if env == None: self.v_des = v_des self.v_fast = 24 # else: # self.v_des = min(self.a+self.b*env.time_counter * env.sim_step,1)*v_des # self.v_des = min(self.a+self.b*env.time_counter * env.sim_step,1)*TRAFFIC_INFLOW_speed # self.v_des = min(self.a+self.b*env.time_counter * env.sim_step,1)*v_max*((np.tanh(env.entry_headway/env.h_st-2)+np.tanh(2))/(1+np.tanh(2))) self.k = 1.0 self.dx_1_0 = 4.5 self.dx_2_0 = 5.25 self.dx_3_0 = 6.0 self.d_1 = 1.5 self.d_2 = 1.0 self.d_3 = 0.5 self.d = 1 self.ref_time = 0 # maximum achievable acceleration by the vehicle self.max_accel = car_following_params.controller_params['accel'] # other parameters self.danger_edges = danger_edges if danger_edges else {}
def __init__(self, veh_id, max_deacc=15, tau=0, dt=0.1): """ Instantiates an RL Controller. Vehicles with this controller are provided with actions by rllab, and perform their actions accordingly. Attributes ---------- veh_id: str Vehicle ID for SUMO identification acc_max: float, optional max acceleration (default: 15) tau: float, optional time delay (default: 0) dt: float, optional timestep (default: 0.1) """ controller_params = {"delay": tau / dt, "max_deaccel": max_deacc} BaseController.__init__(self, veh_id, controller_params)
def __init__(self, veh_id, a=1, time_delay=0.0, dt=0.1, noise=0, fail_safe=None, car_following_params=None): """Instantiate an IDM controller.""" BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.a = a self.dt = dt self.go_action = False
def __init__(self, veh_id, sumo_cf_params, v_max=30, adaptation=0.65, h_st=5, time_delay=0.0, noise=0, fail_safe=None): """Instantiates a Linear OVM controller Attributes ---------- veh_id: str Vehicle ID for SUMO identification sumo_cf_params: SumoCarFollowingParams see parent class v_max: float, optional max velocity (default: 30) adaptation: float adaptation constant (default: 0.65) h_st: float, optional headway for stopping (default: 5) time_delay: float, optional time delay (default: 0.5) noise: float, optional std dev of normal perturbation to the acceleration (default: 0) fail_safe: str, optional type of flow-imposed failsafe the vehicle should posses, defaults to no failsafe (None) """ BaseController.__init__(self, veh_id, sumo_cf_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.veh_id = veh_id # 4.8*1.85 for case I, 3.8*1.85 for case II, per Nakayama self.v_max = v_max # TAU in Traffic Flow Dynamics textbook self.adaptation = adaptation self.h_st = h_st
def __init__(self, veh_id, car_following_params): """Instantiate PISaturation.""" BaseController.__init__(self, veh_id, car_following_params, delay=1.0) # maximum achievable acceleration by the vehicle self.max_accel = car_following_params.controller_params['accel'] # history used to determine AV desired velocity self.v_history = [] # other parameters self.gamma = 2 self.g_l = 7 self.g_u = 30 self.v_catch = 1 # values that are updated by using their old information self.alpha = 0 self.beta = 1 - 0.5 * self.alpha self.U = 0 self.v_target = 0 self.v_cmd = 0
def __init__(self, veh_id, car_following_params): """Instantiate an RL Controller.""" BaseController.__init__(self, veh_id, car_following_params)