Python-can
python-can
Release 2.1.0
Feb 18, 2018
Contents
1
Installation
1.1 GNU/Linux dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Windows dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Installing python-can in development mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
3
3
4
2
Configuration
2.1 In Code . . . . . . . .
2.2 Configuration File . .
2.3 Environment Variables
2.4 Interface Names . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
5
5
6
6
Library API
3.1 Bus . . . . . . . .
3.2 Message . . . . .
3.3 Listeners . . . . .
3.4 Broadcast Manager
3.5 Utilities . . . . . .
3.6 Notifier . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7
7
9
12
16
19
20
CAN Interface Modules
4.1 Socketcan . . . . . . . . . . .
4.2 Kvasers CANLIB . . . . . .
4.3 CAN over Serial . . . . . . .
4.4 CAN over Serial / SLCAN . .
4.5 IXXAT Virtual CAN Interface
4.6 PCAN Basic API . . . . . . .
4.7 USB2CAN Interface . . . . .
4.8 NI-CAN . . . . . . . . . . .
4.9 isCAN . . . . . . . . . . . .
4.10 NEOVI Interface . . . . . . .
4.11 Vector . . . . . . . . . . . . .
4.12 Virtual . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
21
21
28
29
32
32
34
35
37
38
39
40
41
Scripts
5.1 can.logger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 can.player . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
43
44
3
4
5
.
.
.
.
.
.
.
.
.
.
.
.
i
6
Developers Overview
6.1 Contributing . . . .
6.2 Building & Installing
6.3 Creating a Release .
6.4 Code Structure . . .
.
.
.
.
45
45
45
45
46
7
History and Roadmap
7.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3 Support for CAN within Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
47
47
47
8
Known Bugs
49
Python Module Index
ii
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
51
python-can, Release 2.1.0
The python-can library provides Controller Area Network support for Python, providing common abstractions to
different hardware devices, and a suite of utilities for sending and receiving messages on a CAN bus.
python-can runs any where Python runs; from high powered computers with commercial CAN to usb devices right
down to low powered devices running linux such as a BeagleBone or RaspberryPi.
More concretely, some example uses of the library:
? Passively logging what occurs on a CAN bus. For example monitoring a commercial vehicle using its OBD-II
port.
? Testing of hardware that interacts via CAN. Modules found in modern cars, motocycles, boats, and even
wheelchairs have had components tested from Python using this library.
? Prototyping new hardware modules or software algorithms in-the-loop. Easily interact with an existing bus.
? Creating virtual modules to prototype CAN bus communication.
Brief example of the library in action: connecting to a CAN bus, creating and sending a message:
1
2
from __future__ import print_function
import can
3
4
5
6
7
8
def send_one():
bus = can.interface.Bus(bustype='pcan', channel='PCAN_USBBUS1', bitrate=250000)
#bus = can.interface.Bus(bustype='ixxat', channel=0, bitrate=250000)
#bus = can.interface.Bus(bustype='vector', app_name='CANalyzer', channel=0,
?bitrate=250000)
9
10
11
12
13
14
15
16
17
msg = can.Message(arbitration_id=0xc0ffee,
data=[0, 25, 0, 1, 3, 1, 4, 1],
extended_id=True)
try:
bus.send(msg)
print("Message sent on {}".format(bus.channel_info))
except can.CanError:
print("Message NOT sent")
18
19
20
if __name__ == "__main__":
send_one()
Contents:
Contents
1
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
Related searches
- can hear but can t understand
- python thousands separator python 3
- python can t open file
- python including other python files
- can 2 0b vs can fd
- python get python file path
- run python script in python shell
- python convert excel date to python datetime
- python codec can t decode byte
- python codec can t encode character
- python utf 8 codec can t decode byte
- python execute another python script