aboutsummaryrefslogtreecommitdiffstats
path: root/extras/FeedCAN.py
diff options
context:
space:
mode:
authorsuchinton2001 <suchinton.2001@gmail.com>2023-10-09 16:00:58 +0530
committersuchinton2001 <suchinton.2001@gmail.com>2023-10-09 16:00:58 +0530
commitdb862e32df7f31e6453d7f05a6f011091b96ffab (patch)
tree6abcc3a2eceb79a43b7836d1d23a8594da375826 /extras/FeedCAN.py
parent260bbf89836ff9ce98054e5166699a163a0d7c11 (diff)
agl-demo-control-panel: Add grpc support for databroker
- Add grpc support for databroker (set default protocol) - Add virtual car for script mode in IC app - Refine UI elements - Use specific grpc/ws jwt tokens - Simplify settings menu Bug-AGL: SPEC-4905 Signed-off-by: suchinton2001 <suchinton.2001@gmail.com> Change-Id: I59c4b1de80e280fe22993b2d2f7c92d6b41a89c7
Diffstat (limited to 'extras/FeedCAN.py')
-rw-r--r--extras/FeedCAN.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/extras/FeedCAN.py b/extras/FeedCAN.py
index 92649f4..9cd01d5 100644
--- a/extras/FeedCAN.py
+++ b/extras/FeedCAN.py
@@ -15,6 +15,7 @@
"""
import can
+import logging
def send_can_signal(frame):
"""
@@ -25,8 +26,13 @@ def send_can_signal(frame):
None
"""
msg = separate_can_frame(frame)
- bus = can.interface.Bus(channel='can0', bustype='socketcan')
- #msg = can.Message(arbitration_id=can_id, data=data, is_extended_id=False)
+
+ try:
+ bus = can.interface.Bus(channel='can0', bustype='socketcan')
+ except Exception as e:
+ logging.error(f"Failed to initialize bus with channel 'can0': {e}")
+ return
+
try:
bus.send(msg)
print("CAN signal sent successfully:")