Closed VincieD closed 5 years ago
maybe your arxml does not have transmitters defined? If you provide your ARXML (maybe as PN) I could have a look on it. Eduard
I can't provide you the arxml. Maybe we could see it on some screenshots? I can open the arxml with Autosar Explorer how you can see on the screenshot bellow. Here are defined senders and receivers and i quickly checked it and all Frames have at least one sender and one receiver.
Thank you!
Most likely updating your version will fix this. It was changed in https://github.com/ebroecker/canmatrix/commit/81a40ad621d1778b6284faed10f6c6b906b23cda
I noticed just now because my CI builds started failing on this change after the canmatrix version on pip was updated
Thank you!
I'm facing a problem with the latest version. It doesnt want to open my arxml at all.
Funny thing - version 0.6 works fine only for tranciever but return empty list of receiver. Do you face the same problem? Since my arxml contains receivers, it is not obviously a problem o arxml but somewhere between chair and keyboard :)
@VincieD Just for understanding you right:
0.6 works but 0.7 does not work?
the code for extrating the transmitter information seems to be unchanged from 0.6 to 0.7... Also following code does not show a problem at my side. Every frame should have a (maybe empty) transmitter list:
import canmatrix
>>> f = canmatrix.Frame("test")
>>> f.transmitters
[]
>>> for a in f.transmitters:
... print("A")
>>>
maybe you have some defect canmatrix installation?
0.7 Version doesn't open the arxml at all:
File "C:\Users\divis\Desktop\FirstApp\scripts\FlowChart.py", line 106, in readArxml arxml1Db = next(iter(canmatrix.formats.loadp(file).values())) File "C:\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmatrix\formats.py", line 64, in loadp return load(fileObject, importType, key, flatImport, options) File "C:\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmatrix\formats.py", line 74, in load dbs = moduleInstance.load(fileObject, options) File "C:\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmatrix\arxml.py", line 1612, in load frameObject = getFrame(frameTrig,searchPoint,multiplexTranslation,ns, float_factory) File "C:\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmatrix\arxml.py", line 1369, in getFrame getSignals(pdusigmapping, newFrame, xmlRoot, ns, None, float_factory) File "C:\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmatrix\arxml.py", line 1033, in getSignals baseType = arGetChild(isignal,"BASE-TYPE", xmlRoot, ns) File "C:\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmatrix\arxml.py", line 928, in arGetChild ret = getArPath(xmlRoot, ret.text, namespace) File "C:\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmatrix\arxml.py", line 897, in getArPath baseElement = tree.xpath(xbasePath, namespaces=namespaceMap)[0] IndexError: list index out of range
And with the 0.6 version an empty list of receivers and half full transmitters is received:
file = "lokal.arxml"
arxml1Db = next(iter(canmatrix.formats.loadp(file).values()))
pgn, id = self.list_pgn(db=arxml1Db)
for frame in arxml1Db.frames:
self.frames.append(frame.name)
for ecu in arxml1Db.boardUnits:
self.ecus.append(ecu.name)
for idx, pgnx in zip(id, pgn):
Fr = arxml1Db.frameById(idx)
for sig in Fr.signals:
self.signals.append(sig.name)
for tra in Fr.transmitter:
self.fun.set_key(self.transmitters, tra, Fr.name)
for rec in Fr.receiver:
self.fun.set_key(self.receivers, rec, Fr.name)
Thank you very much for your support! P.S.: I can provide the code in case you would like to check it.
please try:
arxml1Db = next(iter(canmatrix.formats.loadp(file, arxmlUseXpath = False).values()))
1) after doing as you said, i found out following:
File "C:\Python36\lib\site-packages\canmatrix-0+unknown-py3.6.egg\canmatrix\canmatrix.py", line 892, in signals_to_bytes least = self.size * 8 - signal.startBit TypeError: unsupported operand type(s) for -: 'int' and 'str'
2) simple cast worked:
least = self.size * 8 - int(signal.startBit)
3) after that:
for rec in Fr.receivers: AttributeError: 'Frame' object has no attribute 'receivers'
4) so i've changed it to 'receiver'. But the list is empty
the TypeError could be fixed with c8cc7e9
Every frame should have receiver...
>>> import canmatrix
>>> f = canmatrix.Frame("test")
>>> f.receiver
[]
>>>
Edit: You found a inconsistency: While frame has transmitters it has only receiver (without s)
should be fixed
While trying to import CAN arxml I'm facing following problem:
AttributeError: 'Frame' object has no attribute 'transmitters'
I can see in canmatrix.py that class Frame should have a list of transmitters. Moreover it is used in functions like updateEcuList(self).
Can anybody tell me why it is in my case not working, or show me better approach how to iterate through whole C-Matrix (ECUs, Frames and recieved/transmitted Signals)
Thank you, Vaclav