Skip to content
Snippets Groups Projects
Commit 804148f1 authored by Claudiu MILEA (95030)'s avatar Claudiu MILEA (95030)
Browse files

Removed old code from previous CAN implementation

parent a326e16e
No related branches found
No related tags found
1 merge request!3Add basic setup for sending frames via CAN Bus and Ethernet between three processes (chassis, powertrain, body)
......@@ -7,29 +7,7 @@ from scapy.config import conf
# from scapy.contrib.cansocket_python_can import CANSocket
from scapy.contrib.cansocket import CANSocket
from scapy.main import load_contrib
from time import sleep
import multiprocessing as mp
import can
def coordinate_python_can():
# create a bus instance using 'with' statement,
# this will cause bus.shutdown() to be called on the block exit;
# many other interfaces are supported as well (see documentation)
with can.Bus(interface='socketcan', channel='vcan0', receive_own_messages=True) as bus:
# send a message
message = can.Message(arbitration_id=123, is_extended_id=False,
data=[0x11, 0x22, 0x33])
bus.send(message, timeout=0.2)
# iterate over received messages
# for msg in bus:
# print(f"{msg.arbitration_id:X}: {msg.data}")
# or use an asynchronous notifier
_ = can.Notifier(bus, [can.Logger("recorded.log"), can.Printer()])
sleep(5)
def get_filtered_can_socket(vehicle_segment: VehicleSegment):
filters = [{'can_id': f.value, 'can_mask': 0x7FF} for f in CANFrame if
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment