Skip to content

Commit

Permalink
misc fixes and improvements
Browse files Browse the repository at this point in the history
- bump calypso
- fix calypso iroh
- fix docker ruamel from #127 embedded
- add qmicli to prep for #155
- add can bus util and remove can data rate
  • Loading branch information
jr1221 committed May 21, 2024
1 parent ca4beff commit 8d65487
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 10 deletions.
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ RUN apt-get update && apt-get install -y \
graphviz \
git-lfs \
util-linux \
wpasupplicant

# just for calypso require ruamel.yaml
RUN apt-get update && apt-get install -y python3-pip && pip install --break-system-packages "ruamel.yaml<0.18.0"
wpasupplicant \
python3-ruamel.yaml

# add all buildroot files there
WORKDIR /home/odysseus/build
Expand Down
2 changes: 2 additions & 0 deletions odysseus_tree/configs/raspberrypi3_64_ap_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ BR2_PACKAGE_LM_SENSORS=y
BR2_PACKAGE_RASPI_GPIO=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_LIBQMI=y
BR2_PACKAGE_BMON=y
BR2_PACKAGE_DHCPCD=y
BR2_PACKAGE_DROPBEAR=y
Expand All @@ -44,6 +45,7 @@ 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_HTOP=y
BR2_PACKAGE_KMOD_TOOLS=y
Expand Down
29 changes: 29 additions & 0 deletions odysseus_tree/overlays/rootfs_overlay_iroh/etc/init.d/S76calypso
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

PIDFILE=/var/run/calypso.pid
EXECUTABLE=/usr/bin/calypso
INTERFACE_NAME=can0
BROKER_IP=192.168.100.1:1883

case "$1" in
start)
echo "Sleeping, waiting to start"
sleep 20s
echo "Starting calypso..."
# start (S) executable (x) in background (b), make pid file (m) at p
start-stop-daemon -S -x "$EXECUTABLE" -b -m -p "$PIDFILE" -- mqtt $BROKER_IP $INTERFACE_NAME skip_can_configure
;;
stop)
echo "Stopping calypso..."
# stop (K) and remove pidfile
start-stop-daemon -K -p "$PIDFILE"
rm "$PIDFILE"
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: {start|stop|restart/reload}"
exit 1
esac
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 = 8803595b62c5252da2aed2c433e1db135769e6c4
CALYPSO_VERSION = 14e484ca7c5d15273a44391f609aaa335094837d
CALYPSO_SITE_METHOD = git
CALYPSO_SITE = https://github.com/Northeastern-Electric-Racing/Calypso
CALYPSO_GIT_SUBMODULES = YES
Expand Down
1 change: 1 addition & 0 deletions odysseus_tree/sources/tpu_telemetry/telemetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ async def set_interval(self, stop: asyncio.Event):
measure = self.measurement()
except Exception as e:
print("Exception in ", type(self))
print("Exception is: ", e)
failure=True


Expand Down
15 changes: 10 additions & 5 deletions odysseus_tree/sources/tpu_telemetry/telemetry/poll_data/can.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
from .. import BufferedCommand, MeasureTask


# read in 1/10 a second increments
FETCH_CMD = ["bmon","-o", "format:fmt='$(attr:txrate:bytes) $(attr:rxrate:bytes)\n'", "-p", "can0" ]
# read using can-utils canbusload, ensure to change bitrate accordingly
FETCH_CMD = ["canbusload","can0@500000"]
class CanMT(MeasureTask, BufferedCommand):
def __init__(self):
MeasureTask.__init__(self, 1000)
BufferedCommand.__init__(self, FETCH_CMD)

def measurement(self):
items = self.read()
# filter out only newlines as list members
items = filter(lambda x: x != '\n', items)
send_data = []
for item in items:
item = item.strip('\'').split(" ")
data = [item[0].strip(), item[1].strip()]
send_data.append(('TPU/Can/DataRate', data, 'kb/s'))
item = item.strip('\'').strip().split(" ")
# 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'))

return send_data

Expand Down

0 comments on commit 8d65487

Please sign in to comment.