commaai / opendbc

a Python API for your car
MIT License
1.95k stars 1.14k forks source link

Several errors in DBC files #1422

Open Elmue opened 1 week ago

Elmue commented 1 week ago

Hello

I wrote a DBC parser which prints a lot of errors when I feed it with your files.

For example in Mazda you have the line: BO_ 1178 2017_6: 8 XXX where "2017_6" is an invalid signal name. All identifiers must start with an alphanumeric character.

acura_ilx_2016_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
acura_rdx_2018_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
acura_rdx_2020_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
Error in line 493, column 10: The signal 'ECON_ON_2' has not been declared.
Error in line 496, column 10: The signal 'CMBS_BUTTON' has not been declared.
------------------------
chrysler_cusw.dbc
Error in line 186, column 23: The message 1492 (0x5D4) has not been declared.
Error in line 187, column 26: The message 498 (0x1F2) has not been declared.
Error in line 188, column 26: The message 498 (0x1F2) has not been declared.
Error in line 190, column 24: The signal 'LKAS_STATE' has not been declared.
------------------------
chrysler_pacifica_2017_hybrid_generated.dbc
Error in line 181, column 1: Semicolon expected.
Error in line 328, column 29: The signal 'BRAKE_PRESSED_2' has not been declared.
Error in line 331, column 25: The signal 'ACCEL_PEDAL' has not been declared.
Error in line 333, column 34: The signal 'LKAS_STEERING_TORQUE' has not been declared.
Error in line 355, column 34: The signal 'ACC_SPEED_CONFIG_KPH' has not been declared.
Error in line 356, column 34: The signal 'ACC_SPEED_CONFIG_MPH' has not been declared.
Error in line 357, column 26: The signal 'CRUISE_STATE' has not been declared.
Error in line 358, column 19: The signal 'SPEED' has not been declared.
Error in line 360, column 10: The signal 'CRUISE_STATE' has not been declared.
------------------------
chrysler_ram_dt_generated.dbc
Error in line 183, column 1: Semicolon expected.
Error in line 186, column 31: The message 258 (0x102) has not been declared.
Error in line 187, column 27: The message 264 (0x108) has not been declared.
Error in line 188, column 36: The message 264 (0x108) has not been declared.
Error in line 189, column 29: The message 678 (0x2A6) has not been declared.
Error in line 190, column 29: The message 678 (0x2A6) has not been declared.
Error in line 191, column 25: The message 678 (0x2A6) has not been declared.
Error in line 244, column 25: The signal 'ACC_Engaged' has not been declared.
Error in line 246, column 28: The signal 'Auto_High_Beam' has not been declared.
Error in line 248, column 36: The signal 'Driver_Seatbelt_Status' has not been declared.
Error in line 249, column 36: The signal 'High_Beam_Lever_Status' has not been declared.
------------------------
chrysler_ram_hd_generated.dbc
Error in line 183, column 1: Semicolon expected.
Error in line 189, column 29: The message 678 (0x2A6) has not been declared.
Error in line 190, column 29: The message 678 (0x2A6) has not been declared.
Error in line 191, column 25: The message 678 (0x2A6) has not been declared.
------------------------
gm_global_a_lowspeed.dbc
Error in line 117, column 16: The signal 'BSM_Indicator_Right' has not been declared.
------------------------
gm_global_a_object.dbc
Error in line 279: Indentifier BO_ not at start of line
Error in line 682: Indentifier BO_ not at start of line
------------------------
gm_global_a_powertrain_generated.dbc
Error in line 359, column 0: Semicolon expected.
------------------------
honda_accord_2018_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
Error in line 520, column 10: The signal 'ECON_ON_2' has not been declared.
Error in line 523, column 10: The signal 'CMBS_BUTTON' has not been declared.
------------------------
honda_civic_ex_2022_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
Error in line 511, column 5: Identifier CM_ must be followed by BO_ BU_ SG_ or EV_
------------------------
honda_civic_hatchback_ex_2017_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
Error in line 502, column 10: The signal 'ECON_ON_2' has not been declared.
Error in line 505, column 10: The signal 'CMBS_BUTTON' has not been declared.
------------------------
honda_civic_touring_2016_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_clarity_hybrid_2018_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_crv_executive_2016_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_crv_ex_2017_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
Error in line 500, column 28: The signal 'RELATED_TO_GAS' has not been declared.
Error in line 501, column 23: The signal 'GAS_BRAKE' has not been declared.
Error in line 505, column 10: The signal 'ECON_ON_2' has not been declared.
Error in line 508, column 10: The signal 'CMBS_BUTTON' has not been declared.
------------------------
honda_crv_touring_2016_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_fit_ex_2018_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_fit_hybrid_2018_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_insight_ex_2019_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_odyssey_exl_2018_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_odyssey_extreme_edition_2018_china_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
honda_pilot_2023_can_generated.dbc
Error in line 153, column 13: Signal name expected.
Error in line 154, column 13: Signal name expected.
------------------------
hyundai_canfd.dbc
Error in line 661, column 5: Identifier CM_ must be followed by BO_ BU_ SG_ or EV_
Error in line 662, column 5: Identifier CM_ must be followed by BO_ BU_ SG_ or EV_
Error in line 663, column 5: Identifier CM_ must be followed by BO_ BU_ SG_ or EV_
Error in line 664, column 5: Identifier CM_ must be followed by BO_ BU_ SG_ or EV_
------------------------
hyundai_kia_generic.dbc
Error in line 1654, column 5: Identifier CM_ must be followed by BO_ BU_ SG_ or EV_
Error in line 1655, column 5: Identifier CM_ must be followed by BO_ BU_ SG_ or EV_
------------------------
mazda_2017.dbc
Error in line 273, column 10: Syntax error.
Error in line 572, column 6: Signal name expected.
Error in line 604, column 10: Syntax error.
Error in line 606, column 10: Syntax error.
Error in line 608, column 10: Syntax error.
Error in line 614, column 10: Syntax error.
Error in line 617, column 10: Syntax error.
Error in line 620, column 10: Syntax error.
Error in line 791, column 1: Semicolon expected.
------------------------
subaru_forester_2017_generated.dbc
Error in line 232, column 17: The signal 'RPM' has not been declared.
------------------------
subaru_outback_2015_generated.dbc
Error in line 232, column 17: The signal 'RPM' has not been declared.
------------------------
subaru_outback_2019_generated.dbc
Error in line 232, column 17: The signal 'RPM' has not been declared.
------------------------
tesla_can.dbc
Error in line 783, column 10: The signal 'UI_mapSpeedLimit' has not been declared.
------------------------
test.dbc
Error in line 24, column 6: Signal name expected.
Error in line 25, column 6: Signal name expected.
Error in line 27, column 9: The message 80 (0x50) has not been declared.
------------------------
toyota_new_mc_pt_generated.dbc
Error in line 491, column 25: The signal 'SLOPE_ANGLE' has not been declared.
Error in line 492, column 19: The signal 'ACCEL' has not been declared.
Error in line 570, column 1: Semicolon expected.
Error in line 625, column 28: The signal 'BRAKE_POSITION' has not been declared.
------------------------
toyota_nodsu_pt_generated.dbc
Error in line 491, column 25: The signal 'SLOPE_ANGLE' has not been declared.
Error in line 492, column 19: The signal 'ACCEL' has not been declared.
Error in line 570, column 1: Semicolon expected.
------------------------
toyota_tnga_k_pt_generated.dbc
Error in line 491, column 25: The signal 'SLOPE_ANGLE' has not been declared.
Error in line 492, column 19: The signal 'ACCEL' has not been declared.
Error in line 570, column 1: Semicolon expected.
------------------------
volvo_v40_2017_pt.dbc
Error in line 353, column 22: The message 437 (0x1B5) has not been declared.
Error in line 354, column 22: The message 437 (0x1B5) has not been declared.
Error in line 355, column 22: The message 437 (0x1B5) has not been declared.
Error in line 356, column 22: The message 437 (0x1B5) has not been declared.
------------------------
vw_golf_mk4.dbc
Error in line 1474, column 32: The signal 'Checksumme_Airbag_1' has not been declared.
Error in line 1475, column 29: The signal 'Zaehler_Airbag_1' has not been declared.
Error in line 1481, column 30: The signal 'Zaehler_Bremse_1' has not been declared.
Error in line 1518, column 33: The signal 'Zaehler_Getriebe_1' has not been declared.
Error in line 1582, column 28: The signal 'LDW_Direction' has not been declared.
Error in line 1583, column 27: The signal 'XX_DLCORTLC1' has not been declared.
Error in line 1584, column 27: The signal 'XX_DLCORTLC2' has not been declared.
Error in line 1586, column 30: The signal 'MFA_v_Signal_02' has not been declared.
------------------------
vw_mqb_2010.dbc
Error in line 1592, column 30: The signal 'ACC_Hold_Request' has not been declared.
Error in line 1593, column 31: The signal 'ACC_Boost_Request' has not been declared.
Error in line 1594, column 35: The signal 'ACC_Freewheel_Request' has not been declared.
Error in line 1595, column 30: The signal 'ACC_Hold_Release' has not been declared.
Error in line 1596, column 33: The signal 'ACC_Accel_Secondary' has not been declared.
Error in line 1597, column 27: The signal 'ACC_Accel_TSK' has not been declared.
Error in line 1608, column 25: The signal 'LDW_Unknown' has not been declared.
Error in line 1609, column 27: The signal 'Alert_Message' has not been declared.
Error in line 1610, column 27: The signal 'LDW_Direction' has not been declared.
Error in line 1611, column 31: The signal 'Right_Lane_Status' has not been declared.
Error in line 1612, column 30: The signal 'Left_Lane_Status' has not been declared.
Error in line 1613, column 31: The signal 'Kombi_Lamp_Orange' has not been declared.
Error in line 1614, column 30: The signal 'Kombi_Lamp_Green' has not been declared.
Error in line 1615, column 24: The signal 'Folgefahrt' has not been declared.
Error in line 1616, column 24: The signal 'SetAbstand' has not been declared.
Error in line 1617, column 21: The signal 'Abstand' has not been declared.
Error in line 1618, column 22: The signal 'SetSpeed' has not been declared.
jyoung8607 commented 1 week ago

