A package for handling CAN bus signals on Linux SocketCAN, for Python 3.3 and later.
Project description
Introduction to can4python
A package for handling CAN bus (Controller Area Network) signals on Linux SocketCAN, for Python 3.3 and later.
Free software: BSD license
Web resources
Source code on GitHub: https://github.com/caran/can4python
Documentation: https://can4python.readthedocs.org.
Python Package Index (PyPI): https://pypi.python.org/pypi/can4python
Features
Sends and receives CAN frames.
Handles parsing of CAN signals from CAN frames.
Uses SocketCAN for Linux.
For Python 3.3 or later. Python 3.4 is required for some functionality.
Implemented as pure Python files, without any external dependencies.
Suitable for use with BeagleBone and Raspberry Pi embedded Linux boards.
Configuration using the open source KCD file format.
Throttle incoming frames to reduce frame rate.
Filtering of incoming frames on data changes. This is done via a bit mask in the Linux kernel.
Periodic frame transmission executed by the Linux kernel (not by Python code).
Useful for showing the contents of KCD files (also those converted from DBC files).
Configuration file format
This CAN library uses the KCD file format for defining CAN signals and CAN messages. It is an open-source file format for describing CAN bus relationships. See https://github.com/julietkilo/kcd for details on the format, and example files.
The licensing of the KCD file format is, according to the web page:
The files that are describing the format are published under the Lesser GPL license. The KCD format is copyrighted by Jan-Niklas Meier (dschanoeh) and Jens Krueger (julietkilo). According to the authors this does not imply any licensing restrictions on software libraries implementing the KCD file format, or on software using those libraries.
Traditionally CAN bus relationships are described in DBC files, a file format owned by Vector Informatik GmbH. There are open source DBC-to-KCD file format converters available, for example the CANBabel tool: https://github.com/julietkilo/CANBabel
Known limitations
Not all CAN functionality is implemented. ‘Error frames’ and ‘remote request frames’ are not handled, and CAN multiplex signals are not supported.
Not all features of the KCD file format are implemented, for example ‘Labels’.
It is assumed that each CAN signal name only is available in a single CAN frame ID.
Dependencies
The can4python package itself has no dependencies, except for Python 3.3+ running on Linux.
For tests, a virtual CAN interface (‘vcan’) must be installed. It is part of the Linux kernel. See the Usage page of this documentation for details.
Dependencies for testing and documentation:
Dependency |
Description |
License |
Debian/pip package |
---|---|---|---|
vcan0 |
Virtual CAN bus interface |
Part of Linux kernel |
|
coverage |
Test coverage measurement |
Apache 2.0 |
P: coverage |
texlive |
Latex library (for PDF creation) |
“Knuth” |
D: texlive-full |
Sphinx 1.3+ |
Documentation tool |
BSD 2-cl |
P: sphinx |
Sphinx rtd theme |
Theme for Sphinx |
MIT |
P: sphinx_rtd_theme |
Installation and usage
See separate documentation pages.
Support
The preferred way is to open a question on Stack Overflow .
Found a bug? Open an issue on Github!
History
0.2.1 (2016-09-30)
Adjust duocumentation build configuration to better fit readthedocs.io
0.2.0 (2016-09-30)
Better support for other architectures. The broadcast manager (BCM) is now functional also on 32 bit ARM processors.
Implemented the read-only properties config and read_bcm on the canbus object.
Implemented the read-only property interfacename on the caninterface objects.
Better checks for invalid settings.
Improved repr() for canframe definition.
Improved documentation.
0.1.1 (2015-11-16)
Improved documentation
0.1.0 (2015-09-22)
First release on GitHub.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file can4python-0.2.1.tar.gz
.
File metadata
- Download URL: can4python-0.2.1.tar.gz
- Upload date:
- Size: 63.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a95a75784d7b4cba1da62c1efa73c1ad8513730c5780ff8b008d88f0b0cfaa54 |
|
MD5 | fb8fc927a4538305360a513e757f580d |
|
BLAKE2b-256 | 34b39fe2dbfc43d7f9d7b2e4f1001985bb92185cb02bb000e45a745c55dd65d0 |
File details
Details for the file can4python-0.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: can4python-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 45.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef2ebea9269d251bdd4bbb9243ee5b424393ef92b9d591a61ef2ac945b12a55d |
|
MD5 | 3d4c4004028c52fb7ecb47db2e24e2ae |
|
BLAKE2b-256 | 7ab97bc04b6b593adb2f33059ef769bd963471099e2c69d2ba7ec1938ceb5226 |