c4deszes / ldfparser

LIN Description File parser written in Python
https://c4deszes.github.io/ldfparser/
MIT License
64 stars 26 forks source link

Make Schedule Tables Accessible #79

Closed edporteous closed 2 years ago

edporteous commented 2 years ago

Is your feature request related to a problem? Please describe. It would be useful to have access to the definition of schedule tables. This information could be used, for example, to write a LIN simulator tool.

Describe the solution you'd like Provide a get function for the schedule table section, and a list of frame slot definitions

Describe alternatives you've considered The information appears to be parsed but not surfaced to the API.

c4deszes commented 2 years ago

The data at the moment is only accessible under the dictionary, if you parse an LDF then it's under ldf._source.

Further parsing into Python objects is planned however I'd need some idea of what a node simulation tool might need. The conversion of schedule tables is pretty straight forward but I don't know how a tool might want to access the entries in the table, like does it need to know how frames or specifically diagnostic frames can be encoded?

To design this part I feel like we should also consider LIN master APIs, but unlike for CAN there aren't many available in Python.

edporteous commented 2 years ago

Thanks, if the parse_ldf() made the same schedule table information available as parse_ldf_to_dict() that would be nice to have, but I haven't fully thought through the simulator use cases. The company I now work for publish the python-lin package so I may look at integrating ldfparse with that package to produce a master simulator.

c4deszes commented 2 years ago

The feature is I'd say complete, the LDF object now has get_schedule_table(name: str) function which can be used to access the list of commands sent, their delay and also every command has their respective properties such as nodes and frames linked.

There are two open points:

Could you take a look at the Pull request or test the branch? You can use pip install git+https://github.com/c4deszes/ldfparser.git@feature/schedule-table.

I also had a look at the different LIN master APIs and it seems that Peak has hardware support, so the LDF could be used to configure the schedule, but both Kvaser and Vector lack this functionality, so for these the schedule has to be maintained by the software. The interesting question for all of them though is how do you control the frame content for these entries and for example do so within a 10ms time window? For certain commands the content is straight forward (FreeFormat, DataDump, AssignNad, etc.) but for some it's not (MasterReq, SlaveResp and Unconditional frames) arguably the more difficult one being the arbitrary diagnostic frames.

c4deszes commented 2 years ago

The two open points were resolved and the feature has been released in 0.13.0

Reopen if you feel like something is missing, the entry encoding/decoding will be implemented once there's a proposal for a common Python LIN master API.