This is fair feedback. It's desirable for other DBC tools to be able to open any of these files. Writing a DBC linter has been on our wishlist for a long time, see #579.

In terms of Vector official DBC format compliance, the generated DBCs are the worst offenders, because they're not composed in the right order and use invalid comments. But after that, details like the ones you name should be identified and cleaned up.

Is your tool something you plan to open source? If so, drop us a link. If it's simple and has few external dependencies, perhaps @adeebshihadeh could be persuaded to open a bounty to integrate it with opendbc CI. We could then start cleaning up these issues and prevent new errors from being merged.

Elmue commented 1 week ago

Hello jyoung8607

Is your tool something you plan to open source?

It is not ready yet. I'am still working on it. I will implement it into the next version of my software HUD ECU Hacker which is charity-ware: https://netcult.ch/elmue/hud%20ecu%20hacker

I have been searching for a useful DBC parser on Github but I found nothing that I can use. Most are written in C or C++ or Python which is useless for me. I need C#. And mostly the error handling is implemented very poorly. So I wrote my own parser, which additionally is highly speed optimized.

I worked on it the last days and added more functionality. Now it even displays MUCH MORE errors!

I uploaded a beta version for you. Simply put it into a folder and the DBC files into the same folder. Then it will parse all files and show the results.

I followed the few rules with sparse descriptions in the PDF file from Vector Informatik GmbH. However this document is so poor that it is quite useless. But I implemented nearly all except Environment Variables. If a section is not checked a hint will be printed like "Section EV_ skipped". But in your files all sections are parsed.

If you should find any bugs please send me an email, which you see when you start the program.

You can download it here: https://netcult.ch/elmue/download/DBC_Parser.zip All you need is .NET framework 4.0 or higher.

And here a screenshot:

Screenshot

Elmue commented 6 days ago

I uploaded a new version 1.1 which finds even more errors.