Files @ 94cab616b578
Branch filter:

Location: HydroBot/hydrobot-software/hydrobot.py

matthewreed
Added data simulation and influxdb logging script
import sys
from phant import Phant
from canard import can, bus
from canard.hw import socketcan
from canard.file import jsondb

p = Phant(jsonPath='keys_m3KwkGKYoxsrqoxpDePxhj8660L.json')

parser = jsondb.JsonDbParser()
b = parser.parse('hydrobot_can.json')
temp_msg = b.get_message("AirTemp")

dev = socketcan.SocketCanDev("can0")
dev.start()

while True:
    frame = dev.recv()
    print(frame)
    
    signals = b.parse_frame(frame)
    if signals:
        for s in signals:
            print(s)
            print(s.value)
    
    temp = temp_msg.get_signal("Temperature").value
    humid = temp_msg.get_signal("Humidity").value
    press = temp_msg.get_signal("Pressure").value
    
    p.log(humid, press, temp)
    print(p.remaining_bytes, p.cap)