Questions tagged [python-can]

The can package provides controller area network support for Python developers; providing common abstractions to different hardware devices, and a suite of utilities for sending and receiving messages on a can bus.

References:

77 questions
8
votes
3 answers

Sharing virtual network with docker container

I am working on a project that requires me to create a virtual CAN network on my host machine $ sudo modprobe vcan $ sudo ip link add dev vcan0 type vcan $ sudo ip link set up vcan0 My ifconfig : My question is how can I share this interface with…
Ansh David
  • 654
  • 1
  • 10
  • 26
4
votes
1 answer

python-can J1939 filter mask

I have been working in a Raspberry with an MCP2515 CAN bus device for read entire values of J1939 messages on broadcasting with python . I would like to filter the J1939 messages, but i'm not undestand the meaning of the can-mask and how I discorver…
Gabriel Lincoln
  • 155
  • 1
  • 10
4
votes
1 answer

Can a can.Bus instance in python-can receive and transmit simultaneously?

I've been using python-can and cantools to transmit and receive CAN bus messages without any issue. But when I begin transmitting periodic messages while also trying to receive messages there seems to be some error. I'm not sure if there is a…
Tim51
  • 141
  • 3
  • 13
4
votes
1 answer

Receive message on CANbus always returns same value with python-can

I have a CAN bus (PCAN) with several inputs. I try to read the inputs in python and print them on the console. The first message I get from the bus is correct, however if I change the state on the input, the data in the message doesn't change and…
Swedgin
  • 815
  • 1
  • 11
  • 20
3
votes
0 answers

Matlab does not call Python class inherited method

I am using Matlab to call Python CAN functions from the python-can package. The code in Python works fine, but when called from Matlab it does not. The issue seems to be that Matlab is calling the send() method from the parent class instead of the…
2
votes
0 answers

python CAN implement a message counter

I am trying to use Python CAN, with Vector CAN interface to implement sending cyclic messages to an actual ECU. The message I am sending let's call it TorqueDemandMsg, it has 4 bit rolling counter MsgCounter as one of the signal, so that the ECU…
Summerle
  • 73
  • 1
  • 5
2
votes
0 answers

What is the python-can equivalent of sending socket CAN message?

I have code that communicates with a motor over CAN, originally written to work on a Linux machine. I want to run it on Windows, and I believe the socket-can libraries are not supported for Windows, and so I am trying to use python-can instead. The…
ITregear
  • 21
  • 3
2
votes
2 answers

Python-can: Fault injection on CAN bus possible?

I'm currently working on some tests for a CAN node, where I'm using python-can and Linux SocketCAN to send and receive CAN frames from the node. Regular sending and receiving is working fine, but now I want to inject faults and see how the CAN node…
EmbeddedNoob
  • 25
  • 1
  • 6
2
votes
1 answer

Showing ImportError: cannot import name 'Message' from 'can'

I am importing CAN messages in Python and I am using python-can library. So the line in my python code here is: from can import Message It was working fine but after I changed the folders, I am getting the below error: Traceback (most recent call…
Winters
  • 54
  • 4
2
votes
1 answer

Python's asyncio.Event() across different classes

I'm writing a Python program to interact with a device based on a CAN Bus. I'm using the python-can module successfully for this purpose. I'm also using asyncio to react to asynchronous events. I have written a "CanBusManager" class that is used by…
2
votes
1 answer

Can't get python-can-viewer to run

I want to use python to read a can-bus and later on going to send messages on the bus via python(I'm a total python newbie, but have knowledge in C and C++). So I started with installing the python-can module via pip. First thing I wanted to try is…
tryanderror
  • 153
  • 1
  • 9
2
votes
2 answers

Is it possible to use socketCAN protocol on MacOS

I am looking to connect to a car wirelessly using socketCAN protocol on MacOS using the module python-can on python3. I don't know how to install the socketCAN protocol on MacOS. Pls help.
hifromdev
  • 262
  • 3
  • 10
1
vote
1 answer

Creating a csv file with measurement data and meta data in the first line

I want to save measurement data I receive via the CAN bus in a csv file. Apart from the measurement data I want to also store some meta data I need to convert the measurement data I receive via CAN. The measurement data is for three axis and has…
melfie
  • 13
  • 2
1
vote
2 answers

Close bus in python-can

I am using python-can to send CAN messages like this: import can bus2 = can.interface.Bus(bustype='pcan', channel='PCAN_USBBUS1', bitrate=500000) msg = can.Message( arbitration_id=0x42, data=[0, 25, 0, 1, 3, 1, 4, 1],…
Dave
  • 171
  • 2
  • 13
1
vote
1 answer

Python CAN Log Converter for the following log types (ASC, BLF, CSV, LOG)

Bear with me as I'm new to Python and coding in general. I was looking to create a script that is able to convert the following common CAN logging formats (ASC, BLF, txt, csv, MF4) to another format (ASC, BLF, txt, csv, MF4). I've already installed…
1
2 3 4 5 6