Code Monkey home page Code Monkey logo

Comments (6)

eerimoq avatar eerimoq commented on June 1, 2024

Almost anything is possible. Can you provide a DBC-file I can use for testing, to make sure the implementaiton works?

from cantools.

sietschie avatar sietschie commented on June 1, 2024

I am afraid I am not allowed to give out the original DBC file. And I don't know enough about DBCs to produce my own file. Maybe you can point me in the right directions so I can make the changes myself?

from cantools.

eerimoq avatar eerimoq commented on June 1, 2024

Have a look here: https://github.com/eerimoq/cantools/blob/master/cantools/db/formats/dbc.py#L305-L313

That's the part of the grammar where your DBC fails. Looks like the grammar should not only allow positive integers?

from cantools.

eerimoq avatar eerimoq commented on June 1, 2024

I suggest that you add the failing DBC-line here: https://github.com/eerimoq/cantools/blob/master/tests/files/foobar.dbc#L83

And then modify the tests in tests/test_cantools.py to make them pass. Depending on the side effects on allowing the new grammar, this is likely very little work and ensures that this DBC syntax will not break in the future. See the README for details on how to run the tests locally.

from cantools.

DC-Melo avatar DC-Melo commented on June 1, 2024

my database is like this:
BA_DEF_ BU_ "NmStationAddress" HEX 0 0;
1 BA_DEF_ BU_ "NodeLayerModules" STRING ;
1811 BA_DEF_REL_ BU_BO_REL_ "GenMsgCycleTimeFast" INT 0 65535;
1 BA_DEF_REL_ BU_BO_REL_ "GenMsgNrOfRepetition" INT 0 65535;
2 BA_DEF_REL_ BU_BO_REL_ "GenMsgDelayTime" INT 0 65535;
3 BA_DEF_REL_ BU_BO_REL_ "GenMsgStartDelayTime" INT 0 65535;
4 BA_DEF_DEF_ "BusType" "";
5 BA_DEF_DEF_REL_ "GenMsgCycleTimeFast" 0;

so:i change the code to:
attribute_definition_rel = Sequence(
'BA_DEF_REL_',
Optional(choice('BU_SG_REL_','BU_BO_REL_')),
'STRING',
'WORD',
choice(DelimitedList('STRING'), OneOrMore('NUMBER')),
';')

now:it is ok

from cantools.

c0sm3s avatar c0sm3s commented on June 1, 2024

I've modify it the dbc.py file to the following:
attribute_definition_rel = Sequence(
'BA_DEF_REL_',
Optional(choice('BU_SG_REL_', 'BU_BO_REL_')),
'STRING',
'WORD',
Optional(choice(DelimitedList('STRING'), OneOrMore('NUMBER'))),
';')

to support a dbc that looks like this:
BA_DEF_REL_ BU_BO_REL_ "Frame1" STRING ;
BA_DEF_REL_ BU_BO_REL_ "Frame2" HEX 0 1407;
BA_DEF_REL_ BU_BO_REL_ "Event1" INT 10 10000;
BA_DEF_REL_ BU_SG_REL_ "Signal1" ENUM "Yes","No";

from cantools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.