Comments (6)
Almost anything is possible. Can you provide a DBC-file I can use for testing, to make sure the implementaiton works?
from cantools.
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.
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.
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.
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.
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)
- Decoding does not check for min / max violation HOT 1
- Floating point rounding operations result in unexpected message encoding HOT 1
- Message._assert_signal_values_valid() uses incorrect minimum raw values for signals with negative scale
- Why does the capitalization of signal names change HOT 2
- textparser.ParseError From SYM file Mux line. HOT 2
- A 2 byte Motorola signal that is signed is decoded wrong HOT 3
- Generated SYM Enum Lines Exceed Max Length HOT 3
- Generate C code without changing message/signal name case HOT 1
- Cantools has no way to load frame of only one bus HOT 2
- In canfd, when data length > 8, dlc != len(data) in Message._check will cause an error.
- sym file parsing cannot handle small number scientific notation. HOT 1
- SPN signal attribute don't use the default value
- Monitor doesn't work on Windows 11 HOT 2
- data export HOT 1
- Frame IDs collisions between extended format frames can and standard format frames HOT 1
- Exporting a dbc file with Chinese comments will result in garbled text for the Chinese parts. HOT 1
- Cannot clear TX Buffer of CAN HOT 1
- EncodeError: signal required for encoding when passing a partial dictionnary to Message.encode() HOT 3
- Extract Request and Response CAN IDs from CDD File HOT 2
- For Autosar classic platform release R4.2.0 and R4.2.1, I am not getting the schema version of it. Can anyone help? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cantools.