def get_cam_can_parser(CP): if CP.carFingerprint in PREGLOBAL_CARS: signals = [ ("Cruise_Set_Speed", "ES_DashStatus", 0), ("Not_Ready_Startup", "ES_DashStatus", 0), ("Throttle_Cruise", "ES_CruiseThrottle", 0), ("Signal1", "ES_CruiseThrottle", 0), ("Cruise_Activated", "ES_CruiseThrottle", 0), ("Signal2", "ES_CruiseThrottle", 0), ("Brake_On", "ES_CruiseThrottle", 0), ("DistanceSwap", "ES_CruiseThrottle", 0), ("Standstill", "ES_CruiseThrottle", 0), ("Signal3", "ES_CruiseThrottle", 0), ("CloseDistance", "ES_CruiseThrottle", 0), ("Signal4", "ES_CruiseThrottle", 0), ("Standstill_2", "ES_CruiseThrottle", 0), ("ES_Error", "ES_CruiseThrottle", 0), ("Signal5", "ES_CruiseThrottle", 0), ("Counter", "ES_CruiseThrottle", 0), ("Signal6", "ES_CruiseThrottle", 0), ("Button", "ES_CruiseThrottle", 0), ("Signal7", "ES_CruiseThrottle", 0), ] checks = [ ("ES_DashStatus", 20), ("ES_CruiseThrottle", 20), ] else: signals = [ ("Cruise_Set_Speed", "ES_DashStatus", 0), ("Conventional_Cruise", "ES_DashStatus", 0), ("Counter", "ES_Distance", 0), ("Signal1", "ES_Distance", 0), ("Cruise_Fault", "ES_Distance", 0), ("Cruise_Throttle", "ES_Distance", 0), ("Signal2", "ES_Distance", 0), ("Car_Follow", "ES_Distance", 0), ("Signal3", "ES_Distance", 0), ("Cruise_Brake_Active", "ES_Distance", 0), ("Distance_Swap", "ES_Distance", 0), ("Cruise_EPB", "ES_Distance", 0), ("Signal4", "ES_Distance", 0), ("Close_Distance", "ES_Distance", 0), ("Signal5", "ES_Distance", 0), ("Cruise_Cancel", "ES_Distance", 0), ("Cruise_Set", "ES_Distance", 0), ("Cruise_Resume", "ES_Distance", 0), ("Signal6", "ES_Distance", 0), ("Counter", "ES_LKAS_State", 0), ("Keep_Hands_On_Wheel", "ES_LKAS_State", 0), ("Empty_Box", "ES_LKAS_State", 0), ("Signal1", "ES_LKAS_State", 0), ("LKAS_ACTIVE", "ES_LKAS_State", 0), ("Signal2", "ES_LKAS_State", 0), ("Backward_Speed_Limit_Menu", "ES_LKAS_State", 0), ("LKAS_ENABLE_3", "ES_LKAS_State", 0), ("LKAS_Left_Line_Light_Blink", "ES_LKAS_State", 0), ("LKAS_ENABLE_2", "ES_LKAS_State", 0), ("LKAS_Right_Line_Light_Blink", "ES_LKAS_State", 0), ("LKAS_Left_Line_Visible", "ES_LKAS_State", 0), ("LKAS_Left_Line_Green", "ES_LKAS_State", 0), ("LKAS_Right_Line_Visible", "ES_LKAS_State", 0), ("LKAS_Right_Line_Green", "ES_LKAS_State", 0), ("LKAS_Alert", "ES_LKAS_State", 0), ("Signal3", "ES_LKAS_State", 0), ] checks = [ ("ES_DashStatus", 10), ("ES_Distance", 20), ("ES_LKAS_State", 10), ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 2)
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("WHL_SPD_FL", "WHL_SPD11", 0), ("WHL_SPD_FR", "WHL_SPD11", 0), ("WHL_SPD_RL", "WHL_SPD11", 0), ("WHL_SPD_RR", "WHL_SPD11", 0), ("YAW_RATE", "ESP12", 0), ("CF_Gway_DrvSeatBeltInd", "CGW4", 1), ("CF_Gway_DrvSeatBeltSw", "CGW1", 0), ("CF_Gway_DrvDrSw", "CGW1", 0), # Driver Door ("CF_Gway_AstDrSw", "CGW1", 0), # Passenger door ("CF_Gway_RLDrSw", "CGW2", 0), # Rear reft door ("CF_Gway_RRDrSw", "CGW2", 0), # Rear right door ("CF_Gway_TSigLHSw", "CGW1", 0), ("CF_Gway_TurnSigLh", "CGW1", 0), ("CF_Gway_TSigRHSw", "CGW1", 0), ("CF_Gway_TurnSigRh", "CGW1", 0), ("CF_Gway_ParkBrakeSw", "CGW1", 0), ("CYL_PRES", "ESP12", 0), ("AVH_STAT", "ESP11", 0), ("CF_Clu_CruiseSwState", "CLU11", 0), ("CF_Clu_CruiseSwMain", "CLU11", 0), ("CF_Clu_SldMainSW", "CLU11", 0), ("CF_Clu_ParityBit1", "CLU11", 0), ("CF_Clu_VanzDecimal", "CLU11", 0), ("CF_Clu_Vanz", "CLU11", 0), ("CF_Clu_SPEED_UNIT", "CLU11", 0), ("CF_Clu_DetentOut", "CLU11", 0), ("CF_Clu_RheostatLevel", "CLU11", 0), ("CF_Clu_CluInfo", "CLU11", 0), ("CF_Clu_AmpInfo", "CLU11", 0), ("CF_Clu_AliveCnt1", "CLU11", 0), ("ACCEnable", "TCS13", 0), ("BrakeLight", "TCS13", 0), ("DriverBraking", "TCS13", 0), ("DriverOverride", "TCS13", 0), ("PBRAKE_ACT", "TCS13", 0), ("CF_VSM_Avail", "TCS13", 0), ("ESC_Off_Step", "TCS15", 0), ("AVH_LAMP", "TCS15", 0), ("CF_Lvr_CruiseSet", "LVR12", 0), ("CRUISE_LAMP_M", "EMS16", 0), ("CR_FCA_Alive", "FCA11", 0), ("Supplemental_Counter", "FCA11", 0), ("MainMode_ACC", "SCC11", 0), ("SCCInfoDisplay", "SCC11", 0), ("AliveCounterACC", "SCC11", 0), ("VSetDis", "SCC11", 0), ("ObjValid", "SCC11", 0), ("DriverAlertDisplay", "SCC11", 0), ("TauGapSet", "SCC11", 4), ("ACC_ObjStatus", "SCC11", 0), ("ACC_ObjLatPos", "SCC11", 0), ("ACC_ObjDist", "SCC11", 150), #TK211X value is 204.6 ("ACC_ObjRelSpd", "SCC11", 0), ("Navi_SCC_Curve_Status", "SCC11", 0), ("Navi_SCC_Curve_Act", "SCC11", 0), ("Navi_SCC_Camera_Act", "SCC11", 0), ("Navi_SCC_Camera_Status", "SCC11", 2), ("ACCMode", "SCC12", 0), ("CF_VSM_Prefill", "SCC12", 0), ("CF_VSM_DecCmdAct", "SCC12", 0), ("CF_VSM_HBACmd", "SCC12", 0), ("CF_VSM_Warn", "SCC12", 0), ("CF_VSM_Stat", "SCC12", 0), ("CF_VSM_BeltCmd", "SCC12", 0), ("ACCFailInfo", "SCC12", 0), ("StopReq", "SCC12", 0), ("CR_VSM_DecCmd", "SCC12", 0), ("aReqRaw", "SCC12", 0), #aReqMax ("TakeOverReq", "SCC12", 0), ("PreFill", "SCC12", 0), ("aReqValue", "SCC12", 0), #aReqMin ("CF_VSM_ConfMode", "SCC12", 1), ("AEB_Failinfo", "SCC12", 0), ("AEB_Status", "SCC12", 2), ("AEB_CmdAct", "SCC12", 0), ("AEB_StopReq", "SCC12", 0), ("CR_VSM_Alive", "SCC12", 0), ("CR_VSM_ChkSum", "SCC12", 0), ("SCCDrvModeRValue", "SCC13", 2), ("SCC_Equip", "SCC13", 1), ("AebDrvSetStatus", "SCC13", 0), ("JerkUpperLimit", "SCC14", 0), ("JerkLowerLimit", "SCC14", 0), ("SCCMode2", "SCC14", 0), ("ComfortBandUpper", "SCC14", 0), ("ComfortBandLower", "SCC14", 0), ("UNIT", "TPMS11", 0), ("PRESSURE_FL", "TPMS11", 0), ("PRESSURE_FR", "TPMS11", 0), ("PRESSURE_RL", "TPMS11", 0), ("PRESSURE_RR", "TPMS11", 0), ] checks = [ # address, frequency ("TCS13", 50), ("TCS15", 10), ("CLU11", 50), ("ESP12", 100), ("CGW1", 10), ("CGW2", 5), ("CGW4", 5), ("WHL_SPD11", 50), ] if CP.sccBus == 0 and CP.enableCruise: checks += [ ("SCC11", 50), ("SCC12", 50), ] if CP.fcaBus == 0: signals += [ ("FCA_CmdAct", "FCA11", 0), ("CF_VSM_Warn", "FCA11", 0), ] checks += [("FCA11", 50)] if CP.mdpsBus == 0: signals += [("CR_Mdps_StrColTq", "MDPS12", 0), ("CF_Mdps_Def", "MDPS12", 0), ("CF_Mdps_ToiActive", "MDPS12", 0), ("CF_Mdps_ToiUnavail", "MDPS12", 0), ("CF_Mdps_ToiFlt", "MDPS12", 0), ("CF_Mdps_MsgCount2", "MDPS12", 0), ("CF_Mdps_Chksum2", "MDPS12", 0), ("CF_Mdps_SErr", "MDPS12", 0), ("CR_Mdps_StrTq", "MDPS12", 0), ("CF_Mdps_FailStat", "MDPS12", 0), ("CR_Mdps_OutTq", "MDPS12", 0)] checks += [("MDPS12", 50)] if CP.sasBus == 0: signals += [ ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), ] checks += [("SAS11", 100)] if CP.bsmAvailable or CP.enableBsm: signals += [ ("CF_Lca_Stat", "LCA11", 0), ("CF_Lca_IndLeft", "LCA11", 0), ("CF_Lca_IndRight", "LCA11", 0), ] checks += [("LCA11", 50)] if CP.carFingerprint in ELEC_VEH: signals += [ ("Accel_Pedal_Pos", "E_EMS11", 0), ] checks += [ ("E_EMS11", 50), ] elif CP.carFingerprint in HYBRID_VEH: signals += [ ("CR_Vcu_AccPedDep_Pc", "EV_PC4", 0), ] checks += [ ("EV_PC4", 50), ] elif CP.emsAvailable: signals += [ ("PV_AV_CAN", "EMS12", 0), ("CF_Ems_AclAct", "EMS16", 0), ] checks += [ ("EMS12", 100), ("EMS16", 100), ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: signals += [ ("CF_Clu_InhibitD", "CLU15", 0), ("CF_Clu_InhibitP", "CLU15", 0), ("CF_Clu_InhibitN", "CLU15", 0), ("CF_Clu_InhibitR", "CLU15", 0), ] checks += [("CLU15", 5)] elif CP.carFingerprint in FEATURES["use_tcu_gears"]: signals += [("CUR_GR", "TCU12", 0)] checks += [("TCU12", 100)] elif CP.evgearAvailable: signals += [("Elect_Gear_Shifter", "ELECT_GEAR", 0)] checks += [("ELECT_GEAR", 20)] elif CP.lvrAvailable: signals += [("CF_Lvr_Gear", "LVR12", 0)] checks += [("LVR12", 100)] if CP.carFingerprint in [CAR.SANTA_FE]: checks.remove(("TCS13", 50)) return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0, enforce_checks=False)
def get_can_parser(CP): signals = [ # sig_name, sig_address ("LEFT_BLINK", "BLINK_INFO"), ("RIGHT_BLINK", "BLINK_INFO"), ("HIGH_BEAMS", "BLINK_INFO"), ("STEER_ANGLE", "STEER"), ("STEER_ANGLE_RATE", "STEER_RATE"), ("STEER_TORQUE_SENSOR", "STEER_TORQUE"), ("STEER_TORQUE_MOTOR", "STEER_TORQUE"), ("FL", "WHEEL_SPEEDS"), ("FR", "WHEEL_SPEEDS"), ("RL", "WHEEL_SPEEDS"), ("RR", "WHEEL_SPEEDS"), ] checks = [ # sig_address, frequency ("BLINK_INFO", 10), ("STEER", 67), ("STEER_RATE", 83), ("STEER_TORQUE", 83), ("WHEEL_SPEEDS", 100), ] if CP.carFingerprint in GEN1: signals += [ ("LKAS_BLOCK", "STEER_RATE"), ("LKAS_TRACK_STATE", "STEER_RATE"), ("HANDS_OFF_5_SECONDS", "STEER_RATE"), ("CRZ_ACTIVE", "CRZ_CTRL"), ("CRZ_AVAILABLE", "CRZ_CTRL"), ("CRZ_SPEED", "CRZ_EVENTS"), ("STANDSTILL", "PEDALS"), ("BRAKE_ON", "PEDALS"), ("BRAKE_PRESSURE", "BRAKE"), ("GEAR", "GEAR"), ("DRIVER_SEATBELT", "SEATBELT"), ("FL", "DOORS"), ("FR", "DOORS"), ("BL", "DOORS"), ("BR", "DOORS"), ("PEDAL_GAS", "ENGINE_DATA"), ("SPEED", "ENGINE_DATA"), ("CTR", "CRZ_BTNS"), ("LEFT_BS1", "BSM"), ("RIGHT_BS1", "BSM"), ] checks += [ ("ENGINE_DATA", 100), ("CRZ_CTRL", 50), ("CRZ_EVENTS", 50), ("CRZ_BTNS", 10), ("PEDALS", 50), ("BRAKE", 50), ("SEATBELT", 10), ("DOORS", 10), ("GEAR", 20), ("BSM", 10), ] return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0)
def get_can2_parser(CP): signals = [] checks = [] if CP.mdpsBus == 1: signals += [("CR_Mdps_StrColTq", "MDPS12", 0), ("CF_Mdps_Def", "MDPS12", 0), ("CF_Mdps_ToiActive", "MDPS12", 0), ("CF_Mdps_ToiUnavail", "MDPS12", 0), ("CF_Mdps_ToiFlt", "MDPS12", 0), ("CF_Mdps_MsgCount2", "MDPS12", 0), ("CF_Mdps_Chksum2", "MDPS12", 0), ("CF_Mdps_SErr", "MDPS12", 0), ("CR_Mdps_StrTq", "MDPS12", 0), ("CF_Mdps_FailStat", "MDPS12", 0), ("CR_Mdps_OutTq", "MDPS12", 0)] checks += [("MDPS12", 50)] if CP.sasBus == 1: signals += [ ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), ] checks += [("SAS11", 100)] if CP.sccBus == 1: signals += [ ("MainMode_ACC", "SCC11", 1), ("SCCInfoDisplay", "SCC11", 0), ("AliveCounterACC", "SCC11", 0), ("VSetDis", "SCC11", 30), ("ObjValid", "SCC11", 0), ("DriverAlertDisplay", "SCC11", 0), ("TauGapSet", "SCC11", 4), ("ACC_ObjStatus", "SCC11", 0), ("ACC_ObjLatPos", "SCC11", 0), ("ACC_ObjDist", "SCC11", 150.), ("ACC_ObjRelSpd", "SCC11", 0), ("Navi_SCC_Curve_Status", "SCC11", 0), ("Navi_SCC_Curve_Act", "SCC11", 0), ("Navi_SCC_Camera_Act", "SCC11", 0), ("Navi_SCC_Camera_Status", "SCC11", 2), ("ACCMode", "SCC12", 0), ("CF_VSM_Prefill", "SCC12", 0), ("CF_VSM_DecCmdAct", "SCC12", 0), ("CF_VSM_HBACmd", "SCC12", 0), ("CF_VSM_Warn", "SCC12", 0), ("CF_VSM_Stat", "SCC12", 0), ("CF_VSM_BeltCmd", "SCC12", 0), ("ACCFailInfo", "SCC12", 0), ("StopReq", "SCC12", 0), ("CR_VSM_DecCmd", "SCC12", 0), ("aReqRaw", "SCC12", 0), #aReqMax ("TakeOverReq", "SCC12", 0), ("PreFill", "SCC12", 0), ("aReqValue", "SCC12", 0), #aReqMin ("CF_VSM_ConfMode", "SCC12", 1), ("AEB_Failinfo", "SCC12", 0), ("AEB_Status", "SCC12", 2), ("AEB_CmdAct", "SCC12", 0), ("AEB_StopReq", "SCC12", 0), ("CR_VSM_Alive", "SCC12", 0), ("CR_VSM_ChkSum", "SCC12", 0), ("SCCDrvModeRValue", "SCC13", 2), ("SCC_Equip", "SCC13", 1), ("AebDrvSetStatus", "SCC13", 0), ("JerkUpperLimit", "SCC14", 0), ("JerkLowerLimit", "SCC14", 0), ("SCCMode2", "SCC14", 0), ("ComfortBandUpper", "SCC14", 0), ("ComfortBandLower", "SCC14", 0), ] checks += [ ("SCC11", 50), ("SCC12", 50), ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 1)
def get_adas_can_parser(CP): # this function generates lists for signal, messages and initial values if CP.carFingerprint == CAR.ALTIMA: signals = [ ("DESIRED_ANGLE", "LKAS", 0), ("SET_0x80_2", "LKAS", 0), ("MAX_TORQUE", "LKAS", 0), ("SET_0x80", "LKAS", 0), ("COUNTER", "LKAS", 0), ("LKA_ACTIVE", "LKAS", 0), ("CRUISE_ON", "PRO_PILOT", 0), ] checks = [ ("PRO_PILOT", 100), ] else: signals = [ # sig_name, sig_address, default ("LKAS_ENABLED", "LKAS_SETTINGS", 0), ("CRUISE_ENABLED", "CRUISE_STATE", 0), ("DESIRED_ANGLE", "LKAS", 0), ("SET_0x80_2", "LKAS", 0), ("MAX_TORQUE", "LKAS", 0), ("SET_0x80", "LKAS", 0), ("COUNTER", "LKAS", 0), ("LKA_ACTIVE", "LKAS", 0), # Below are the HUD messages. We copy the stock message and modify ("LARGE_WARNING_FLASHING", "PROPILOT_HUD", 0), ("SIDE_RADAR_ERROR_FLASHING1", "PROPILOT_HUD", 0), ("SIDE_RADAR_ERROR_FLASHING2", "PROPILOT_HUD", 0), ("LEAD_CAR", "PROPILOT_HUD", 0), ("LEAD_CAR_ERROR", "PROPILOT_HUD", 0), ("FRONT_RADAR_ERROR", "PROPILOT_HUD", 0), ("FRONT_RADAR_ERROR_FLASHING", "PROPILOT_HUD", 0), ("SIDE_RADAR_ERROR_FLASHING3", "PROPILOT_HUD", 0), ("LKAS_ERROR_FLASHING", "PROPILOT_HUD", 0), ("SAFETY_SHIELD_ACTIVE", "PROPILOT_HUD", 0), ("RIGHT_LANE_GREEN_FLASH", "PROPILOT_HUD", 0), ("LEFT_LANE_GREEN_FLASH", "PROPILOT_HUD", 0), ("FOLLOW_DISTANCE", "PROPILOT_HUD", 0), ("AUDIBLE_TONE", "PROPILOT_HUD", 0), ("SPEED_SET_ICON", "PROPILOT_HUD", 0), ("SMALL_STEERING_WHEEL_ICON", "PROPILOT_HUD", 0), ("unknown59", "PROPILOT_HUD", 0), ("unknown55", "PROPILOT_HUD", 0), ("unknown26", "PROPILOT_HUD", 0), ("unknown28", "PROPILOT_HUD", 0), ("unknown31", "PROPILOT_HUD", 0), ("SET_SPEED", "PROPILOT_HUD", 0), ("unknown43", "PROPILOT_HUD", 0), ("unknown08", "PROPILOT_HUD", 0), ("unknown05", "PROPILOT_HUD", 0), ("unknown02", "PROPILOT_HUD", 0), ("NA_HIGH_ACCEL_TEMP", "PROPILOT_HUD_INFO_MSG", 0), ("SIDE_RADAR_NA_HIGH_CABIN_TEMP", "PROPILOT_HUD_INFO_MSG", 0), ("SIDE_RADAR_MALFUNCTION", "PROPILOT_HUD_INFO_MSG", 0), ("LKAS_MALFUNCTION", "PROPILOT_HUD_INFO_MSG", 0), ("FRONT_RADAR_MALFUNCTION", "PROPILOT_HUD_INFO_MSG", 0), ("SIDE_RADAR_NA_CLEAN_REAR_CAMERA", "PROPILOT_HUD_INFO_MSG", 0), ("NA_POOR_ROAD_CONDITIONS", "PROPILOT_HUD_INFO_MSG", 0), ("CURRENTLY_UNAVAILABLE", "PROPILOT_HUD_INFO_MSG", 0), ("SAFETY_SHIELD_OFF", "PROPILOT_HUD_INFO_MSG", 0), ("FRONT_COLLISION_NA_FRONT_RADAR_OBSTRUCTION", "PROPILOT_HUD_INFO_MSG", 0), ("PEDAL_MISSAPPLICATION_SYSTEM_ACTIVATED", "PROPILOT_HUD_INFO_MSG", 0), ("SIDE_IMPACT_NA_RADAR_OBSTRUCTION", "PROPILOT_HUD_INFO_MSG", 0), ("WARNING_DO_NOT_ENTER", "PROPILOT_HUD_INFO_MSG", 0), ("SIDE_IMPACT_SYSTEM_OFF", "PROPILOT_HUD_INFO_MSG", 0), ("SIDE_IMPACT_MALFUNCTION", "PROPILOT_HUD_INFO_MSG", 0), ("FRONT_COLLISION_MALFUNCTION", "PROPILOT_HUD_INFO_MSG", 0), ("SIDE_RADAR_MALFUNCTION2", "PROPILOT_HUD_INFO_MSG", 0), ("LKAS_MALFUNCTION2", "PROPILOT_HUD_INFO_MSG", 0), ("FRONT_RADAR_MALFUNCTION2", "PROPILOT_HUD_INFO_MSG", 0), ("PROPILOT_NA_MSGS", "PROPILOT_HUD_INFO_MSG", 0), ("BOTTOM_MSG", "PROPILOT_HUD_INFO_MSG", 0), ("HANDS_ON_WHEEL_WARNING", "PROPILOT_HUD_INFO_MSG", 0), ("WARNING_STEP_ON_BRAKE_NOW", "PROPILOT_HUD_INFO_MSG", 0), ("PROPILOT_NA_FRONT_CAMERA_OBSTRUCTED", "PROPILOT_HUD_INFO_MSG", 0), ("PROPILOT_NA_HIGH_CABIN_TEMP", "PROPILOT_HUD_INFO_MSG", 0), ("WARNING_PROPILOT_MALFUNCTION", "PROPILOT_HUD_INFO_MSG", 0), ("ACC_UNAVAILABLE_HIGH_CABIN_TEMP", "PROPILOT_HUD_INFO_MSG", 0), ("ACC_NA_FRONT_CAMERA_IMPARED", "PROPILOT_HUD_INFO_MSG", 0), ("unknown07", "PROPILOT_HUD_INFO_MSG", 0), ("unknown10", "PROPILOT_HUD_INFO_MSG", 0), ("unknown15", "PROPILOT_HUD_INFO_MSG", 0), ("unknown23", "PROPILOT_HUD_INFO_MSG", 0), ("unknown19", "PROPILOT_HUD_INFO_MSG", 0), ("unknown31", "PROPILOT_HUD_INFO_MSG", 0), ("unknown32", "PROPILOT_HUD_INFO_MSG", 0), ("unknown46", "PROPILOT_HUD_INFO_MSG", 0), ("unknown61", "PROPILOT_HUD_INFO_MSG", 0), ("unknown55", "PROPILOT_HUD_INFO_MSG", 0), ("unknown50", "PROPILOT_HUD_INFO_MSG", 0), ] checks = [ ("CRUISE_STATE", 50), ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 2)
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("WHL_SPD_FL", "WHL_SPD11", 0), ("WHL_SPD_FR", "WHL_SPD11", 0), ("WHL_SPD_RL", "WHL_SPD11", 0), ("WHL_SPD_RR", "WHL_SPD11", 0), ("YAW_RATE", "ESP12", 0), ("CF_Gway_DrvSeatBeltInd", "CGW4", 1), ("CF_Gway_DrvSeatBeltSw", "CGW1", 0), ("CF_Gway_DrvDrSw", "CGW1", 0), # Driver Door ("CF_Gway_AstDrSw", "CGW1", 0), # Passenger door ("CF_Gway_RLDrSw", "CGW2", 0), # Rear reft door ("CF_Gway_RRDrSw", "CGW2", 0), # Rear right door ("CF_Gway_TurnSigLh", "CGW1", 0), ("CF_Gway_TurnSigRh", "CGW1", 0), ("CF_Gway_ParkBrakeSw", "CGW1", 0), ("CYL_PRES", "ESP12", 0), ("CF_Clu_CruiseSwState", "CLU11", 0), ("CF_Clu_CruiseSwMain", "CLU11", 0), ("CF_Clu_SldMainSW", "CLU11", 0), ("CF_Clu_ParityBit1", "CLU11", 0), ("CF_Clu_VanzDecimal", "CLU11", 0), ("CF_Clu_Vanz", "CLU11", 0), ("CF_Clu_SPEED_UNIT", "CLU11", 0), ("CF_Clu_DetentOut", "CLU11", 0), ("CF_Clu_RheostatLevel", "CLU11", 0), ("CF_Clu_CluInfo", "CLU11", 0), ("CF_Clu_AmpInfo", "CLU11", 0), ("CF_Clu_AliveCnt1", "CLU11", 0), ("ACCEnable", "TCS13", 0), ("ACC_REQ", "TCS13", 0), ("BrakeLight", "TCS13", 0), ("DriverBraking", "TCS13", 0), ("StandStill", "TCS13", 0), ("PBRAKE_ACT", "TCS13", 0), ("ESC_Off_Step", "TCS15", 0), ("AVH_LAMP", "TCS15", 0), ("CF_Lvr_GearInf", "LVR11", 0), # Transmission Gear (0 = N or P, 1-8 = Fwd, 14 = Rev) ("CR_Mdps_StrColTq", "MDPS12", 0), ("CF_Mdps_ToiActive", "MDPS12", 0), ("CF_Mdps_ToiUnavail", "MDPS12", 0), ("CF_Mdps_FailStat", "MDPS12", 0), ("CR_Mdps_OutTq", "MDPS12", 0), ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), ("MainMode_ACC", "SCC11", 0), ("VSetDis", "SCC11", 0), ("SCCInfoDisplay", "SCC11", 0), ("ACC_ObjDist", "SCC11", 0), ("ACCMode", "SCC12", 1), ] checks = [ # address, frequency ("MDPS12", 50), ("TCS13", 50), ("TCS15", 10), ("CLU11", 50), ("ESP12", 100), ("CGW1", 10), ("CGW4", 5), ("WHL_SPD11", 50), ("SAS11", 100), ] if not CP.openpilotLongitudinalControl: checks += [ ("SCC11", 50), ("SCC12", 50), ] if CP.carFingerprint in FEATURES["use_bsm"]: signals += [ ("CF_Lca_IndLeft", "LCA11", 0), ("CF_Lca_IndRight", "LCA11", 0), ] checks += [("LCA11", 50)] if CP.carFingerprint in EV_HYBRID: signals += [ ("Accel_Pedal_Pos", "E_EMS11", 0), ] checks += [ ("E_EMS11", 50), ] else: signals += [ ("PV_AV_CAN", "EMS12", 0), ("CF_Ems_AclAct", "EMS16", 0), ] checks += [ ("EMS12", 100), ("EMS16", 100), ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: signals += [ ("CF_Clu_InhibitD", "CLU15", 0), ("CF_Clu_InhibitP", "CLU15", 0), ("CF_Clu_InhibitN", "CLU15", 0), ("CF_Clu_InhibitR", "CLU15", 0), ] checks += [("CLU15", 5)] elif CP.carFingerprint in FEATURES["use_tcu_gears"]: signals += [("CUR_GR", "TCU12", 0)] checks += [("TCU12", 100)] elif CP.carFingerprint in FEATURES["use_elect_gears"]: signals += [("Elect_Gear_Shifter", "ELECT_GEAR", 0)] checks += [("ELECT_GEAR", 20)] else: signals += [("CF_Lvr_Gear", "LVR12", 0)] checks += [("LVR12", 100)] if CP.carFingerprint in FEATURES["use_fca"]: signals += [ ("FCA_CmdAct", "FCA11", 0), ("CF_VSM_Warn", "FCA11", 0), ] if not CP.openpilotLongitudinalControl: checks += [("FCA11", 50)] else: signals += [ ("AEB_CmdAct", "SCC12", 0), ("CF_VSM_Warn", "SCC12", 0), ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
def get_cam_can_parser(CP): if CP.carFingerprint in PREGLOBAL_CARS: signals = [ ("Cruise_Set_Speed", "ES_DashStatus", 0), ("Not_Ready_Startup", "ES_DashStatus", 0), ("Car_Follow", "ES_DashStatus", 0), ("Cruise_Throttle", "ES_Distance", 0), ("Signal1", "ES_Distance", 0), ("Car_Follow", "ES_Distance", 0), ("Signal2", "ES_Distance", 0), ("Brake_On", "ES_Distance", 0), ("Distance_Swap", "ES_Distance", 0), ("Standstill", "ES_Distance", 0), ("Signal3", "ES_Distance", 0), ("Close_Distance", "ES_Distance", 0), ("Signal4", "ES_Distance", 0), ("Standstill_2", "ES_Distance", 0), ("Cruise_Fault", "ES_Distance", 0), ("Signal5", "ES_Distance", 0), ("Counter", "ES_Distance", 0), ("Signal6", "ES_Distance", 0), ("Cruise_Button", "ES_Distance", 0), ("Signal7", "ES_Distance", 0), ("LKAS_Command", "ES_LKAS", 0), ] checks = [ ("ES_DashStatus", 20), ("ES_Distance", 20), ("ES_LKAS", 2), ] else: signals = [ ("Counter", "ES_DashStatus", 0), ("PCB_Off", "ES_DashStatus", 0), ("LDW_Off", "ES_DashStatus", 0), ("Signal1", "ES_DashStatus", 0), ("Cruise_State_Msg", "ES_DashStatus", 0), ("LKAS_State_Msg", "ES_DashStatus", 0), ("Signal2", "ES_DashStatus", 0), ("Cruise_Soft_Disable", "ES_DashStatus", 0), ("EyeSight_Status_Msg", "ES_DashStatus", 0), ("Signal3", "ES_DashStatus", 0), ("Cruise_Distance", "ES_DashStatus", 0), ("Signal4", "ES_DashStatus", 0), ("Conventional_Cruise", "ES_DashStatus", 0), ("Signal5", "ES_DashStatus", 0), ("Cruise_Disengaged", "ES_DashStatus", 0), ("Cruise_Activated", "ES_DashStatus", 0), ("Signal6", "ES_DashStatus", 0), ("Cruise_Set_Speed", "ES_DashStatus", 0), ("Cruise_Fault", "ES_DashStatus", 0), ("Cruise_On", "ES_DashStatus", 0), ("Display_Own_Car", "ES_DashStatus", 0), ("Brake_Lights", "ES_DashStatus", 0), ("Car_Follow", "ES_DashStatus", 0), ("Signal7", "ES_DashStatus", 0), ("Far_Distance", "ES_DashStatus", 0), ("Cruise_State", "ES_DashStatus", 0), ("Counter", "ES_LKAS_State", 0), ("LKAS_Alert_Msg", "ES_LKAS_State", 0), ("Signal1", "ES_LKAS_State", 0), ("LKAS_ACTIVE", "ES_LKAS_State", 0), ("LKAS_Dash_State", "ES_LKAS_State", 0), ("Signal2", "ES_LKAS_State", 0), ("Backward_Speed_Limit_Menu", "ES_LKAS_State", 0), ("LKAS_Left_Line_Enable", "ES_LKAS_State", 0), ("LKAS_Left_Line_Light_Blink", "ES_LKAS_State", 0), ("LKAS_Right_Line_Enable", "ES_LKAS_State", 0), ("LKAS_Right_Line_Light_Blink", "ES_LKAS_State", 0), ("LKAS_Left_Line_Visible", "ES_LKAS_State", 0), ("LKAS_Right_Line_Visible", "ES_LKAS_State", 0), ("LKAS_Alert", "ES_LKAS_State", 0), ("Signal3", "ES_LKAS_State", 0), ("LKAS_Output", "ES_LKAS", 0), ] checks = [ ("ES_DashStatus", 10), ("ES_LKAS_State", 10), ("ES_LKAS", 2), ] if CP.carFingerprint not in [CAR.CROSSTREK_2020H, CAR.OUTBACK]: signals += [ ("Counter", "ES_Distance", 0), ("Signal1", "ES_Distance", 0), ("Cruise_Fault", "ES_Distance", 0), ("Cruise_Throttle", "ES_Distance", 0), ("Signal2", "ES_Distance", 0), ("Car_Follow", "ES_Distance", 0), ("Signal3", "ES_Distance", 0), ("Cruise_Brake_Active", "ES_Distance", 0), ("Distance_Swap", "ES_Distance", 0), ("Cruise_EPB", "ES_Distance", 0), ("Signal4", "ES_Distance", 0), ("Close_Distance", "ES_Distance", 0), ("Signal5", "ES_Distance", 0), ("Cruise_Cancel", "ES_Distance", 0), ("Cruise_Set", "ES_Distance", 0), ("Cruise_Resume", "ES_Distance", 0), ("Signal6", "ES_Distance", 0), ] checks += [ ("ES_Distance", 20), ] return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 2)
if CP.carFingerprint in TSS2_CAR: signals += [("L_ADJACENT", "BSM", 0)] signals += [("L_APPROACHING", "BSM", 0)] signals += [("R_ADJACENT", "BSM", 0)] <<<<<<< HEAD logging.info("DBC.CP.carFingerprint.pt: %s", DBC[CP.carFingerprint]['pt']) logging.info("signals: %s", signals) logging.info("checks: %s", checks) ======= signals += [("R_APPROACHING", "BSM", 0)] >>>>>>> a3d0c3b92112be5fdcc52d9675445f7f763f62eb return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0) @staticmethod def get_cam_can_parser(CP): <<<<<<< HEAD logging.info("CarState get_cam_can_parser") signals = [("FORCE", "PRE_COLLISION", 0), ("PRECOLLISION_ACTIVE", "PRE_COLLISION", 0)] ======= signals = [ ("FORCE", "PRE_COLLISION", 0), ("PRECOLLISION_ACTIVE", "PRE_COLLISION", 0) ] >>>>>>> a3d0c3b92112be5fdcc52d9675445f7f763f62eb # use steering message to check if panda is connected to frc
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("STEER_ANGLE", "STEER_ANGLE_SENSOR", 0), ("GEAR", "GEAR_PACKET", 0), ("BRAKE_PRESSED", "BRAKE_MODULE", 0), ("GAS_PEDAL", "GAS_PEDAL", 0), ("WHEEL_SPEED_FL", "WHEEL_SPEEDS", 0), ("WHEEL_SPEED_FR", "WHEEL_SPEEDS", 0), ("WHEEL_SPEED_RL", "WHEEL_SPEEDS", 0), ("WHEEL_SPEED_RR", "WHEEL_SPEEDS", 0), ("DOOR_OPEN_FL", "SEATS_DOORS", 1), ("DOOR_OPEN_FR", "SEATS_DOORS", 1), ("DOOR_OPEN_RL", "SEATS_DOORS", 1), ("DOOR_OPEN_RR", "SEATS_DOORS", 1), ("SEATBELT_DRIVER_UNLATCHED", "SEATS_DOORS", 1), ("TC_DISABLED", "ESP_CONTROL", 1), ("STEER_FRACTION", "STEER_ANGLE_SENSOR", 0), ("STEER_RATE", "STEER_ANGLE_SENSOR", 0), ("CRUISE_ACTIVE", "PCM_CRUISE", 0), ("CRUISE_STATE", "PCM_CRUISE", 0), ("GAS_RELEASED", "PCM_CRUISE", 1), ("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR", 0), ("STEER_TORQUE_EPS", "STEER_TORQUE_SENSOR", 0), ("STEER_ANGLE", "STEER_TORQUE_SENSOR", 0), ("TURN_SIGNALS", "STEERING_LEVERS", 3), # 3 is no blinkers ("LKA_STATE", "EPS_STATUS", 0), ("BRAKE_LIGHTS_ACC", "ESP_CONTROL", 0), ("AUTO_HIGH_BEAM", "LIGHT_STALK", 0), ] checks = [ #("BRAKE_MODULE", 40), #("GAS_PEDAL", 33), ("WHEEL_SPEEDS", 80), ("STEER_ANGLE_SENSOR", 80), ("PCM_CRUISE", 33), ("STEER_TORQUE_SENSOR", 50), ("EPS_STATUS", 25), ] if CP.carFingerprint in [CAR.LEXUS_ISH, CAR.LEXUS_GSH]: signals.append(("GAS_PEDAL", "GAS_PEDAL_ALT", 0)) signals.append(("MAIN_ON", "PCM_CRUISE_ALT", 0)) signals.append(("SET_SPEED", "PCM_CRUISE_ALT", 0)) signals.append(("AUTO_HIGH_BEAM", "LIGHT_STALK_ISH", 0)) checks += [ ("BRAKE_MODULE", 50), ("GAS_PEDAL_ALT", 50), ("PCM_CRUISE_ALT", 1), ] else: signals += [ ("AUTO_HIGH_BEAM", "LIGHT_STALK", 0), ("GAS_PEDAL", "GAS_PEDAL", 0), ] checks += [ ("BRAKE_MODULE", 40), ("GAS_PEDAL", 33), ] if CP.carFingerprint in [CAR.LEXUS_IS, CAR.LEXUS_NXT]: signals.append(("MAIN_ON", "DSU_CRUISE", 0)) signals.append(("SET_SPEED", "DSU_CRUISE", 0)) checks.append(("DSU_CRUISE", 5)) else: signals.append(("MAIN_ON", "PCM_CRUISE_2", 0)) signals.append(("SET_SPEED", "PCM_CRUISE_2", 0)) signals.append(("LOW_SPEED_LOCKOUT", "PCM_CRUISE_2", 0)) checks.append(("PCM_CRUISE_2", 33)) if CP.carFingerprint == CAR.PRIUS: signals += [("STATE", "AUTOPARK_STATUS", 0)] # add gas interceptor reading if we are using it if CP.enableGasInterceptor: signals.append(("INTERCEPTOR_GAS", "GAS_SENSOR", 0)) signals.append(("INTERCEPTOR_GAS2", "GAS_SENSOR", 0)) checks.append(("GAS_SENSOR", 50)) if CP.carFingerprint in TSS2_CAR: signals += [("L_ADJACENT", "BSM", 0)] signals += [("L_APPROACHING", "BSM", 0)] signals += [("R_ADJACENT", "BSM", 0)] signals += [("R_APPROACHING", "BSM", 0)] if Params().get('dp_toyota_zss') == b'1': signals += [("ZORRO_STEER", "SECONDARY_STEER_ANGLE", 0)] checks = [] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
def get_can_parser(CP): # this function generates lists for signal, messages and initial values signals = [ # sig_name, sig_address, default ("LWI_Lenkradwinkel", "LWI_01", 0), # Absolute steering angle ("LWI_VZ_Lenkradwinkel", "LWI_01", 0), # Steering angle sign ("LWI_Lenkradw_Geschw", "LWI_01", 0), # Absolute steering rate ("LWI_VZ_Lenkradw_Geschw", "LWI_01", 0), # Steering rate sign ("ESP_VL_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, front left ("ESP_VR_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, front right ("ESP_HL_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, rear left ("ESP_HR_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, rear right ("ESP_Gierrate", "ESP_02", 0), # Absolute yaw rate ("ESP_VZ_Gierrate", "ESP_02", 0), # Yaw rate sign ("ZV_FT_offen", "Gateway_72", 0), # Door open, driver ("ZV_BT_offen", "Gateway_72", 0), # Door open, passenger ("ZV_HFS_offen", "Gateway_72", 0), # Door open, rear left ("ZV_HBFS_offen", "Gateway_72", 0), # Door open, rear right ("ZV_HD_offen", "Gateway_72", 0), # Trunk or hatch open ("BH_Blinker_li", "Gateway_72", 0), # Left turn signal on ("BH_Blinker_re", "Gateway_72", 0), # Right turn signal on ("GE_Fahrstufe", "Getriebe_11", 0), # Auto trans gear selector position ("AB_Gurtschloss_FA", "Airbag_02", 0), # Seatbelt status, driver ("AB_Gurtschloss_BF", "Airbag_02", 0), # Seatbelt status, passenger ("ESP_Fahrer_bremst", "ESP_05", 0), # Brake pedal pressed ("ESP_Status_Bremsdruck", "ESP_05", 0), # Brakes applied ("ESP_Bremsdruck", "ESP_05", 0), # Brake pressure applied ("MO_Fahrpedalrohwert_01", "Motor_20", 0), # Accelerator pedal value ("MO_Kuppl_schalter", "Motor_14", 0), # Clutch switch ("Driver_Strain", "EPS_01", 0), # Absolute driver torque input ("Driver_Strain_VZ", "EPS_01", 0), # Driver torque input sign ("HCA_Ready", "EPS_01", 0), # Steering rack HCA support configured ("ESP_Tastung_passiv", "ESP_21", 0), # Stability control disabled ("KBI_MFA_v_Einheit_02", "Einheiten_01", 0), # MPH vs KMH speed display ("KBI_Handbremse", "Kombi_01", 0), # Manual handbrake applied ("TSK_Status", "TSK_06", 0), # ACC engagement status from drivetrain coordinator ("TSK_Fahrzeugmasse_02", "Motor_16", 0), # Estimated vehicle mass from drivetrain coordinator ("ACC_Status_ACC", "ACC_06", 0), # ACC engagement status ("ACC_Typ", "ACC_06", 0), # ACC type (follow to stop, stop&go) ("SetSpeed", "ACC_02", 0), # ACC set speed ("GRA_Hauptschalter", "GRA_ACC_01", 0), # ACC button, on/off ("GRA_Abbrechen", "GRA_ACC_01", 0), # ACC button, cancel ("GRA_Tip_Setzen", "GRA_ACC_01", 0), # ACC button, set ("GRA_Tip_Hoch", "GRA_ACC_01", 0), # ACC button, increase or accel ("GRA_Tip_Runter", "GRA_ACC_01", 0), # ACC button, decrease or decel ("GRA_Tip_Wiederaufnahme", "GRA_ACC_01", 0), # ACC button, resume ("GRA_Verstellung_Zeitluecke", "GRA_ACC_01", 0), # ACC button, time gap adj ("GRA_Typ_Hauptschalter", "GRA_ACC_01", 0), # ACC main button type ("GRA_Tip_Stufe_2", "GRA_ACC_01", 0), # unknown related to stalk type ("GRA_ButtonTypeInfo", "GRA_ACC_01", 0), # unknown related to stalk type ("COUNTER", "GRA_ACC_01", 0), # GRA_ACC_01 CAN message counter ] checks = [ # sig_address, frequency ("LWI_01", 100 ), # From J500 Steering Assist with integrated sensors ("EPS_01", 100), # From J500 Steering Assist with integrated sensors ("ESP_19", 100), # From J104 ABS/ESP controller ("ESP_05", 50), # From J104 ABS/ESP controller ("ESP_21", 50), # From J104 ABS/ESP controller ("ACC_06", 50), # From J428 ACC radar control module ("Motor_20", 50), # From J623 Engine control module ("TSK_06", 50), # From J623 Engine control module ("GRA_ACC_01", 33), # From J??? steering wheel control buttons ("ACC_02", 17), # From J428 ACC radar control module ("Getriebe_11", 20), # From J743 Auto transmission control module ("Gateway_72", 10), # From J533 CAN gateway (aggregated data) ("Motor_14", 10), # From J623 Engine control module ("Airbag_02", 5), # From J234 Airbag control module ("Kombi_01", 2), # From J285 Instrument cluster ("Motor_16", 2), # From J623 Engine control module ("Einheiten_01", 1), # From J??? not known if gateway, cluster, or BCM ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, CANBUS.pt)
def get_can_parser(CP): signals = [ # sig_name, sig_address ("LWI_Lenkradwinkel", "LWI_01"), # Absolute steering angle ("LWI_VZ_Lenkradwinkel", "LWI_01"), # Steering angle sign ("LWI_Lenkradw_Geschw", "LWI_01"), # Absolute steering rate ("LWI_VZ_Lenkradw_Geschw", "LWI_01"), # Steering rate sign ("ESP_VL_Radgeschw_02", "ESP_19"), # ABS wheel speed, front left ("ESP_VR_Radgeschw_02", "ESP_19"), # ABS wheel speed, front right ("ESP_HL_Radgeschw_02", "ESP_19"), # ABS wheel speed, rear left ("ESP_HR_Radgeschw_02", "ESP_19"), # ABS wheel speed, rear right ("ESP_Gierrate", "ESP_02"), # Absolute yaw rate ("ESP_VZ_Gierrate", "ESP_02"), # Yaw rate sign ("ZV_FT_offen", "Gateway_72"), # Door open, driver ("ZV_BT_offen", "Gateway_72"), # Door open, passenger ("ZV_HFS_offen", "Gateway_72"), # Door open, rear left ("ZV_HBFS_offen", "Gateway_72"), # Door open, rear right ("ZV_HD_offen", "Gateway_72"), # Trunk or hatch open ("Comfort_Signal_Left", "Blinkmodi_02" ), # Left turn signal including comfort blink interval ("Comfort_Signal_Right", "Blinkmodi_02" ), # Right turn signal including comfort blink interval ("AB_Gurtschloss_FA", "Airbag_02"), # Seatbelt status, driver ("AB_Gurtschloss_BF", "Airbag_02"), # Seatbelt status, passenger ("ESP_Fahrer_bremst", "ESP_05"), # Brake pedal pressed ("ESP_Bremsdruck", "ESP_05"), # Brake pressure applied ("MO_Fahrpedalrohwert_01", "Motor_20"), # Accelerator pedal value ("EPS_Lenkmoment", "LH_EPS_03"), # Absolute driver torque input ("EPS_VZ_Lenkmoment", "LH_EPS_03"), # Driver torque input sign ("EPS_HCA_Status", "LH_EPS_03"), # EPS HCA control status ("ESP_Tastung_passiv", "ESP_21"), # Stability control disabled ("ESP_Haltebestaetigung", "ESP_21"), # ESP hold confirmation ("KBI_Handbremse", "Kombi_01"), # Manual handbrake applied ("TSK_Status", "TSK_06"), # ACC engagement status from drivetrain coordinator ("GRA_Hauptschalter", "GRA_ACC_01"), # ACC button, on/off ("GRA_Abbrechen", "GRA_ACC_01"), # ACC button, cancel ("GRA_Tip_Setzen", "GRA_ACC_01"), # ACC button, set ("GRA_Tip_Hoch", "GRA_ACC_01"), # ACC button, increase or accel ("GRA_Tip_Runter", "GRA_ACC_01"), # ACC button, decrease or decel ("GRA_Tip_Wiederaufnahme", "GRA_ACC_01"), # ACC button, resume ("GRA_Verstellung_Zeitluecke", "GRA_ACC_01"), # ACC button, time gap adj ("GRA_Typ_Hauptschalter", "GRA_ACC_01"), # ACC main button type ("GRA_Tip_Stufe_2", "GRA_ACC_01"), # unknown related to stalk type ("GRA_ButtonTypeInfo", "GRA_ACC_01"), # unknown related to stalk type ("COUNTER", "GRA_ACC_01"), # GRA_ACC_01 CAN message counter ] checks = [ # sig_address, frequency ("LWI_01", 100 ), # From J500 Steering Assist with integrated sensors ("LH_EPS_03", 100), # From J500 Steering Assist with integrated sensors ("ESP_19", 100), # From J104 ABS/ESP controller ("ESP_05", 50), # From J104 ABS/ESP controller ("ESP_21", 50), # From J104 ABS/ESP controller ("Motor_20", 50), # From J623 Engine control module ("TSK_06", 50), # From J623 Engine control module ("ESP_02", 50), # From J104 ABS/ESP controller ("GRA_ACC_01", 33 ), # From J533 CAN gateway (via LIN from steering wheel controls) ("Gateway_72", 10), # From J533 CAN gateway (aggregated data) ("Airbag_02", 5), # From J234 Airbag control module ("Kombi_01", 2), # From J285 Instrument cluster ( "Blinkmodi_02", 1 ), # From J519 BCM (sent at 1Hz when no lights active, 50Hz when active) ] if CP.transmissionType == TransmissionType.automatic: signals.append( ("GE_Fahrstufe", "Getriebe_11")) # Auto trans gear selector position checks.append(("Getriebe_11", 20)) # From J743 Auto transmission control module elif CP.transmissionType == TransmissionType.direct: signals.append( ("GearPosition", "EV_Gearshift")) # EV gear selector position checks.append( ("EV_Gearshift", 10)) # From J??? unknown EV control module elif CP.transmissionType == TransmissionType.manual: signals += [ ("MO_Kuppl_schalter", "Motor_14"), # Clutch switch ("BCM1_Rueckfahrlicht_Schalter", "Gateway_72") ] # Reverse light from BCM checks.append(("Motor_14", 10)) # From J623 Engine control module if CP.networkLocation == NetworkLocation.fwdCamera: # Radars are here on CANBUS.pt signals += MqbExtraSignals.fwd_radar_signals checks += MqbExtraSignals.fwd_radar_checks if CP.enableBsm: signals += MqbExtraSignals.bsm_radar_signals checks += MqbExtraSignals.bsm_radar_checks return CANParser(DBC_FILES.mqb, signals, checks, CANBUS.pt)
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("WHL_SPD_FL", "WHL_SPD11", 0), ("WHL_SPD_FR", "WHL_SPD11", 0), ("WHL_SPD_RL", "WHL_SPD11", 0), ("WHL_SPD_RR", "WHL_SPD11", 0), ("YAW_RATE", "ESP12", 0), ("CF_Gway_DrvSeatBeltInd", "CGW4", 1), ("CF_Gway_DrvSeatBeltSw", "CGW1", 0), ("CF_Gway_DrvDrSw", "CGW1", 0), # Driver Door ("CF_Gway_AstDrSw", "CGW1", 0), # Passenger door ("CF_Gway_RLDrSw", "CGW2", 0), # Rear reft door ("CF_Gway_RRDrSw", "CGW2", 0), # Rear right door ("CF_Gway_TSigLHSw", "CGW1", 0), ("CF_Gway_TurnSigLh", "CGW1", 0), ("CF_Gway_TSigRHSw", "CGW1", 0), ("CF_Gway_TurnSigRh", "CGW1", 0), ("CF_Gway_ParkBrakeSw", "CGW1", 0), ("CYL_PRES", "ESP12", 0), ("CF_Clu_CruiseSwState", "CLU11", 0), ("CF_Clu_CruiseSwMain", "CLU11", 0), ("CF_Clu_SldMainSW", "CLU11", 0), ("CF_Clu_ParityBit1", "CLU11", 0), ("CF_Clu_VanzDecimal", "CLU11", 0), ("CF_Clu_Vanz", "CLU11", 0), ("CF_Clu_SPEED_UNIT", "CLU11", 0), ("CF_Clu_DetentOut", "CLU11", 0), ("CF_Clu_RheostatLevel", "CLU11", 0), ("CF_Clu_CluInfo", "CLU11", 0), ("CF_Clu_AmpInfo", "CLU11", 0), ("CF_Clu_AliveCnt1", "CLU11", 0), ("ACCEnable", "TCS13", 0), ("BrakeLight", "TCS13", 0), ("DriverBraking", "TCS13", 0), ("ESC_Off_Step", "TCS15", 0), ("CF_Lvr_GearInf", "LVR11", 0), # Transmission Gear (0 = N or P, 1-8 = Fwd, 14 = Rev) ("CR_Mdps_StrColTq", "MDPS12", 0), ("CF_Mdps_ToiActive", "MDPS12", 0), ("CF_Mdps_ToiUnavail", "MDPS12", 0), ("CF_Mdps_FailStat", "MDPS12", 0), ("CR_Mdps_OutTq", "MDPS12", 0), ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), ("PV_AV_CAN", "EMS12", 0), ("CF_Ems_AclAct", "EMS16", 0), ] checks = [ # address, frequency ("MDPS12", 50), ("TCS13", 50), ("TCS15", 10), ("CLU11", 50), ("ESP12", 100), ("CGW1", 10), ("CGW4", 5), ("WHL_SPD11", 50), ("SAS11", 100), ("EMS12", 100), ("EMS16", 100), ] signals += [ ("CRUISE_LAMP_M", "EMS16", 0), ("CF_Lvr_CruiseSet", "LVR12", 0), # ("Vision_ObjDist_Low","V_OptData_739", 0), ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: signals += [ ("CF_Clu_InhibitD", "CLU15", 0), ("CF_Clu_InhibitP", "CLU15", 0), ("CF_Clu_InhibitN", "CLU15", 0), ("CF_Clu_InhibitR", "CLU15", 0), ] checks += [("CLU15", 5)] elif CP.carFingerprint in FEATURES["use_tcu_gears"]: signals += [("CUR_GR", "TCU12", 0)] checks += [("TCU12", 100)] elif CP.carFingerprint in FEATURES["use_elect_gears"]: signals += [("Elect_Gear_Shifter", "ELECT_GEAR", 0)] checks += [("ELECT_GEAR", 20)] else: signals += [("CF_Lvr_Gear", "LVR12", 0)] checks += [("LVR12", 100)] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
def test_honda_brake(self): self.longMessage = True sendcan = messaging.pub_sock('sendcan') car_name = HONDA.CIVIC params = CarInterface.get_params(car_name) CI = CarInterface(params, CarController) # Get parser parser_signals = [ ('COMPUTER_BRAKE', 'BRAKE_COMMAND', 0), ('BRAKE_PUMP_REQUEST', 'BRAKE_COMMAND', 0), # pump_on ('CRUISE_OVERRIDE', 'BRAKE_COMMAND', 0), # pcm_override ('CRUISE_FAULT_CMD', 'BRAKE_COMMAND', 0), # pcm_fault_cmd ('CRUISE_CANCEL_CMD', 'BRAKE_COMMAND', 0), # pcm_cancel_cmd ('COMPUTER_BRAKE_REQUEST', 'BRAKE_COMMAND', 0), # brake_rq ('SET_ME_0X80', 'BRAKE_COMMAND', 0), ('BRAKE_LIGHTS', 'BRAKE_COMMAND', 0), # brakelights ('FCW', 'BRAKE_COMMAND', 0), ] parser = CANParser(CI.cp.dbc_name, parser_signals, [], 0, sendcan=True, tcp_addr="127.0.0.1") time.sleep(0.2) # Slow joiner syndrome VA = car.CarControl.HUDControl.VisualAlert for override in [True, False]: for cancel in [True, False]: for fcw in [True, False]: steps = 25 if not override and not cancel else 2 for brake in np.linspace(0., 0.95, steps): control = car.CarControl.new_message() hud = car.CarControl.HUDControl.new_message() if fcw: hud.visualAlert = VA.fcw cruise = car.CarControl.CruiseControl.new_message() cruise.cancel = cancel cruise.override = override actuators = car.CarControl.Actuators.new_message() actuators.brake = float(brake) control.enabled = True control.actuators = actuators control.hudControl = hud control.cruiseControl = cruise CI.update(control) CI.CS.steer_not_allowed = False for _ in range(20): can_sends = CI.apply(control) sendcan.send(can_list_to_can_capnp(can_sends, msgtype='sendcan')) for _ in range(5): parser.update(int(sec_since_boot() * 1e9), False) time.sleep(0.01) brake_command = parser.vl['BRAKE_COMMAND']['COMPUTER_BRAKE'] min_expected_brake = int(1024 / 4 * (actuators.brake - 0.02)) max_expected_brake = int(1024 / 4 * (actuators.brake + 0.02)) braking = actuators.brake > 0 braking_ok = min_expected_brake <= brake_command <= max_expected_brake if steps == 2: braking_ok = True self.assertTrue(braking_ok, msg="Car: %s, brake %.2f" % (car_name, brake)) self.assertEqual(0x80, parser.vl['BRAKE_COMMAND']['SET_ME_0X80']) self.assertEqual(braking, parser.vl['BRAKE_COMMAND']['BRAKE_PUMP_REQUEST']) self.assertEqual(braking, parser.vl['BRAKE_COMMAND']['COMPUTER_BRAKE_REQUEST']) self.assertEqual(braking, parser.vl['BRAKE_COMMAND']['BRAKE_LIGHTS']) self.assertFalse(parser.vl['BRAKE_COMMAND']['CRUISE_FAULT_CMD']) self.assertEqual(override, parser.vl['BRAKE_COMMAND']['CRUISE_OVERRIDE']) self.assertEqual(cancel, parser.vl['BRAKE_COMMAND']['CRUISE_CANCEL_CMD']) self.assertEqual(fcw, bool(parser.vl['BRAKE_COMMAND']['FCW']))
def test_honda_lkas_hud(self): self.longMessage = True sendcan = messaging.pub_sock('sendcan') car_name = HONDA.CIVIC params = CarInterface.get_params(car_name) CI = CarInterface(params, CarController) # Get parser parser_signals = [ ('SET_ME_X41', 'LKAS_HUD', 0), ('SET_ME_X48', 'LKAS_HUD', 0), ('STEERING_REQUIRED', 'LKAS_HUD', 0), ('SOLID_LANES', 'LKAS_HUD', 0), ('LEAD_SPEED', 'RADAR_HUD', 0), ('LEAD_STATE', 'RADAR_HUD', 0), ('LEAD_DISTANCE', 'RADAR_HUD', 0), ('ACC_ALERTS', 'RADAR_HUD', 0), ] VA = car.CarControl.HUDControl.VisualAlert parser = CANParser(CI.cp.dbc_name, parser_signals, [], 0, sendcan=True, tcp_addr="127.0.0.1") time.sleep(0.2) # Slow joiner syndrome alerts = { VA.none: 0, VA.brakePressed: 10, VA.wrongGear: 6, VA.seatbeltUnbuckled: 5, VA.speedTooHigh: 8, } for steer_required in [True, False]: for lanes in [True, False]: for alert in alerts.keys(): control = car.CarControl.new_message() hud = car.CarControl.HUDControl.new_message() control.enabled = True if steer_required: hud.visualAlert = VA.steerRequired else: hud.visualAlert = alert hud.lanesVisible = lanes control.hudControl = hud CI.update(control) for _ in range(25): can_sends = CI.apply(control) sendcan.send(can_list_to_can_capnp(can_sends, msgtype='sendcan')) for _ in range(5): parser.update(int(sec_since_boot() * 1e9), False) time.sleep(0.01) self.assertEqual(0x41, parser.vl['LKAS_HUD']['SET_ME_X41']) self.assertEqual(0x48, parser.vl['LKAS_HUD']['SET_ME_X48']) self.assertEqual(steer_required, parser.vl['LKAS_HUD']['STEERING_REQUIRED']) self.assertEqual(lanes, parser.vl['LKAS_HUD']['SOLID_LANES']) self.assertEqual(0x1fe, parser.vl['RADAR_HUD']['LEAD_SPEED']) self.assertEqual(0x7, parser.vl['RADAR_HUD']['LEAD_STATE']) self.assertEqual(0x1e, parser.vl['RADAR_HUD']['LEAD_DISTANCE']) self.assertEqual(alerts[alert] if not steer_required else 0, parser.vl['RADAR_HUD']['ACC_ALERTS'])
def get_mqb_can_parser(CP): # this function generates lists for signal, messages and initial values signals = [ # sig_name, sig_address, default ("EPS_Berechneter_LW", "LH_EPS_03", 0), # Absolute steering angle ("EPS_VZ_BLW", "LH_EPS_03", 0), # Steering angle sign ("LWI_Lenkradw_Geschw", "LWI_01", 0), # Absolute steering rate ("LWI_VZ_Lenkradw_Geschw", "LWI_01", 0), # Steering rate sign ("ESP_VL_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, front left ("ESP_VR_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, front right ("ESP_HL_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, rear left ("ESP_HR_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, rear right ("ESP_Gierrate", "ESP_02", 0), # Absolute yaw rate ("ESP_VZ_Gierrate", "ESP_02", 0), # Yaw rate sign ("ZV_FT_offen", "Gateway_72", 0), # Door open, driver ("ZV_BT_offen", "Gateway_72", 0), # Door open, passenger ("ZV_HFS_offen", "Gateway_72", 0), # Door open, rear left ("ZV_HBFS_offen", "Gateway_72", 0), # Door open, rear right ("ZV_HD_offen", "Gateway_72", 0), # Trunk or hatch open ("BH_Blinker_li", "Gateway_72", 0), # Left turn signal on ("BH_Blinker_re", "Gateway_72", 0), # Right turn signal on ("AB_Gurtschloss_FA", "Airbag_02", 0), # Seatbelt status, driver ("AB_Gurtschloss_BF", "Airbag_02", 0), # Seatbelt status, passenger ("ESP_Fahrer_bremst", "ESP_05", 0), # Brake pedal pressed ("ESP_Status_Bremsdruck", "ESP_05", 0), # Brakes applied ("ESP_Bremsdruck", "ESP_05", 0), # Brake pressure applied ("MO_Fahrpedalrohwert_01", "Motor_20", 0), # Accelerator pedal value ("EPS_Lenkmoment", "LH_EPS_03", 0), # Absolute driver torque input ("EPS_VZ_Lenkmoment", "LH_EPS_03", 0), # Driver torque input sign ("EPS_HCA_Status", "LH_EPS_03", 0), # Steering rack ready to process HCA commands ("ESP_Tastung_passiv", "ESP_21", 0), # Stability control disabled ("KBI_MFA_v_Einheit_02", "Einheiten_01", 0), # MPH vs KMH speed display ("KBI_Handbremse", "Kombi_01", 0), # Manual handbrake applied ("TSK_Status", "TSK_06", 0), # ACC engagement status from drivetrain coordinator ("GRA_Hauptschalter", "GRA_ACC_01", 0), # ACC button, on/off ("GRA_Abbrechen", "GRA_ACC_01", 0), # ACC button, cancel ("GRA_Tip_Setzen", "GRA_ACC_01", 0), # ACC button, set ("GRA_Tip_Hoch", "GRA_ACC_01", 0), # ACC button, increase or accel ("GRA_Tip_Runter", "GRA_ACC_01", 0), # ACC button, decrease or decel ("GRA_Tip_Wiederaufnahme", "GRA_ACC_01", 0), # ACC button, resume ("GRA_Verstellung_Zeitluecke", "GRA_ACC_01", 0), # ACC button, time gap adj ("GRA_Typ_Hauptschalter", "GRA_ACC_01", 0), # ACC main button type ("GRA_Tip_Stufe_2", "GRA_ACC_01", 0), # unknown related to stalk type ("GRA_Typ468", "GRA_ACC_01", 0), # Set/Resume button behavior as overloaded coast/accel?? ("GRA_ButtonTypeInfo", "GRA_ACC_01", 0), # unknown related to stalk type ("COUNTER", "GRA_ACC_01", 0), # GRA_ACC_01 CAN message counter ] checks = [ # sig_address, frequency ("LWI_01", 100 ), # From J500 Steering Assist with integrated sensors ("LH_EPS_03", 100), # From J500 Steering Assist with integrated sensors ("ESP_19", 100), # From J104 ABS/ESP controller ("ESP_05", 50), # From J104 ABS/ESP controller ("ESP_21", 50), # From J104 ABS/ESP controller ("Motor_20", 50), # From J623 Engine control module ("TSK_06", 50), # From J623 Engine control module ("GRA_ACC_01", 33), # From J??? steering wheel control buttons ("Gateway_72", 10), # From J533 CAN gateway (aggregated data) ("Airbag_02", 5), # From J234 Airbag control module ("Kombi_01", 2), # From J285 Instrument cluster ("Einheiten_01", 1), # From J??? not known if gateway, cluster, or BCM ] if CP.transmissionType == TRANS.automatic: signals += [("GE_Fahrstufe", "Getriebe_11", 0) ] # Auto trans gear selector position checks += [("Getriebe_11", 20) ] # From J743 Auto transmission control module elif CP.transmissionType == TRANS.direct: signals += [("GearPosition", "EV_Gearshift", 0) ] # EV gear selector position checks += [("EV_Gearshift", 10) ] # From J??? unknown EV control module elif CP.transmissionType == TRANS.manual: signals += [ ("MO_Kuppl_schalter", "Motor_14", 0), # Clutch switch ("BCM1_Rueckfahrlicht_Schalter", "Gateway_72", 0) ] # Reverse light from BCM checks += [("Motor_14", 10)] # From J623 Engine control module if CP.networkLocation == NWL.fwdCamera: # Extended CAN devices other than the camera are here on CANBUS.pt # FIXME: gate SWA_01 checks on module being detected, and reduce duplicate network location code signals += [ ("AWV2_Priowarnung", "ACC_10", 0), # FCW related ("AWV2_Freigabe", "ACC_10", 0), # FCW related ("ANB_Teilbremsung_Freigabe", "ACC_10", 0), # AEB related ("ANB_Zielbremsung_Freigabe", "ACC_10", 0), # AEB related ("SWA_Infostufe_SWA_li", "SWA_01", 0), # Blindspot object info, left ("SWA_Warnung_SWA_li", "SWA_01", 0), # Blindspot object warning, left ("SWA_Infostufe_SWA_re", "SWA_01", 0), # Blindspot object info, right ("SWA_Warnung_SWA_re", "SWA_01", 0), # Blindspot object warning, right ("ACC_Wunschgeschw", "ACC_02", 0) ] # ACC set speed checks += [ ("ACC_10", 50), # From J428 ACC radar control module # FIXME: SWA_01 should be checked when we have better detection of installed hardware #("SWA_01", 20), # From J1086 Lane Change Assist module ("ACC_02", 17) ] # From J428 ACC radar control module checks = [] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, CANBUS.pt)
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("STEER_ANGLE", "STEER_ANGLE_SENSOR", 0), ("GEAR", "GEAR_PACKET", 0), ("BRAKE_PRESSED", "BRAKE_MODULE", 0), ("GAS_PEDAL", "GAS_PEDAL", 0), ("WHEEL_SPEED_FL", "WHEEL_SPEEDS", 0), ("WHEEL_SPEED_FR", "WHEEL_SPEEDS", 0), ("WHEEL_SPEED_RL", "WHEEL_SPEEDS", 0), ("WHEEL_SPEED_RR", "WHEEL_SPEEDS", 0), ("DOOR_OPEN_FL", "SEATS_DOORS", 1), ("DOOR_OPEN_FR", "SEATS_DOORS", 1), ("DOOR_OPEN_RL", "SEATS_DOORS", 1), ("DOOR_OPEN_RR", "SEATS_DOORS", 1), ("SEATBELT_DRIVER_UNLATCHED", "SEATS_DOORS", 1), ("TC_DISABLED", "ESP_CONTROL", 1), ("STEER_FRACTION", "STEER_ANGLE_SENSOR", 0), ("STEER_RATE", "STEER_ANGLE_SENSOR", 0), ("CRUISE_ACTIVE", "PCM_CRUISE", 0), ("CRUISE_STATE", "PCM_CRUISE", 0), ("GAS_RELEASED", "PCM_CRUISE", 1), ("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR", 0), ("STEER_TORQUE_EPS", "STEER_TORQUE_SENSOR", 0), ("STEER_ANGLE", "STEER_TORQUE_SENSOR", 0), ("TURN_SIGNALS", "STEERING_LEVERS", 3), # 3 is no blinkers ("LKA_STATE", "EPS_STATUS", 0), ("AUTO_HIGH_BEAM", "LIGHT_STALK", 0), ] checks = [ ("GEAR_PACKET", 1), ("LIGHT_STALK", 1), ("STEERING_LEVERS", 0.15), ("SEATS_DOORS", 3), ("ESP_CONTROL", 3), ("EPS_STATUS", 25), ("BRAKE_MODULE", 40), ("GAS_PEDAL", 33), ("WHEEL_SPEEDS", 80), ("STEER_ANGLE_SENSOR", 80), ("PCM_CRUISE", 33), ("STEER_TORQUE_SENSOR", 50), ] if CP.carFingerprint == CAR.LEXUS_IS: signals.append(("MAIN_ON", "DSU_CRUISE", 0)) signals.append(("SET_SPEED", "DSU_CRUISE", 0)) checks.append(("DSU_CRUISE", 5)) else: signals.append(("MAIN_ON", "PCM_CRUISE_2", 0)) signals.append(("SET_SPEED", "PCM_CRUISE_2", 0)) signals.append(("LOW_SPEED_LOCKOUT", "PCM_CRUISE_2", 0)) checks.append(("PCM_CRUISE_2", 33)) # add gas interceptor reading if we are using it if CP.enableGasInterceptor: signals.append(("INTERCEPTOR_GAS", "GAS_SENSOR", 0)) signals.append(("INTERCEPTOR_GAS2", "GAS_SENSOR", 0)) checks.append(("GAS_SENSOR", 50)) if CP.enableBsm: signals += [ ("L_ADJACENT", "BSM", 0), ("L_APPROACHING", "BSM", 0), ("R_ADJACENT", "BSM", 0), ("R_APPROACHING", "BSM", 0), ] checks += [("BSM", 1)] return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0)
def get_pq_can_parser(CP): signals = [ # sig_name, sig_address, default ("LH3_BLW", "Lenkhilfe_3", 0), # Absolute steering angle ("LH3_BLWSign", "Lenkhilfe_3", 0), # Steering angle sign ("LH3_LM", "Lenkhilfe_3", 0), # Absolute driver torque input ("LH3_LMSign", "Lenkhilfe_3", 0), # Driver torque input sign ("LH2_Sta_HCA", "Lenkhilfe_2", 0), # Steering rack HCA status ("Lenkradwinkel_Geschwindigkeit", "Lenkwinkel_1", 0), # Absolute steering rate ("Lenkradwinkel_Geschwindigkeit_S", "Lenkwinkel_1", 0), # Steering rate sign ("Radgeschw__VL_4_1", "Bremse_3", 0), # ABS wheel speed, front left ("Radgeschw__VR_4_1", "Bremse_3", 0), # ABS wheel speed, front right ("Radgeschw__HL_4_1", "Bremse_3", 0), # ABS wheel speed, rear left ("Radgeschw__HR_4_1", "Bremse_3", 0), # ABS wheel speed, rear right ("Giergeschwindigkeit", "Bremse_5", 0), # Absolute yaw rate ("Vorzeichen_der_Giergeschwindigk", "Bremse_5", 0), # Yaw rate sign ("GK1_Fa_Tuerkont", "Gate_Komf_1", 0), # Door open, driver # TODO: locate passenger and rear door states ("GK1_Blinker_li", "Gate_Komf_1", 0), # Left turn signal on ("GK1_Blinker_re", "Gate_Komf_1", 0), # Right turn signal on ("Gurtschalter_Fahrer", "Airbag_1", 0), # Seatbelt status, driver ("Gurtschalter_Beifahrer", "Airbag_1", 0), # Seatbelt status, passenger ("Bremstestschalter", "Motor_2", 0), # Brake pedal pressed (brake light test switch) ("Bremslichtschalter", "Motor_2", 0), # Brakes applied (brake light switch) ("Bremsdruck", "Bremse_5", 0), # Brake pressure applied ("Vorzeichen_Bremsdruck", "Bremse_5", 0), # Brake pressure applied sign (???) ("Fahrpedal_Rohsignal", "Motor_3", 0), # Accelerator pedal value ("ESP_Passiv_getastet", "Bremse_1", 0), # Stability control disabled ("MFA_v_Einheit_02", "Einheiten_1", 0), # MPH vs KMH speed display ("Bremsinfo", "Kombi_1", 0), # Manual handbrake applied ("GRA_Status", "Motor_2", 0), # ACC engagement status ("Hauptschalter", "GRA_neu", 0), # ACC button, on/off ("Abbrechen", "GRA_neu", 0), # ACC button, cancel ("Setzen", "GRA_neu", 0), # ACC button, set ("Lang_Tip_up", "GRA_neu", 0), # ACC button, increase or accel, long press ("Lang_Tip_down", "GRA_neu", 0), # ACC button, decrease or decel, long press ("Kurz_Tip_up", "GRA_neu", 0), # ACC button, increase or accel, short press ("Kurz_Tip_down", "GRA_neu", 0), # ACC button, decrease or decel, short press ("Wiederaufnahme", "GRA_neu", 0), # ACC button, resume ("Zeitlueckenverstellung", "GRA_neu", 0), # ACC button, time gap adj ] checks = [ # sig_address, frequency ("Bremse_3", 100), # From J104 ABS/ESP controller ("Lenkhilfe_3", 100), # From J500 Steering Assist with integrated sensors ("Lenkwinkel_1", 100), # From J500 Steering Assist with integrated sensors ("Motor_3", 100), # From J623 Engine control module ("Airbag_1", 50), # From J234 Airbag control module ("Bremse_5", 50), # From J104 ABS/ESP controller ("GRA_neu", 50), # From J??? steering wheel control buttons ("Kombi_1", 50), # From J285 Instrument cluster ("Motor_2", 50), # From J623 Engine control module ("Lenkhilfe_2", 20), # From J500 Steering Assist with integrated sensors ("Gate_Komf_1", 10), # From J533 CAN gateway ("Einheiten_1", 1), # From J??? cluster or gateway ] if CP.transmissionType == TRANS.automatic: signals += [("Waehlhebelposition__Getriebe_1_", "Getriebe_1", 0) ] # Auto trans gear selector position checks += [("Getriebe_1", 100) ] # From J743 Auto transmission control module elif CP.transmissionType == TRANS.manual: signals += [ ("Kupplungsschalter", "Motor_1", 0), # Clutch switch ("GK1_Rueckfahr", "Gate_Komf_1", 0) ] # Reverse light from BCM checks += [("Motor_1", 100)] # From J623 Engine control module if CP.networkLocation == NWL.fwdCamera: # The ACC radar is here on CANBUS.pt signals += [("ACA_V_Wunsch", "ACC_GRA_Anziege", 0) ] # ACC set speed checks += [("ACC_GRA_Anziege", 25) ] # From J428 ACC radar control module checks = [] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, CANBUS.pt)
def get_can_parser(CP): # this function generates lists for signal, messages and initial values signals = [ # sig_name, sig_address, default ("LEFT_BLINK", "BLINK_INFO", 0), ("RIGHT_BLINK", "BLINK_INFO", 0), ("STEER_ANGLE", "STEER", 0), ("STEER_ANGLE_RATE", "STEER_RATE", 0), ("STEER_TORQUE_SENSOR", "STEER_TORQUE", 0), ("STEER_TORQUE_MOTOR", "STEER_TORQUE", 0), ("FL", "WHEEL_SPEEDS", 0), ("FR", "WHEEL_SPEEDS", 0), ("RL", "WHEEL_SPEEDS", 0), ("RR", "WHEEL_SPEEDS", 0), ] checks = [ # sig_address, frequency ("BLINK_INFO", 10), ("STEER", 67), ("STEER_RATE", 83), ("STEER_TORQUE", 83), ("WHEEL_SPEEDS", 100), ] if CP.carFingerprint in GEN1: signals += [ ("LKAS_BLOCK", "STEER_RATE", 0), ("LKAS_TRACK_STATE", "STEER_RATE", 0), ("HANDS_OFF_5_SECONDS", "STEER_RATE", 0), ("CRZ_ACTIVE", "CRZ_CTRL", 0), ("STANDSTILL", "PEDALS", 0), ("BRAKE_ON", "PEDALS", 0), ("BRAKE_PRESSURE", "BRAKE", 0), ("GEAR", "GEAR", 0), ("DRIVER_SEATBELT", "SEATBELT", 0), ("FL", "DOORS", 0), ("FR", "DOORS", 0), ("BL", "DOORS", 0), ("BR", "DOORS", 0), ("PEDAL_GAS", "ENGINE_DATA", 0), ("SPEED", "ENGINE_DATA", 0), ("RES", "CRZ_BTNS", 0), ("SET_P", "CRZ_BTNS", 0), ("SET_M", "CRZ_BTNS", 0), ("CTR", "CRZ_BTNS", 0), ("LEFT_BS1", "BSM", 0), ("RIGHT_BS1", "BSM", 0), ] checks += [ ("ENGINE_DATA", 100), ("CRZ_CTRL", 50), ("CRZ_BTNS", 10), ("PEDALS", 50), ("BRAKE", 50), ("SEATBELT", 10), ("DOORS", 10), ("GEAR", 20), ("BSM", 10), ] return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0)
def get_can_parser(CP): # this function generates lists for signal, messages and initial values signals = [ # sig_name, sig_address, default ("Steer_Torque_Sensor", "Steering_Torque", 0), ("Steer_Torque_Output", "Steering_Torque", 0), ("Steering_Angle", "Steering_Torque", 0), ("Steer_Error_1", "Steering_Torque", 0), ("Brake_Pedal", "Brake_Pedal", 0), ("LEFT_BLINKER", "Dashlights", 0), ("RIGHT_BLINKER", "Dashlights", 0), ("SEATBELT_FL", "Dashlights", 0), ("DOOR_OPEN_FR", "BodyInfo", 1), ("DOOR_OPEN_FL", "BodyInfo", 1), ("DOOR_OPEN_RR", "BodyInfo", 1), ("DOOR_OPEN_RL", "BodyInfo", 1), ] checks = [ # sig_address, frequency ("Throttle", 100), ("Brake_Pedal", 50), ("Steering_Torque", 50), ] # Wheel_Speeds is on can1 for OUTBACK if CP.carFingerprint != CAR.OUTBACK: signals += [ ("FL", "Wheel_Speeds", 0), ("FR", "Wheel_Speeds", 0), ("RL", "Wheel_Speeds", 0), ("RR", "Wheel_Speeds", 0), ] checks += [ ("Wheel_Speeds", 50), ] # Transmission is on can1 for CROSSTREK_2020H if CP.carFingerprint != CAR.CROSSTREK_2020H: signals += [ ("Gear", "Transmission", 0), ] checks += [ ("Transmission", 100), ] # CruiseControl is on can1 for OUTBACK and not used for CROSSTREK_2020H if CP.carFingerprint not in [CAR.OUTBACK, CAR.CROSSTREK_2020H]: signals += [ ("Cruise_On", "CruiseControl", 0), ("Cruise_Activated", "CruiseControl", 0), ] if CP.carFingerprint in PREGLOBAL_CARS: signals += [ ("Throttle_Pedal", "Throttle", 0), ("Counter", "Throttle", 0), ("Signal1", "Throttle", 0), ("Not_Full_Throttle", "Throttle", 0), ("Signal2", "Throttle", 0), ("Engine_RPM", "Throttle", 0), ("Off_Throttle", "Throttle", 0), ("Signal3", "Throttle", 0), ("Throttle_Cruise", "Throttle", 0), ("Throttle_Combo", "Throttle", 0), ("Throttle_Body", "Throttle", 0), ("Off_Throttle_2", "Throttle", 0), ("Signal4", "Throttle", 0), ("UNITS", "Dash_State2", 0), ("Steering_Angle", "Steering", 0), ] checks += [ ("BodyInfo", 1), ("CruiseControl", 50), ("Dash_State2", 1), ("Steering", 50), ] if CP.carFingerprint in [ CAR.FORESTER_PREGLOBAL, CAR.LEVORG_PREGLOBAL, CAR.WRX_PREGLOBAL ]: checks += [ ("Dashlights", 20), ] elif CP.carFingerprint in [ CAR.LEGACY_PREGLOBAL, CAR.LEGACY_PREGLOBAL_2018, CAR.OUTBACK_PREGLOBAL, CAR.OUTBACK_PREGLOBAL_2018 ]: checks += [ ("Dashlights", 10), ] else: signals += [ ("Counter", "Throttle", 0), ("Signal1", "Throttle", 0), ("Engine_RPM", "Throttle", 0), ("Signal2", "Throttle", 0), ("Throttle_Pedal", "Throttle", 0), ("Throttle_Cruise", "Throttle", 0), ("Throttle_Combo", "Throttle", 0), ("Signal1", "Throttle", 0), ("Off_Accel", "Throttle", 0), ("Counter", "Brake_Pedal", 0), ("Signal1", "Brake_Pedal", 0), ("Speed", "Brake_Pedal", 0), ("Signal2", "Brake_Pedal", 0), ("Brake_Lights", "Brake_Pedal", 0), ("Signal3", "Brake_Pedal", 0), ("Signal4", "Brake_Pedal", 0), ("Steer_Warning", "Steering_Torque", 0), ("UNITS", "Dashlights", 0), ] checks += [ ("Dashlights", 10), ("BodyInfo", 10), ] # Brake_Status is on can1 for OUTBACK if CP.carFingerprint != CAR.OUTBACK: signals += [ ("Brake", "Brake_Status", 0), ] checks += [ ("Brake_Status", 50), ] # CruiseControl is on can1 for OUTBACK and nod used for CROSSTREK_2020H if CP.carFingerprint not in [CAR.OUTBACK, CAR.CROSSTREK_2020H]: checks += [ ("CruiseControl", 20), ] if CP.enableBsm: signals += [ ("L_ADJACENT", "BSD_RCTA", 0), ("R_ADJACENT", "BSD_RCTA", 0), ("L_APPROACHING", "BSD_RCTA", 0), ("R_APPROACHING", "BSD_RCTA", 0), ] checks += [ ("BSD_RCTA", 17), ] return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0)
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("WHL_SPD_FL", "WHL_SPD11", 0), ("WHL_SPD_FR", "WHL_SPD11", 0), ("WHL_SPD_RL", "WHL_SPD11", 0), ("WHL_SPD_RR", "WHL_SPD11", 0), ("YAW_RATE", "ESP12", 0), ("CF_Gway_DrvSeatBeltInd", "CGW4", 1), ("CF_Gway_DrvSeatBeltSw", "CGW1", 0), # Driver Seatbelt ("CF_Gway_DrvDrSw", "CGW1", 0), # Driver Door is open ("CF_Gway_AstDrSw", "CGW1", 0), # Passenger door is open ("CF_Gway_RLDrSw", "CGW2", 0), # Rear reft door is open ("CF_Gway_RRDrSw", "CGW2", 0), # Rear right door is open ("CF_Gway_TSigLHSw", "CGW1", 0), ("CF_Gway_TurnSigLh", "CGW1", 0), ("CF_Gway_TSigRHSw", "CGW1", 0), ("CF_Gway_TurnSigRh", "CGW1", 0), ("CF_Gway_ParkBrakeSw", "CGW1", 0), # Parking Brake ("CYL_PRES", "ESP12", 0), ("CF_Clu_CruiseSwState", "CLU11", 0), ("CF_Clu_CruiseSwMain", "CLU11", 0), ("CF_Clu_SldMainSW", "CLU11", 0), ("CF_Clu_ParityBit1", "CLU11", 0), ("CF_Clu_VanzDecimal", "CLU11", 0), ("CF_Clu_Vanz", "CLU11", 0), ("CF_Clu_SPEED_UNIT", "CLU11", 0), ("CF_Clu_DetentOut", "CLU11", 0), ("CF_Clu_RheostatLevel", "CLU11", 0), ("CF_Clu_CluInfo", "CLU11", 0), ("CF_Clu_AmpInfo", "CLU11", 0), ("CF_Clu_AliveCnt1", "CLU11", 0), ("ACCEnable", "TCS13", 0), ("BrakeLight", "TCS13", 0), ("DriverBraking", "TCS13", 0), ("CF_VSM_Avail", "TCS13", 0), ("ESC_Off_Step", "TCS15", 0), ("CF_Lvr_GearInf", "LVR11", 0), # Transmission Gear (0 = N or P, 1-8 = Fwd, 14 = Rev) ("CF_Lca_Stat", "LCA11", 0), ("CF_Lca_IndLeft", "LCA11", 0), ("CF_Lca_IndRight", "LCA11", 0), ("MainMode_ACC", "SCC11", 1), ("SCCInfoDisplay", "SCC11", 0), ("AliveCounterACC", "SCC11", 0), ("VSetDis", "SCC11", 30), ("ObjValid", "SCC11", 0), ("DriverAlertDisplay", "SCC11", 0), ("TauGapSet", "SCC11", 4), ("ACC_ObjStatus", "SCC11", 0), ("ACC_ObjLatPos", "SCC11", 0), ("ACC_ObjDist", "SCC11", 150), #TK211X value is 204.6 ("ACC_ObjRelSpd", "SCC11", 0), ("Navi_SCC_Curve_Status", "SCC11", 0), ("Navi_SCC_Curve_Act", "SCC11", 0), ("Navi_SCC_Camera_Act", "SCC11", 0), ("Navi_SCC_Camera_Status", "SCC11", 2), ("ACCMode", "SCC12", 0), ("CF_VSM_Prefill", "SCC12", 0), ("CF_VSM_DecCmdAct", "SCC12", 0), ("CF_VSM_HBACmd", "SCC12", 0), ("CF_VSM_Warn", "SCC12", 0), ("CF_VSM_Stat", "SCC12", 0), ("CF_VSM_BeltCmd", "SCC12", 0), ("ACCFailInfo", "SCC12", 0), ("StopReq", "SCC12", 0), ("CR_VSM_DecCmd", "SCC12", 0), ("aReqRaw", "SCC12", 0), #aReqMax ("TakeOverReq", "SCC12", 0), ("PreFill", "SCC12", 0), ("aReqValue", "SCC12", 0), #aReqMin ("CF_VSM_ConfMode", "SCC12", 1), ("AEB_Failinfo", "SCC12", 0), ("AEB_Status", "SCC12", 2), ("AEB_CmdAct", "SCC12", 0), ("AEB_StopReq", "SCC12", 0), ("CR_VSM_Alive", "SCC12", 0), ("CR_VSM_ChkSum", "SCC12", 0), ("SCCDrvModeRValue", "SCC13", 2), ("SCC_Equip", "SCC13", 1), ("AebDrvSetStatus", "SCC13", 0), ("JerkUpperLimit", "SCC14", 0), ("JerkLowerLimit", "SCC14", 0), ("SCCMode2", "SCC14", 0), ("ComfortBandUpper", "SCC14", 0), ("ComfortBandLower", "SCC14", 0), ] checks = [ # address, frequency ("TCS13", 50), ("TCS15", 10), ("CLU11", 50), ("ESP12", 100), ("CGW1", 10), ("CGW4", 5), ("WHL_SPD11", 50), ] if CP.sccBus == 0 and CP.enableCruise: checks += [ ("SCC11", 50), ("SCC12", 50), ] if CP.mdpsBus == 0: signals += [("CR_Mdps_StrColTq", "MDPS12", 0), ("CF_Mdps_Def", "MDPS12", 0), ("CF_Mdps_ToiActive", "MDPS12", 0), ("CF_Mdps_ToiUnavail", "MDPS12", 0), ("CF_Mdps_MsgCount2", "MDPS12", 0), ("CF_Mdps_Chksum2", "MDPS12", 0), ("CF_Mdps_ToiFlt", "MDPS12", 0), ("CF_Mdps_SErr", "MDPS12", 0), ("CR_Mdps_StrTq", "MDPS12", 0), ("CF_Mdps_FailStat", "MDPS12", 0), ("CR_Mdps_OutTq", "MDPS12", 0)] checks += [("MDPS12", 50)] if CP.sasBus == 0: signals += [ ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), ] checks += [("SAS11", 100)] if CP.sccBus == -1: signals += [ ("CRUISE_LAMP_M", "EMS16", 0), ("CF_Lvr_CruiseSet", "LVR12", 0), ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: signals += [ ("CF_Clu_InhibitD", "CLU15", 0), ("CF_Clu_InhibitP", "CLU15", 0), ("CF_Clu_InhibitN", "CLU15", 0), ("CF_Clu_InhibitR", "CLU15", 0), ] elif CP.carFingerprint in FEATURES["use_tcu_gears"]: signals += [ ("CUR_GR", "TCU12", 0), ] elif CP.carFingerprint in FEATURES["use_elect_gears"]: signals += [ ("Elect_Gear_Shifter", "ELECT_GEAR", 0), ] else: signals += [ ("CF_Lvr_Gear", "LVR12", 0), ] if CP.carFingerprint not in FEATURES["use_elect_ems"]: signals += [ ("PV_AV_CAN", "EMS12", 0), ("CF_Ems_AclAct", "EMS16", 0), ] checks += [ ("EMS12", 100), ("EMS16", 100), ] else: signals += [ ("Accel_Pedal_Pos", "E_EMS11", 0), ("Brake_Pedal_Pos", "E_EMS11", 0), ] checks += [ ("E_EMS11", 100), ] if CP.carFingerprint in FEATURES["use_fca"]: signals += [ ("FCA_CmdAct", "FCA11", 0), ("CF_VSM_Warn", "FCA11", 0), ] checks += [("FCA11", 50)] if CP.carFingerprint in [CAR.SANTA_FE]: checks.remove(("TCS13", 50)) if CP.spasEnabled: if CP.mdpsBus == 1: signals += [ ("SWI_IGK", "EMS11", 0), ("F_N_ENG", "EMS11", 0), ("ACK_TCS", "EMS11", 0), ("PUC_STAT", "EMS11", 0), ("TQ_COR_STAT", "EMS11", 0), ("RLY_AC", "EMS11", 0), ("F_SUB_TQI", "EMS11", 0), ("TQI_ACOR", "EMS11", 0), ("N", "EMS11", 0), ("TQI", "EMS11", 0), ("TQFR", "EMS11", 0), ("VS", "EMS11", 0), ("RATIO_TQI_BAS_MAX_STND", "EMS11", 0), ] checks += [("EMS11", 100)] elif CP.mdpsBus == 0: signals += [ ("CR_Mdps_StrAng", "MDPS11", 0), ("CF_Mdps_Stat", "MDPS11", 0), ] checks += [("MDPS11", 100)] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
def get_can_parser(CP): checks = [] signals = [ # sig_name, sig_address, default ("WHL_SPD_FL", "WHL_SPD11", 0), ("WHL_SPD_FR", "WHL_SPD11", 0), ("WHL_SPD_RL", "WHL_SPD11", 0), ("WHL_SPD_RR", "WHL_SPD11", 0), ("YAW_RATE", "ESP12", 0), ("CF_Gway_DrvSeatBeltInd", "CGW4", 1), ("CF_Gway_DrvSeatBeltSw", "CGW1", 0), ("CF_Gway_DrvDrSw", "CGW1", 0), # Driver Door ("CF_Gway_AstDrSw", "CGW1", 0), # Passenger door ("CF_Gway_RLDrSw", "CGW2", 0), # Rear reft door ("CF_Gway_RRDrSw", "CGW2", 0), # Rear right door ("CF_Gway_TSigLHSw", "CGW1", 0), ("CF_Gway_TurnSigLh", "CGW1", 0), ("CF_Gway_TSigRHSw", "CGW1", 0), ("CF_Gway_TurnSigRh", "CGW1", 0), ("CF_Gway_ParkBrakeSw", "CGW1", 0), ("CYL_PRES", "ESP12", 0), ("AVH_STAT", "ESP11", 0), ("CF_Clu_CruiseSwState", "CLU11", 0), ("CF_Clu_CruiseSwMain", "CLU11", 0), ("CF_Clu_SldMainSW", "CLU11", 0), ("CF_Clu_ParityBit1", "CLU11", 0), ("CF_Clu_VanzDecimal", "CLU11", 0), ("CF_Clu_Vanz", "CLU11", 0), ("CF_Clu_SPEED_UNIT", "CLU11", 0), ("CF_Clu_DetentOut", "CLU11", 0), ("CF_Clu_RheostatLevel", "CLU11", 0), ("CF_Clu_CluInfo", "CLU11", 0), ("CF_Clu_AmpInfo", "CLU11", 0), ("CF_Clu_AliveCnt1", "CLU11", 0), ("ACCEnable", "TCS13", 0), ("BrakeLight", "TCS13", 0), ("DriverBraking", "TCS13", 0), ("DriverOverride", "TCS13", 0), ("ESC_Off_Step", "TCS15", 0), ("CF_Lvr_CruiseSet", "LVR12", 0), ("CRUISE_LAMP_M", "EMS16", 0), ("CR_VSM_Alive", "SCC12", 0), ("AliveCounterACC", "SCC11", 0), ("CR_FCA_Alive", "FCA11", 0), ("Supplemental_Counter", "FCA11", 0), ("PRESSURE_FL", "TPMS11", 0), ("PRESSURE_FR", "TPMS11", 0), ("PRESSURE_RL", "TPMS11", 0), ("PRESSURE_RR", "TPMS11", 0), ] checks = [ # address, frequency ("TCS13", 50), ("TCS15", 10), ("CLU11", 50), ("ESP12", 100), ("CGW1", 10), ("CGW4", 5), ("WHL_SPD11", 50), ] if CP.sccBus == 0: signals += [ ("MainMode_ACC", "SCC11", 0), ("VSetDis", "SCC11", 0), ("SCCInfoDisplay", "SCC11", 0), ("ACC_ObjStatus", "SCC11", 0), ("ACC_ObjDist", "SCC11", 0), ("ObjValid", "SCC11", 0), ("ACC_ObjRelSpd", "SCC11", 0), ("AliveCounterACC", "SCC11", 0), ("ACCMode", "SCC12", 1), ("AEB_CmdAct", "SCC12", 0), ("CF_VSM_Warn", "SCC12", 0), ("CR_VSM_Alive", "SCC12", 0), ] checks += [ ("SCC11", 50), ("SCC12", 50), ] if CP.fcaBus == 0: signals += [ ("FCA_CmdAct", "FCA11", 0), ("CF_VSM_Warn", "FCA11", 0), ("CR_FCA_Alive", "FCA11", 0), ("Supplemental_Counter", "FCA11", 0), ] checks += [("FCA11", 50)] if not CP.mdpsHarness: signals += [("CR_Mdps_StrColTq", "MDPS12", 0), ("CF_Mdps_Def", "MDPS12", 0), ("CF_Mdps_ToiActive", "MDPS12", 0), ("CF_Mdps_ToiUnavail", "MDPS12", 0), ("CF_Mdps_MsgCount2", "MDPS12", 0), ("CF_Mdps_Chksum2", "MDPS12", 0), ("CF_Mdps_ToiFlt", "MDPS12", 0), ("CF_Mdps_SErr", "MDPS12", 0), ("CR_Mdps_StrTq", "MDPS12", 0), ("CF_Mdps_FailStat", "MDPS12", 0), ("CR_Mdps_OutTq", "MDPS12", 0)] checks += [("MDPS12", 50)] if CP.sasBus == 0: signals += [ ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), ] checks += [("SAS11", 100)] if CP.bsmAvailable: signals += [ ("CF_Lca_IndLeft", "LCA11", 0), ("CF_Lca_IndRight", "LCA11", 0), ] checks += [("LCA11", 50)] if CP.carFingerprint in ELEC_VEH: signals += [ ("Accel_Pedal_Pos", "E_EMS11", 0), ] checks += [ ("E_EMS11", 50), ] elif CP.carFingerprint in HYBRID_VEH: signals += [ ("CR_Vcu_AccPedDep_Pc", "EV_PC4", 0), ] checks += [ ("EV_PC4", 50), ] elif CP.emsAvailable: signals += [ ("PV_AV_CAN", "EMS12", 0), ("CF_Ems_AclAct", "EMS16", 0), ] checks += [ ("EMS12", 100), ("EMS16", 100), ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: signals += [ ("CF_Clu_InhibitD", "CLU15", 0), ("CF_Clu_InhibitP", "CLU15", 0), ("CF_Clu_InhibitN", "CLU15", 0), ("CF_Clu_InhibitR", "CLU15", 0), ] checks += [("CLU15", 5)] elif CP.carFingerprint in FEATURES["use_tcu_gears"]: signals += [("CUR_GR", "TCU12", 0)] checks += [("TCU12", 100)] elif CP.evgearAvailable: signals += [("Elect_Gear_Shifter", "ELECT_GEAR", 0)] checks += [("ELECT_GEAR", 20)] elif CP.lvrAvailable: signals += [("CF_Lvr_Gear", "LVR12", 0)] checks += [("LVR12", 100)] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
def get_can_parser(self, CP): signals, checks = get_can_signals(CP, self.gearbox_msg, self.main_on_sig_msg) bus_pt = 1 if CP.carFingerprint in HONDA_BOSCH else 0 return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus_pt)
def get_can_parser(CP): # this function generates lists for signal, messages and initial values signals = [ # sig_name, sig_address, default ("WHEEL_SPEED_FL", "WHEEL_SPEEDS_FRONT", 0), ("WHEEL_SPEED_FR", "WHEEL_SPEEDS_FRONT", 0), ("WHEEL_SPEED_RL", "WHEEL_SPEEDS_REAR", 0), ("WHEEL_SPEED_RR", "WHEEL_SPEEDS_REAR", 0), ("STEER_ANGLE", "STEER_ANGLE_SENSOR", 0), ("DOOR_OPEN_FR", "DOORS_LIGHTS", 1), ("DOOR_OPEN_FL", "DOORS_LIGHTS", 1), ("DOOR_OPEN_RR", "DOORS_LIGHTS", 1), ("DOOR_OPEN_RL", "DOORS_LIGHTS", 1), ("RIGHT_BLINKER", "LIGHTS", 0), ("LEFT_BLINKER", "LIGHTS", 0), ("ESP_DISABLED", "ESP", 0), ("GEAR_SHIFTER", "GEARBOX", 0), ] checks = [ # sig_address, frequency ("WHEEL_SPEEDS_REAR", 50), ("WHEEL_SPEEDS_FRONT", 50), ("STEER_ANGLE_SENSOR", 100), ("DOORS_LIGHTS", 10), ] if CP.carFingerprint in [CAR.ROGUE, CAR.XTRAIL, CAR.ALTIMA]: signals += [ ("USER_BRAKE_PRESSED", "DOORS_LIGHTS", 1), ("BRAKE_LIGHT", "DOORS_LIGHTS", 1), ("GAS_PEDAL", "GAS_PEDAL", 0), ("SEATBELT_DRIVER_LATCHED", "HUD", 0), ("SPEED_MPH", "HUD", 0), ("PROPILOT_BUTTON", "CRUISE_THROTTLE", 0), ("CANCEL_BUTTON", "CRUISE_THROTTLE", 0), ("GAS_PEDAL_INVERTED", "CRUISE_THROTTLE", 0), ("SET_BUTTON", "CRUISE_THROTTLE", 0), ("RES_BUTTON", "CRUISE_THROTTLE", 0), ("FOLLOW_DISTANCE_BUTTON", "CRUISE_THROTTLE", 0), ("NO_BUTTON_PRESSED", "CRUISE_THROTTLE", 0), ("GAS_PEDAL", "CRUISE_THROTTLE", 0), ("USER_BRAKE_PRESSED", "CRUISE_THROTTLE", 0), ("NEW_SIGNAL_2", "CRUISE_THROTTLE", 0), ("GAS_PRESSED_INVERTED", "CRUISE_THROTTLE", 0), ("unsure1", "CRUISE_THROTTLE", 0), ("unsure2", "CRUISE_THROTTLE", 0), ("unsure3", "CRUISE_THROTTLE", 0), ] checks += [ ("GAS_PEDAL", 100), ("CRUISE_THROTTLE", 50), ("HUD", 25), ] elif CP.carFingerprint in [CAR.LEAF, CAR.LEAF_IC]: signals += [ ("BRAKE_PEDAL", "BRAKE_PEDAL", 0), ("GAS_PEDAL", "CRUISE_THROTTLE", 0), ("CRUISE_AVAILABLE", "CRUISE_THROTTLE", 0), ("SPEED_MPH", "HUD_SETTINGS", 0), ("SEATBELT_DRIVER_LATCHED", "SEATBELT", 0), # Copy other values, we use this to cancel ("CANCEL_SEATBELT", "CANCEL_MSG", 0), ("NEW_SIGNAL_1", "CANCEL_MSG", 0), ("NEW_SIGNAL_2", "CANCEL_MSG", 0), ("NEW_SIGNAL_3", "CANCEL_MSG", 0), ] checks += [ ("BRAKE_PEDAL", 100), ("CRUISE_THROTTLE", 50), ] if CP.carFingerprint == CAR.ALTIMA: signals += [ ("LKAS_ENABLED", "LKAS_SETTINGS", 0), ("CRUISE_ENABLED", "CRUISE_STATE", 0), ("SET_SPEED", "PROPILOT_HUD", 0), ] checks += [ ("CRUISE_STATE", 10), ("LKAS_SETTINGS", 10), ("PROPILOT_HUD", 50), ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 1) signals += [ ("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR", 0), ] checks += [ ("STEER_TORQUE_SENSOR", 100), ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("WHL_SPD_FL", "WHL_SPD11", 0), ("WHL_SPD_FR", "WHL_SPD11", 0), ("WHL_SPD_RL", "WHL_SPD11", 0), ("WHL_SPD_RR", "WHL_SPD11", 0), ("YAW_RATE", "ESP12", 0), ("CF_Gway_DrvSeatBeltInd", "CGW4", 1), ("CF_Gway_DrvSeatBeltSw", "CGW1", 0), # Driver Seatbelt ("CF_Gway_DrvDrSw", "CGW1", 0), # Driver Door is open ("CF_Gway_AstDrSw", "CGW1", 0), # Passenger door is open ("CF_Gway_RLDrSw", "CGW2", 0), # Rear reft door is open ("CF_Gway_RRDrSw", "CGW2", 0), # Rear right door is open ("CF_Gway_TSigLHSw", "CGW1", 0), ("CF_Gway_TurnSigLh", "CGW1", 0), ("CF_Gway_TSigRHSw", "CGW1", 0), ("CF_Gway_TurnSigRh", "CGW1", 0), ("CF_Gway_ParkBrakeSw", "CGW1", 0), # Parking Brake ("CYL_PRES", "ESP12", 0), ("CF_Clu_CruiseSwState", "CLU11", 0), ("CF_Clu_CruiseSwMain", "CLU11", 0), ("CF_Clu_SldMainSW", "CLU11", 0), ("CF_Clu_ParityBit1", "CLU11", 0), ("CF_Clu_VanzDecimal", "CLU11", 0), ("CF_Clu_Vanz", "CLU11", 0), ("CF_Clu_SPEED_UNIT", "CLU11", 0), ("CF_Clu_DetentOut", "CLU11", 0), ("CF_Clu_RheostatLevel", "CLU11", 0), ("CF_Clu_CluInfo", "CLU11", 0), ("CF_Clu_AmpInfo", "CLU11", 0), ("CF_Clu_AliveCnt1", "CLU11", 0), ("ACCEnable", "TCS13", 0), ("BrakeLight", "TCS13", 0), ("DriverBraking", "TCS13", 0), ("ESC_Off_Step", "TCS15", 0), ("CF_Lvr_GearInf", "LVR11", 0), #Transmission Gear (0 = N or P, 1-8 = Fwd, 14 = Rev) ("CF_Lca_Stat", "LCA11", 0), ("CF_Lca_IndLeft", "LCA11", 0), ("CF_Lca_IndRight", "LCA11", 0), ] checks = [ # address, frequency ("TCS13", 50), ("TCS15", 10), ("CLU11", 50), ("ESP12", 100), ("CGW1", 10), ("CGW4", 5), ("WHL_SPD11", 50), ] if not CP.mdpsBus: signals += [("CR_Mdps_StrColTq", "MDPS12", 0), ("CF_Mdps_Def", "MDPS12", 0), ("CF_Mdps_ToiActive", "MDPS12", 0), ("CF_Mdps_ToiUnavail", "MDPS12", 0), ("CF_Mdps_MsgCount2", "MDPS12", 0), ("CF_Mdps_Chksum2", "MDPS12", 0), ("CF_Mdps_ToiFlt", "MDPS12", 0), ("CF_Mdps_SErr", "MDPS12", 0), ("CR_Mdps_StrTq", "MDPS12", 0), ("CF_Mdps_FailStat", "MDPS12", 0), ("CR_Mdps_OutTq", "MDPS12", 0)] checks += [("MDPS12", 50)] if not CP.sasBus: signals += [ ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), ] checks += [("SAS11", 100)] if CP.sccBus == -1: signals += [ ("CRUISE_LAMP_M", "EMS16", 0), ("CF_Lvr_CruiseSet", "LVR12", 0), ] elif not CP.sccBus: signals += [ ("MainMode_ACC", "SCC11", 0), ("VSetDis", "SCC11", 0), ("SCCInfoDisplay", "SCC11", 0), ("ACC_ObjDist", "SCC11", 0), ("TauGapSet", "SCC11", 0), ("ACCMode", "SCC12", 0), ("CF_VSM_Prefill", "SCC12", 0), ("CF_VSM_DecCmdAct", "SCC12", 0), ("CF_VSM_HBACmd", "SCC12", 0), ("CF_VSM_Warn", "SCC12", 0), ("CF_VSM_Stat", "SCC12", 0), ("CF_VSM_BeltCmd", "SCC12", 0), ("ACCFailInfo", "SCC12", 0), ("ACCMode", "SCC12", 0), ("StopReq", "SCC12", 0), ("CR_VSM_DecCmd", "SCC12", 0), ("aReqMax", "SCC12", 0), ("TakeOverReq", "SCC12", 0), ("PreFill", "SCC12", 0), ("aReqMin", "SCC12", 0), ("CF_VSM_ConfMode", "SCC12", 0), ("AEB_Failinfo", "SCC12", 0), ("AEB_Status", "SCC12", 0), ("AEB_CmdAct", "SCC12", 0), ("AEB_StopReq", "SCC12", 0), ("CR_VSM_Alive", "SCC12", 0), ("CR_VSM_ChkSum", "SCC12", 0), ] checks += [ ("SCC11", 50), ("SCC12", 50), ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: signals += [ ("CF_Clu_InhibitD", "CLU15", 0), ("CF_Clu_InhibitP", "CLU15", 0), ("CF_Clu_InhibitN", "CLU15", 0), ("CF_Clu_InhibitR", "CLU15", 0), ] elif CP.carFingerprint in FEATURES["use_tcu_gears"]: signals += [ ("CUR_GR", "TCU12", 0), ] elif CP.carFingerprint in FEATURES["use_elect_gears"]: signals += [ ("Elect_Gear_Shifter", "ELECT_GEAR", 0), ] else: signals += [ ("CF_Lvr_Gear", "LVR12", 0), ] if CP.carFingerprint not in FEATURES["use_elect_ems"]: signals += [ ("PV_AV_CAN", "EMS12", 0), ("CF_Ems_AclAct", "EMS16", 0), ] checks += [ ("EMS12", 100), ("EMS16", 100), ] else: signals += [ ("Accel_Pedal_Pos", "E_EMS11", 0), ("Brake_Pedal_Pos", "E_EMS11", 0), ] checks += [ ("E_EMS11", 100), ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("WHL_SPD_FL", "WHL_SPD11", 0), ("WHL_SPD_FR", "WHL_SPD11", 0), ("WHL_SPD_RL", "WHL_SPD11", 0), ("WHL_SPD_RR", "WHL_SPD11", 0), ("YAW_RATE", "ESP12", 0), ("CF_Gway_DrvSeatBeltInd", "CGW4", 1), ("CF_Gway_DrvSeatBeltSw", "CGW1", 0), ("CF_Gway_DrvDrSw", "CGW1", 0), # Driver Door ("CF_Gway_AstDrSw", "CGW1", 0), # Passenger door ("CF_Gway_RLDrSw", "CGW2", 0), # Rear reft door ("CF_Gway_RRDrSw", "CGW2", 0), # Rear right door ("CF_Gway_TSigLHSw", "CGW1", 0), ("CF_Gway_TurnSigLh", "CGW1", 0), ("CF_Gway_TSigRHSw", "CGW1", 0), ("CF_Gway_TurnSigRh", "CGW1", 0), ("CF_Gway_ParkBrakeSw", "CGW1", 0), ("CYL_PRES", "ESP12", 0), ("CF_Clu_CruiseSwState", "CLU11", 0), ("CF_Clu_CruiseSwMain", "CLU11", 0), ("CF_Clu_SldMainSW", "CLU11", 0), ("CF_Clu_ParityBit1", "CLU11", 0), ("CF_Clu_VanzDecimal", "CLU11", 0), ("CF_Clu_Vanz", "CLU11", 0), ("CF_Clu_SPEED_UNIT", "CLU11", 0), ("CF_Clu_DetentOut", "CLU11", 0), ("CF_Clu_RheostatLevel", "CLU11", 0), ("CF_Clu_CluInfo", "CLU11", 0), ("CF_Clu_AmpInfo", "CLU11", 0), ("CF_Clu_AliveCnt1", "CLU11", 0), ("ACCEnable", "TCS13", 0), ("BrakeLight", "TCS13", 0), ("DriverBraking", "TCS13", 0), ("DriverOverride", "TCS13", 0), ("ESC_Off_Step", "TCS15", 0), ("CF_Lvr_GearInf", "LVR11", 0), # Transmission Gear (0 = N or P, 1-8 = Fwd, 14 = Rev) ("CF_Lca_IndLeft", "LCA11", 0), ("CF_Lca_IndRight", "LCA11", 0), ("CR_Mdps_StrColTq", "MDPS12", 0), ("CF_Mdps_Def", "MDPS12", 0), # ("CF_Mdps_ToiActive", "MDPS12", 0), ("CF_Mdps_ToiUnavail", "MDPS12", 0), ("CF_Mdps_MsgCount2", "MDPS12", 0), # ("CF_Mdps_Chksum2", "MDPS12", 0), # ("CF_Mdps_ToiFlt", "MDPS12", 0), # ("CF_Mdps_SErr", "MDPS12", 0), # ("CR_Mdps_StrTq", "MDPS12", 0), # ("CF_Mdps_FailStat", "MDPS12", 0), ("CR_Mdps_OutTq", "MDPS12", 0), ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), ("MainMode_ACC", "SCC11", 0), ("VSetDis", "SCC11", 0), ("SCCInfoDisplay", "SCC11", 0), ("ACC_ObjDist", "SCC11", 0), ("ACC_ObjRelSpd", "SCC11", 0), ("ACCMode", "SCC12", 1), ] checks = [ # address, frequency ("MDPS12", 50), # 593 ("TCS13", 50), # 916 ("TCS15", 10), ("CLU11", 50), ("ESP12", 100), ("CGW1", 10), ("CGW4", 5), ("WHL_SPD11", 50), # 902 ("SAS11", 100), ("SCC11", 50), ("SCC12", 50), # 1057 ("LCA11", 50), ] signals, checks = CarState.get_parser_ev_hybrid(CP, signals, checks) signals, checks = CarState.get_parser_gears(CP, signals, checks) return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
def get_can_parser(CP): signals = [ # sig_name, sig_address, default ("ESP_vehicleSpeed", "ESP_B", 0), ("DI_pedalPos", "DI_torque1", 0), ("DI_brakePedal", "DI_torque2", 0), ("StW_AnglHP", "STW_ANGLHP_STAT", 0), ("StW_AnglHP_Spd", "STW_ANGLHP_STAT", 0), ("EPAS_handsOnLevel", "EPAS_sysStatus", 0), ("EPAS_torsionBarTorque", "EPAS_sysStatus", 0), ("EPAS_internalSAS", "EPAS_sysStatus", 0), ("EPAS_eacStatus", "EPAS_sysStatus", 1), ("EPAS_eacErrorCode", "EPAS_sysStatus", 0), ("DI_cruiseState", "DI_state", 0), ("DI_digitalSpeed", "DI_state", 0), ("DI_speedUnits", "DI_state", 0), ("DI_gear", "DI_torque2", 0), ("DOOR_STATE_FL", "GTW_carState", 1), ("DOOR_STATE_FR", "GTW_carState", 1), ("DOOR_STATE_RL", "GTW_carState", 1), ("DOOR_STATE_RR", "GTW_carState", 1), ("DOOR_STATE_FrontTrunk", "GTW_carState", 1), ("BOOT_STATE", "GTW_carState", 1), ("BC_indicatorLStatus", "GTW_carState", 1), ("BC_indicatorRStatus", "GTW_carState", 1), ("SDM_bcklDrivStatus", "SDM1", 0), ("driverBrakeStatus", "BrakeMessage", 0), # We copy this whole message when spamming cancel ("SpdCtrlLvr_Stat", "STW_ACTN_RQ", 0), ("VSL_Enbl_Rq", "STW_ACTN_RQ", 0), ("SpdCtrlLvrStat_Inv", "STW_ACTN_RQ", 0), ("DTR_Dist_Rq", "STW_ACTN_RQ", 0), ("TurnIndLvr_Stat", "STW_ACTN_RQ", 0), ("HiBmLvr_Stat", "STW_ACTN_RQ", 0), ("WprWashSw_Psd", "STW_ACTN_RQ", 0), ("WprWash_R_Sw_Posn_V2", "STW_ACTN_RQ", 0), ("StW_Lvr_Stat", "STW_ACTN_RQ", 0), ("StW_Cond_Flt", "STW_ACTN_RQ", 0), ("StW_Cond_Psd", "STW_ACTN_RQ", 0), ("HrnSw_Psd", "STW_ACTN_RQ", 0), ("StW_Sw00_Psd", "STW_ACTN_RQ", 0), ("StW_Sw01_Psd", "STW_ACTN_RQ", 0), ("StW_Sw02_Psd", "STW_ACTN_RQ", 0), ("StW_Sw03_Psd", "STW_ACTN_RQ", 0), ("StW_Sw04_Psd", "STW_ACTN_RQ", 0), ("StW_Sw05_Psd", "STW_ACTN_RQ", 0), ("StW_Sw06_Psd", "STW_ACTN_RQ", 0), ("StW_Sw07_Psd", "STW_ACTN_RQ", 0), ("StW_Sw08_Psd", "STW_ACTN_RQ", 0), ("StW_Sw09_Psd", "STW_ACTN_RQ", 0), ("StW_Sw10_Psd", "STW_ACTN_RQ", 0), ("StW_Sw11_Psd", "STW_ACTN_RQ", 0), ("StW_Sw12_Psd", "STW_ACTN_RQ", 0), ("StW_Sw13_Psd", "STW_ACTN_RQ", 0), ("StW_Sw14_Psd", "STW_ACTN_RQ", 0), ("StW_Sw15_Psd", "STW_ACTN_RQ", 0), ("WprSw6Posn", "STW_ACTN_RQ", 0), ("MC_STW_ACTN_RQ", "STW_ACTN_RQ", 0), ("CRC_STW_ACTN_RQ", "STW_ACTN_RQ", 0), ] checks = [ # sig_address, frequency ("ESP_B", 50), ("DI_torque1", 100), ("DI_torque2", 100), ("STW_ANGLHP_STAT", 100), ("EPAS_sysStatus", 25), ("DI_state", 10), ("STW_ACTN_RQ", 10), ("GTW_carState", 10), ("SDM1", 10), ("BrakeMessage", 50), ] return CANParser(DBC[CP.carFingerprint]['chassis'], signals, checks, CANBUS.chassis)
def get_cam_can_parser(CP): signals = [ # sig_name, sig_address, default ("CF_Lkas_LdwsActivemode", "LKAS11", 0), ("CF_Lkas_LdwsSysState", "LKAS11", 0), ("CF_Lkas_SysWarning", "LKAS11", 0), ("CF_Lkas_LdwsLHWarning", "LKAS11", 0), ("CF_Lkas_LdwsRHWarning", "LKAS11", 0), ("CF_Lkas_HbaLamp", "LKAS11", 0), ("CF_Lkas_FcwBasReq", "LKAS11", 0), ("CF_Lkas_ToiFlt", "LKAS11", 0), ("CF_Lkas_HbaSysState", "LKAS11", 0), ("CF_Lkas_FcwOpt", "LKAS11", 0), ("CF_Lkas_HbaOpt", "LKAS11", 0), ("CF_Lkas_FcwSysState", "LKAS11", 0), ("CF_Lkas_FcwCollisionWarning", "LKAS11", 0), ("CF_Lkas_MsgCount", "LKAS11", 0), ("CF_Lkas_FusionState", "LKAS11", 0), ("CF_Lkas_FcwOpt_USM", "LKAS11", 0), ("CF_Lkas_LdwsOpt_USM", "LKAS11", 0) ] checks = [("LKAS11", 100)] if CP.sccBus == 2: signals += [ ("MainMode_ACC", "SCC11", 0), ("SCCInfoDisplay", "SCC11", 0), ("AliveCounterACC", "SCC11", 0), ("VSetDis", "SCC11", 0), ("ObjValid", "SCC11", 0), ("DriverAlertDisplay", "SCC11", 0), ("TauGapSet", "SCC11", 4), ("ACC_ObjStatus", "SCC11", 0), ("ACC_ObjLatPos", "SCC11", 0), ("ACC_ObjDist", "SCC11", 150.), ("ACC_ObjRelSpd", "SCC11", 0), ("Navi_SCC_Curve_Status", "SCC11", 0), ("Navi_SCC_Curve_Act", "SCC11", 0), ("Navi_SCC_Camera_Act", "SCC11", 0), ("Navi_SCC_Camera_Status", "SCC11", 2), ("ACCMode", "SCC12", 0), ("CF_VSM_Prefill", "SCC12", 0), ("CF_VSM_DecCmdAct", "SCC12", 0), ("CF_VSM_HBACmd", "SCC12", 0), ("CF_VSM_Warn", "SCC12", 0), ("CF_VSM_Stat", "SCC12", 0), ("CF_VSM_BeltCmd", "SCC12", 0), ("ACCFailInfo", "SCC12", 0), ("StopReq", "SCC12", 0), ("CR_VSM_DecCmd", "SCC12", 0), ("aReqRaw", "SCC12", 0), ("TakeOverReq", "SCC12", 0), ("PreFill", "SCC12", 0), ("aReqValue", "SCC12", 0), ("CF_VSM_ConfMode", "SCC12", 1), ("AEB_Failinfo", "SCC12", 0), ("AEB_Status", "SCC12", 2), ("AEB_CmdAct", "SCC12", 0), ("AEB_StopReq", "SCC12", 0), ("CR_VSM_Alive", "SCC12", 0), ("CR_VSM_ChkSum", "SCC12", 0), ("SCCDrvModeRValue", "SCC13", 2), ("SCC_Equip", "SCC13", 1), ("AebDrvSetStatus", "SCC13", 0), ("JerkUpperLimit", "SCC14", 0), ("JerkLowerLimit", "SCC14", 0), ("SCCMode2", "SCC14", 0), ("ComfortBandUpper", "SCC14", 0), ("ComfortBandLower", "SCC14", 0), ("ACCMode", "SCC14", 0), ("ObjGap", "SCC14", 0), ("CF_VSM_Prefill", "FCA11", 0), ("CF_VSM_HBACmd", "FCA11", 0), ("CF_VSM_Warn", "FCA11", 0), ("CF_VSM_BeltCmd", "FCA11", 0), ("CR_VSM_DecCmd", "FCA11", 0), ("FCA_Status", "FCA11", 2), ("FCA_CmdAct", "FCA11", 0), ("FCA_StopReq", "FCA11", 0), ("FCA_DrvSetStatus", "FCA11", 1), ("CF_VSM_DecCmdAct", "FCA11", 0), ("FCA_Failinfo", "FCA11", 0), ("FCA_RelativeVelocity", "FCA11", 0), ("FCA_TimetoCollision", "FCA11", 2540.), ("CR_FCA_Alive", "FCA11", 0), ("CR_FCA_ChkSum", "FCA11", 0), ("Supplemental_Counter", "FCA11", 0), ("PAINT1_Status", "FCA11", 1), ] if CP.sccBus == 2: checks += [ ("SCC11", 50), ("SCC12", 50), ] if CP.fcaBus == 2: checks += [("FCA11", 50)] return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 2, enforce_checks=False)
def get_can_parser_init(CP): signals, checks = get_can_signals(CP) bus_pt = 1 if CP.isPandaBlack and CP.carFingerprint in HONDA_BOSCH else 0 return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, bus_pt)
def get_can_parser(CP): # this function generates lists for signal, messages and initial values signals = [ # sig_name, sig_address, default ("EPS_Berechneter_LW", "LH_EPS_03", 0), # Absolute steering angle ("EPS_VZ_BLW", "LH_EPS_03", 0), # Steering angle sign ("LWI_Lenkradw_Geschw", "LWI_01", 0), # Absolute steering rate ("LWI_VZ_Lenkradw_Geschw", "LWI_01", 0), # Steering rate sign ("ESP_VL_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, front left ("ESP_VR_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, front right ("ESP_HL_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, rear left ("ESP_HR_Radgeschw_02", "ESP_19", 0), # ABS wheel speed, rear right ("ESP_Gierrate", "ESP_02", 0), # Absolute yaw rate ("ESP_VZ_Gierrate", "ESP_02", 0), # Yaw rate sign ("ZV_FT_offen", "Gateway_72", 0), # Door open, driver ("ZV_BT_offen", "Gateway_72", 0), # Door open, passenger ("ZV_HFS_offen", "Gateway_72", 0), # Door open, rear left ("ZV_HBFS_offen", "Gateway_72", 0), # Door open, rear right ("ZV_HD_offen", "Gateway_72", 0), # Trunk or hatch open ("BH_Blinker_li", "Gateway_72", 0), # Left turn signal on ("BH_Blinker_re", "Gateway_72", 0), # Right turn signal on ("AB_Gurtschloss_FA", "Airbag_02", 0), # Seatbelt status, driver ("AB_Gurtschloss_BF", "Airbag_02", 0), # Seatbelt status, passenger ("ESP_Fahrer_bremst", "ESP_05", 0), # Brake pedal pressed ("ESP_Bremsdruck", "ESP_05", 0), # Brake pressure applied ("MO_Fahrpedalrohwert_01", "Motor_20", 0), # Accelerator pedal value ("MO_Kuppl_schalter", "Motor_14", 0), # Clutch switch ("EPS_Lenkmoment", "LH_EPS_03", 0), # Absolute driver torque input ("EPS_VZ_Lenkmoment", "LH_EPS_03", 0), # Driver torque input sign ("EPS_HCA_Status", "LH_EPS_03", 0), # Steering rack HCA support configured ("ESP_Tastung_passiv", "ESP_21", 0), # Stability control disabled ("KBI_MFA_v_Einheit_02", "Einheiten_01", 0), # MPH vs KMH speed display ("KBI_Handbremse", "Kombi_01", 0), # Manual handbrake applied ("TSK_Status", "TSK_06", 0), # ACC engagement status from drivetrain coordinator ("GRA_Hauptschalter", "GRA_ACC_01", 0), # ACC button, on/off ("GRA_Abbrechen", "GRA_ACC_01", 0), # ACC button, cancel ("GRA_Tip_Setzen", "GRA_ACC_01", 0), # ACC button, set ("GRA_Tip_Hoch", "GRA_ACC_01", 0), # ACC button, increase or accel ("GRA_Tip_Runter", "GRA_ACC_01", 0), # ACC button, decrease or decel ("GRA_Tip_Wiederaufnahme", "GRA_ACC_01", 0), # ACC button, resume ("GRA_Verstellung_Zeitluecke", "GRA_ACC_01", 0), # ACC button, time gap adj ("GRA_Typ_Hauptschalter", "GRA_ACC_01", 0), # ACC main button type ("GRA_Tip_Stufe_2", "GRA_ACC_01", 0), # unknown related to stalk type ("GRA_ButtonTypeInfo", "GRA_ACC_01", 0), # unknown related to stalk type ("COUNTER", "GRA_ACC_01", 0), # GRA_ACC_01 CAN message counter ] checks = [ # sig_address, frequency ("LWI_01", 100 ), # From J500 Steering Assist with integrated sensors ("LH_EPS_03", 100), # From J500 Steering Assist with integrated sensors ("ESP_19", 100), # From J104 ABS/ESP controller ("ESP_05", 50), # From J104 ABS/ESP controller ("ESP_21", 50), # From J104 ABS/ESP controller ("Motor_20", 50), # From J623 Engine control module ("TSK_06", 50), # From J623 Engine control module ("ESP_02", 50), # From J104 ABS/ESP controller ("GRA_ACC_01", 33 ), # From J533 CAN gateway (via LIN from steering wheel controls) ("Gateway_72", 10), # From J533 CAN gateway (aggregated data) ("Motor_14", 10), # From J623 Engine control module ("Airbag_02", 5), # From J234 Airbag control module ("Kombi_01", 2), # From J285 Instrument cluster ("Einheiten_01", 1), # From J??? not known if gateway, cluster, or BCM ] if CP.transmissionType == TransmissionType.automatic: signals += [("GE_Fahrstufe", "Getriebe_11", 0) ] # Auto trans gear selector position checks += [("Getriebe_11", 20) ] # From J743 Auto transmission control module elif CP.transmissionType == TransmissionType.direct: signals += [("GearPosition", "EV_Gearshift", 0) ] # EV gear selector position checks += [("EV_Gearshift", 10) ] # From J??? unknown EV control module elif CP.transmissionType == TransmissionType.manual: signals += [ ("MO_Kuppl_schalter", "Motor_14", 0), # Clutch switch ("BCM1_Rueckfahrlicht_Schalter", "Gateway_72", 0) ] # Reverse light from BCM checks += [("Motor_14", 10)] # From J623 Engine control module # TODO: Detect ACC radar bus location signals += MqbExtraSignals.fwd_radar_signals checks += MqbExtraSignals.fwd_radar_checks # TODO: Detect BSM radar bus location if CP.enableBsm: signals += MqbExtraSignals.bsm_radar_signals checks += MqbExtraSignals.bsm_radar_checks return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, CANBUS.pt)
def get_can_parser(CP): signals = [ # sig_name, sig_address ("Veh_V_ActlEng", "EngVehicleSpThrottle2" ), # ABS vehicle speed (kph) ("VehYaw_W_Actl", "Yaw_Data_FD1"), # ABS vehicle yaw rate (rad/s) ("VehStop_D_Stat", "DesiredTorqBrk"), # ABS vehicle stopped ("PrkBrkStatus", "DesiredTorqBrk"), # ABS park brake status ("ApedPos_Pc_ActlArb", "EngVehicleSpThrottle"), # PCM throttle (pct) ("BrkTot_Tq_Actl", "BrakeSnData_4"), # ABS brake torque (Nm) ("BpedDrvAppl_D_Actl", "EngBrakeData"), # PCM driver brake pedal pressed ("Veh_V_DsplyCcSet", "EngBrakeData"), # PCM ACC set speed (mph) # The units might change with IPC settings? ("CcStat_D_Actl", "EngBrakeData"), # PCM ACC status ("StePinComp_An_Est", "SteeringPinion_Data"), # PSCM estimated steering angle (deg) # Calculates steering angle (and offset) from pinion # angle and driving measurements. # StePinRelInit_An_Sns is the pinion angle, initialised # to zero at the beginning of the drive. ("SteeringColumnTorque", "EPAS_INFO" ), # PSCM steering column torque (Nm) ("EPAS_Failure", "EPAS_INFO"), # PSCM EPAS status ("LaHandsOff_B_Actl", "Lane_Assist_Data3_FD1"), # PSCM LKAS hands off wheel ("TurnLghtSwtch_D_Stat", "Steering_Data_FD1"), # SCCM Turn signal switch ("TjaButtnOnOffPress", "Steering_Data_FD1" ), # SCCM ACC button, lane-centering/traffic jam assist toggle ("DrStatDrv_B_Actl", "BodyInfo_3_FD1"), # BCM Door open, driver ("DrStatPsngr_B_Actl", "BodyInfo_3_FD1"), # BCM Door open, passenger ("DrStatRl_B_Actl", "BodyInfo_3_FD1"), # BCM Door open, rear left ("DrStatRr_B_Actl", "BodyInfo_3_FD1"), # BCM Door open, rear right ("FirstRowBuckleDriver", "RCMStatusMessage2_FD1"), # RCM Seatbelt status, driver ] checks = [ # sig_address, frequency ("EngVehicleSpThrottle2", 50), ("Yaw_Data_FD1", 100), ("DesiredTorqBrk", 50), ("EngVehicleSpThrottle", 100), ("BrakeSnData_4", 50), ("EngBrakeData", 10), ("SteeringPinion_Data", 100), ("EPAS_INFO", 50), ("Lane_Assist_Data3_FD1", 33), ("Steering_Data_FD1", 10), ("BodyInfo_3_FD1", 2), ("RCMStatusMessage2_FD1", 10), ] if CP.transmissionType == TransmissionType.automatic: signals += [ ("TrnGear_D_RqDrv", "Gear_Shift_by_Wire_FD1"), # GWM transmission gear position ] checks += [ ("Gear_Shift_by_Wire_FD1", 10), ] elif CP.transmissionType == TransmissionType.manual: signals += [ ("CluPdlPos_Pc_Meas", "Engine_Clutch_Data"), # PCM clutch (pct) ("RvrseLghtOn_B_Stat", "BCM_Lamp_Stat_FD1"), # BCM reverse light ] checks += [ ("Engine_Clutch_Data", 33), ("BCM_Lamp_Stat_FD1", 1), ] if CP.enableBsm: signals += [ ("SodDetctLeft_D_Stat", "Side_Detect_L_Stat"), # Blindspot sensor, left ("SodDetctRight_D_Stat", "Side_Detect_R_Stat"), # Blindspot sensor, right ] checks += [ ("Side_Detect_L_Stat", 5), ("Side_Detect_R_Stat", 5), ] return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, CANBUS.main)