All Projects → c4deszes → ldfparser

c4deszes / ldfparser

Licence: MIT license
LIN Description File parser written in Python

Programming Languages

python
139335 projects - #7 most used programming language
Jinja
831 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to ldfparser

BMWConnectedAnalysis
No description or website provided.
Stars: ✭ 24 (-20%)
Mutual labels:  automotive
Asap2
Asap2 parser.
Stars: ✭ 27 (-10%)
Mutual labels:  automotive
Safe-Renderer
Luxoft Automotive HMI Safe Renderer
Stars: ✭ 20 (-33.33%)
Mutual labels:  automotive
Firmware Over The Air
graduation project of ITI, flashing a new firmware over the air for automotive industry
Stars: ✭ 18 (-40%)
Mutual labels:  automotive
TractorHacking.github.io
Tractor Hacking GHPages
Stars: ✭ 34 (+13.33%)
Mutual labels:  automotive
dreyeve
[TPAMI 2018] Predicting the Driver’s Focus of Attention: the DR(eye)VE Project. A deep neural network learnt to reproduce the human driver focus of attention (FoA) in a variety of real-world driving scenarios.
Stars: ✭ 88 (+193.33%)
Mutual labels:  automotive
talking-with-cars
CAN analysis - Use your car as a gamepad!
Stars: ✭ 95 (+216.67%)
Mutual labels:  automotive
f1-telemetry-client
A Node UDP client and telemetry parser for Codemaster's Formula 1 series of games
Stars: ✭ 128 (+326.67%)
Mutual labels:  automotive
Awesome Robotic Tooling
Tooling for professional robotic development in C++ and Python with a touch of ROS, autonomous driving and aerospace.
Stars: ✭ 1,876 (+6153.33%)
Mutual labels:  automotive
awesome-automotive-can-id
🚜 unpretentious attempt to collect CAN IDs and payloads for various car brands/models in one place.
Stars: ✭ 104 (+246.67%)
Mutual labels:  automotive
uds
Python package for communication via UDS (Unified Diagnostic Services) protocol. The package supports typical buses (i.e. CAN, Ethernet, LIN, FlexRay, K-Line) with possible extensions to any bus.
Stars: ✭ 18 (-40%)
Mutual labels:  automotive
DLT-Message-Analyzer
"Extended search" plugin for the DLT-viewer
Stars: ✭ 31 (+3.33%)
Mutual labels:  automotive
iso15765-canbus
Implementation of ISO15765-2 in C
Stars: ✭ 36 (+20%)
Mutual labels:  automotive
meta-pelux
PELUX is an open source, GENIVI compliant development platform that supports the Qt Automotive Suite
Stars: ✭ 34 (+13.33%)
Mutual labels:  automotive
sonicdisc
A 360° ultrasonic scanner
Stars: ✭ 35 (+16.67%)
Mutual labels:  automotive
elmobd
A Go library for talking to cars over OBD-II
Stars: ✭ 139 (+363.33%)
Mutual labels:  automotive
QtDigitalInstrumentCluster
Qt OBD II Digital Instrument Cluster
Stars: ✭ 37 (+23.33%)
Mutual labels:  automotive
vehicle signal manager
Vehicle Signal Manager to read, transform, and emit VSS signals based on configurable rules.
Stars: ✭ 12 (-60%)
Mutual labels:  automotive
audiowagon
AudioWagon will play audio files from an attached USB flash drive in cars equipped with Android Automotive OS
Stars: ✭ 23 (-23.33%)
Mutual labels:  automotive
lin-cms-koa-core
A simple and practical CMS implememted by koa
Stars: ✭ 42 (+40%)
Mutual labels:  lin

LDF Parser

Workflow Github Pages PyPI version PyPI - Python Version codecov.io Total alerts Language grade: Python GitHub last commit License: MIT

This tool is able parse LIN Description Files, retrieve signal names and frames from them, as well as encoding messages using frame definitions and decoding them.


Disclaimers

The library is still in a pre-release state, therefore features may break between minor versions. For this reason it's recommended that productive environments pin to the exact version of the library and do an integration test or review when updating the version. Breaking changes and how to migrate to the new version will be documented in the changelog and on the Github releases page.

The tool has been written according the LIN standards 1.3, 2.0, 2.1 and 2.2A, but due to errors in the documentation there's no guarantee that the library will be able to parse your LDF. In such cases if possible first verify the LDF with a commercial tool such as Vector LDF Explorer or the tool that was used to create the LDF. If the LDF seems to be correct then open a new issue. I also recommend trying the LDF to JSON conversion mechanism, see if that succeeds.

The LIN standard is now known as ISO 17987 which clears up some of the confusing parts in the 2.2A specification. Since this new standard is not freely available this library won't support the modifications present in ISO 17987. I don't think it's going to a huge problem because the LIN 2.2A released in 2010 has overall better adoption.

The LDF usually contains sensitive information, if you need to open an issue related to the parser then try to provide either an anonymized version with signals and frames obfuscated or just the relevant segments in an example LDF when opening issues.


Installation

You can install this library from PyPI using pip.

pip install ldfparser

Examples

import ldfparser
import binascii

# Load LDF
ldf = ldfparser.parse_ldf(path = "network.ldf")
frame = ldf.get_unconditional_frame('Frame_1')

# Get baudrate from LDF
print(ldf.get_baudrate())

# Encode signal values into frame
message = frame.encode_raw({"Signal_1": 123, "Signal_2": 0})
print(binascii.hexlify(message))
>>> 0x7B00

# Decode message into dictionary of signal names and values
received = bytearray([0x7B, 0x00])
print(frame.decode(received))
>>> {"Signal_1": 123, "Signal_2": 0}

# Encode signal values through converters
message = frame.encode({"MotorRPM": 100, "FanState": "ON"})
print(binascii.hexlify(message))
>>> 0xFE01

More examples can be found in the examples directory.


Documentation

Documentation is published to Github Pages.


Features

  • Semantic validation of LDF files

  • Retrieve header information (version, baudrate)

  • Retrieve Signal and Frame information

  • Retrieve Signal encoding types and use them to convert values

  • Retrieve Node attributes

  • Retrieve schedule table information

  • Command Line Interface

  • Capturing comments

  • Encode and decode standard diagnostic frames

  • Saving LDF object as an .ldf file (experimental)

Known issues / missing features

  • Certain parsing related errors are unintuitive

  • Checksum calculation for frames

  • Token information is not preserved


Development

Install the requirements via pip install -r requirements.txt

Install the library locally by running pip install -e .

Pytest is used for testing, to execute all tests run pytest -m 'not snapshot'

Flake8 is used for linting, run flake8 to print out all linting errors.


Contributors

@c4deszes (Author)


Credits

Inspired by uCAN-LIN LinUSBConverter, specifically the LDF parsing mechanism via Lark. Previously the library included most of the lark file, parsing code and examples, since 0.5.0 they've been completely rewritten to better accomodate the different LIN standards.


License

License: MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].