RCMast3r / data_acq

2 stars 3 forks source link

usage and development

to get into a dev environment locally (on linux):

  1. install nix:
sh <(curl -L https://nixos.org/nix/install) --daemon
  1. enable flakes:

    • Add the following to ~/.config/nix/nix.conf or /etc/nix/nix.conf:
      experimental-features = nix-command flakes
  2. run nix develop to enter dev shell

  3. run runner.py for the local usb to CAN listener on host machine

usage notes:

nix flake lock --update-input ht_can_pkg_flake

by default, it uses a fixed version of the hytech CAN library and it must be manually updated. downstream usage of this can update this too via specifying it in the flake input as well if need be.

TODO:

automation goals

flowchart TD

sym[PCAN symbol editor generation of `.sym` file] --> CI
subgraph user input
    sym
end

CI[remote CI generation and release of dbc / proto] --> pio[local built platformio util CAN lib]
CI --> np[local built nix proto gen lib]
CI --> bin[remote schema binary generation using ci devshell]
bin --> fg[foxglove webserver service]
np --> mc[mcap writer / CAN msg to protobuf service]
CI --> cantools[cantools dbc load]

automation requirements:

high level overview

input:

output:

flowchart TD
    CAN[RPI CAN] --> py_async_q[encoded CAN data]
    py_async_q --> des[DBC based CAN parser] 
    des --> pb_pack[protobuf packet creation]

    pb_pack --> data_q1[webserver protobuf packet queue]
    pb_pack --> data_q2[MCAP file writer protobuf packet queue]
    subgraph websocket thread
        data_q1 --> enc[serialize into protobuf packet]
        enc --> py_foxglove[foxglove server websocket]
    end
    subgraph file writer thread
        data_q2 --> py_mcap[MCAP file writer]
    end

notes:

kvaser u100 pinout: Alt text

get files from the car:

rsync -azP nixos@192.168.40.1:/home/nixos/recordings ~/hytech_mcaps