Skip to content

Commit

Permalink
Merge branch 'develop/stability-and-improvements' into ody-voice
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 authored Oct 31, 2024
2 parents 2178c28 + ee317f6 commit 453f4c3
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@v6.8.0
uses: docker/build-push-action@v6.9.0
with:
context: .
push: true
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ RUN apt-get update && apt-get install -y \
graphviz \
git-lfs \
util-linux \
wpasupplicant \
python3-ruamel.yaml
wpasupplicant

# add all buildroot files there
WORKDIR /home/odysseus/build
Expand Down
1 change: 0 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ services:
build: .
image: ghcr.io/northeastern-electric-racing/odysseus:develop-stability-and-improvements
command: /bin/bash
privileged: true
tty: true
stdin_open: true
network_mode: host
Expand Down
3 changes: 2 additions & 1 deletion docker_scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ alias load-secrets="source /home/odysseus/scripts/load-secrets.sh"

# for each defconfig make output subdirectory
make -C /home/odysseus/build/buildroot O=/home/odysseus/outputs/tpu BR2_EXTERNAL=/home/odysseus/build/odysseus_tree raspberrypi4_64_tpu_defconfig
make -C /home/odysseus/build/buildroot O=/home/odysseus/outputs/ap BR2_EXTERNAL=/home/odysseus/build/odysseus_tree raspberrypi3_64_ap_defconfig
make -C /home/odysseus/build/buildroot O=/home/odysseus/outputs/ap-pi3 BR2_EXTERNAL=/home/odysseus/build/odysseus_tree raspberrypi3_64_ap_defconfig
make -C /home/odysseus/build/buildroot O=/home/odysseus/outputs/ap-pi4 BR2_EXTERNAL=/home/odysseus/build/odysseus_tree raspberrypi4_64_ap_defconfig
make -C /home/odysseus/build/buildroot O=/home/odysseus/outputs/iroh BR2_EXTERNAL=/home/odysseus/build/odysseus_tree raspberrypi3_64_iroh_defconfig


Expand Down
File renamed without changes.
41 changes: 41 additions & 0 deletions odysseus_tree/board/ap/config-pi4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Please note that this is only a sample, we recommend you to change it to fit
# your needs.
# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE.
# See http://buildroot.org/manual.html#rootfs-custom
# and http://elinux.org/RPiconfig for a description of config.txt syntax

start_file=start4.elf
fixup_file=fixup4.dat

kernel=Image

# To use an external initramfs file
#initramfs rootfs.cpio.gz

# Disable overscan assuming the display supports displaying the full resolution
# If the text shown on the screen disappears off the edge, comment this out
disable_overscan=1

# How much memory in MB to assign to the GPU on Pi models having
# 256, 512 or 1024 MB total memory
gpu_mem_256=100
gpu_mem_512=100
gpu_mem_1024=100

# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console
dtoverlay=miniuart-bt

enable_uart=1

# enable autoprobing of Bluetooth driver without need of hciattach/btattach
#dtparam=krnbt=on


# enable 64bits support
arm_64bit=1

[newracom]
dtoverlay=disable-bt
dtoverlay=disable-wifi
dtoverlay=newracom_for_5-16_or_later
dtparam=spi=on
6 changes: 4 additions & 2 deletions odysseus_tree/configs/raspberrypi3_64_ap_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ BR2_aarch64=y
BR2_ARM_FPU_VFPV4=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_CCACHE=y
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_ODY_TREE_PATH)/patches"
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_ODY_TREE_PATH)/patches board/raspberrypi/patches"
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_TARGET_GENERIC_HOSTNAME="raspberrypi-ap"
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_TARGET_GENERIC_ROOT_PASSWD="$(ODY_AP_ROOT_PASSWORD)"
# BR2_TARGET_GENERIC_GETTY is not set
BR2_TARGET_TZ_INFO=y
BR2_TARGET_LOCALTIME="America/New_York"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_common $(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_nrc_common $(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_ap"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-ap.sh $(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-os-release.sh board/raspberrypi3-64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3-64/post-image.sh"
Expand All @@ -29,7 +31,7 @@ BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
BR2_PACKAGE_RPI_FIRMWARE=y
BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI=y
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="$(BR2_EXTERNAL_ODY_TREE_PATH)/board/ap/config.txt"
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="$(BR2_EXTERNAL_ODY_TREE_PATH)/board/ap/config-pi3.txt"
BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE="$(BR2_EXTERNAL_ODY_TREE_PATH)/board/ap/cmdline.txt"
BR2_PACKAGE_LM_SENSORS=y
BR2_PACKAGE_RASPI_GPIO=y
Expand Down
79 changes: 79 additions & 0 deletions odysseus_tree/configs/raspberrypi4_64_ap_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
BR2_aarch64=y
BR2_cortex_a72=y
BR2_ARM_FPU_VFPV4=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_CCACHE=y
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_ODY_TREE_PATH)/patches board/raspberrypi/patches"
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_TARGET_GENERIC_HOSTNAME="raspberrypi-ap"
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_TARGET_GENERIC_ROOT_PASSWD="$(ODY_AP_ROOT_PASSWORD)"
# BR2_TARGET_GENERIC_GETTY is not set
BR2_TARGET_TZ_INFO=y
BR2_TARGET_LOCALTIME="America/New_York"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_common $(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_nrc_common $(BR2_EXTERNAL_ODY_TREE_PATH)/overlays/rootfs_overlay_ap"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-ap.sh $(BR2_EXTERNAL_ODY_TREE_PATH)/post-build-os-release.sh board/raspberrypi4-64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4-64/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="AP"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,576cc10e1ed50a9eacffc7a05c796051d7343ea4)/linux-576cc10e1ed50a9eacffc7a05c796051d7343ea4.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-4-b broadcom/bcm2711-rpi-400 broadcom/bcm2711-rpi-cm4 broadcom/bcm2711-rpi-cm4s"
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_LINUX_TOOLS_GPIO=y
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_XZ=y
BR2_PACKAGE_ZSTD=y
BR2_PACKAGE_GIT=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
BR2_PACKAGE_RPI_FIRMWARE=y
BR2_PACKAGE_RPI_FIRMWARE_BOOTCODE_BIN=y
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="$(BR2_EXTERNAL_ODY_TREE_PATH)/board/ap/config-pi4.txt"
BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE="$(BR2_EXTERNAL_ODY_TREE_PATH)/board/ap/cmdline.txt"
BR2_PACKAGE_LM_SENSORS=y
BR2_PACKAGE_RASPI_GPIO=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_OPENSSL=y
BR2_PACKAGE_LIBQMI=y
BR2_PACKAGE_LIBCURL=y
BR2_PACKAGE_BMON=y
BR2_PACKAGE_CHRONY=y
BR2_PACKAGE_DHCPCD=y
BR2_PACKAGE_DROPBEAR=y
BR2_PACKAGE_GESFTPSERVER=y
BR2_PACKAGE_HOSTAPD=y
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
BR2_PACKAGE_IPERF3=y
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_IPUTILS=y
BR2_PACKAGE_IW=y
BR2_PACKAGE_UQMI=y
BR2_PACKAGE_WIRELESS_REGDB=y
BR2_PACKAGE_DOCKER_CLI=y
BR2_PACKAGE_DOCKER_COMPOSE=y
BR2_PACKAGE_DOCKER_ENGINE=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_NANO=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="2G"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_KMOD_XZ=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_NRC7292=y
BR2_PACKAGE_NRC7292_CUSTOM_BD_FILE="$(BR2_EXTERNAL_ODY_TREE_PATH)/package/nrc7292/nrc7292_alfa_bd.dat"
BR2_PACKAGE_NRC_CLI=y
BR2_PACKAGE_NRC_INIT_EXTRA=y
BR2_PACKAGE_ALFA_LED=y
BR2_PACKAGE_ALFA_LED_AP=y
BR2_PACKAGE_RPI_DTLOADER=y
BR2_PACKAGE_RPI_DTLOADER_FILES="$(BR2_EXTERNAL_ODY_TREE_PATH)/package/nrc7292/newracom_for_5-16_or_later.dts"
BR2_PACKAGE_USBIP=y
2 changes: 1 addition & 1 deletion odysseus_tree/package/calypso/calypso.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CALYPSO_VERSION = 547a8da764e5e77cd18cf62e996b3edae8076f4f
CALYPSO_VERSION = ea52c5ff6a04db2719bf8320891b3f021e05de3f
CALYPSO_SITE_METHOD = git
CALYPSO_SITE = https://github.com/Northeastern-Electric-Racing/Calypso
CALYPSO_GIT_SUBMODULES = YES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def measurement(self):
# get rid of empty strings in list
item = list(filter(None, item))
# convert percentage to decimal
send_data.append(('TPU/Can/BusUtil', [str(float(item[5].strip().strip("%")) / 100)], '%'))
send_data.append(('TPU/Can/BitsUsed', [item[2].strip()], 'bits'))
send_data.append(('TPU/Can/BusUtil', [float(item[5].strip().strip("%")) / 100], '%'))
send_data.append(('TPU/Can/BitsUsed', [float(item[2].strip())], 'bits'))

return send_data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def measurement(self):
data = []

temperature = self.read_sensor_data(TEMP_SENSOR_PATH)
if temperature is not None:
if float(temperature) is not None:
data.append(("TPU/Environment/Temperature", [temperature], "Celsius"))

humidity = self.read_sensor_data(HUMIDITY_SENSOR_PATH = '/sys/class/hwmon/hwmon2/humidity1_input')
if humidity is not None:
if float(humidity) is not None:
data.append(("TPU/Environment/Humidity", [humidity], "%"))

return data
Expand All @@ -41,4 +41,4 @@ def main():


if __name__ == "__main__":
main()
main()
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ def __init__(self):

def measurement(self):
return [
("TPU/Example/Data1", ["114"], "C"),
("TPU/Example/Data2", ["1431242"], "D"),
("TPU/Example/Data3", ["1431242"], "Q"),
("TPU/Example/Data4", ["112343122"], "X"),
("TPU/Example/Data5", ["112341232"], "M"),
("TPU/Example/Data6", ["1413242"], "W"),
("TPU/Example/Data1", [114], "C"),
("TPU/Example/Data2", [1431242], "D"),
("TPU/Example/Data3", [1431242], "Q"),
("TPU/Example/Data4", [112343122], "X"),
("TPU/Example/Data5", [112341232], "M"),
("TPU/Example/Data6", [1413242], "W"),
]

def main():
Expand All @@ -20,4 +20,4 @@ def main():


if __name__ == "__main__":
main()
main()
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def measurement(self):
send_data = []
if 0 == self.session.read() and self.session.valid:
tempMode = self.session.fix.mode
send_data.append(("TPU/GPS/Mode", [str(tempMode)], "enum"))
send_data.append(("TPU/GPS/Mode", [tempMode], "enum"))

if gps.isfinite(self.session.fix.speed):
send_data.append(("TPU/GPS/GroundSpeed", [str(self.session.fix.speed)], "knot"))
send_data.append(("TPU/GPS/GroundSpeed", [self.session.fix.speed], "knot"))

if gps.isfinite(self.session.fix.latitude) and gps.isfinite(self.session.fix.longitude) and self.session.fix.latitude != 0 and self.session.fix.longitude != 0:
send_data.append(("TPU/GPS/Location", [str(self.session.fix.latitude), str(self.session.fix.longitude)], "coordinate"))
send_data.append(("TPU/GPS/Location", [self.session.fix.latitude, self.session.fix.longitude], "coordinate"))

return send_data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def measurement(self):
send_data = []
for item in items:
item = item.strip('\'').split(" ")
data = [item[0].strip(), item[1].strip()]
data = [float(item[0].strip()), float(item[1].strip())]
send_data.append(('TPU/HaLow/DataRate', data, 'kb/s'))

return send_data
Expand All @@ -47,8 +47,8 @@ def measurement(self):
send_data = []
for line in out:
data_line = line.splitlines()[2]
parsed_data_ap = data_line.split()[5][:-1].strip()
parsed_data_sta = data_line.split()[3][:-1].strip()
parsed_data_ap = float(data_line.split()[5][:-1].strip())
parsed_data_sta = float(data_line.split()[3][:-1].strip())
send_data.append(("TPU/HaLow/ApMCS", [parsed_data_ap], "int"))
send_data.append(("TPU/HaLow/StaMCS", [parsed_data_sta], "int"))

Expand All @@ -65,7 +65,7 @@ def measurement(self):
send_data = []
for line in out:
split = line.splitlines()[1]
data = split.split(":")[1].strip()
data = float(split.split(":")[1].strip())
send_data.append(("TPU/HaLow/RSSI", [data], "int"))
return send_data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@ def __init__(self):

def measurement(self):
temps = psutil.sensors_temperatures(fahrenheit=False)
for name, entries in temps.items():
for entry in entries:
line = " %-20s %s °C (high = %s °C, critical = %s °C)" % (
entry.label or name,
entry.current,
entry.high,
entry.critical,
)
return [("TPU/OnBoard/CpuTemp", [str(entry.current)], "celsius")]
current = temps["cpu_thermal"][0].current
return [("TPU/OnBoard/CpuTemp", [current], "celsius")]


class CpuUsageMT(MeasureTask):
Expand All @@ -24,7 +17,7 @@ def __init__(self):

def measurement(self):
cpu_usage = psutil.cpu_percent()
return [("TPU/OnBoard/CpuUsage", [str(cpu_usage)], "percent")]
return [("TPU/OnBoard/CpuUsage", [cpu_usage], "percent")]



Expand All @@ -39,7 +32,7 @@ def __init__(self):

def measurement(self):
broker_cpu_usage = self.process.cpu_percent()
return [("TPU/OnBoard/BrokerCpuUsage", [str(broker_cpu_usage)], "percent")]
return [("TPU/OnBoard/BrokerCpuUsage", [broker_cpu_usage], "percent")]


class MemAvailMT(MeasureTask):
Expand All @@ -49,7 +42,7 @@ def __init__(self):
def measurement(self):
mem_info = psutil.virtual_memory()
mem_available = mem_info.available / (1024 * 1024)
return [("TPU/OnBoard/MemAvailable", [str(mem_available)], "MB")]
return [("TPU/OnBoard/MemAvailable", [mem_available], "MB")]


def main():
Expand Down
7 changes: 5 additions & 2 deletions odysseus_tree/sources/tpu_telemetry/telemetry/publish.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import asyncio
import math
import signal
import time


from telemetry.poll_data import gps_data, halow, on_board, can
from . import (
Expand Down Expand Up @@ -40,14 +42,15 @@ def publish_data(topic, message_data):

async def interval(task: MeasureTask):
async for result in task.set_interval(STOP):
time_us = time.time() * 1000000
# process each tuple
for packet in result:
data = server_data_pb2.ServerData()
topic, values, data.unit = packet

data.time_us = int(time_us)
# process the data values
for val in values:
data.value.append(val)
data.values.append(val)
else:
message_data = data.SerializeToString()
publish_data(topic, message_data)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
syntax = "proto3";

package serverdata.v1;
package serverdata.v2;

message ServerData {
repeated string value = 1;
// ensure old type is reserved
reserved 1;
reserved "value";
string unit = 2;
// time since unix epoch in MICROSECONDS
uint64 time_us = 3;
repeated float values = 4;
}
Loading

0 comments on commit 453f4c3

Please sign in to comment.