Virtual CAN Bus silmulator does not work on Ubuntu

776 views Asked by At

I am trying to replay a log file using the following code. It's a very simple code to read each signal from the file and create the command. It is creating the command correctly. I print it to check and it works fine, but when I use os.system(command) to simulate VCAN it freezes and doesn't show the command on the terminal.

import os

filename = "canLogs.log"
f = open(filename, "r")
...
(Reading logs from file and create "command")
...

print(command) 
os.system(command)

I am using Ubuntu 64-bit (vmWare) on my Mac. This code works fine on Raspberry Pi. And I installed the folllowings: Socketcan and sudo apt-get install can-utils and pip3 install cantools. And I bring the virtual can interface by

sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set vcan0 up

To test the interface, when I put this cansend vcan0 123#1122334455667788 on the command line, doesn't give me any errors. So probably something is wrong with os.system(command), although I checked it by sending other commands. I wonder if I missed isntalling any other libraries in order to use it on Ubuntu (vmWare).

Any help would be great. Thanks

0

There are 0 answers