| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -8,7 +8,7 @@ from cereal import car | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from common.basedir import BASEDIR | 
					 | 
					 | 
					 | 
					from common.basedir import BASEDIR | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from common.conversions import Conversions as CV | 
					 | 
					 | 
					 | 
					from common.conversions import Conversions as CV | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from common.kalman.simple_kalman import KF1D | 
					 | 
					 | 
					 | 
					from common.kalman.simple_kalman import KF1D | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from common.numpy_fast import interp | 
					 | 
					 | 
					 | 
					from common.numpy_fast import clip, interp | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from common.realtime import DT_CTRL | 
					 | 
					 | 
					 | 
					from common.realtime import DT_CTRL | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from selfdrive.car import apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness | 
					 | 
					 | 
					 | 
					from selfdrive.car import apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, apply_center_deadzone | 
					 | 
					 | 
					 | 
					from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, apply_center_deadzone | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -327,6 +327,7 @@ class CarStateBase(ABC): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.cruise_buttons = 0 | 
					 | 
					 | 
					 | 
					    self.cruise_buttons = 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.left_blinker_cnt = 0 | 
					 | 
					 | 
					 | 
					    self.left_blinker_cnt = 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.right_blinker_cnt = 0 | 
					 | 
					 | 
					 | 
					    self.right_blinker_cnt = 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    self.steering_pressed_cnt = 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.left_blinker_prev = False | 
					 | 
					 | 
					 | 
					    self.left_blinker_prev = False | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.right_blinker_prev = False | 
					 | 
					 | 
					 | 
					    self.right_blinker_prev = False | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.cluster_speed_hyst_gap = 0.0 | 
					 | 
					 | 
					 | 
					    self.cluster_speed_hyst_gap = 0.0 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -364,6 +365,12 @@ class CarStateBase(ABC): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.right_blinker_cnt = blinker_time if right_blinker_lamp else max(self.right_blinker_cnt - 1, 0) | 
					 | 
					 | 
					 | 
					    self.right_blinker_cnt = blinker_time if right_blinker_lamp else max(self.right_blinker_cnt - 1, 0) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return self.left_blinker_cnt > 0, self.right_blinker_cnt > 0 | 
					 | 
					 | 
					 | 
					    return self.left_blinker_cnt > 0, self.right_blinker_cnt > 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  def update_steering_pressed(self, steering_pressed, steering_pressed_min_count): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    """Applies filtering on steering pressed for noisy driver torque signals.""" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    self.steering_pressed_cnt += 1 if steering_pressed else -1 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    self.steering_pressed_cnt = clip(self.steering_pressed_cnt, 0, steering_pressed_min_count * 2) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    return self.steering_pressed_cnt > steering_pressed_min_count | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def update_blinker_from_stalk(self, blinker_time: int, left_blinker_stalk: bool, right_blinker_stalk: bool): | 
					 | 
					 | 
					 | 
					  def update_blinker_from_stalk(self, blinker_time: int, left_blinker_stalk: bool, right_blinker_stalk: bool): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    """Update blinkers from stalk position. When stalk is seen the blinker will be on for at least blinker_time, | 
					 | 
					 | 
					 | 
					    """Update blinkers from stalk position. When stalk is seen the blinker will be on for at least blinker_time, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    or until the stalk is turned off, whichever is longer. If the opposite stalk direction is seen the blinker | 
					 | 
					 | 
					 | 
					    or until the stalk is turned off, whichever is longer. If the opposite stalk direction is seen the blinker | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |