christoph2 / pya2l Goto Github PK
View Code? Open in Web Editor NEWASAM ASAP2 Library for Python
License: GNU General Public License v2.0
ASAM ASAP2 Library for Python
License: GNU General Public License v2.0
When the conversion name for a dataitem has square-brackets in the middle of it, the parser seems to assume that that's the end of the name.
When I read the conversion of a dataitem like this, it only includes everything up to the closing square-bracket.
Snippets:
From the A2L file:
/begin MEASUREMENT ***.******_12 "" UWORD ***.******[12]_******* 0 0.0 0.0 65535.0 ECU_ADDRESS 0x******** DISPLAY_IDENTIFIER ***.******[12] /end MEASUREMENT
An error message from when the parser was running (after calling db.import_a2l(...))
**************.a2l::line ****:** extraneous input '_*******' expecting {INT, HEX}
DATA='''/begin CHARACTERISTIC TEST[0][0].TEST
"TEST[FL,0].TEST"
VALUE
0x0003237C
_HELLO
30
_TEST
-18
12
DISPLAY_IDENTIFIER TEST[FL_0].TEST
FORMAT "%3.1"
/end CHARACTERISTIC'''
parser = ParserWrapper('a2l', 'characteristic', A2LListener, debug = False)
session = parser.parseFromString(DATA)
Fails with:
line 1:29 mismatched input '[' expecting STRING
Probably caused by:
partialIdentifier:
i = IDENT (a = arraySpecifier)?
;
in a2l.g4
This project currently includes a lot of ANTLR4-generated code under the py3 package. This creates unnecessary code churn when upgrading ANTRL. It may also hide bugs if CI-servers regenerate these files as part of the build process, which AppVeyor does.
I propose that the generation of parsers and lexers be moved to build-time. This would create an build-time dependency on ANTLR. It would not affect existing unit tests, since AppVeyor already does this and Travis is broken anyway.
@christoph2 If you think this sounds like a way forward, I can prepare a pull request.
Hello! We were wondering if this should be a warning or an error?
Line 338 in ca54775
We say warning because we don't stop or as far as I can see and since it's something that can happen, not which has happened?
Fact:
When running this lib using robot-framework tests, the pya2l.DB.import_a2l() slows down drastically.
Info:
general info
test info
test run info
Other info
conclusion
python 3:
C:\python3\python>python D:\01_Project\asap2\pyA2L\setup.py install
running install
running bdist_egg
running egg_info
writing pya2l.egg-info\PKG-INFO
writing dependency_links to pya2l.egg-info\dependency_links.txt
writing requirements to pya2l.egg-info\requires.txt
writing top-level names to pya2l.egg-info\top_level.txt
warning: manifest_maker: standard file 'setup.py' not found
**_error: package directory 'pya2l' does not exist_**
Hello Christoph,
I have 2 queries about using the tool,
I am actually trying to convert an arxml to an intermediate A2L file. Do you think this library can support this requirement?
Can there be documentation of the APIs provided in the library, to understand how each API can be used or certain(variety) use-cases so as to cover all the usage? [ I did come across the documentation however isn't exhaustive ]
I'm trying to generate the python file using Antlr4, but seems there is some difference which I generated in py3 folder, would you please check?
And what is the a2l.py for, looks like generated by Antlr4, but not in py3 folder?
the issue
line 53940:95 mismatched input '"aktiv"' expecting {'ASCII', 'CURVE', 'MAP', 'CUBOID', 'CUBE_4', 'CUBE_5', 'VAL_BLK', 'VALUE'}
line 53952:5 mismatched input 'CHARACTERISTIC' expecting 'MODULE'
when i checked the a2l file the long name was
/begin CHARACTERISTIC
DestfRst_C
"Abschaltung ""aktiv"" zu ""nicht aktiv"""
VALUE
0x91C6000
Wu8
1.00000000000
compu_VERB
0.00
1.00000000000
FORMAT "%1.11"
/end CHARACTERISTIC
I'm trying to use pyA2L for exporting the A2L file into excel file. Is there an API for that?
Or could you help me with a sample implementation?
I'm trying to parse an a2l file using pyA2L library.
Here's a snippet:
/begin MOD_PAR "D915E_N46A610"
VERSION "[REDACTED]"
ADDR_EPK 0x1C21F0
EPK "[READACTED]"
CUSTOMER_NO "5"
USER "GS-ES/EAD1-Richard"
PHONE_NO ""
CPU_TYPE "GoldenOak"
ECU "[REDACTED]"
/end
When using db.import_a2l
to parse a file containg the snippet above I get a bunch parsing errors (line 880 is CUSTOMER_NO
):
[INFO (pya2l.Preprocessor)]: Pre-processing 'definitions.a2l'[UTF-8-SIG]
[INFO (pya2l.DB)]: Parsing pre-processed data ...
definitions.a2l::line 880:17 extraneous input '5' expecting {'VERSION', 'ADDR_EPK', 'CPU_TYPE', 'CUSTOMER', 'CUSTOMER_NO', 'ECU', 'ECU_CALIBRATION_OFFSET', 'EPK', 'NO_OF_INTERFACES', 'PHONE_NO', 'SUPPLIER', 'SYSTEM_CONSTANT', 'USER', '/begin', '/end'}
definitions.a2l::line 881:12 token recognition error at: '-E'
definitions.a2l::line 881:15 token recognition error at: '/E'
definitions.a2l::line 881:20 token recognition error at: '-R'
Is there a problem with the library or do I need to fix my a2l file?
Hi @christoph2,
Since there is no information related to installation, after cloning the repo I used the usual command to setup python package from souce:
python setup.py install
Looks like all went well. When I tried to test the package with the built-in test you have @ pyA2L/pya2l/tests/testA2LAcceptance.py
It gives me a ModuleNotFoundError: No module named 'pya2l.py3'
Below is the log,
$ py test.py Traceback (most recent call last): File "test.py", line 617, in <module> parser.parseFromString(TEST_A2L) File "D:\Python\36\lib\site-packages\pya2l-0.1.0-py3.6.egg\pya2l\a2lparser.py", line 265, in parseFromString File "D:\Python\36\lib\site-packages\pya2l-0.1.0-py3.6.egg\pya2l\a2lparser.py", line 268, in parse File "D:\Python\36\lib\site-packages\pya2l-0.1.0-py3.6.egg\pya2l\aml.py", line 63, in __init__ File "D:\Python\36\lib\site-packages\pya2l-0.1.0-py3.6.egg\pya2l\aml.py", line 69, in _load File "D:\Python\36\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked ModuleNotFoundError: No module named 'pya2l.py3'
Am I doing something wrong with the setup? Your response will be highly appreciated.
hello,
We want to generate intermediate a2l based on source code or configuration files, rather than modifying or merging based on a2l files. Can this tool be implemented? If it can be implemented, do you have any usage examples or explanatory documents? thanks
Please share the documentation for using the pya2l package. also if possible please provide few examples for how to use it for merging the a2l files.
Thanks.
Hello! I have a question for you about using A2L file.
Is possible to import A2L file in Python code for controling signals while ECU is connected?
I was working with CAN communication and using cantools for import, control and decode signals from DBC file, now, I am facing with XCP and I need to know whether the similar possible with A2L file.
If your answer is yes, please provide me some example how to do this. If not, please let me know.
Best regards and thank you in advance!
=============================
if encoding is not None:
warnings.warn("Don't use parameter encoding
anymore -- file encoding is autodetected now.", DeprecationWarning, stacklevel = 2)
The implication is that the 'encoding=' parameter has been deprecated, however the actual behaviour of the code is to override it. I have an a2l file which I believe is Windows-1252 (or might be ISO-8859-1) generated by a vector tool. However the auto-detection does not work and pya2ldb is unable to parse the file without generating an error.
Is it possible to reinstate the encoding parameter. My understanding is that, in general it is not possible to autodetect text encoding reliably.
Hi thanks for you pyA2l.
is it possible to read the xcp_on_can daq entries of my a2l file? i have the following structure in the file and would like an xcp_on_can table in the database with the following information.
/begin XCP_ON_CAN
0x0100 /* XCP on CAN version /
CAN_ID_BROADCAST 0x0100 / Broadcast /
CAN_ID_MASTER 0x0200 / CMD/STIM /
CAN_ID_SLAVE 0x0300 / RES/ERR/EV/SERV/DAQ /
BAUDRATE 500000 / BAUDRATE /
/begin DAQ_LIST_CAN_ID
0x0000 / for DAQ_LIST 0 /
FIXED 0x310
/end DAQ_LIST_CAN_ID
/begin DAQ_LIST_CAN_ID
0x0001 / for DAQ_LIST 1 /
FIXED 0x320
/end DAQ_LIST_CAN_ID
/begin DAQ_LIST_CAN_ID
0x0002 / for DAQ_LIST 2 */
FIXED 0x330
/end DAQ_LIST_CAN_ID
/end XCP_ON_CAN
Greetings
In the preprocessing of multiple line comments as following lines, all this COMPU_METHOD will be removed. It will cause the error in the lexcer paring. so either
/begin COMPU_METHOD
/* Name of CompuMethod / SWC_JctTempEstm_CM_single
/ Long identifier / "Q = V"
/ Conversion Type / RAT_FUNC
/ Format / "%8.6"
/ Units / ""
/ Coefficients */ COEFFS 0 1 0 0 0 1
/end COMPU_METHOD
/begin COMPU_METHOD
/end COMPU_METHOD
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.