Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I tried to generate using following dbc file: #7

Closed
marcelbuesing opened this issue Mar 8, 2021 · 8 comments
Closed

I tried to generate using following dbc file: #7

marcelbuesing opened this issue Mar 8, 2021 · 8 comments

Comments

@marcelbuesing
Copy link
Owner

marcelbuesing commented Mar 8, 2021

I tried to generate using following dbc file:
toyota_corolla_2017_pt_generated.dbc.zip
But got error:

Error: Could not parse dbc file: NomError(
    Error(
        Code(
            CompleteByteSlice(
                [
                    67,
                    77,
                    95,
                    32,
                    34,
                    65,
                    85,
                    84,
                    79,
                    71,
                    69,
                    78,
                    69,
                    82,
                    65,
                    84,
                    69,
                    68,
...

Originally posted by @andresv in technocreatives/dbc-codegen#7 (comment)

@andresv
Copy link

andresv commented Mar 8, 2021

@marcelbuesing
Copy link
Owner Author

The crate is fairly sensitive to order of the elements and white space. It basically needs to be reordered, some whitespace removed and missing semi-colons need to be added. At least some of the stuff should probably be fixed in can-dbc (e.g. unexpected whitespace).

@marcelbuesing
Copy link
Owner Author

I just added the cantools dbc test files as an integration test. There a quite a number of files (23/58) not working right now, fixing those should cover more dbc files. Cantools seems to ignore the order of the elements so it probably make sense to ignore it in this crate as well.

@abalmos
Copy link

abalmos commented Mar 20, 2021

Just adding that I am trying to load a complete j1939 dbc file and hit parsing errors. I imagine many of the same issues as the failing tests you mention @marcelbuesing. Do you by chance have a good resource on the DBC format to help locate some of the errors?

@marcelbuesing
Copy link
Owner Author

marcelbuesing commented Mar 20, 2021

Since it's a proprietary format all I can tell you is, you might find what you are looking for when searching Baidu.cn for dbc file format.

I think the issues right now are mostly:

  • whitespace in unexpected places
  • order of elements should not be mandatory
  • error reporting in nom 4 is bad

So my goal is to finish the migration to nom 6 (nom6 branch) first so there is better error reporting (VerboseError). Help is welcome!

@andresv
Copy link

andresv commented Mar 24, 2021

I took another comma dbc file and arranged some fields around to be more compatible to common understanding about dbc files. However there is something still wrong and I am unable to figure out why decoder does not like this file.
toyota_prius_2017_pt_generated.dbc.zip

At least python cantools were able to parse it.
Error log from parser. I guess PRE_COLLISION_2 is the last message what it was able to parse.

Message {
                message_id: MessageId(
                    836,
                ),
                message_name: "PRE_COLLISION_2",
                message_size: 8,
                transmitter: NodeName(
                    "DSU",
                ),
                signals: [
                    Signal {
                        name: "CHECKSUM",
                        multiplexer_indicator: Plain,
                        start_bit: 63,
                        signal_size: 8,
                        byte_order: BigEndian,
                        value_type: Unsigned,
                        factor: 1.0,
                        offset: 0.0,
                        min: 0.0,
                        max: 0.0,
                        unit: "",
                        receivers: [
                            "XXX",
                        ],
                    },
                ],
            },
        ],
        message_transmitters: [],
        environment_variables: [],
        environment_variable_data: [],
        signal_types: [],
        comments: [],
        attribute_definitions: [],
        attribute_defaults: [],
        attribute_values: [],
        value_descriptions: [],
        signal_type_refs: [],
        signal_groups: [],
        signal_extended_value_type_list: [],
    },
    [
        66,
        79,

EDIT: found the issue:
next one was BO_ 869 DSU_CRUISE : 7 DSU which has extra after name.

@andresv
Copy link

andresv commented Apr 7, 2021

This particular issue is upstream problem.
Comma.ai DBC files do not follow spec:
commaai/opendbc#151
commaai/opendbc#329

@marcelbuesing
Copy link
Owner Author

I'll close this for now-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants