Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

Table of Contents

Telemetry System

The new telemetry system uses a Raspberry Pi to collect CAN messages from the vehicle along with metrics such as GPS coordinates. We use Node-Red to collect this data and also send it to FRED’s Node-Red which will store our data in the cloud and allow us to pull data from InfluxDB which is hosted by FRED.

Raspberry Pi

The link below shows how to set up Node-Red on the Raspberry Pi.

Telemetry: Setting up Node-Red, Chronograf, and Grafana

To set up the connection between the Raspberry Pi’s Node-Red and FRED’s Node-Red, refer to the link here:

Connecting Device Node-Red to Cloud Node-Red

FRED

Link to FRED. This is the system we will be using that hosts Node-Red and InfluxDB on the cloud.

Multiple Network Interface Traffic (Multihoming)

We can set up the Raspberry Pi such that we can send data over both LTE and wifi depending on the location of the vehicle and our situation. We can set this up on the Pi by following instructions provided here or read the short version below.

Assign each interface IP address using ifconfig to set up multihoming.

Example:

# ifconfig eth0 192.168.1.254 up
# ifconfig eth1 192.168.2.254 up

Long Term Storage

In terms of storing data locally on the Raspberry Pi, Node-Red can directly output the data to a CSV file locally on the Raspberry Pi. These files can be manually moved to Google Drive if necessary. The youtube tutorial below explains how to use the CSV node in Node-Red.

CSV Node Tutorial

For our purposes, the setup should look something like this.

Aggregating the CAN Messages

Since there is a flutter app that analyzes the CAN data and provides us with metrics on the vehicle, we need to be able to send WebSocket messages to the flutter app which can be set up through Node-Red. However, we also need to format these WebSocket messages as a JSON, similar to what is shown below.

{
"speed" : num,
"errors" : [],
"right_turn" : bool,
"left_turn" : bool,
"soc" : {
  battery_percent : num,
  ...
},
drive_state : "",
cruise_control : bool
}

Currently, the messages that Node-Red receives from vcan0 are like the object below, so we need to use the generated DBC file to translate these messages for the flutter app.

{
    "ext":false,
    "rtr":false,
    "canid":123,
    "dlc":5,
    "data":[1,2,3,4,5]}
}

Generating the DBC File

# You may need to be root or use "sudo" to run these commands

# Update packages and install dependency packages for services
apt-get update \
 && apt-get dist-upgrade -y \
 && apt-get clean \
 && echo 'Finished installing dependencies'

# Install packages
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
  clang-format \
  git \
  golang-go \
  golang-goprotobuf-dev \
  protobuf-compiler \
  python-pip \
  && rm -rf /var/lib/apt/lists/*

# Clone and install project dependencies
git clone https://github.com/uw-midsun/codegen-tooling-xiv.git \
  && cd codegen-tooling-xiv \
  && pip install -r requirements.txt

# Generate DBC and templates
cd codegen-tooling-xiv \
  && make gen \
  && make gen-dbc
  • No labels