def __init__(self, dbc_name, car_fingerprint, enable_camera): self.apply_steer_last = 0 self.turning_signal_timer = 0 self.car_fingerprint = car_fingerprint self.lkas11_cnt = 0 self.mdps12_cnt = 0 self.cnt = 0 self.last_resume_cnt = 0 self.map_speed = 0 self.enable_camera = enable_camera # True when camera present, and we need to replace all the camera messages # otherwise we forward the camera msgs and we just replace the lkas cmd signals self.camera_disconnected = False self.packer = CANPacker(dbc_name) context = zmq.Context() self.params = Params() self.map_data_sock = messaging.sub_sock( context, service_list['liveMapData'].port, conflate=True) self.speed_conv = 3.6 self.speed_adjusted = False self.checksum = "NONE" self.checksum_learn_cnt = 0 self.en_cnt = 0 self.apply_steer_ang = 0.0 self.en_spas = 3 self.mdps11_stat_last = 0 self.lkas = False self.spas_present = True # TODO Make Automatic self.ALCA = ALCAController( self, True, False) # Enabled True and SteerByAngle only False
def __init__(self, dbc_name, car_fingerprint, enable_camera, enable_dsu, enable_apg): self.braking = False # redundant safety check with the board self.controls_allowed = True self.last_steer = 0 self.last_angle = 0 self.accel_steady = 0. self.car_fingerprint = car_fingerprint self.alert_active = False self.last_standstill = False self.standstill_req = False self.angle_control = False self.steer_angle_enabled = False self.ipas_reset_counter = 0 self.last_fault_frame = -200 self.fake_ecus = set() if enable_camera: self.fake_ecus.add(ECU.CAM) if enable_dsu: self.fake_ecus.add(ECU.DSU) if enable_apg: self.fake_ecus.add(ECU.APGS) self.ALCA = ALCAController( self, True, False) # Enabled True and SteerByAngle only False self.packer = CANPacker(dbc_name)
def __init__(self, dbc_name, enable_camera=True): self.params = Params() self.braking = False self.brake_steady = 0. self.brake_last = 0. self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) self.epas_disabled = True self.last_angle = 0. self.last_accel = 0. self.ALCA = ALCAController(self,True,True) # Enabled and SteerByAngle both True self.ACC = ACCController() self.PCC = PCCController(self) self.HSO = HSOController(self) self.GYRO = GYROController() self.sent_DAS_bootID = False context = zmq.Context() self.poller = zmq.Poller() self.speedlimit = messaging.sub_sock(context, service_list['liveMapData'].port, conflate=True, poller=self.poller) self.speedlimit_ms = 0 self.speedlimit_valid = False self.speedlimit_units = 0 self.opState = 0 # 0-disabled, 1-enabled, 2-disabling, 3-unavailable, 5-warning self.accPitch = 0. self.accRoll = 0. self.accYaw = 0. self.magPitch = 0. self.magRoll = 0. self.magYaw = 0. self.gyroPitch = 0. self.gyroRoll = 0. self.gyroYaw = 0. self.set_speed_limit_active = False self.speed_limit_offset = 0.
def __init__(self, dbc_name, enable_camera=True): self.braking = False self.brake_steady = 0. self.brake_last = 0. self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) self.new_radar_config = False self.ALCA = ALCAController(self,True,False) # Enabled True and SteerByAngle only False
def __init__(self, dbc_name, enable_camera=True): self.braking = False self.brake_steady = 0. self.brake_last = 0. self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) self.epas_disabled = True self.last_angle = 0. self.last_accel = 0. self.ALCA = ALCAController(self, True, True) # Enabled and SteerByAngle both True self.ACC = ACCController() self.PCC = PCCController(self) self.HSO = HSOController(self)
def __init__(self, car_fingerprint): self.start_time = sec_since_boot() self.lkas_active = False self.steer_idx = 0 self.apply_steer_last = 0 self.car_fingerprint = car_fingerprint self.es_distance_cnt = -1 self.es_lkas_cnt = -1 self.counter = 0 self.ALCA = ALCAController(self,True,False) # Enabled True and SteerByAngle only False # Setup detection helper. Routes commands to # an appropriate CAN bus number. self.params = CarControllerParams(car_fingerprint) print(DBC) self.packer = CANPacker(DBC[car_fingerprint]['pt'])
def __init__(self, canbus, car_fingerprint, allow_controls): self.pedal_steady = 0. self.start_time = sec_since_boot() self.chime = 0 self.steer_idx = 0 self.apply_steer_last = 0 self.car_fingerprint = car_fingerprint self.allow_controls = allow_controls self.lka_icon_status_last = (False, False) self.ALCA = ALCAController( self, True, False) # Enabled True and SteerByAngle only False # Setup detection helper. Routes commands to # an appropriate CAN bus number. self.canbus = canbus self.params = CarControllerParams(car_fingerprint) self.packer_pt = CANPacker(DBC[car_fingerprint]['pt']) self.packer_ch = CANPacker(DBC[car_fingerprint]['chassis'])
def __init__(self, dbc_name, car_fingerprint, enable_camera): self.braking = False # redundant safety check with the board self.controls_allowed = True self.apply_steer_last = 0 self.ccframe = 0 self.prev_frame = -1 self.hud_count = 0 self.car_fingerprint = car_fingerprint self.alert_active = False self.send_chime = False self.gone_fast_yet = False self.ALCA = ALCAController( self, True, False) # Enabled True and SteerByAngle only False self.fake_ecus = set() if enable_camera: self.fake_ecus.add(ECU.CAM) self.packer = CANPacker(dbc_name)
def __init__(self, dbc_name, enable_camera=True): self.braking = False self.brake_steady = 0. self.brake_last = 0. self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) self.epas_disabled = True self.last_angle = 0. self.last_accel = 0. self.ALCA = ALCAController(self, True, True) # Enabled and SteerByAngle both True self.ACC = ACCController() self.PCC = PCCController(self) self.HSO = HSOController(self) self.sent_DAS_bootID = False context = zmq.Context() self.poller = zmq.Poller() self.speedlimit = messaging.sub_sock(context, service_list['speedLimit'].port, conflate=True, poller=self.poller) self.speedlimit_mph = 0
def __init__(self, dbc_name, CP, VM): self.fleet_speed_state = 0 self.cc_counter = 0 self.alcaStateData = None self.icLeadsData = None self.params = Params() self.braking = False self.brake_steady = 0. self.brake_last = 0. self.packer = CANPacker(dbc_name) self.epas_disabled = True self.last_angle = 0. self.last_accel = 0. self.blinker = Blinker() self.ALCA = ALCAController(self, True, True) # Enabled and SteerByAngle both True self.ACC = ACCController(self) self.PCC = PCCController(self) self.HSO = HSOController(self) self.GYRO = GYROController() self.AHB = AHBController(self) self.sent_DAS_bootID = False self.speedlimit = None self.trafficevents = messaging.sub_sock('trafficEvents', conflate=True) self.pathPlan = messaging.sub_sock('pathPlan', conflate=True) self.radarState = messaging.sub_sock('radarState', conflate=True) self.icLeads = messaging.sub_sock('uiIcLeads', conflate=True) self.icCarLR = messaging.sub_sock('uiIcCarLR', conflate=True) self.alcaState = messaging.sub_sock('alcaState', conflate=True) self.gpsLocationExternal = None self.opState = 0 # 0-disabled, 1-enabled, 2-disabling, 3-unavailable, 5-warning self.accPitch = 0. self.accRoll = 0. self.accYaw = 0. self.magPitch = 0. self.magRoll = 0. self.magYaw = 0. self.gyroPitch = 0. self.gyroRoll = 0. self.gyroYaw = 0. self.set_speed_limit_active = False self.speed_limit_offset = 0. self.speed_limit_ms = 0. # for warnings self.warningCounter = 0 self.DAS_206_apUnavailable = 0 self.DAS_222_accCameraBlind = 0 #DAS_206 lkas not ebabled self.DAS_219_lcTempUnavailableSpeed = 0 self.DAS_220_lcTempUnavailableRoad = 0 self.DAS_221_lcAborting = 0 self.DAS_211_accNoSeatBelt = 0 self.DAS_207_lkasUnavailable = 0 #use for manual steer? self.DAS_208_rackDetected = 0 #use for low battery? self.DAS_202_noisyEnvironment = 0 #use for planner error? self.DAS_025_steeringOverride = 0 #another one to use for manual steer? self.warningNeeded = 0 # items for IC integration for Lane and Lead Car self.average_over_x_pathplan_values = 1 self.curv0Matrix = MovingAverage(self.average_over_x_pathplan_values) self.curv1Matrix = MovingAverage(self.average_over_x_pathplan_values) self.curv2Matrix = MovingAverage(self.average_over_x_pathplan_values) self.curv3Matrix = MovingAverage(self.average_over_x_pathplan_values) self.leadDxMatrix = MovingAverage(self.average_over_x_pathplan_values) self.leadDyMatrix = MovingAverage(self.average_over_x_pathplan_values) self.leadDx = 0. self.leadDy = 0. self.leadClass = 0 self.leadVx = 0. self.leadId = 0 self.lead2Dx = 0. self.lead2Dy = 0. self.lead2Class = 0 self.lead2Vx = 0. self.lead2Id = 0 self.lLine = 0 self.rLine = 0 self.curv0 = 0. self.curv1 = 0. self.curv2 = 0. self.curv3 = 0. self.visionCurvC0 = 0. self.laneRange = 30 #max is 160m but OP has issues with precision beyond 50 self.laneWidth = 0. self.stopSign_visible = False self.stopSign_distance = 1000. self.stopSign_action = 0 self.stopSign_resume = False self.stopLight_visible = False self.stopLight_distance = 1000. self.stopLight_action = 0 self.stopLight_resume = False self.stopLight_color = 0. #0-unknown, 1-red, 2-yellow, 3-green self.stopSignWarning = 0 self.stopLightWarning = 0 self.stopSignWarning_last = 0 self.stopLightWarning_last = 0 self.roadSignType = 0xFF self.roadSignStopDist = 1000. self.roadSignColor = 0. self.roadSignControlActive = 0 self.roadSignType_last = 0xFF self.roadSignDistanceWarning = 50. self.alca_enabled = False self.ldwStatus = 0 self.prev_ldwStatus = 0 self.radarVin_idx = 0 self.LDW_ENABLE_SPEED = 16 self.should_ldw = False self.ldw_numb_frame_end = 0 self.isMetric = (self.params.get("IsMetric") == "1") self.ahbLead1 = None