From e808a1ec3dc33bdbd6d4ef868bbc84d3916de765 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 16 Jun 2023 16:25:57 -0700 Subject: [PATCH 01/30] Subaru: add AEB related signals (#858) * rename signal2 * generate * generate * add one more def --- generator/subaru/_subaru_global.dbc | 6 +++++- subaru_global_2017_generated.dbc | 6 +++++- subaru_global_2020_hybrid_generated.dbc | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/generator/subaru/_subaru_global.dbc b/generator/subaru/_subaru_global.dbc index 96ca9bab3a..732ae36736 100644 --- a/generator/subaru/_subaru_global.dbc +++ b/generator/subaru/_subaru_global.dbc @@ -132,7 +132,7 @@ BO_ 544 ES_Brake: 8 XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX SG_ Signal1 : 12|4@1+ (1,0) [0|15] "" XXX SG_ Brake_Pressure : 16|16@1+ (1,0) [0|65535] "" XXX - SG_ Signal2 : 32|4@1+ (1,0) [0|15] "" XXX + SG_ AEB_Status : 32|4@1+ (1,0) [0|15] "" XXX SG_ Cruise_Brake_Lights : 36|1@1+ (1,0) [0|1] "" XXX SG_ Cruise_Brake_Fault : 37|1@1+ (1,0) [0|1] "" XXX SG_ Cruise_Brake_Active : 38|1@1+ (1,0) [0|1] "" XXX @@ -240,6 +240,9 @@ BO_ 1677 Dash_State: 8 XXX CM_ SG_ 64 Throttle_Combo "Throttle Cruise + Pedal"; CM_ SG_ 313 Brake_Lights "Driver or Cruise Brake on"; CM_ SG_ 544 Cruise_Brake_Lights "1 = switch on brake lights"; +CM_ SG_ 544 Brake_Pressure "Winds down after cruise disabled. Also can be non-zero when likely preparing for AEB"; +CM_ SG_ 544 Signal3 "Usually goes to 2 if AEB_Status is 4"; +CM_ SG_ 544 AEB_Status "Occasionally is 4 instead of 8 while Brake_Pressure is non-zero, unsure why"; CM_ SG_ 801 PCB_Off "Pre-Collision Braking off"; CM_ SG_ 801 Brake_Lights "Driver or Cruise brake on"; CM_ SG_ 801 Cruise_State "0 = Normal, 1 = Hold+User Brake, 2 = Ready, 3 = Hold"; @@ -256,3 +259,4 @@ CM_ SG_ 802 LKAS_Dash_State "0 = Off, 1 = Ready, 2 = Active"; CM_ SG_ 802 LKAS_Right_Line_Visible "0 = Off, 1 = White, 2 = Green, 3 = Orange"; CM_ SG_ 912 UNITS "0 = Metric, 1 = Imperial"; CM_ SG_ 912 ICY_ROAD "1 = DASHLIGHT ON, 2 = WARNING, 3 = OFF"; +VAL_ 544 AEB_Status 12 "AEB related" 8 "AEB actuation" 4 "AEB related" 0 "No AEB actuation"; diff --git a/subaru_global_2017_generated.dbc b/subaru_global_2017_generated.dbc index b572d1b644..aad534b1dc 100644 --- a/subaru_global_2017_generated.dbc +++ b/subaru_global_2017_generated.dbc @@ -136,7 +136,7 @@ BO_ 544 ES_Brake: 8 XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX SG_ Signal1 : 12|4@1+ (1,0) [0|15] "" XXX SG_ Brake_Pressure : 16|16@1+ (1,0) [0|65535] "" XXX - SG_ Signal2 : 32|4@1+ (1,0) [0|15] "" XXX + SG_ AEB_Status : 32|4@1+ (1,0) [0|15] "" XXX SG_ Cruise_Brake_Lights : 36|1@1+ (1,0) [0|1] "" XXX SG_ Cruise_Brake_Fault : 37|1@1+ (1,0) [0|1] "" XXX SG_ Cruise_Brake_Active : 38|1@1+ (1,0) [0|1] "" XXX @@ -244,6 +244,9 @@ BO_ 1677 Dash_State: 8 XXX CM_ SG_ 64 Throttle_Combo "Throttle Cruise + Pedal"; CM_ SG_ 313 Brake_Lights "Driver or Cruise Brake on"; CM_ SG_ 544 Cruise_Brake_Lights "1 = switch on brake lights"; +CM_ SG_ 544 Brake_Pressure "Winds down after cruise disabled. Also can be non-zero when likely preparing for AEB"; +CM_ SG_ 544 Signal3 "Usually goes to 2 if AEB_Status is 4"; +CM_ SG_ 544 AEB_Status "Occasionally is 4 instead of 8 while Brake_Pressure is non-zero, unsure why"; CM_ SG_ 801 PCB_Off "Pre-Collision Braking off"; CM_ SG_ 801 Brake_Lights "Driver or Cruise brake on"; CM_ SG_ 801 Cruise_State "0 = Normal, 1 = Hold+User Brake, 2 = Ready, 3 = Hold"; @@ -260,6 +263,7 @@ CM_ SG_ 802 LKAS_Dash_State "0 = Off, 1 = Ready, 2 = Active"; CM_ SG_ 802 LKAS_Right_Line_Visible "0 = Off, 1 = White, 2 = Green, 3 = Orange"; CM_ SG_ 912 UNITS "0 = Metric, 1 = Imperial"; CM_ SG_ 912 ICY_ROAD "1 = DASHLIGHT ON, 2 = WARNING, 3 = OFF"; +VAL_ 544 AEB_Status 12 "AEB related" 8 "AEB actuation" 4 "AEB related" 0 "No AEB actuation"; CM_ "subaru_global_2017.dbc starts here"; diff --git a/subaru_global_2020_hybrid_generated.dbc b/subaru_global_2020_hybrid_generated.dbc index 86358c4505..ad6767b2b8 100644 --- a/subaru_global_2020_hybrid_generated.dbc +++ b/subaru_global_2020_hybrid_generated.dbc @@ -136,7 +136,7 @@ BO_ 544 ES_Brake: 8 XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX SG_ Signal1 : 12|4@1+ (1,0) [0|15] "" XXX SG_ Brake_Pressure : 16|16@1+ (1,0) [0|65535] "" XXX - SG_ Signal2 : 32|4@1+ (1,0) [0|15] "" XXX + SG_ AEB_Status : 32|4@1+ (1,0) [0|15] "" XXX SG_ Cruise_Brake_Lights : 36|1@1+ (1,0) [0|1] "" XXX SG_ Cruise_Brake_Fault : 37|1@1+ (1,0) [0|1] "" XXX SG_ Cruise_Brake_Active : 38|1@1+ (1,0) [0|1] "" XXX @@ -244,6 +244,9 @@ BO_ 1677 Dash_State: 8 XXX CM_ SG_ 64 Throttle_Combo "Throttle Cruise + Pedal"; CM_ SG_ 313 Brake_Lights "Driver or Cruise Brake on"; CM_ SG_ 544 Cruise_Brake_Lights "1 = switch on brake lights"; +CM_ SG_ 544 Brake_Pressure "Winds down after cruise disabled. Also can be non-zero when likely preparing for AEB"; +CM_ SG_ 544 Signal3 "Usually goes to 2 if AEB_Status is 4"; +CM_ SG_ 544 AEB_Status "Occasionally is 4 instead of 8 while Brake_Pressure is non-zero, unsure why"; CM_ SG_ 801 PCB_Off "Pre-Collision Braking off"; CM_ SG_ 801 Brake_Lights "Driver or Cruise brake on"; CM_ SG_ 801 Cruise_State "0 = Normal, 1 = Hold+User Brake, 2 = Ready, 3 = Hold"; @@ -260,6 +263,7 @@ CM_ SG_ 802 LKAS_Dash_State "0 = Off, 1 = Ready, 2 = Active"; CM_ SG_ 802 LKAS_Right_Line_Visible "0 = Off, 1 = White, 2 = Green, 3 = Orange"; CM_ SG_ 912 UNITS "0 = Metric, 1 = Imperial"; CM_ SG_ 912 ICY_ROAD "1 = DASHLIGHT ON, 2 = WARNING, 3 = OFF"; +VAL_ 544 AEB_Status 12 "AEB related" 8 "AEB actuation" 4 "AEB related" 0 "No AEB actuation"; CM_ "subaru_global_2020_hybrid.dbc starts here"; From aa044ea9452e60f861577910ddc1cb3b610bc73a Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Sun, 18 Jun 2023 16:06:42 +0100 Subject: [PATCH 02/30] add poetry pyproject required fields --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index d5d543cf90..26af720fa9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,9 @@ +[tool.poetry] name = "opendbc" +version = "1.0.0" +description = "CAN bus databases and tools" license = "MIT" +authors = ["Vehicle Researcher "] readme = "README.md" repository = "https://github.com/commaai/opendbc" From 2eab8d2a1d3de7b641d3655b1dc41fd14a4f24fc Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 21 Jun 2023 02:20:51 -0700 Subject: [PATCH 03/30] Toyota: fix KINEMATICS signal (#864) fix signal --- generator/toyota/_toyota_2017.dbc | 2 +- toyota_new_mc_pt_generated.dbc | 2 +- toyota_nodsu_pt_generated.dbc | 2 +- toyota_tnga_k_pt_generated.dbc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generator/toyota/_toyota_2017.dbc b/generator/toyota/_toyota_2017.dbc index e6148ca6af..17d07b8ee5 100644 --- a/generator/toyota/_toyota_2017.dbc +++ b/generator/toyota/_toyota_2017.dbc @@ -38,7 +38,7 @@ BU_: XXX DSU HCU EPS IPAS CGW BGM BO_ 36 KINEMATICS: 8 XXX SG_ ACCEL_Y : 33|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX SG_ YAW_RATE : 1|10@0+ (0.244,-125) [0|65535] "deg/s" XXX - SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + SG_ ACCEL_X : 17|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX BO_ 37 STEER_ANGLE_SENSOR: 8 XXX SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX diff --git a/toyota_new_mc_pt_generated.dbc b/toyota_new_mc_pt_generated.dbc index 3bd6792054..1f4d0a838c 100644 --- a/toyota_new_mc_pt_generated.dbc +++ b/toyota_new_mc_pt_generated.dbc @@ -83,7 +83,7 @@ BU_: XXX DSU HCU EPS IPAS CGW BGM BO_ 36 KINEMATICS: 8 XXX SG_ ACCEL_Y : 33|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX SG_ YAW_RATE : 1|10@0+ (0.244,-125) [0|65535] "deg/s" XXX - SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + SG_ ACCEL_X : 17|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX BO_ 37 STEER_ANGLE_SENSOR: 8 XXX SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index f409b5c3c7..f69dc059b0 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -83,7 +83,7 @@ BU_: XXX DSU HCU EPS IPAS CGW BGM BO_ 36 KINEMATICS: 8 XXX SG_ ACCEL_Y : 33|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX SG_ YAW_RATE : 1|10@0+ (0.244,-125) [0|65535] "deg/s" XXX - SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + SG_ ACCEL_X : 17|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX BO_ 37 STEER_ANGLE_SENSOR: 8 XXX SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX diff --git a/toyota_tnga_k_pt_generated.dbc b/toyota_tnga_k_pt_generated.dbc index 22c0a1ca2a..920275321b 100644 --- a/toyota_tnga_k_pt_generated.dbc +++ b/toyota_tnga_k_pt_generated.dbc @@ -83,7 +83,7 @@ BU_: XXX DSU HCU EPS IPAS CGW BGM BO_ 36 KINEMATICS: 8 XXX SG_ ACCEL_Y : 33|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX SG_ YAW_RATE : 1|10@0+ (0.244,-125) [0|65535] "deg/s" XXX - SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + SG_ ACCEL_X : 17|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX BO_ 37 STEER_ANGLE_SENSOR: 8 XXX SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX From f241a87591b0e0339c5c8b6e2b1976271807ac56 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Fri, 23 Jun 2023 16:05:02 -0400 Subject: [PATCH 04/30] Subaru: Signals Cleanup (#862) cleanup Co-authored-by: Cameron Clough --- generator/subaru/subaru_global_2017.dbc | 2 +- subaru_global_2017_generated.dbc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/subaru/subaru_global_2017.dbc b/generator/subaru/subaru_global_2017.dbc index 0d358aea06..d03a6a3f9b 100644 --- a/generator/subaru/subaru_global_2017.dbc +++ b/generator/subaru/subaru_global_2017.dbc @@ -53,7 +53,7 @@ BO_ 576 CruiseControl: 8 XXX SG_ Cruise_Activated : 41|1@1+ (1,0) [0|1] "" XXX SG_ Signal2 : 42|22@1+ (1,0) [0|4194303] "" XXX -BO_ 803 INFOTAINMENT_STATUS: 8 XXX +BO_ 803 ES_Infotainment: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX SG_ LKAS_Blue_Lines : 15|4@0+ (1,0) [0|15] "" XXX diff --git a/subaru_global_2017_generated.dbc b/subaru_global_2017_generated.dbc index aad534b1dc..9b7f9a6422 100644 --- a/subaru_global_2017_generated.dbc +++ b/subaru_global_2017_generated.dbc @@ -320,7 +320,7 @@ BO_ 576 CruiseControl: 8 XXX SG_ Cruise_Activated : 41|1@1+ (1,0) [0|1] "" XXX SG_ Signal2 : 42|22@1+ (1,0) [0|4194303] "" XXX -BO_ 803 INFOTAINMENT_STATUS: 8 XXX +BO_ 803 ES_Infotainment: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX SG_ LKAS_Blue_Lines : 15|4@0+ (1,0) [0|15] "" XXX From 0a7560a2db05b5be359649def88ddda7fc8a0b49 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 24 Jun 2023 15:14:36 -0700 Subject: [PATCH 05/30] pre-commit: autoupdate hooks (#863) Update pre-commit hook versions Co-authored-by: adeebshihadeh --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2ed88fed43..f231072ce3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: - id: check-merge-conflict - id: check-symlinks - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.5 hooks: - id: codespell exclude: '\.dbc$' From e51a78721d99eac223f02cd9b993824712855952 Mon Sep 17 00:00:00 2001 From: Irene Cheng Chi <12470297+cydia2020@users.noreply.github.com> Date: Sat, 1 Jul 2023 06:27:13 +1000 Subject: [PATCH 06/30] Toyota: fix length and description of LDA messages (#868) --- generator/toyota/_toyota_2017.dbc | 6 +++--- toyota_new_mc_pt_generated.dbc | 6 +++--- toyota_nodsu_pt_generated.dbc | 6 +++--- toyota_tnga_k_pt_generated.dbc | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/generator/toyota/_toyota_2017.dbc b/generator/toyota/_toyota_2017.dbc index 17d07b8ee5..4d7cfa4b7d 100644 --- a/generator/toyota/_toyota_2017.dbc +++ b/generator/toyota/_toyota_2017.dbc @@ -241,7 +241,7 @@ BO_ 1042 LKAS_HUD: 8 DSU SG_ LDA_UNAVAILABLE : 16|1@0+ (1,0) [0|1] "" XXX SG_ LDA_SENSITIVITY : 18|2@0+ (1,0) [0|3] "" XXX SG_ LDA_SA_TOGGLE : 20|2@0+ (1,0) [0|3] "" XXX - SG_ LDA_SPEED_TOO_LOW : 21|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MESSAGES : 23|3@0+ (1,0) [0|1] "" XXX SG_ LDA_ON_MESSAGE : 31|2@0+ (1,0) [0|3] "" XXX SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX SG_ LANE_SWAY_TOGGLE : 43|1@0+ (1,0) [0|1] "" XXX @@ -423,7 +423,7 @@ CM_ SG_ 1042 LDA_SENSITIVITY "LDA Sensitivity"; CM_ SG_ 1042 LDA_ON_MESSAGE "Display LDA Turned ON message"; CM_ SG_ 1042 REPEATED_BEEPS "LDA audible warning"; CM_ SG_ 1042 LDA_UNAVAILABLE_QUIET "LDA toggles and sensitivity settings are greyed out if set to 1"; -CM_ SG_ 1042 LDA_SPEED_TOO_LOW "length is 3 bits in the leaked DBC, displays LDA unavailable below approx 50 km/h if set to 1"; +CM_ SG_ 1042 LDA_MESSAGES "Various LDA Messages"; CM_ SG_ 1042 LDA_FRONT_CAMERA_BLOCKED "originally LDAFCVB, LDA related settings are greyed out if set to 1"; CM_ SG_ 1042 TAKE_CONTROL "Please Control Steering Wheel warning"; CM_ SG_ 1042 LANE_SWAY_TOGGLE "Lane Sway Warning System SWS Switch"; @@ -487,7 +487,7 @@ VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; VAL_ 1042 LDA_ON_MESSAGE 2 "Lane Departure Alert Turned ON, Steering Assist Inactive" 1 "Lane Departure Alert Turned ON, Steering Assist Active" 0 "clear"; VAL_ 1042 LDA_SA_TOGGLE 2 "steering assist off" 1 "steering assist on"; VAL_ 1042 LDA_SENSITIVITY 2 "standard" 1 "high" 0 "undefined"; -VAL_ 1042 LDA_SPEED_TOO_LOW 1 "lda unavailable, speed too low" 0 "ok"; +VAL_ 1042 LDA_MESSAGES 4 "lda unavailable at this speed" 1 "lda unavailable below approx 50km/h" 0 "ok"; VAL_ 1042 LDA_FRONT_CAMERA_BLOCKED 1 "lda unavailable" 0 "ok"; VAL_ 1042 TAKE_CONTROL 1 "take control" 0 "ok"; VAL_ 1042 LANE_SWAY_WARNING 3 "ok" 2 "orange please take a break" 1 "prompt would you like to take a break" 0 "ok"; diff --git a/toyota_new_mc_pt_generated.dbc b/toyota_new_mc_pt_generated.dbc index 1f4d0a838c..bce58032d4 100644 --- a/toyota_new_mc_pt_generated.dbc +++ b/toyota_new_mc_pt_generated.dbc @@ -286,7 +286,7 @@ BO_ 1042 LKAS_HUD: 8 DSU SG_ LDA_UNAVAILABLE : 16|1@0+ (1,0) [0|1] "" XXX SG_ LDA_SENSITIVITY : 18|2@0+ (1,0) [0|3] "" XXX SG_ LDA_SA_TOGGLE : 20|2@0+ (1,0) [0|3] "" XXX - SG_ LDA_SPEED_TOO_LOW : 21|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MESSAGES : 23|3@0+ (1,0) [0|1] "" XXX SG_ LDA_ON_MESSAGE : 31|2@0+ (1,0) [0|3] "" XXX SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX SG_ LANE_SWAY_TOGGLE : 43|1@0+ (1,0) [0|1] "" XXX @@ -468,7 +468,7 @@ CM_ SG_ 1042 LDA_SENSITIVITY "LDA Sensitivity"; CM_ SG_ 1042 LDA_ON_MESSAGE "Display LDA Turned ON message"; CM_ SG_ 1042 REPEATED_BEEPS "LDA audible warning"; CM_ SG_ 1042 LDA_UNAVAILABLE_QUIET "LDA toggles and sensitivity settings are greyed out if set to 1"; -CM_ SG_ 1042 LDA_SPEED_TOO_LOW "length is 3 bits in the leaked DBC, displays LDA unavailable below approx 50 km/h if set to 1"; +CM_ SG_ 1042 LDA_MESSAGES "Various LDA Messages"; CM_ SG_ 1042 LDA_FRONT_CAMERA_BLOCKED "originally LDAFCVB, LDA related settings are greyed out if set to 1"; CM_ SG_ 1042 TAKE_CONTROL "Please Control Steering Wheel warning"; CM_ SG_ 1042 LANE_SWAY_TOGGLE "Lane Sway Warning System SWS Switch"; @@ -532,7 +532,7 @@ VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; VAL_ 1042 LDA_ON_MESSAGE 2 "Lane Departure Alert Turned ON, Steering Assist Inactive" 1 "Lane Departure Alert Turned ON, Steering Assist Active" 0 "clear"; VAL_ 1042 LDA_SA_TOGGLE 2 "steering assist off" 1 "steering assist on"; VAL_ 1042 LDA_SENSITIVITY 2 "standard" 1 "high" 0 "undefined"; -VAL_ 1042 LDA_SPEED_TOO_LOW 1 "lda unavailable, speed too low" 0 "ok"; +VAL_ 1042 LDA_MESSAGES 4 "lda unavailable at this speed" 1 "lda unavailable below approx 50km/h" 0 "ok"; VAL_ 1042 LDA_FRONT_CAMERA_BLOCKED 1 "lda unavailable" 0 "ok"; VAL_ 1042 TAKE_CONTROL 1 "take control" 0 "ok"; VAL_ 1042 LANE_SWAY_WARNING 3 "ok" 2 "orange please take a break" 1 "prompt would you like to take a break" 0 "ok"; diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index f69dc059b0..2c0fcb686a 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -286,7 +286,7 @@ BO_ 1042 LKAS_HUD: 8 DSU SG_ LDA_UNAVAILABLE : 16|1@0+ (1,0) [0|1] "" XXX SG_ LDA_SENSITIVITY : 18|2@0+ (1,0) [0|3] "" XXX SG_ LDA_SA_TOGGLE : 20|2@0+ (1,0) [0|3] "" XXX - SG_ LDA_SPEED_TOO_LOW : 21|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MESSAGES : 23|3@0+ (1,0) [0|1] "" XXX SG_ LDA_ON_MESSAGE : 31|2@0+ (1,0) [0|3] "" XXX SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX SG_ LANE_SWAY_TOGGLE : 43|1@0+ (1,0) [0|1] "" XXX @@ -468,7 +468,7 @@ CM_ SG_ 1042 LDA_SENSITIVITY "LDA Sensitivity"; CM_ SG_ 1042 LDA_ON_MESSAGE "Display LDA Turned ON message"; CM_ SG_ 1042 REPEATED_BEEPS "LDA audible warning"; CM_ SG_ 1042 LDA_UNAVAILABLE_QUIET "LDA toggles and sensitivity settings are greyed out if set to 1"; -CM_ SG_ 1042 LDA_SPEED_TOO_LOW "length is 3 bits in the leaked DBC, displays LDA unavailable below approx 50 km/h if set to 1"; +CM_ SG_ 1042 LDA_MESSAGES "Various LDA Messages"; CM_ SG_ 1042 LDA_FRONT_CAMERA_BLOCKED "originally LDAFCVB, LDA related settings are greyed out if set to 1"; CM_ SG_ 1042 TAKE_CONTROL "Please Control Steering Wheel warning"; CM_ SG_ 1042 LANE_SWAY_TOGGLE "Lane Sway Warning System SWS Switch"; @@ -532,7 +532,7 @@ VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; VAL_ 1042 LDA_ON_MESSAGE 2 "Lane Departure Alert Turned ON, Steering Assist Inactive" 1 "Lane Departure Alert Turned ON, Steering Assist Active" 0 "clear"; VAL_ 1042 LDA_SA_TOGGLE 2 "steering assist off" 1 "steering assist on"; VAL_ 1042 LDA_SENSITIVITY 2 "standard" 1 "high" 0 "undefined"; -VAL_ 1042 LDA_SPEED_TOO_LOW 1 "lda unavailable, speed too low" 0 "ok"; +VAL_ 1042 LDA_MESSAGES 4 "lda unavailable at this speed" 1 "lda unavailable below approx 50km/h" 0 "ok"; VAL_ 1042 LDA_FRONT_CAMERA_BLOCKED 1 "lda unavailable" 0 "ok"; VAL_ 1042 TAKE_CONTROL 1 "take control" 0 "ok"; VAL_ 1042 LANE_SWAY_WARNING 3 "ok" 2 "orange please take a break" 1 "prompt would you like to take a break" 0 "ok"; diff --git a/toyota_tnga_k_pt_generated.dbc b/toyota_tnga_k_pt_generated.dbc index 920275321b..9d17f2f02f 100644 --- a/toyota_tnga_k_pt_generated.dbc +++ b/toyota_tnga_k_pt_generated.dbc @@ -286,7 +286,7 @@ BO_ 1042 LKAS_HUD: 8 DSU SG_ LDA_UNAVAILABLE : 16|1@0+ (1,0) [0|1] "" XXX SG_ LDA_SENSITIVITY : 18|2@0+ (1,0) [0|3] "" XXX SG_ LDA_SA_TOGGLE : 20|2@0+ (1,0) [0|3] "" XXX - SG_ LDA_SPEED_TOO_LOW : 21|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MESSAGES : 23|3@0+ (1,0) [0|1] "" XXX SG_ LDA_ON_MESSAGE : 31|2@0+ (1,0) [0|3] "" XXX SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX SG_ LANE_SWAY_TOGGLE : 43|1@0+ (1,0) [0|1] "" XXX @@ -468,7 +468,7 @@ CM_ SG_ 1042 LDA_SENSITIVITY "LDA Sensitivity"; CM_ SG_ 1042 LDA_ON_MESSAGE "Display LDA Turned ON message"; CM_ SG_ 1042 REPEATED_BEEPS "LDA audible warning"; CM_ SG_ 1042 LDA_UNAVAILABLE_QUIET "LDA toggles and sensitivity settings are greyed out if set to 1"; -CM_ SG_ 1042 LDA_SPEED_TOO_LOW "length is 3 bits in the leaked DBC, displays LDA unavailable below approx 50 km/h if set to 1"; +CM_ SG_ 1042 LDA_MESSAGES "Various LDA Messages"; CM_ SG_ 1042 LDA_FRONT_CAMERA_BLOCKED "originally LDAFCVB, LDA related settings are greyed out if set to 1"; CM_ SG_ 1042 TAKE_CONTROL "Please Control Steering Wheel warning"; CM_ SG_ 1042 LANE_SWAY_TOGGLE "Lane Sway Warning System SWS Switch"; @@ -532,7 +532,7 @@ VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; VAL_ 1042 LDA_ON_MESSAGE 2 "Lane Departure Alert Turned ON, Steering Assist Inactive" 1 "Lane Departure Alert Turned ON, Steering Assist Active" 0 "clear"; VAL_ 1042 LDA_SA_TOGGLE 2 "steering assist off" 1 "steering assist on"; VAL_ 1042 LDA_SENSITIVITY 2 "standard" 1 "high" 0 "undefined"; -VAL_ 1042 LDA_SPEED_TOO_LOW 1 "lda unavailable, speed too low" 0 "ok"; +VAL_ 1042 LDA_MESSAGES 4 "lda unavailable at this speed" 1 "lda unavailable below approx 50km/h" 0 "ok"; VAL_ 1042 LDA_FRONT_CAMERA_BLOCKED 1 "lda unavailable" 0 "ok"; VAL_ 1042 TAKE_CONTROL 1 "take control" 0 "ok"; VAL_ 1042 LANE_SWAY_WARNING 3 "ok" 2 "orange please take a break" 1 "prompt would you like to take a break" 0 "ok"; From 7a760a130a27146d7f02a8efb83ad3d5b79d9d71 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 30 Jun 2023 15:29:46 -0700 Subject: [PATCH 07/30] CANParser: test missing messages in DBC (#871) test --- can/tests/test_packer_parser.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/can/tests/test_packer_parser.py b/can/tests/test_packer_parser.py index e504c90b94..9e3cc08c48 100755 --- a/can/tests/test_packer_parser.py +++ b/can/tests/test_packer_parser.py @@ -2,6 +2,7 @@ import os import unittest import random +from functools import partial import cereal.messaging as messaging from opendbc.can.parser import CANParser @@ -317,6 +318,18 @@ def test_timestamp_nanos(self): ts_nanos = parser.ts_nanos["POWERTRAIN_DATA"].values() self.assertEqual(set(ts_nanos), {0}) + def test_undefined_signals(self): + # Ensure we don't allow messages not in the DBC + existing_signals = {"STEERING_CONTROL": ["STEER_TORQUE_REQUEST", "SET_ME_X00_2", "COUNTER"], + "CAN_FD_MESSAGE": ["SIGNED", "64_BIT_LE", "64_BIT_BE", "COUNTER"]} + + for msg, sigs in existing_signals.items(): + for sig in sigs: + CANParser(TEST_DBC, [(sig, msg)], [(msg, 0)]) + self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, msg + "123")], [(msg, 0)])) + self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, msg)], [(msg + "123", 0)])) + self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, msg + "123")], [(msg + "123", 0)])) + if __name__ == "__main__": unittest.main() From 915a97f722b74c468ef890ab6ccecdcb60af7263 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Fri, 30 Jun 2023 17:34:53 -0700 Subject: [PATCH 08/30] pre-commit: autoupdate hooks (#866) Update pre-commit hook versions Co-authored-by: adeebshihadeh --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f231072ce3..0a6c034e10 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: - --check-hidden - --builtins clear,rare,informal,usage,code,names,en-GB_to_en-US - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.3.0 + rev: v1.4.1 hooks: - id: mypy - repo: https://github.com/PyCQA/flake8 From f22aff9f6e9b37941e9cbc2f9df9cd49cddacd1f Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Fri, 30 Jun 2023 17:35:57 -0700 Subject: [PATCH 09/30] bump to python 3.11.4 (#865) * bump to python 3.11.4 * Update requirements.txt * fix * req * fixfix --------- Co-authored-by: Maxime Desroches --- .github/workflows/tests.yml | 2 +- Dockerfile | 6 +++--- generator/chrysler/_stellantis_common_ram.py | 2 +- generator/generator.py | 4 ++-- .../hyundai/hyundai_kia_mando_corner_radar.py | 2 +- generator/hyundai/hyundai_kia_mando_front_radar.py | 2 +- requirements.txt | 14 +++++++------- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5ab3dac992..d3c95f5cd4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,7 @@ name: tests on: [push, pull_request] env: - RUN: docker run -v $GITHUB_WORKSPACE:/project/opendbc -w /project/opendbc -e PYTHONWARNINGS=error --shm-size 1G --rm opendbc /bin/bash -c + RUN: docker run -v $GITHUB_WORKSPACE:/project/opendbc -w /project/opendbc -e PYTHONWARNINGS="error,default::DeprecationWarning" --shm-size 1G --rm opendbc /bin/bash -c BUILD: | docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile) || true docker pull ghcr.io/commaai/opendbc:latest || true diff --git a/Dockerfile b/Dockerfile index c406413aee..69c851c49c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,13 +34,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}" -RUN pyenv install 3.8.10 -RUN pyenv global 3.8.10 +RUN pyenv install 3.11.4 +RUN pyenv global 3.11.4 RUN pyenv rehash COPY requirements.txt /tmp/ RUN pip install --no-cache-dir -r /tmp/requirements.txt -RUN pip install --no-cache-dir pre-commit==2.15.0 pylint==2.5.2 +RUN pip install --no-cache-dir pre-commit==2.15.0 pylint==2.17.4 ENV PYTHONPATH=/project diff --git a/generator/chrysler/_stellantis_common_ram.py b/generator/chrysler/_stellantis_common_ram.py index b117db0dda..5072985ebc 100755 --- a/generator/chrysler/_stellantis_common_ram.py +++ b/generator/chrysler/_stellantis_common_ram.py @@ -32,7 +32,7 @@ chrysler_path = os.path.dirname(os.path.realpath(__file__)) for out, addr_lookup in chrysler_to_ram.items(): - with open(os.path.join(chrysler_path, src)) as in_f, open(os.path.join(chrysler_path, out), 'w') as out_f: + with open(os.path.join(chrysler_path, src), encoding='utf-8') as in_f, open(os.path.join(chrysler_path, out), 'w', encoding='utf-8') as out_f: out_f.write(f'CM_ "Generated from {src}"\n\n') wrote_addrs = set() diff --git a/generator/generator.py b/generator/generator.py index 9d5b37b5db..214c8fb1a5 100755 --- a/generator/generator.py +++ b/generator/generator.py @@ -11,7 +11,7 @@ def read_dbc(src_dir: str, filename: str) -> str: - with open(os.path.join(src_dir, filename)) as file_in: + with open(os.path.join(src_dir, filename), encoding='utf-8') as file_in: return file_in.read() @@ -23,7 +23,7 @@ def create_dbc(src_dir: str, filename: str, output_path: str): output_filename = filename.replace('.dbc', generated_suffix) output_file_location = os.path.join(output_path, output_filename) - with open(output_file_location, 'w') as dbc_file_out: + with open(output_file_location, 'w', encoding='utf-8') as dbc_file_out: dbc_file_out.write('CM_ "AUTOGENERATED FILE, DO NOT EDIT";\n') for include_filename in includes: diff --git a/generator/hyundai/hyundai_kia_mando_corner_radar.py b/generator/hyundai/hyundai_kia_mando_corner_radar.py index d4bcf67e5f..aad417e32a 100755 --- a/generator/hyundai/hyundai_kia_mando_corner_radar.py +++ b/generator/hyundai/hyundai_kia_mando_corner_radar.py @@ -5,7 +5,7 @@ if __name__ == "__main__": dbc_name = os.path.basename(__file__).replace(".py", ".dbc") hyundai_path = os.path.dirname(os.path.realpath(__file__)) - with open(os.path.join(hyundai_path, dbc_name), "w") as f: + with open(os.path.join(hyundai_path, dbc_name), "w", encoding='utf-8') as f: f.write(""" VERSION "" diff --git a/generator/hyundai/hyundai_kia_mando_front_radar.py b/generator/hyundai/hyundai_kia_mando_front_radar.py index 8870bf0cda..ee8dde64d4 100755 --- a/generator/hyundai/hyundai_kia_mando_front_radar.py +++ b/generator/hyundai/hyundai_kia_mando_front_radar.py @@ -4,7 +4,7 @@ if __name__ == "__main__": dbc_name = os.path.basename(__file__).replace(".py", ".dbc") hyundai_path = os.path.dirname(os.path.realpath(__file__)) - with open(os.path.join(hyundai_path, dbc_name), "w") as f: + with open(os.path.join(hyundai_path, dbc_name), "w", encoding='utf-8') as f: f.write(""" VERSION "" diff --git a/requirements.txt b/requirements.txt index 62b29a25ad..a95489c44e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -Cython==0.29.34 -flake8==6.0.0 -Jinja2==3.1.2 -numpy==1.24.2 -pycapnp==1.3.0 -pylint==2.17.2 -pyyaml==6.0 +Cython +flake8 +Jinja2 +numpy +pycapnp +pylint==2.17.4 +pyyaml scons From 5f27703db0a27cb5c2ad4328a1890262dc7c4811 Mon Sep 17 00:00:00 2001 From: godoppl Date: Sat, 1 Jul 2023 07:41:29 +0200 Subject: [PATCH 10/30] Add ISG state to HK generic (#860) * Add ISG state to HK generic * Move values to VAL_ row * move comment --------- Co-authored-by: Cameron Clough --- hyundai_kia_generic.dbc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hyundai_kia_generic.dbc b/hyundai_kia_generic.dbc index c141934403..f554b7fb17 100644 --- a/hyundai_kia_generic.dbc +++ b/hyundai_kia_generic.dbc @@ -698,6 +698,7 @@ BO_ 1365 FPCM11: 8 FPCM BO_ 871 LVR12: 8 LVR SG_ CF_Lvr_CruiseSet : 0|8@1+ (1.0,0.0) [0.0|255.0] "" CLU,TCU + SG_ CF_Lvr_IsgState : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,TCU SG_ CF_Lvr_Gear : 32|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,TCU BO_ 872 LVR11: 8 LVR @@ -1641,9 +1642,11 @@ BO_ 1348 Navi_HU: 8 XXX SG_ SpeedLim_Nav_Clu : 7|8@0+ (1,0) [0|255] "" XXX CM_ "BO_ E_EMS11: All (plug-in) hybrids use this gas signal: CR_Vcu_AccPedDep_Pos, and all EVs use the Accel_Pedal_Pos signal. See hyundai/values.py for a specific car list"; +CM_ SG_ 871 CF_Lvr_IsgState "Idle Stop and Go"; CM_ SG_ 1348 SpeedLim_Nav_Clu "Speed limit displayed on Nav, Cluster and HUD"; VAL_ 274 CUR_GR 1 "D" 2 "D" 3 "D" 4 "D" 5 "D" 6 "D" 7 "D" 8 "D" 14 "R" 0 "P"; +VAL_ 871 CF_Lvr_IsgState 0 "enabled" 1 "activated" 2 "unknown" 3 "disabled"; VAL_ 871 CF_Lvr_Gear 12 "T" 5 "D" 8 "S" 6 "N" 7 "R" 0 "P"; VAL_ 882 Elect_Gear_Shifter 5 "D" 8 "S" 6 "N" 7 "R" 0 "P"; VAL_ 905 ACCMode 0 "off" 1 "enabled" 2 "driver_override" 3 "off_maybe_fault" 4 "cancelled"; From ecd0613872c935d56cd6472e7b46e0a3e916c9d8 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Sat, 1 Jul 2023 01:41:22 -0700 Subject: [PATCH 11/30] tests: rename CAN Parser performance test file (#872) rename --- can/tests/{test_parser.py => test_parser_performance.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename can/tests/{test_parser.py => test_parser_performance.py} (100%) diff --git a/can/tests/test_parser.py b/can/tests/test_parser_performance.py similarity index 100% rename from can/tests/test_parser.py rename to can/tests/test_parser_performance.py From 008104f9400b6161461db40d66ce13b34ea9ce79 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sat, 1 Jul 2023 17:04:33 +0800 Subject: [PATCH 12/30] CANParser: check if signals exist (#870) * check if signals exist * add failing test * better args and test msg in checks * also need to check message addrs * fix up new_msg * consistent * check signals if msg addresses are used * cleanup * cleanup --------- Co-authored-by: Shane Smiskol --- can/parser_pyx.pyx | 18 ++++++++++++------ can/tests/test_packer_parser.py | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/can/parser_pyx.pyx b/can/parser_pyx.pyx index 1a387cfee5..f9cf87e04c 100644 --- a/can/parser_pyx.pyx +++ b/can/parser_pyx.pyx @@ -41,12 +41,17 @@ cdef class CANParser: self.vl_all = {} self.ts_nanos = {} msg_name_to_address = {} + msg_address_to_signals = {} for i in range(self.dbc[0].msgs.size()): msg = self.dbc[0].msgs[i] name = msg.name.decode("utf8") msg_name_to_address[name] = msg.address + msg_address_to_signals[msg.address] = set() + for sig in msg.sigs: + msg_address_to_signals[msg.address].add(sig.name.decode("utf8")) + self.address_to_msg_name[msg.address] = name self.vl[msg.address] = {} self.vl[name] = self.vl[msg.address] @@ -58,12 +63,13 @@ cdef class CANParser: # Convert message names into addresses for i in range(len(signals)): s = signals[i] - if not isinstance(s[1], numbers.Number): - if s[1] not in msg_name_to_address: - print(msg_name_to_address) - raise RuntimeError(f"could not find message {repr(s[1])} in DBC {self.dbc_name}") - s = (s[0], msg_name_to_address[s[1]]) - signals[i] = s + address = s[1] if isinstance(s[1], numbers.Number) else msg_name_to_address.get(s[1]) + if address not in msg_address_to_signals: + raise RuntimeError(f"could not find message {repr(s[1])} in DBC {self.dbc_name}") + if s[0] not in msg_address_to_signals[address]: + raise RuntimeError(f"could not find signal {repr(s[0])} in {repr(s[1])}, DBC {self.dbc_name}") + + signals[i] = (s[0], address) for i in range(len(checks)): c = checks[i] diff --git a/can/tests/test_packer_parser.py b/can/tests/test_packer_parser.py index 9e3cc08c48..126fd4989b 100755 --- a/can/tests/test_packer_parser.py +++ b/can/tests/test_packer_parser.py @@ -319,16 +319,22 @@ def test_timestamp_nanos(self): self.assertEqual(set(ts_nanos), {0}) def test_undefined_signals(self): - # Ensure we don't allow messages not in the DBC - existing_signals = {"STEERING_CONTROL": ["STEER_TORQUE_REQUEST", "SET_ME_X00_2", "COUNTER"], - "CAN_FD_MESSAGE": ["SIGNED", "64_BIT_LE", "64_BIT_BE", "COUNTER"]} + # Ensure we don't allow messages or signals not in the DBC + existing_signals = { + "STEERING_CONTROL": ["STEER_TORQUE_REQUEST", "SET_ME_X00_2", "COUNTER"], + 228: ["STEER_TORQUE_REQUEST", "SET_ME_X00_2", "COUNTER"], + "CAN_FD_MESSAGE": ["SIGNED", "64_BIT_LE", "64_BIT_BE", "COUNTER"], + 245: ["SIGNED", "64_BIT_LE", "64_BIT_BE", "COUNTER"], + } for msg, sigs in existing_signals.items(): for sig in sigs: CANParser(TEST_DBC, [(sig, msg)], [(msg, 0)]) - self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, msg + "123")], [(msg, 0)])) - self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, msg)], [(msg + "123", 0)])) - self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, msg + "123")], [(msg + "123", 0)])) + new_msg = msg + "1" if isinstance(msg, str) else msg + 1 + self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig + "1", msg)], [(msg, 0)])) + self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, new_msg)], [(msg, 0)])) + self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, msg)], [(new_msg, 0)])) + self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, new_msg)], [(new_msg, 0)])) if __name__ == "__main__": From 15e4ae8d48cc9dcdde24b64dd0e7717e5fb9a32c Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 5 Jul 2023 19:28:14 -0700 Subject: [PATCH 13/30] Toyota: add auto high beam message from camera (#878) * add msg * rename * generate --- generator/toyota/_toyota_2017.dbc | 5 +++++ toyota_new_mc_pt_generated.dbc | 5 +++++ toyota_nodsu_pt_generated.dbc | 5 +++++ toyota_tnga_k_pt_generated.dbc | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/generator/toyota/_toyota_2017.dbc b/generator/toyota/_toyota_2017.dbc index 4d7cfa4b7d..8b8edea7a8 100644 --- a/generator/toyota/_toyota_2017.dbc +++ b/generator/toyota/_toyota_2017.dbc @@ -265,6 +265,11 @@ BO_ 1043 TIME : 8 CGW SG_ GMTDIFF_MINUTES : 50|6@0+ (1,0) [0|0] "minutes" XXX SG_ SUMMER : 60|1@0+ (1,0) [0|0] "" XXX +BO_ 1044 AUTO_HIGH_BEAM: 8 FCM + SG_ AHB_DUTY : 47|8@0+ (0.5,0) [0|0] "%" Vector__XXX + SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX + SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX + BO_ 1083 AUTOPARK_STATUS: 8 IPAS SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX diff --git a/toyota_new_mc_pt_generated.dbc b/toyota_new_mc_pt_generated.dbc index bce58032d4..b5667101d5 100644 --- a/toyota_new_mc_pt_generated.dbc +++ b/toyota_new_mc_pt_generated.dbc @@ -310,6 +310,11 @@ BO_ 1043 TIME : 8 CGW SG_ GMTDIFF_MINUTES : 50|6@0+ (1,0) [0|0] "minutes" XXX SG_ SUMMER : 60|1@0+ (1,0) [0|0] "" XXX +BO_ 1044 AUTO_HIGH_BEAM: 8 FCM + SG_ AHB_DUTY : 47|8@0+ (0.5,0) [0|0] "%" Vector__XXX + SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX + SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX + BO_ 1083 AUTOPARK_STATUS: 8 IPAS SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index 2c0fcb686a..060aec3010 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -310,6 +310,11 @@ BO_ 1043 TIME : 8 CGW SG_ GMTDIFF_MINUTES : 50|6@0+ (1,0) [0|0] "minutes" XXX SG_ SUMMER : 60|1@0+ (1,0) [0|0] "" XXX +BO_ 1044 AUTO_HIGH_BEAM: 8 FCM + SG_ AHB_DUTY : 47|8@0+ (0.5,0) [0|0] "%" Vector__XXX + SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX + SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX + BO_ 1083 AUTOPARK_STATUS: 8 IPAS SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX diff --git a/toyota_tnga_k_pt_generated.dbc b/toyota_tnga_k_pt_generated.dbc index 9d17f2f02f..c16b9f1234 100644 --- a/toyota_tnga_k_pt_generated.dbc +++ b/toyota_tnga_k_pt_generated.dbc @@ -310,6 +310,11 @@ BO_ 1043 TIME : 8 CGW SG_ GMTDIFF_MINUTES : 50|6@0+ (1,0) [0|0] "minutes" XXX SG_ SUMMER : 60|1@0+ (1,0) [0|0] "" XXX +BO_ 1044 AUTO_HIGH_BEAM: 8 FCM + SG_ AHB_DUTY : 47|8@0+ (0.5,0) [0|0] "%" Vector__XXX + SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX + SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX + BO_ 1083 AUTOPARK_STATUS: 8 IPAS SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX From 6430f4c3b6f65c1a9870df6e2a5ec17f17aed744 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 5 Jul 2023 20:03:58 -0700 Subject: [PATCH 14/30] Toyota: add LTA related message from camera (#880) * add msg and comments * rename and mark FCM (camera) * update range * run generator * isbe --- generator/toyota/toyota_nodsu_pt.dbc | 16 ++++++++++++++++ toyota_nodsu_pt_generated.dbc | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/generator/toyota/toyota_nodsu_pt.dbc b/generator/toyota/toyota_nodsu_pt.dbc index fe0ab32323..5629363dd9 100644 --- a/generator/toyota/toyota_nodsu_pt.dbc +++ b/generator/toyota/toyota_nodsu_pt.dbc @@ -27,6 +27,16 @@ BO_ 610 EPS_STATUS: 8 EPS SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 881 LTA_RELATED: 8 FCM + SG_ GAS_PEDAL : 15|8@0+ (0.005,0) [0|1] "" XXX + SG_ STEER_ANGLE : 23|16@0- (0.0573,0) [-500|500] "" XXX + SG_ TURN_SIGNALS : 35|2@0+ (1,0) [0|3] "" XXX + SG_ UNKNOWN_2 : 58|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_SA_TOGGLE : 59|1@0+ (1,0) [0|1] "" XXX + SG_ LTA_STEER_REQUEST : 60|1@0+ (1,0) [0|1] "" XXX + SG_ UNKNOWN : 61|1@0+ (1,0) [0|1] "" XXX + SG_ STEERING_PRESSED : 63|1@0+ (1,0) [0|1] "" XXX + BO_ 1014 BSM: 8 XXX SG_ L_ADJACENT : 0|1@0+ (1,0) [0|1] "" XXX SG_ L_APPROACHING : 8|1@0+ (1,0) [0|1] "" XXX @@ -46,6 +56,12 @@ CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +CM_ SG_ 881 GAS_PEDAL "not set on all cars, only seen on TSS 2.5 Camry Hybrid so far"; +CM_ SG_ 881 STEER_ANGLE "matches STEER_TORQUE_SENSOR->STEER_ANGLE"; +CM_ SG_ 881 TURN_SIGNALS "flipped on some cars"; +CM_ SG_ 881 LTA_STEER_REQUEST "matches STEERING_LTA->STEER_REQUEST"; +CM_ SG_ 881 UNKNOWN "related to steering wheel angle"; +CM_ SG_ 881 STEERING_PRESSED "low sensitivity steering wheel pressed by driver signal"; CM_ SG_ 1014 L_ADJACENT "vehicle adjacent left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; CM_ SG_ 1014 L_APPROACHING "vehicle approaching from left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; CM_ SG_ 1014 R_ADJACENT "vehicle adjacent right side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index 060aec3010..d1a5bc9d11 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -582,6 +582,16 @@ BO_ 610 EPS_STATUS: 8 EPS SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 881 LTA_RELATED: 8 FCM + SG_ GAS_PEDAL : 15|8@0+ (0.005,0) [0|1] "" XXX + SG_ STEER_ANGLE : 23|16@0- (0.0573,0) [-500|500] "" XXX + SG_ TURN_SIGNALS : 35|2@0+ (1,0) [0|3] "" XXX + SG_ UNKNOWN_2 : 58|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_SA_TOGGLE : 59|1@0+ (1,0) [0|1] "" XXX + SG_ LTA_STEER_REQUEST : 60|1@0+ (1,0) [0|1] "" XXX + SG_ UNKNOWN : 61|1@0+ (1,0) [0|1] "" XXX + SG_ STEERING_PRESSED : 63|1@0+ (1,0) [0|1] "" XXX + BO_ 1014 BSM: 8 XXX SG_ L_ADJACENT : 0|1@0+ (1,0) [0|1] "" XXX SG_ L_APPROACHING : 8|1@0+ (1,0) [0|1] "" XXX @@ -601,6 +611,12 @@ CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +CM_ SG_ 881 GAS_PEDAL "not set on all cars, only seen on TSS 2.5 Camry Hybrid so far"; +CM_ SG_ 881 STEER_ANGLE "matches STEER_TORQUE_SENSOR->STEER_ANGLE"; +CM_ SG_ 881 TURN_SIGNALS "flipped on some cars"; +CM_ SG_ 881 LTA_STEER_REQUEST "matches STEERING_LTA->STEER_REQUEST"; +CM_ SG_ 881 UNKNOWN "related to steering wheel angle"; +CM_ SG_ 881 STEERING_PRESSED "low sensitivity steering wheel pressed by driver signal"; CM_ SG_ 1014 L_ADJACENT "vehicle adjacent left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; CM_ SG_ 1014 L_APPROACHING "vehicle approaching from left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; CM_ SG_ 1014 R_ADJACENT "vehicle adjacent right side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; From 53716e8466f645d685ddd51755636b6249765a2c Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 5 Jul 2023 20:15:59 -0700 Subject: [PATCH 15/30] Toyota: update an LTA signal name (#879) * add temporarily * add a comment * think this is what it shows, but exact text doesn't matter --- generator/toyota/toyota_nodsu_pt.dbc | 4 ++-- toyota_nodsu_pt_generated.dbc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generator/toyota/toyota_nodsu_pt.dbc b/generator/toyota/toyota_nodsu_pt.dbc index 5629363dd9..9f7c3f5ebd 100644 --- a/generator/toyota/toyota_nodsu_pt.dbc +++ b/generator/toyota/toyota_nodsu_pt.dbc @@ -10,7 +10,7 @@ BO_ 401 STEERING_LTA: 8 XXX SG_ STEER_ANGLE_CMD : 15|16@0- (0.0573,0) [-540|540] "" XXX SG_ STEER_REQUEST_2 : 25|1@0+ (1,0) [0|1] "" XXX SG_ LKA_ACTIVE : 26|1@0+ (1,0) [0|1] "" XXX - SG_ BIT : 30|1@0+ (1,0) [0|1] "" XXX + SG_ CLEAR_HOLD_STEERING_ALERT : 30|1@0+ (1,0) [0|1] "" XXX SG_ COUNTER : 6|6@0+ (1,0) [0|255] "" XXX SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX SG_ SETME_X1 : 7|1@0+ (1,0) [0|1] "" XXX @@ -49,7 +49,7 @@ CM_ SG_ 401 PERCENTAGE "driver override percentage (0-100), very close to steeri CM_ SG_ 401 SETME_X64 "ramps to 0 smoothly then back on falling edge of STEER_REQUEST if BIT isn't 1"; CM_ SG_ 401 ANGLE "angle of car relative to lane center on LTA camera"; CM_ SG_ 401 STEER_ANGLE_CMD "desired angle, OEM steers up to 95 degrees, no angle limit but torque will bottom out"; -CM_ SG_ 401 BIT "has correlation to STEER_REQUEST"; +CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_ALERT ('Hold Steering') by applying torque to steering wheel"; CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index d1a5bc9d11..7802c65f7c 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -565,7 +565,7 @@ BO_ 401 STEERING_LTA: 8 XXX SG_ STEER_ANGLE_CMD : 15|16@0- (0.0573,0) [-540|540] "" XXX SG_ STEER_REQUEST_2 : 25|1@0+ (1,0) [0|1] "" XXX SG_ LKA_ACTIVE : 26|1@0+ (1,0) [0|1] "" XXX - SG_ BIT : 30|1@0+ (1,0) [0|1] "" XXX + SG_ CLEAR_HOLD_STEERING_ALERT : 30|1@0+ (1,0) [0|1] "" XXX SG_ COUNTER : 6|6@0+ (1,0) [0|255] "" XXX SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX SG_ SETME_X1 : 7|1@0+ (1,0) [0|1] "" XXX @@ -604,7 +604,7 @@ CM_ SG_ 401 PERCENTAGE "driver override percentage (0-100), very close to steeri CM_ SG_ 401 SETME_X64 "ramps to 0 smoothly then back on falling edge of STEER_REQUEST if BIT isn't 1"; CM_ SG_ 401 ANGLE "angle of car relative to lane center on LTA camera"; CM_ SG_ 401 STEER_ANGLE_CMD "desired angle, OEM steers up to 95 degrees, no angle limit but torque will bottom out"; -CM_ SG_ 401 BIT "has correlation to STEER_REQUEST"; +CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_ALERT ('Hold Steering') by applying torque to steering wheel"; CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; From ff445c412f28b64ee6e15f49594f70c76d2e9acf Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 5 Jul 2023 21:25:09 -0700 Subject: [PATCH 16/30] Toyota: update LTA comments (#881) * add/update comments * generate --- generator/toyota/toyota_nodsu_pt.dbc | 5 +++-- toyota_nodsu_pt_generated.dbc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/generator/toyota/toyota_nodsu_pt.dbc b/generator/toyota/toyota_nodsu_pt.dbc index 9f7c3f5ebd..441c5c0cb0 100644 --- a/generator/toyota/toyota_nodsu_pt.dbc +++ b/generator/toyota/toyota_nodsu_pt.dbc @@ -59,9 +59,10 @@ CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; CM_ SG_ 881 GAS_PEDAL "not set on all cars, only seen on TSS 2.5 Camry Hybrid so far"; CM_ SG_ 881 STEER_ANGLE "matches STEER_TORQUE_SENSOR->STEER_ANGLE"; CM_ SG_ 881 TURN_SIGNALS "flipped on some cars"; -CM_ SG_ 881 LTA_STEER_REQUEST "matches STEERING_LTA->STEER_REQUEST"; +CM_ SG_ 881 LDA_SA_TOGGLE "not applicable for all cars"; +CM_ SG_ 881 LTA_STEER_REQUEST "only applicable for TSS 2.5: matches STEERING_LTA->STEER_REQUEST"; CM_ SG_ 881 UNKNOWN "related to steering wheel angle"; -CM_ SG_ 881 STEERING_PRESSED "low sensitivity steering wheel pressed by driver signal"; +CM_ SG_ 881 STEERING_PRESSED "only applicable for TSS 2.5: low sensitivity steering wheel pressed by driver signal"; CM_ SG_ 1014 L_ADJACENT "vehicle adjacent left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; CM_ SG_ 1014 L_APPROACHING "vehicle approaching from left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; CM_ SG_ 1014 R_ADJACENT "vehicle adjacent right side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index 7802c65f7c..e7bf54cc80 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -614,9 +614,10 @@ CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; CM_ SG_ 881 GAS_PEDAL "not set on all cars, only seen on TSS 2.5 Camry Hybrid so far"; CM_ SG_ 881 STEER_ANGLE "matches STEER_TORQUE_SENSOR->STEER_ANGLE"; CM_ SG_ 881 TURN_SIGNALS "flipped on some cars"; -CM_ SG_ 881 LTA_STEER_REQUEST "matches STEERING_LTA->STEER_REQUEST"; +CM_ SG_ 881 LDA_SA_TOGGLE "not applicable for all cars"; +CM_ SG_ 881 LTA_STEER_REQUEST "only applicable for TSS 2.5: matches STEERING_LTA->STEER_REQUEST"; CM_ SG_ 881 UNKNOWN "related to steering wheel angle"; -CM_ SG_ 881 STEERING_PRESSED "low sensitivity steering wheel pressed by driver signal"; +CM_ SG_ 881 STEERING_PRESSED "only applicable for TSS 2.5: low sensitivity steering wheel pressed by driver signal"; CM_ SG_ 1014 L_ADJACENT "vehicle adjacent left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; CM_ SG_ 1014 L_APPROACHING "vehicle approaching from left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; CM_ SG_ 1014 R_ADJACENT "vehicle adjacent right side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED"; From 2886a193ec211d88792fb12fd6d35481e22db87f Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 6 Jul 2023 01:05:45 -0700 Subject: [PATCH 17/30] Toyota: add comment for LTA signal (#876) * add comment * more complete comment * gen * but * add val for cabana --- generator/toyota/toyota_nodsu_pt.dbc | 2 ++ toyota_nodsu_pt_generated.dbc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/generator/toyota/toyota_nodsu_pt.dbc b/generator/toyota/toyota_nodsu_pt.dbc index 441c5c0cb0..d51caa4756 100644 --- a/generator/toyota/toyota_nodsu_pt.dbc +++ b/generator/toyota/toyota_nodsu_pt.dbc @@ -53,6 +53,7 @@ CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_A CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; +CM_ SG_ 401 SETME_X3 "almost completely correlates with Toyota Safety Sense version, but may instead describe max torque when using LTA. if TSS 2.5 or 2022 RAV4, this is always 1. if TSS 2.0 this is always 3 (or 0 on Alphard, Highlander, NX)"; CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; @@ -70,6 +71,7 @@ CM_ SG_ 1014 R_APPROACHING "vehicle approaching from right side of car. enabled CM_ SG_ 1014 ADJACENT_ENABLED "when BSM is enabled in settings, this is on along with APPROACHING_ENABLED. this controls bsm alert visibility"; CM_ SG_ 1014 APPROACHING_ENABLED "when BSM is enabled in settings, this is on along with ADJACENT_ENABLED. this controls bsm alert visibility"; +VAL_ 401 SETME_X3 3 "TSS 2.0" 1 "TSS 2.5 or 2022 RAV4" 0 "TSS 2.0 on Alphard, Highlander, NX"; VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; VAL_ 610 LKA_STATE 25 "temporary_fault" 17 "permanent_fault" 11 "lka_missing_unavailable2" 9 "temporary_fault2" 5 "active" 3 "lka_missing_unavailable" 1 "standby"; VAL_ 610 LTA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 3 "lta_missing_unavailable" 1 "standby"; diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index e7bf54cc80..f8e37092d8 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -608,6 +608,7 @@ CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_A CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; +CM_ SG_ 401 SETME_X3 "almost completely correlates with Toyota Safety Sense version, but may instead describe max torque when using LTA. if TSS 2.5 or 2022 RAV4, this is always 1. if TSS 2.0 this is always 3 (or 0 on Alphard, Highlander, NX)"; CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; @@ -625,6 +626,7 @@ CM_ SG_ 1014 R_APPROACHING "vehicle approaching from right side of car. enabled CM_ SG_ 1014 ADJACENT_ENABLED "when BSM is enabled in settings, this is on along with APPROACHING_ENABLED. this controls bsm alert visibility"; CM_ SG_ 1014 APPROACHING_ENABLED "when BSM is enabled in settings, this is on along with ADJACENT_ENABLED. this controls bsm alert visibility"; +VAL_ 401 SETME_X3 3 "TSS 2.0" 1 "TSS 2.5 or 2022 RAV4" 0 "TSS 2.0 on Alphard, Highlander, NX"; VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; VAL_ 610 LKA_STATE 25 "temporary_fault" 17 "permanent_fault" 11 "lka_missing_unavailable2" 9 "temporary_fault2" 5 "active" 3 "lka_missing_unavailable" 1 "standby"; VAL_ 610 LTA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 3 "lta_missing_unavailable" 1 "standby"; From 75253095dc6a7fcd6da4ad0100e632cdf4fe9f61 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 6 Jul 2023 13:36:31 -0700 Subject: [PATCH 18/30] Toyota: add LTA comment for SETME_X1 (#885) add comment --- generator/toyota/toyota_nodsu_pt.dbc | 1 + toyota_nodsu_pt_generated.dbc | 1 + 2 files changed, 2 insertions(+) diff --git a/generator/toyota/toyota_nodsu_pt.dbc b/generator/toyota/toyota_nodsu_pt.dbc index d51caa4756..f7e9d08af3 100644 --- a/generator/toyota/toyota_nodsu_pt.dbc +++ b/generator/toyota/toyota_nodsu_pt.dbc @@ -53,6 +53,7 @@ CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_A CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; +CM_ SG_ 401 SETME_X1 "usually 1, seen at 0 on some South American Corollas"; CM_ SG_ 401 SETME_X3 "almost completely correlates with Toyota Safety Sense version, but may instead describe max torque when using LTA. if TSS 2.5 or 2022 RAV4, this is always 1. if TSS 2.0 this is always 3 (or 0 on Alphard, Highlander, NX)"; CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index f8e37092d8..57bd990215 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -608,6 +608,7 @@ CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_A CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; +CM_ SG_ 401 SETME_X1 "usually 1, seen at 0 on some South American Corollas"; CM_ SG_ 401 SETME_X3 "almost completely correlates with Toyota Safety Sense version, but may instead describe max torque when using LTA. if TSS 2.5 or 2022 RAV4, this is always 1. if TSS 2.0 this is always 3 (or 0 on Alphard, Highlander, NX)"; CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; From b38a74af81c59ac32efc50d37dace657001dd1db Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 6 Jul 2023 16:42:50 -0700 Subject: [PATCH 19/30] Toyota: update LTA comment for SETME_X1 (#887) * update comment, slightly more accurate * EPS still accepts it though --- generator/toyota/toyota_nodsu_pt.dbc | 2 +- toyota_nodsu_pt_generated.dbc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/toyota/toyota_nodsu_pt.dbc b/generator/toyota/toyota_nodsu_pt.dbc index f7e9d08af3..909a198a31 100644 --- a/generator/toyota/toyota_nodsu_pt.dbc +++ b/generator/toyota/toyota_nodsu_pt.dbc @@ -53,7 +53,7 @@ CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_A CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; -CM_ SG_ 401 SETME_X1 "usually 1, seen at 0 on some South American Corollas"; +CM_ SG_ 401 SETME_X1 "usually 1, seen at 0 on some South American Corollas indicating lack of stock Lane Tracing Assist"; CM_ SG_ 401 SETME_X3 "almost completely correlates with Toyota Safety Sense version, but may instead describe max torque when using LTA. if TSS 2.5 or 2022 RAV4, this is always 1. if TSS 2.0 this is always 3 (or 0 on Alphard, Highlander, NX)"; CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; diff --git a/toyota_nodsu_pt_generated.dbc b/toyota_nodsu_pt_generated.dbc index 57bd990215..2ea426557f 100644 --- a/toyota_nodsu_pt_generated.dbc +++ b/toyota_nodsu_pt_generated.dbc @@ -608,7 +608,7 @@ CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_A CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not"; CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA"; -CM_ SG_ 401 SETME_X1 "usually 1, seen at 0 on some South American Corollas"; +CM_ SG_ 401 SETME_X1 "usually 1, seen at 0 on some South American Corollas indicating lack of stock Lane Tracing Assist"; CM_ SG_ 401 SETME_X3 "almost completely correlates with Toyota Safety Sense version, but may instead describe max torque when using LTA. if TSS 2.5 or 2022 RAV4, this is always 1. if TSS 2.0 this is always 3 (or 0 on Alphard, Highlander, NX)"; CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; From 33940105be96ec1f265f9de3fb40956710cd1ea8 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 7 Jul 2023 01:02:12 -0700 Subject: [PATCH 20/30] tests: global constants (#889) small clean up --- can/tests/__init__.py | 8 ++++++++ can/tests/test_dbc_exceptions.py | 1 + can/tests/test_dbc_parser.py | 12 ++---------- can/tests/test_packer_parser.py | 5 +---- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/can/tests/__init__.py b/can/tests/__init__.py index e69de29bb2..3bf02fdae0 100644 --- a/can/tests/__init__.py +++ b/can/tests/__init__.py @@ -0,0 +1,8 @@ +import glob +import os + +from opendbc import DBC_PATH + +ALL_DBCS = [os.path.basename(dbc).split('.')[0] for dbc in + glob.glob(f"{DBC_PATH}/*.dbc")] +TEST_DBC = os.path.abspath(os.path.join(os.path.dirname(__file__), "test.dbc")) diff --git a/can/tests/test_dbc_exceptions.py b/can/tests/test_dbc_exceptions.py index b594893ea5..e9102a2cfa 100755 --- a/can/tests/test_dbc_exceptions.py +++ b/can/tests/test_dbc_exceptions.py @@ -5,6 +5,7 @@ from opendbc.can.parser import CANParser, CANDefine from opendbc.can.packer import CANPacker + class TestCanParserPackerExceptions(unittest.TestCase): def test_civic_exceptions(self): dbc_file = "honda_civic_touring_2016_can_generated" diff --git a/can/tests/test_dbc_parser.py b/can/tests/test_dbc_parser.py index b28392606d..72cacd7f16 100755 --- a/can/tests/test_dbc_parser.py +++ b/can/tests/test_dbc_parser.py @@ -1,19 +1,11 @@ #!/usr/bin/env python3 -import glob -import os import unittest -from opendbc import DBC_PATH from opendbc.can.parser import CANParser +from opendbc.can.tests import ALL_DBCS class TestDBCParser(unittest.TestCase): - @classmethod - def setUpClass(cls): - cls.dbcs = [] - for dbc in glob.glob(f"{DBC_PATH}/*.dbc"): - cls.dbcs.append(os.path.basename(dbc).split('.')[0]) - def test_parse_all_dbcs(self): """ Dynamic DBC parser checks: @@ -23,7 +15,7 @@ def test_parse_all_dbcs(self): - All BO_, SG_, VAL_ lines for syntax errors """ - for dbc in self.dbcs: + for dbc in ALL_DBCS: with self.subTest(dbc=dbc): CANParser(dbc, [], [], 0) diff --git a/can/tests/test_packer_parser.py b/can/tests/test_packer_parser.py index 126fd4989b..b0be24847d 100755 --- a/can/tests/test_packer_parser.py +++ b/can/tests/test_packer_parser.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -import os import unittest import random from functools import partial @@ -7,9 +6,7 @@ import cereal.messaging as messaging from opendbc.can.parser import CANParser from opendbc.can.packer import CANPacker - - -TEST_DBC = os.path.abspath(os.path.join(os.path.dirname(__file__), "test.dbc")) +from opendbc.can.tests import TEST_DBC # Python implementation so we don't have to depend on boardd From fe8d535a7fd99eeb15526ca944a6019b9a1e5ea0 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 7 Jul 2023 01:09:24 -0700 Subject: [PATCH 21/30] CANDefine: test all DBCs (#888) * change addr for ioniq 6 * add new msg * a test for this * add to test_dbc_exceptions * cmt * fix --- can/tests/test.dbc | 2 ++ can/tests/test_dbc_exceptions.py | 3 +++ can/tests/test_define.py | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/can/tests/test.dbc b/can/tests/test.dbc index 0134c7a4c0..05104fb068 100644 --- a/can/tests/test.dbc +++ b/can/tests/test.dbc @@ -23,3 +23,5 @@ BO_ 245 CAN_FD_MESSAGE: 32 XXX SG_ SIGNED : 22|16@0- (1,0) [0|1] "" XXX SG_ 64_BIT_LE : 159|64@1+ (1,0) [0|1] "" XXX SG_ 64_BIT_BE : 80|64@0+ (1,0) [0|1] "" XXX + +VAL_ 80 NON_EXISTENT_ADDR 0 "test"; diff --git a/can/tests/test_dbc_exceptions.py b/can/tests/test_dbc_exceptions.py index e9102a2cfa..02956eca8c 100755 --- a/can/tests/test_dbc_exceptions.py +++ b/can/tests/test_dbc_exceptions.py @@ -4,6 +4,7 @@ from opendbc.can.parser import CANParser, CANDefine from opendbc.can.packer import CANPacker +from opendbc.can.tests import TEST_DBC class TestCanParserPackerExceptions(unittest.TestCase): @@ -21,6 +22,8 @@ def test_civic_exceptions(self): CANPacker(dbc_invalid) with self.assertRaises(RuntimeError): CANDefine(dbc_invalid) + with self.assertRaises(KeyError): + CANDefine(TEST_DBC) with self.assertRaises(RuntimeError): CANParser(dbc_file, signals, [], 0) diff --git a/can/tests/test_define.py b/can/tests/test_define.py index d9a6f7d671..ed35e87f9f 100755 --- a/can/tests/test_define.py +++ b/can/tests/test_define.py @@ -2,6 +2,7 @@ import unittest from opendbc.can.can_define import CANDefine +from opendbc.can.tests import ALL_DBCS class TestCADNDefine(unittest.TestCase): @@ -22,6 +23,12 @@ def test_civic(self): } ) + def test_all_dbcs(self): + # Asserts no exceptions on all DBCs + for dbc in ALL_DBCS: + with self.subTest(dbc=dbc): + CANDefine(dbc) + if __name__ == "__main__": unittest.main() From e498d012147e00301fc443663e0ee57cbfdc3c24 Mon Sep 17 00:00:00 2001 From: junhee Ahn <33146367+saga0619@users.noreply.github.com> Date: Fri, 7 Jul 2023 19:09:22 +0900 Subject: [PATCH 22/30] HYUNDAI: update speed camera signal (#890) --- hyundai_kia_generic.dbc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hyundai_kia_generic.dbc b/hyundai_kia_generic.dbc index f554b7fb17..f1af8f9d2e 100644 --- a/hyundai_kia_generic.dbc +++ b/hyundai_kia_generic.dbc @@ -1640,6 +1640,8 @@ BO_ 1042 ICM_412h: 8 ICM BO_ 1348 Navi_HU: 8 XXX SG_ SpeedLim_Nav_Clu : 7|8@0+ (1,0) [0|255] "" XXX + SG_ SpeedLim_Nav_General : 29|1@0+ (1,0) [0|1] "" XXX + SG_ SpeedLim_Nav_Cam : 30|1@0+ (1,0) [0|1] "" XXX CM_ "BO_ E_EMS11: All (plug-in) hybrids use this gas signal: CR_Vcu_AccPedDep_Pos, and all EVs use the Accel_Pedal_Pos signal. See hyundai/values.py for a specific car list"; CM_ SG_ 871 CF_Lvr_IsgState "Idle Stop and Go"; From 236359cf63c3caaf8e02b972c452aabac416662a Mon Sep 17 00:00:00 2001 From: martinl Date: Thu, 13 Jul 2023 02:07:45 +0300 Subject: [PATCH 23/30] Add Subaru Global 2022 DBC (#758) * Add Subaru Global 2022 DBC * Rename SET_1 to LKAS_Request * mostly repeated signals, combined those * PR cleanup * move to existing dbc --------- Co-authored-by: Justin Newberry --- generator/subaru/_subaru_global.dbc | 7 +++++++ subaru_global_2017_generated.dbc | 7 +++++++ subaru_global_2020_hybrid_generated.dbc | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/generator/subaru/_subaru_global.dbc b/generator/subaru/_subaru_global.dbc index 732ae36736..b6e577a404 100644 --- a/generator/subaru/_subaru_global.dbc +++ b/generator/subaru/_subaru_global.dbc @@ -127,6 +127,13 @@ BO_ 290 ES_LKAS: 8 XXX SG_ LKAS_Output : 16|13@1- (-1,0) [-8191|8191] "" XXX SG_ LKAS_Request : 29|1@0+ (1,0) [0|1] "" XXX +BO_ 292 ES_LKAS_ALT: 8 XXX + SG_ CHECKSUM : 0|8@1+ (1,0) [0|1] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|1] "" XXX + SG_ LKAS_Request : 12|1@1+ (1,0) [0|1] "" XXX + SG_ LKAS_Output : 40|17@1- (-1,0) [0|1] "" XXX + SG_ SET_3 : 60|2@1+ (1,0) [0|1] "" XXX + BO_ 544 ES_Brake: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX diff --git a/subaru_global_2017_generated.dbc b/subaru_global_2017_generated.dbc index 9b7f9a6422..a67fcfd39e 100644 --- a/subaru_global_2017_generated.dbc +++ b/subaru_global_2017_generated.dbc @@ -131,6 +131,13 @@ BO_ 290 ES_LKAS: 8 XXX SG_ LKAS_Output : 16|13@1- (-1,0) [-8191|8191] "" XXX SG_ LKAS_Request : 29|1@0+ (1,0) [0|1] "" XXX +BO_ 292 ES_LKAS_ALT: 8 XXX + SG_ CHECKSUM : 0|8@1+ (1,0) [0|1] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|1] "" XXX + SG_ LKAS_Request : 12|1@1+ (1,0) [0|1] "" XXX + SG_ LKAS_Output : 40|17@1- (-1,0) [0|1] "" XXX + SG_ SET_3 : 60|2@1+ (1,0) [0|1] "" XXX + BO_ 544 ES_Brake: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX diff --git a/subaru_global_2020_hybrid_generated.dbc b/subaru_global_2020_hybrid_generated.dbc index ad6767b2b8..9316e3c36b 100644 --- a/subaru_global_2020_hybrid_generated.dbc +++ b/subaru_global_2020_hybrid_generated.dbc @@ -131,6 +131,13 @@ BO_ 290 ES_LKAS: 8 XXX SG_ LKAS_Output : 16|13@1- (-1,0) [-8191|8191] "" XXX SG_ LKAS_Request : 29|1@0+ (1,0) [0|1] "" XXX +BO_ 292 ES_LKAS_ALT: 8 XXX + SG_ CHECKSUM : 0|8@1+ (1,0) [0|1] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|1] "" XXX + SG_ LKAS_Request : 12|1@1+ (1,0) [0|1] "" XXX + SG_ LKAS_Output : 40|17@1- (-1,0) [0|1] "" XXX + SG_ SET_3 : 60|2@1+ (1,0) [0|1] "" XXX + BO_ 544 ES_Brake: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX From 5beef54494db306aa69264924e681f0eb06266a3 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 13 Jul 2023 19:40:01 -0700 Subject: [PATCH 24/30] Subaru: more steering messages (#893) --- generator/subaru/_subaru_global.dbc | 13 +++++++++++-- subaru_global_2017_generated.dbc | 13 +++++++++++-- subaru_global_2020_hybrid_generated.dbc | 13 +++++++++++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/generator/subaru/_subaru_global.dbc b/generator/subaru/_subaru_global.dbc index b6e577a404..7b56f20af4 100644 --- a/generator/subaru/_subaru_global.dbc +++ b/generator/subaru/_subaru_global.dbc @@ -83,10 +83,14 @@ BO_ 314 Wheel_Speeds: 8 XXX SG_ FL : 51|13@1+ (0.057,0) [0|255] "kph" XXX SG_ RL : 38|13@1+ (0.057,0) [0|255] "kph" XXX -BO_ 280 STOP_START: 8 XXX +BO_ 280 Steering_Torque_2: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX - SG_ State : 63|1@1+ (1,0) [0|1] "" XXX + SG_ Steer_Torque_Output : 13|11@1- (-10,0) [0|255] "" XXX + SG_ Signal1 : 24|8@1+ (1,0) [0|511] "" XXX + SG_ Steer_Torque_Sensor : 45|11@1- (-1,0) [0|255] "" XXX + SG_ Steering_Active : 61|1@0+ (1,0) [0|1] "" XXX + SG_ Steering_Disabled : 63|1@1+ (1,0) [0|1] "" XXX BO_ 281 Steering_Torque: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX @@ -98,6 +102,11 @@ BO_ 281 Steering_Torque: 8 XXX SG_ Steering_Angle : 32|16@1- (-0.0217,0) [-600|600] "" X SG_ Steer_Torque_Output : 48|11@1- (-10,0) [-1000|1000] "" XXX +BO_ 282 Steering_2: 8 XXX + SG_ CHECKSUM : 0|8@1+ (1,0) [0|1] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|1] "" XXX + SG_ Steering_Angle : 24|17@1- (-0.01,0) [0|1] "" XXX + BO_ 312 Brake_Pressure_L_R: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX diff --git a/subaru_global_2017_generated.dbc b/subaru_global_2017_generated.dbc index a67fcfd39e..75f15ea946 100644 --- a/subaru_global_2017_generated.dbc +++ b/subaru_global_2017_generated.dbc @@ -87,10 +87,14 @@ BO_ 314 Wheel_Speeds: 8 XXX SG_ FL : 51|13@1+ (0.057,0) [0|255] "kph" XXX SG_ RL : 38|13@1+ (0.057,0) [0|255] "kph" XXX -BO_ 280 STOP_START: 8 XXX +BO_ 280 Steering_Torque_2: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX - SG_ State : 63|1@1+ (1,0) [0|1] "" XXX + SG_ Steer_Torque_Output : 13|11@1- (-10,0) [0|255] "" XXX + SG_ Signal1 : 24|8@1+ (1,0) [0|511] "" XXX + SG_ Steer_Torque_Sensor : 45|11@1- (-1,0) [0|255] "" XXX + SG_ Steering_Active : 61|1@0+ (1,0) [0|1] "" XXX + SG_ Steering_Disabled : 63|1@1+ (1,0) [0|1] "" XXX BO_ 281 Steering_Torque: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX @@ -102,6 +106,11 @@ BO_ 281 Steering_Torque: 8 XXX SG_ Steering_Angle : 32|16@1- (-0.0217,0) [-600|600] "" X SG_ Steer_Torque_Output : 48|11@1- (-10,0) [-1000|1000] "" XXX +BO_ 282 Steering_2: 8 XXX + SG_ CHECKSUM : 0|8@1+ (1,0) [0|1] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|1] "" XXX + SG_ Steering_Angle : 24|17@1- (-0.01,0) [0|1] "" XXX + BO_ 312 Brake_Pressure_L_R: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX diff --git a/subaru_global_2020_hybrid_generated.dbc b/subaru_global_2020_hybrid_generated.dbc index 9316e3c36b..2d93bde1c6 100644 --- a/subaru_global_2020_hybrid_generated.dbc +++ b/subaru_global_2020_hybrid_generated.dbc @@ -87,10 +87,14 @@ BO_ 314 Wheel_Speeds: 8 XXX SG_ FL : 51|13@1+ (0.057,0) [0|255] "kph" XXX SG_ RL : 38|13@1+ (0.057,0) [0|255] "kph" XXX -BO_ 280 STOP_START: 8 XXX +BO_ 280 Steering_Torque_2: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX - SG_ State : 63|1@1+ (1,0) [0|1] "" XXX + SG_ Steer_Torque_Output : 13|11@1- (-10,0) [0|255] "" XXX + SG_ Signal1 : 24|8@1+ (1,0) [0|511] "" XXX + SG_ Steer_Torque_Sensor : 45|11@1- (-1,0) [0|255] "" XXX + SG_ Steering_Active : 61|1@0+ (1,0) [0|1] "" XXX + SG_ Steering_Disabled : 63|1@1+ (1,0) [0|1] "" XXX BO_ 281 Steering_Torque: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX @@ -102,6 +106,11 @@ BO_ 281 Steering_Torque: 8 XXX SG_ Steering_Angle : 32|16@1- (-0.0217,0) [-600|600] "" X SG_ Steer_Torque_Output : 48|11@1- (-10,0) [-1000|1000] "" XXX +BO_ 282 Steering_2: 8 XXX + SG_ CHECKSUM : 0|8@1+ (1,0) [0|1] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|1] "" XXX + SG_ Steering_Angle : 24|17@1- (-0.01,0) [0|1] "" XXX + BO_ 312 Brake_Pressure_L_R: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX From f45946fecb1771f787b360ced0e52b6b91b6f43b Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 13 Jul 2023 21:59:14 -0700 Subject: [PATCH 25/30] test parser: cleanup test (#894) * test * Revert "test" This reverts commit 406505313cfd6f45569a99fd9546475cb8f65179. * no partial --- can/tests/test_packer_parser.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/can/tests/test_packer_parser.py b/can/tests/test_packer_parser.py index b0be24847d..1b7399c40f 100755 --- a/can/tests/test_packer_parser.py +++ b/can/tests/test_packer_parser.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import unittest import random -from functools import partial import cereal.messaging as messaging from opendbc.can.parser import CANParser @@ -328,10 +327,10 @@ def test_undefined_signals(self): for sig in sigs: CANParser(TEST_DBC, [(sig, msg)], [(msg, 0)]) new_msg = msg + "1" if isinstance(msg, str) else msg + 1 - self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig + "1", msg)], [(msg, 0)])) - self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, new_msg)], [(msg, 0)])) - self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, msg)], [(new_msg, 0)])) - self.assertRaises(RuntimeError, partial(CANParser, TEST_DBC, [(sig, new_msg)], [(new_msg, 0)])) + self.assertRaises(RuntimeError, CANParser, TEST_DBC, [(sig + "1", msg)], [(msg, 0)]) + self.assertRaises(RuntimeError, CANParser, TEST_DBC, [(sig, new_msg)], [(msg, 0)]) + self.assertRaises(RuntimeError, CANParser, TEST_DBC, [(sig, msg)], [(new_msg, 0)]) + self.assertRaises(RuntimeError, CANParser, TEST_DBC, [(sig, new_msg)], [(new_msg, 0)]) if __name__ == "__main__": From 2e54e4d4f2c5e64c9aa045bc44816de5690a2703 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 14 Jul 2023 03:47:25 -0700 Subject: [PATCH 26/30] CANPacker: don't track size (#895) clean up --- can/packer_pyx.pyx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/can/packer_pyx.pyx b/can/packer_pyx.pyx index b0179d7f90..3304339086 100644 --- a/can/packer_pyx.pyx +++ b/can/packer_pyx.pyx @@ -14,8 +14,7 @@ cdef class CANPacker: cdef: cpp_CANPacker *packer const DBC *dbc - map[string, (int, int)] name_to_address_and_size - map[int, int] address_to_size + map[string, int] name_to_address def __init__(self, dbc_name): self.dbc = dbc_lookup(dbc_name) @@ -25,8 +24,7 @@ cdef class CANPacker: self.packer = new cpp_CANPacker(dbc_name) for i in range(self.dbc[0].msgs.size()): msg = self.dbc[0].msgs[i] - self.name_to_address_and_size[string(msg.name)] = (msg.address, msg.size) - self.address_to_size[msg.address] = msg.size + self.name_to_address[string(msg.name)] = msg.address cdef vector[uint8_t] pack(self, addr, values): cdef vector[SignalPackValue] values_thing @@ -41,12 +39,11 @@ cdef class CANPacker: return self.packer.pack(addr, values_thing) cpdef make_can_msg(self, name_or_addr, bus, values): - cdef int addr, size + cdef int addr if type(name_or_addr) == int: addr = name_or_addr - size = self.address_to_size[name_or_addr] else: - addr, size = self.name_to_address_and_size[name_or_addr.encode("utf8")] + addr = self.name_to_address[name_or_addr.encode("utf8")] cdef vector[uint8_t] val = self.pack(addr, values) - return [addr, 0, (&val[0])[:size], bus] + return [addr, 0, (&val[0])[:val.size()], bus] From 3a0083b41ef950409a0b5e1bf9d7cfd051208ea1 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Fri, 14 Jul 2023 19:41:27 +0800 Subject: [PATCH 27/30] CANPacker: refactor to avoid undefined signals (#891) * refactor to avoid undefined signals * add non-zero offset check * Revert "add non-zero offset check" This reverts commit bc0bb60f4fdd8ffdca7197ff6dbd3cb50b857c30. * clean up * use underscores, we haven't standardized one or the other yet * use message name * test it works --------- Co-authored-by: Shane Smiskol --- can/common.h | 2 ++ can/common.pxd | 1 + can/packer.cc | 24 ++++++++++++++++++------ can/packer_pyx.pyx | 23 +++++++---------------- can/tests/test_packer_parser.py | 6 ++++++ 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/can/common.h b/can/common.h index 0031d787f0..3275fbdd22 100644 --- a/can/common.h +++ b/can/common.h @@ -94,10 +94,12 @@ class CANPacker { const DBC *dbc = NULL; std::map, Signal> signal_lookup; std::map message_lookup; + std::map message_name_to_address; std::map counters; public: CANPacker(const std::string& dbc_name); + uint32_t address_from_name(const std::string &msg_name); std::vector pack(uint32_t address, const std::vector &values); Msg* lookup_message(uint32_t address); }; diff --git a/can/common.pxd b/can/common.pxd index aeb1f0a92e..f1027b5213 100644 --- a/can/common.pxd +++ b/can/common.pxd @@ -79,4 +79,5 @@ cdef extern from "common.h": cdef cppclass CANPacker: CANPacker(string) + uint32_t address_from_name(const string&) vector[uint8_t] pack(uint32_t, vector[SignalPackValue]&) diff --git a/can/packer.cc b/can/packer.cc index 6cee2eb1b5..72fbfc5e32 100644 --- a/can/packer.cc +++ b/can/packer.cc @@ -33,6 +33,7 @@ CANPacker::CANPacker(const std::string& dbc_name) { for (const auto& msg : dbc->msgs) { message_lookup[msg.address] = msg; + message_name_to_address[msg.name] = msg.address; for (const auto& sig : msg.sigs) { signal_lookup[std::make_pair(msg.address, std::string(sig.name))] = sig; } @@ -40,20 +41,31 @@ CANPacker::CANPacker(const std::string& dbc_name) { init_crc_lookup_tables(); } -std::vector CANPacker::pack(uint32_t address, const std::vector &signals) { +uint32_t CANPacker::address_from_name(const std::string &msg_name) { + auto msg_it = message_name_to_address.find(msg_name); + if (msg_it == message_name_to_address.end()) { + throw std::runtime_error("CANPacker::address_from_name(): invalid message name " + msg_name); + } + return msg_it->second; +} + +std::vector CANPacker::pack(uint32_t address, const std::vector &values) { + auto msg_it = message_lookup.find(address); + if (msg_it == message_lookup.end()) { + throw std::runtime_error("CANPacker::pack(): invalid address " + std::to_string(address)); + } + std::vector ret(message_lookup[address].size, 0); // set all values for all given signal/value pairs bool counter_set = false; - for (const auto& sigval : signals) { + for (const auto& sigval : values) { auto sig_it = signal_lookup.find(std::make_pair(address, sigval.name)); if (sig_it == signal_lookup.end()) { - // TODO: do something more here. invalid flag like CANParser? - WARN("undefined signal %s - %d\n", sigval.name.c_str(), address); - continue; + throw std::runtime_error("CANPacker::pack(): undefined signal " + sigval.name + " in " + msg_it->second.name); } - const auto &sig = sig_it->second; + const auto &sig = sig_it->second; int64_t ival = (int64_t)(round((sigval.value - sig.offset) / sig.factor)); if (ival < 0) { ival = (1ULL << sig.size) + ival; diff --git a/can/packer_pyx.pyx b/can/packer_pyx.pyx index 3304339086..4689a0a03a 100644 --- a/can/packer_pyx.pyx +++ b/can/packer_pyx.pyx @@ -1,30 +1,21 @@ # distutils: language = c++ # cython: c_string_encoding=ascii, language_level=3 -from libc.stdint cimport uint8_t +from libc.stdint cimport uint8_t, uint32_t from libcpp.vector cimport vector -from libcpp.map cimport map -from libcpp.string cimport string from .common cimport CANPacker as cpp_CANPacker -from .common cimport dbc_lookup, SignalPackValue, DBC +from .common cimport dbc_lookup, SignalPackValue cdef class CANPacker: - cdef: - cpp_CANPacker *packer - const DBC *dbc - map[string, int] name_to_address + cdef cpp_CANPacker *packer def __init__(self, dbc_name): - self.dbc = dbc_lookup(dbc_name) - if not self.dbc: + if not dbc_lookup(dbc_name): raise RuntimeError(f"Can't lookup {dbc_name}") self.packer = new cpp_CANPacker(dbc_name) - for i in range(self.dbc[0].msgs.size()): - msg = self.dbc[0].msgs[i] - self.name_to_address[string(msg.name)] = msg.address cdef vector[uint8_t] pack(self, addr, values): cdef vector[SignalPackValue] values_thing @@ -38,12 +29,12 @@ cdef class CANPacker: return self.packer.pack(addr, values_thing) - cpdef make_can_msg(self, name_or_addr, bus, values): - cdef int addr + cpdef make_can_msg(self, name_or_addr, bus, values) except +RuntimeError: + cdef uint32_t addr if type(name_or_addr) == int: addr = name_or_addr else: - addr = self.name_to_address[name_or_addr.encode("utf8")] + addr = self.packer.address_from_name(name_or_addr.encode("utf8")) cdef vector[uint8_t] val = self.pack(addr, values) return [addr, 0, (&val[0])[:val.size()], bus] diff --git a/can/tests/test_packer_parser.py b/can/tests/test_packer_parser.py index 1b7399c40f..275ccc7975 100755 --- a/can/tests/test_packer_parser.py +++ b/can/tests/test_packer_parser.py @@ -323,6 +323,7 @@ def test_undefined_signals(self): 245: ["SIGNED", "64_BIT_LE", "64_BIT_BE", "COUNTER"], } + packer = CANPacker(TEST_DBC) for msg, sigs in existing_signals.items(): for sig in sigs: CANParser(TEST_DBC, [(sig, msg)], [(msg, 0)]) @@ -332,6 +333,11 @@ def test_undefined_signals(self): self.assertRaises(RuntimeError, CANParser, TEST_DBC, [(sig, msg)], [(new_msg, 0)]) self.assertRaises(RuntimeError, CANParser, TEST_DBC, [(sig, new_msg)], [(new_msg, 0)]) + packer.make_can_msg(msg, 0, {sig: 0}) + self.assertRaises(RuntimeError, packer.make_can_msg, msg, 0, {sig + "1": 0}) + self.assertRaises(RuntimeError, packer.make_can_msg, new_msg, 0, {sig: 0}) + self.assertRaises(RuntimeError, packer.make_can_msg, new_msg, 0, {sig + "1": 0}) + if __name__ == "__main__": unittest.main() From b03468a714da2eb8ef83f07a373f3f1514491cad Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Fri, 14 Jul 2023 16:48:22 +0100 Subject: [PATCH 28/30] packer: import stdexcept (#897) --- can/packer.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/can/packer.cc b/can/packer.cc index 72fbfc5e32..6da41f9627 100644 --- a/can/packer.cc +++ b/can/packer.cc @@ -1,8 +1,9 @@ -#include -#include #include -#include +#include #include +#include +#include +#include #include "opendbc/can/common.h" From 1c43e1cbd689c9d61121cdcea6c132c655697a14 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Mon, 17 Jul 2023 20:52:16 -0700 Subject: [PATCH 29/30] CI: Fix panda CI by not upgrading Cython (#898) * runtime error remove * cython 3.0.0 breaks panda * dont change that --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a95489c44e..f767d02670 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Cython +Cython<3.0.0 flake8 Jinja2 numpy From 3ef35ed2298a3a9d199f9145409547710065884c Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 17 Jul 2023 22:17:11 -0700 Subject: [PATCH 30/30] Revert "CANPacker: refactor to avoid undefined signals (#891)" (#899) This reverts commit 3a0083b41ef950409a0b5e1bf9d7cfd051208ea1. --- can/common.h | 2 -- can/common.pxd | 1 - can/packer.cc | 24 ++++++------------------ can/packer_pyx.pyx | 23 ++++++++++++++++------- can/tests/test_packer_parser.py | 6 ------ 5 files changed, 22 insertions(+), 34 deletions(-) diff --git a/can/common.h b/can/common.h index 3275fbdd22..0031d787f0 100644 --- a/can/common.h +++ b/can/common.h @@ -94,12 +94,10 @@ class CANPacker { const DBC *dbc = NULL; std::map, Signal> signal_lookup; std::map message_lookup; - std::map message_name_to_address; std::map counters; public: CANPacker(const std::string& dbc_name); - uint32_t address_from_name(const std::string &msg_name); std::vector pack(uint32_t address, const std::vector &values); Msg* lookup_message(uint32_t address); }; diff --git a/can/common.pxd b/can/common.pxd index f1027b5213..aeb1f0a92e 100644 --- a/can/common.pxd +++ b/can/common.pxd @@ -79,5 +79,4 @@ cdef extern from "common.h": cdef cppclass CANPacker: CANPacker(string) - uint32_t address_from_name(const string&) vector[uint8_t] pack(uint32_t, vector[SignalPackValue]&) diff --git a/can/packer.cc b/can/packer.cc index 6da41f9627..ad762828bc 100644 --- a/can/packer.cc +++ b/can/packer.cc @@ -34,7 +34,6 @@ CANPacker::CANPacker(const std::string& dbc_name) { for (const auto& msg : dbc->msgs) { message_lookup[msg.address] = msg; - message_name_to_address[msg.name] = msg.address; for (const auto& sig : msg.sigs) { signal_lookup[std::make_pair(msg.address, std::string(sig.name))] = sig; } @@ -42,31 +41,20 @@ CANPacker::CANPacker(const std::string& dbc_name) { init_crc_lookup_tables(); } -uint32_t CANPacker::address_from_name(const std::string &msg_name) { - auto msg_it = message_name_to_address.find(msg_name); - if (msg_it == message_name_to_address.end()) { - throw std::runtime_error("CANPacker::address_from_name(): invalid message name " + msg_name); - } - return msg_it->second; -} - -std::vector CANPacker::pack(uint32_t address, const std::vector &values) { - auto msg_it = message_lookup.find(address); - if (msg_it == message_lookup.end()) { - throw std::runtime_error("CANPacker::pack(): invalid address " + std::to_string(address)); - } - +std::vector CANPacker::pack(uint32_t address, const std::vector &signals) { std::vector ret(message_lookup[address].size, 0); // set all values for all given signal/value pairs bool counter_set = false; - for (const auto& sigval : values) { + for (const auto& sigval : signals) { auto sig_it = signal_lookup.find(std::make_pair(address, sigval.name)); if (sig_it == signal_lookup.end()) { - throw std::runtime_error("CANPacker::pack(): undefined signal " + sigval.name + " in " + msg_it->second.name); + // TODO: do something more here. invalid flag like CANParser? + WARN("undefined signal %s - %d\n", sigval.name.c_str(), address); + continue; } - const auto &sig = sig_it->second; + int64_t ival = (int64_t)(round((sigval.value - sig.offset) / sig.factor)); if (ival < 0) { ival = (1ULL << sig.size) + ival; diff --git a/can/packer_pyx.pyx b/can/packer_pyx.pyx index 4689a0a03a..3304339086 100644 --- a/can/packer_pyx.pyx +++ b/can/packer_pyx.pyx @@ -1,21 +1,30 @@ # distutils: language = c++ # cython: c_string_encoding=ascii, language_level=3 -from libc.stdint cimport uint8_t, uint32_t +from libc.stdint cimport uint8_t from libcpp.vector cimport vector +from libcpp.map cimport map +from libcpp.string cimport string from .common cimport CANPacker as cpp_CANPacker -from .common cimport dbc_lookup, SignalPackValue +from .common cimport dbc_lookup, SignalPackValue, DBC cdef class CANPacker: - cdef cpp_CANPacker *packer + cdef: + cpp_CANPacker *packer + const DBC *dbc + map[string, int] name_to_address def __init__(self, dbc_name): - if not dbc_lookup(dbc_name): + self.dbc = dbc_lookup(dbc_name) + if not self.dbc: raise RuntimeError(f"Can't lookup {dbc_name}") self.packer = new cpp_CANPacker(dbc_name) + for i in range(self.dbc[0].msgs.size()): + msg = self.dbc[0].msgs[i] + self.name_to_address[string(msg.name)] = msg.address cdef vector[uint8_t] pack(self, addr, values): cdef vector[SignalPackValue] values_thing @@ -29,12 +38,12 @@ cdef class CANPacker: return self.packer.pack(addr, values_thing) - cpdef make_can_msg(self, name_or_addr, bus, values) except +RuntimeError: - cdef uint32_t addr + cpdef make_can_msg(self, name_or_addr, bus, values): + cdef int addr if type(name_or_addr) == int: addr = name_or_addr else: - addr = self.packer.address_from_name(name_or_addr.encode("utf8")) + addr = self.name_to_address[name_or_addr.encode("utf8")] cdef vector[uint8_t] val = self.pack(addr, values) return [addr, 0, (&val[0])[:val.size()], bus] diff --git a/can/tests/test_packer_parser.py b/can/tests/test_packer_parser.py index 275ccc7975..1b7399c40f 100755 --- a/can/tests/test_packer_parser.py +++ b/can/tests/test_packer_parser.py @@ -323,7 +323,6 @@ def test_undefined_signals(self): 245: ["SIGNED", "64_BIT_LE", "64_BIT_BE", "COUNTER"], } - packer = CANPacker(TEST_DBC) for msg, sigs in existing_signals.items(): for sig in sigs: CANParser(TEST_DBC, [(sig, msg)], [(msg, 0)]) @@ -333,11 +332,6 @@ def test_undefined_signals(self): self.assertRaises(RuntimeError, CANParser, TEST_DBC, [(sig, msg)], [(new_msg, 0)]) self.assertRaises(RuntimeError, CANParser, TEST_DBC, [(sig, new_msg)], [(new_msg, 0)]) - packer.make_can_msg(msg, 0, {sig: 0}) - self.assertRaises(RuntimeError, packer.make_can_msg, msg, 0, {sig + "1": 0}) - self.assertRaises(RuntimeError, packer.make_can_msg, new_msg, 0, {sig: 0}) - self.assertRaises(RuntimeError, packer.make_can_msg, new_msg, 0, {sig + "1": 0}) - if __name__ == "__main__": unittest.main()