Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix network monitor to use Mbps and search for available ethernet interfaces #432

Merged
merged 6 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/esw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,4 @@ brushless:
max_torque: 0.13
multiplier: -1

network_iface: "enp44s0"
network_iface: "enp0s31f6"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to do something like this in network_monitor.py

import os iface_list = os.list_dir('/sys/class/net/')
And then check for an interface that starts with enp

4 changes: 2 additions & 2 deletions src/esw/network_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_bytes(t: str, interface: str) -> int:
tx2 = get_bytes("tx", iface)
rx2 = get_bytes("rx", iface)

tx_speed = (tx2 - tx1) / 1000000.0 # MBps
rx_speed = (rx2 - rx1) / 1000000.0 # MBps
tx_speed = (tx2 - tx1) * 8.0 / 1000000.0 # Mbps
rx_speed = (rx2 - rx1) * 8.0/ 1000000.0 # Mbps

pub.publish(NetworkBandwidth(tx_speed, rx_speed))
4 changes: 2 additions & 2 deletions src/teleop/gui/src/components/CommReadout.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div class="wrap">
<span
>TX: {{ parseFloat(tx).toFixed(2) }} RX:
{{ parseFloat(rx).toFixed(2) }}</span
>TX: {{ parseFloat(tx).toFixed(2) }} Mbps RX:
{{ parseFloat(rx).toFixed(2) }} Mbps</span
>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion system_services/rover-base-station-gstreamer-0.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Description=Base Station Gstreamer Service 0

[Service]
Environment="DISPLAY=:1"
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/mrover/.Xauthority"
User=mrover
ExecStart=/usr/bin/gst-launch-1.0 udpsrc port=5000 ! "application/x-rtp, encoding-name=(string)H264, payload=96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
Expand Down
2 changes: 1 addition & 1 deletion system_services/rover-base-station-gstreamer-1.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Description=Base Station Gstreamer Service 1

[Service]
Environment="DISPLAY=:1"
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/mrover/.Xauthority"
User=mrover
ExecStart=/usr/bin/gst-launch-1.0 udpsrc port=5001 ! "application/x-rtp, encoding-name=(string)H264, payload=96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
Expand Down
2 changes: 1 addition & 1 deletion system_services/rover-base-station-gstreamer-2.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Description=Base Station Gstreamer Service 2

[Service]
Environment="DISPLAY=:1"
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/mrover/.Xauthority"
User=mrover
ExecStart=/usr/bin/gst-launch-1.0 udpsrc port=5002 ! "application/x-rtp, encoding-name=(string)H264, payload=96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
Expand Down
2 changes: 1 addition & 1 deletion system_services/rover-base-station-gstreamer-3.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Description=Base Station Gstreamer Service 3

[Service]
Environment="DISPLAY=:1"
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/mrover/.Xauthority"
User=mrover
ExecStart=/usr/bin/gst-launch-1.0 udpsrc port=5003 ! "application/x-rtp, encoding-name=(string)H264, payload=96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
Expand Down