Embedded hardware / software developer -- 2

Job ID: 35589742

Budget: ₹1,500 – ₹12,500 INR

Using this script here under on a rpi3 terminal I get the following outputs (see picture)

import can
import time
import os

print('\n\rCAN Rx test')
print('Bring up CAN0....')
os.system("sudo /sbin/ip link set can0 up type can bitrate 500000")
time.sleep(0.1)

try:

bus = can.interface.Bus(channel='can0', bustype='socketcan')
except OSError:
print('Cannot find PiCAN board.')
exit()

print('Ready')
try:

while True:

message = bus.recv() # Wait until a message is received.

c = '{0:f} {1:x} {2:x} '.format(message.timestamp, message.arbitration_id, message.dlc)
s=''
for i in range(message.dlc ):
s += '{0:x} '.format(message.data[i])

print(' {}'.format(c+s))

except KeyboardInterrupt:
#Catch keyboard interrupt
os.system("sudo /sbin/ip link set can0 down")
print('\n\rKeyboard interrupt')

the task would be for you to break the can frames and have them instead mapped to output easy to read strings and values instead of the complete frame. For example RPM10000 or PWR100.. BATT55 .. etc.. The highlights in the picture is just to show you the cycle time (timestamp) and the can frames on the canbus line but that's not important.

The output in strings must of course be read on the terminal instead of the current one now..