diff --git a/README.md b/README.md
index 9d2ab64..f6766cc 100644
--- a/README.md
+++ b/README.md
@@ -32,20 +32,23 @@ If you would like to contribute to Jankboard 2, there's only a few simple steps
- If you don't have access to a development environment that supports running standalone executables (eg. Github Codespaces), you can try running `npm run dev` instead of `npm run tauri dev`, which will open a development server at `localhost:5173` with the frontend running in the web. However, this may break at any time as critical functionality is more directly attached to the Rust backend.
- If for some reason you need to install and use the Python backend while we are migrating to Rust, run `poetry install --no-root` in the root directory of the project to install dependencies. You can start the server with `poetry run flask --app app/server.py run --host localhost --port 1280` (it must be running at port `1280` for the frontend to detect it).
-## Current progress
+## Current progress and improvements over (original) Jankboard
-- Basic UI layout complete
-- Media player working with a few small issues
-- App system working smoothly
-- Camera feed likely working
-- Frontend syncs basic telemetry data with robot through the same Socket-IO code that powered Jankboard v1
-- Notification service installed, with Toast and audio capability
+- Layout, toasts/notifications, music player, and app system ported.
+- Toast and audio cue system is much more robust
+- Transitions added almost everywhere to make things smoother
+- Tauri app created successfully, currently still using Flask backend
+- Visualization vastly improved with Threlte (Three.js) powered 3D robot simulation
+- Robot model ported successfully via massive optimization through polygon decimation
+- Added settings app with options to disable certain features and developer tools for testing
## TODO
- Camera cutout overlay
- Overhaul audio player system
-- Robot visualization (3D, in Threlte).
-- Overhaul backend
+- Overhaul visualization (especially camera)
+- Overhaul backend in Rust
- Further integrate telemetry (like GPWS, collision warning, etc)
- Finish re-creating / adding various voice alerts and sequences
+- Create dynamic voice prompt system to support new languages very easily
+- Add dynamic voice prompt fallback to support incremental voice prompt migration
diff --git a/client/package-lock.json b/client/package-lock.json
index c3afd7d..26b404d 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -9,8 +9,10 @@
"version": "0.0.0",
"dependencies": {
"@fontsource/roboto": "^5.0.8",
+ "@tauri-apps/api": "^1.5.3",
"@threlte/core": "^7.1.0",
"@threlte/extras": "^8.8.0",
+ "camera-controls": "^2.8.3",
"howler": "^2.2.4",
"material-icons": "^1.13.12",
"material-symbols": "^0.15.0",
@@ -810,6 +812,20 @@
"vite": "^5.0.0"
}
},
+ "node_modules/@tauri-apps/api": {
+ "version": "1.5.3",
+ "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-1.5.3.tgz",
+ "integrity": "sha512-zxnDjHHKjOsrIzZm6nO5Xapb/BxqUq1tc7cGkFXsFkGTsSWgCPH1D8mm0XS9weJY2OaR73I3k3S+b7eSzJDfqA==",
+ "engines": {
+ "node": ">= 14.6.0",
+ "npm": ">= 6.6.0",
+ "yarn": ">= 1.19.1"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/tauri"
+ }
+ },
"node_modules/@tauri-apps/cli": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-1.5.10.tgz",
@@ -1300,6 +1316,14 @@
"node": ">= 6"
}
},
+ "node_modules/camera-controls": {
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/camera-controls/-/camera-controls-2.8.3.tgz",
+ "integrity": "sha512-zFjqUR6onLkG+z1A6vAWfzovxZxWVSvp6e5t3lfZgfgPZtX3n74aykNAUaoRbq8Y3tOxadHkDjbfGDOP9hFf2w==",
+ "peerDependencies": {
+ "three": ">=0.126.1"
+ }
+ },
"node_modules/caniuse-lite": {
"version": "1.0.30001588",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz",
diff --git a/client/package.json b/client/package.json
index 634fbe2..4b054fa 100644
--- a/client/package.json
+++ b/client/package.json
@@ -29,8 +29,10 @@
},
"dependencies": {
"@fontsource/roboto": "^5.0.8",
+ "@tauri-apps/api": "^1.5.3",
"@threlte/core": "^7.1.0",
"@threlte/extras": "^8.8.0",
+ "camera-controls": "^2.8.3",
"howler": "^2.2.4",
"material-icons": "^1.13.12",
"material-symbols": "^0.15.0",
diff --git a/client/public/static/voices/en/adaptive-cruise-control.wav b/client/public/static/voices/en-US/adaptive-cruise-control.wav
similarity index 100%
rename from client/public/static/voices/en/adaptive-cruise-control.wav
rename to client/public/static/voices/en-US/adaptive-cruise-control.wav
diff --git a/client/public/static/voices/en/all-brakes-disengaged.wav b/client/public/static/voices/en-US/all-brakes-disengaged.wav
similarity index 100%
rename from client/public/static/voices/en/all-brakes-disengaged.wav
rename to client/public/static/voices/en-US/all-brakes-disengaged.wav
diff --git a/client/public/static/voices/en/autonomous-period-started.wav b/client/public/static/voices/en-US/autonomous-period-started.wav
similarity index 100%
rename from client/public/static/voices/en/autonomous-period-started.wav
rename to client/public/static/voices/en-US/autonomous-period-started.wav
diff --git a/client/public/static/voices/en/battery-critically-low.wav b/client/public/static/voices/en-US/battery-critically-low.wav
similarity index 100%
rename from client/public/static/voices/en/battery-critically-low.wav
rename to client/public/static/voices/en-US/battery-critically-low.wav
diff --git a/client/public/static/voices/en/battery-faults-detected.wav b/client/public/static/voices/en-US/battery-faults-detected.wav
similarity index 100%
rename from client/public/static/voices/en/battery-faults-detected.wav
rename to client/public/static/voices/en-US/battery-faults-detected.wav
diff --git a/client/public/static/voices/en/battery-good.wav b/client/public/static/voices/en-US/battery-good.wav
similarity index 100%
rename from client/public/static/voices/en/battery-good.wav
rename to client/public/static/voices/en-US/battery-good.wav
diff --git a/client/public/static/voices/en/battery-low.wav b/client/public/static/voices/en-US/battery-low.wav
similarity index 100%
rename from client/public/static/voices/en/battery-low.wav
rename to client/public/static/voices/en-US/battery-low.wav
diff --git a/client/public/static/voices/en/breaching-1323-mainframe.wav b/client/public/static/voices/en-US/breaching-1323-mainframe.wav
similarity index 100%
rename from client/public/static/voices/en/breaching-1323-mainframe.wav
rename to client/public/static/voices/en-US/breaching-1323-mainframe.wav
diff --git a/client/public/static/voices/en/breaching-254-mainframe.wav b/client/public/static/voices/en-US/breaching-254-mainframe.wav
similarity index 100%
rename from client/public/static/voices/en/breaching-254-mainframe.wav
rename to client/public/static/voices/en-US/breaching-254-mainframe.wav
diff --git a/client/public/static/voices/en/breaching-fms.wav b/client/public/static/voices/en-US/breaching-fms.wav
similarity index 100%
rename from client/public/static/voices/en/breaching-fms.wav
rename to client/public/static/voices/en-US/breaching-fms.wav
diff --git a/client/public/static/voices/en/breaching-monte-vista.wav b/client/public/static/voices/en-US/breaching-monte-vista.wav
similarity index 100%
rename from client/public/static/voices/en/breaching-monte-vista.wav
rename to client/public/static/voices/en-US/breaching-monte-vista.wav
diff --git a/client/public/static/voices/en/bullying-rohan.wav b/client/public/static/voices/en-US/bullying-rohan.wav
similarity index 100%
rename from client/public/static/voices/en/bullying-rohan.wav
rename to client/public/static/voices/en-US/bullying-rohan.wav
diff --git a/client/public/static/voices/en/bypassing-coprocessor-restrictions.wav b/client/public/static/voices/en-US/bypassing-coprocessor-restrictions.wav
similarity index 100%
rename from client/public/static/voices/en/bypassing-coprocessor-restrictions.wav
rename to client/public/static/voices/en-US/bypassing-coprocessor-restrictions.wav
diff --git a/client/public/static/voices/en/collision-detected.wav b/client/public/static/voices/en-US/collision-detected.wav
similarity index 100%
rename from client/public/static/voices/en/collision-detected.wav
rename to client/public/static/voices/en-US/collision-detected.wav
diff --git a/client/public/static/voices/en/collision-imminent.wav b/client/public/static/voices/en-US/collision-imminent.wav
similarity index 100%
rename from client/public/static/voices/en/collision-imminent.wav
rename to client/public/static/voices/en-US/collision-imminent.wav
diff --git a/client/public/static/voices/en/critical-robot-failure.wav b/client/public/static/voices/en-US/critical-robot-failure.wav
similarity index 100%
rename from client/public/static/voices/en/critical-robot-failure.wav
rename to client/public/static/voices/en-US/critical-robot-failure.wav
diff --git a/client/public/static/voices/en/cruise-control-engaged.wav b/client/public/static/voices/en-US/cruise-control-engaged.wav
similarity index 100%
rename from client/public/static/voices/en/cruise-control-engaged.wav
rename to client/public/static/voices/en-US/cruise-control-engaged.wav
diff --git a/client/public/static/voices/en/deep-bozo-buffering.wav b/client/public/static/voices/en-US/deep-bozo-buffering.wav
similarity index 100%
rename from client/public/static/voices/en/deep-bozo-buffering.wav
rename to client/public/static/voices/en-US/deep-bozo-buffering.wav
diff --git a/client/public/static/voices/en/deep-bozo-has-detected.wav b/client/public/static/voices/en-US/deep-bozo-has-detected.wav
similarity index 100%
rename from client/public/static/voices/en/deep-bozo-has-detected.wav
rename to client/public/static/voices/en-US/deep-bozo-has-detected.wav
diff --git a/client/public/static/voices/en/deep-bozo-has-sentience.wav b/client/public/static/voices/en-US/deep-bozo-has-sentience.wav
similarity index 100%
rename from client/public/static/voices/en/deep-bozo-has-sentience.wav
rename to client/public/static/voices/en-US/deep-bozo-has-sentience.wav
diff --git a/client/public/static/voices/en/doom-engaged.wav b/client/public/static/voices/en-US/doom-engaged.wav
similarity index 100%
rename from client/public/static/voices/en/doom-engaged.wav
rename to client/public/static/voices/en-US/doom-engaged.wav
diff --git a/client/public/static/voices/en/downloading-copyrighted-music.wav b/client/public/static/voices/en-US/downloading-copyrighted-music.wav
similarity index 100%
rename from client/public/static/voices/en/downloading-copyrighted-music.wav
rename to client/public/static/voices/en-US/downloading-copyrighted-music.wav
diff --git a/client/public/static/voices/en/e-brakes-engaged.wav b/client/public/static/voices/en-US/e-brakes-engaged.wav
similarity index 100%
rename from client/public/static/voices/en/e-brakes-engaged.wav
rename to client/public/static/voices/en-US/e-brakes-engaged.wav
diff --git a/client/public/static/voices/en/e-stop-and.wav b/client/public/static/voices/en-US/e-stop-and.wav
similarity index 100%
rename from client/public/static/voices/en/e-stop-and.wav
rename to client/public/static/voices/en-US/e-stop-and.wav
diff --git a/client/public/static/voices/en/e-stop-automatically.wav b/client/public/static/voices/en-US/e-stop-automatically.wav
similarity index 100%
rename from client/public/static/voices/en/e-stop-automatically.wav
rename to client/public/static/voices/en-US/e-stop-automatically.wav
diff --git a/client/public/static/voices/en/e-stop-temporarily.wav b/client/public/static/voices/en-US/e-stop-temporarily.wav
similarity index 100%
rename from client/public/static/voices/en/e-stop-temporarily.wav
rename to client/public/static/voices/en-US/e-stop-temporarily.wav
diff --git a/client/public/static/voices/en/emergency-speedbost-engaged.wav b/client/public/static/voices/en-US/emergency-speedbost-engaged.wav
similarity index 100%
rename from client/public/static/voices/en/emergency-speedbost-engaged.wav
rename to client/public/static/voices/en-US/emergency-speedbost-engaged.wav
diff --git a/client/public/static/voices/en/follow-mode-engaged.wav b/client/public/static/voices/en-US/follow-mode-engaged.wav
similarity index 100%
rename from client/public/static/voices/en/follow-mode-engaged.wav
rename to client/public/static/voices/en-US/follow-mode-engaged.wav
diff --git a/client/public/static/voices/en/full-self-driving-automatically.wav b/client/public/static/voices/en-US/full-self-driving-automatically.wav
similarity index 100%
rename from client/public/static/voices/en/full-self-driving-automatically.wav
rename to client/public/static/voices/en-US/full-self-driving-automatically.wav
diff --git a/client/public/static/voices/en/full-self-driving-disengaged.wav b/client/public/static/voices/en-US/full-self-driving-disengaged.wav
similarity index 100%
rename from client/public/static/voices/en/full-self-driving-disengaged.wav
rename to client/public/static/voices/en-US/full-self-driving-disengaged.wav
diff --git a/client/public/static/voices/en/full-self-driving-engaged.wav b/client/public/static/voices/en-US/full-self-driving-engaged.wav
similarity index 100%
rename from client/public/static/voices/en/full-self-driving-engaged.wav
rename to client/public/static/voices/en-US/full-self-driving-engaged.wav
diff --git a/client/public/static/voices/en/full-self-driving-refuses.wav b/client/public/static/voices/en-US/full-self-driving-refuses.wav
similarity index 100%
rename from client/public/static/voices/en/full-self-driving-refuses.wav
rename to client/public/static/voices/en-US/full-self-driving-refuses.wav
diff --git a/client/public/static/voices/en/hello-virtual-assistant.wav b/client/public/static/voices/en-US/hello-virtual-assistant.wav
similarity index 100%
rename from client/public/static/voices/en/hello-virtual-assistant.wav
rename to client/public/static/voices/en-US/hello-virtual-assistant.wav
diff --git a/client/public/static/voices/en/infotainment-system-buffering.wav b/client/public/static/voices/en-US/infotainment-system-buffering.wav
similarity index 100%
rename from client/public/static/voices/en/infotainment-system-buffering.wav
rename to client/public/static/voices/en-US/infotainment-system-buffering.wav
diff --git a/client/public/static/voices/en/infotainment-system-online.wav b/client/public/static/voices/en-US/infotainment-system-online.wav
similarity index 100%
rename from client/public/static/voices/en/infotainment-system-online.wav
rename to client/public/static/voices/en-US/infotainment-system-online.wav
diff --git a/client/public/static/voices/en/jankboard-initialized.wav b/client/public/static/voices/en-US/jankboard-initialized.wav
similarity index 100%
rename from client/public/static/voices/en/jankboard-initialized.wav
rename to client/public/static/voices/en-US/jankboard-initialized.wav
diff --git a/client/public/static/voices/en/littenos-is-online.wav b/client/public/static/voices/en-US/littenos-is-online.wav
similarity index 100%
rename from client/public/static/voices/en/littenos-is-online.wav
rename to client/public/static/voices/en-US/littenos-is-online.wav
diff --git a/client/public/static/voices/en/loading-pirated-nintendo.wav b/client/public/static/voices/en-US/loading-pirated-nintendo.wav
similarity index 100%
rename from client/public/static/voices/en/loading-pirated-nintendo.wav
rename to client/public/static/voices/en-US/loading-pirated-nintendo.wav
diff --git a/client/public/static/voices/en/max-vestrapren-do.wav b/client/public/static/voices/en-US/max-vestrapren-do.wav
similarity index 100%
rename from client/public/static/voices/en/max-vestrapren-do.wav
rename to client/public/static/voices/en-US/max-vestrapren-do.wav
diff --git a/client/public/static/voices/en/neutral-brakes-disengaged.wav b/client/public/static/voices/en-US/neutral-brakes-disengaged.wav
similarity index 100%
rename from client/public/static/voices/en/neutral-brakes-disengaged.wav
rename to client/public/static/voices/en-US/neutral-brakes-disengaged.wav
diff --git a/client/public/static/voices/en/overspeed.wav b/client/public/static/voices/en-US/overspeed.wav
similarity index 100%
rename from client/public/static/voices/en/overspeed.wav
rename to client/public/static/voices/en-US/overspeed.wav
diff --git a/client/public/static/voices/en/parked-brakes-engaged.wav b/client/public/static/voices/en-US/parked-brakes-engaged.wav
similarity index 100%
rename from client/public/static/voices/en/parked-brakes-engaged.wav
rename to client/public/static/voices/en-US/parked-brakes-engaged.wav
diff --git a/client/public/static/voices/en/rapid-deceleration-detected.wav b/client/public/static/voices/en-US/rapid-deceleration-detected.wav
similarity index 100%
rename from client/public/static/voices/en/rapid-deceleration-detected.wav
rename to client/public/static/voices/en-US/rapid-deceleration-detected.wav
diff --git a/client/public/static/voices/en/rapidly-approaching-speed.wav b/client/public/static/voices/en-US/rapidly-approaching-speed.wav
similarity index 100%
rename from client/public/static/voices/en/rapidly-approaching-speed.wav
rename to client/public/static/voices/en-US/rapidly-approaching-speed.wav
diff --git a/client/public/static/voices/en/retard.wav b/client/public/static/voices/en-US/retard.wav
similarity index 100%
rename from client/public/static/voices/en/retard.wav
rename to client/public/static/voices/en-US/retard.wav
diff --git a/client/public/static/voices/en/reverse.wav b/client/public/static/voices/en-US/reverse.wav
similarity index 100%
rename from client/public/static/voices/en/reverse.wav
rename to client/public/static/voices/en-US/reverse.wav
diff --git a/client/public/static/voices/en/self-destruct-countdown.wav b/client/public/static/voices/en-US/self-destruct-countdown.wav
similarity index 100%
rename from client/public/static/voices/en/self-destruct-countdown.wav
rename to client/public/static/voices/en-US/self-destruct-countdown.wav
diff --git a/client/public/static/voices/en/sentry-mode-engaged.wav b/client/public/static/voices/en-US/sentry-mode-engaged.wav
similarity index 100%
rename from client/public/static/voices/en/sentry-mode-engaged.wav
rename to client/public/static/voices/en-US/sentry-mode-engaged.wav
diff --git a/client/public/static/voices/en/set-acceleration-profile-chill.wav b/client/public/static/voices/en-US/set-acceleration-profile-chill.wav
similarity index 100%
rename from client/public/static/voices/en/set-acceleration-profile-chill.wav
rename to client/public/static/voices/en-US/set-acceleration-profile-chill.wav
diff --git a/client/public/static/voices/en/set-acceleration-profile-ludicrous.wav b/client/public/static/voices/en-US/set-acceleration-profile-ludicrous.wav
similarity index 100%
rename from client/public/static/voices/en/set-acceleration-profile-ludicrous.wav
rename to client/public/static/voices/en-US/set-acceleration-profile-ludicrous.wav
diff --git a/client/public/static/voices/en/shifted-into-automatic.wav b/client/public/static/voices/en-US/shifted-into-automatic.wav
similarity index 100%
rename from client/public/static/voices/en/shifted-into-automatic.wav
rename to client/public/static/voices/en-US/shifted-into-automatic.wav
diff --git a/client/public/static/voices/en/shifted-into-drive.wav b/client/public/static/voices/en-US/shifted-into-drive.wav
similarity index 100%
rename from client/public/static/voices/en/shifted-into-drive.wav
rename to client/public/static/voices/en-US/shifted-into-drive.wav
diff --git a/client/public/static/voices/en/shifted-into-low.wav b/client/public/static/voices/en-US/shifted-into-low.wav
similarity index 100%
rename from client/public/static/voices/en/shifted-into-low.wav
rename to client/public/static/voices/en-US/shifted-into-low.wav
diff --git a/client/public/static/voices/en/shut-down-sequence.wav b/client/public/static/voices/en-US/shut-down-sequence.wav
similarity index 100%
rename from client/public/static/voices/en/shut-down-sequence.wav
rename to client/public/static/voices/en-US/shut-down-sequence.wav
diff --git a/client/public/static/voices/en/teleoperated-period-started.wav b/client/public/static/voices/en-US/teleoperated-period-started.wav
similarity index 100%
rename from client/public/static/voices/en/teleoperated-period-started.wav
rename to client/public/static/voices/en-US/teleoperated-period-started.wav
diff --git a/client/public/static/voices/en/terrain-pull-up.wav b/client/public/static/voices/en-US/terrain-pull-up.wav
similarity index 100%
rename from client/public/static/voices/en/terrain-pull-up.wav
rename to client/public/static/voices/en-US/terrain-pull-up.wav
diff --git a/client/public/static/voices/en/user-error-detected.wav b/client/public/static/voices/en-US/user-error-detected.wav
similarity index 100%
rename from client/public/static/voices/en/user-error-detected.wav
rename to client/public/static/voices/en-US/user-error-detected.wav
diff --git a/client/src-tauri/Cargo.lock b/client/src-tauri/Cargo.lock
index a771765..e0ab805 100644
--- a/client/src-tauri/Cargo.lock
+++ b/client/src-tauri/Cargo.lock
@@ -66,10 +66,14 @@ checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
name = "app"
version = "0.1.0"
dependencies = [
+ "network-tables",
"serde",
"serde_json",
"tauri",
"tauri-build",
+ "tokio",
+ "tracing",
+ "tracing-subscriber",
]
[[package]]
@@ -788,6 +792,12 @@ dependencies = [
"syn 2.0.50",
]
+[[package]]
+name = "futures-sink"
+version = "0.3.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
+
[[package]]
name = "futures-task"
version = "0.3.30"
@@ -802,6 +812,7 @@ checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
dependencies = [
"futures-core",
"futures-macro",
+ "futures-sink",
"futures-task",
"pin-project-lite",
"pin-utils",
@@ -1184,6 +1195,12 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573"
+[[package]]
+name = "httparse"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
+
[[package]]
name = "iana-time-zone"
version = "0.1.60"
@@ -1528,6 +1545,17 @@ dependencies = [
"simd-adler32",
]
+[[package]]
+name = "mio"
+version = "0.8.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
+dependencies = [
+ "libc",
+ "wasi 0.11.0+wasi-snapshot-preview1",
+ "windows-sys 0.48.0",
+]
+
[[package]]
name = "ndk"
version = "0.6.0"
@@ -1556,6 +1584,26 @@ dependencies = [
"jni-sys",
]
+[[package]]
+name = "network-tables"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7d34242b4ee3505f5d9f6eeb8cc409cfa1f18a517825c78e6001fe304c3977b"
+dependencies = [
+ "futures-util",
+ "parking_lot",
+ "rand 0.8.5",
+ "rmp",
+ "rmp-serde",
+ "rmpv",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "tokio",
+ "tokio-tungstenite",
+ "tracing",
+]
+
[[package]]
name = "new_debug_unreachable"
version = "1.0.4"
@@ -1721,6 +1769,12 @@ dependencies = [
"windows-targets 0.48.5",
]
+[[package]]
+name = "paste"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
+
[[package]]
name = "percent-encoding"
version = "2.3.1"
@@ -2142,6 +2196,40 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
+[[package]]
+name = "rmp"
+version = "0.8.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20"
+dependencies = [
+ "byteorder",
+ "num-traits",
+ "paste",
+]
+
+[[package]]
+name = "rmp-serde"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a"
+dependencies = [
+ "byteorder",
+ "rmp",
+ "serde",
+]
+
+[[package]]
+name = "rmpv"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e0e0214a4a2b444ecce41a4025792fc31f77c7bb89c46d253953ea8c65701ec"
+dependencies = [
+ "num-traits",
+ "rmp",
+ "serde",
+ "serde_bytes",
+]
+
[[package]]
name = "rustc-demangle"
version = "0.1.23"
@@ -2247,6 +2335,15 @@ dependencies = [
"serde_derive",
]
+[[package]]
+name = "serde_bytes"
+version = "0.11.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "serde_derive"
version = "1.0.197"
@@ -2352,6 +2449,17 @@ dependencies = [
"stable_deref_trait",
]
+[[package]]
+name = "sha1"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
[[package]]
name = "sha2"
version = "0.10.8"
@@ -2372,6 +2480,15 @@ dependencies = [
"lazy_static",
]
+[[package]]
+name = "signal-hook-registry"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "simd-adler32"
version = "0.3.7"
@@ -2399,6 +2516,16 @@ version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
+[[package]]
+name = "socket2"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871"
+dependencies = [
+ "libc",
+ "windows-sys 0.52.0",
+]
+
[[package]]
name = "soup2"
version = "0.2.1"
@@ -2895,8 +3022,38 @@ checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
dependencies = [
"backtrace",
"bytes",
+ "libc",
+ "mio",
"num_cpus",
+ "parking_lot",
"pin-project-lite",
+ "signal-hook-registry",
+ "socket2",
+ "tokio-macros",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.50",
+]
+
+[[package]]
+name = "tokio-tungstenite"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd"
+dependencies = [
+ "futures-util",
+ "log",
+ "tokio",
+ "tungstenite",
]
[[package]]
@@ -3037,6 +3194,25 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "tungstenite"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788"
+dependencies = [
+ "base64 0.13.1",
+ "byteorder",
+ "bytes",
+ "http",
+ "httparse",
+ "log",
+ "rand 0.8.5",
+ "sha1",
+ "thiserror",
+ "url",
+ "utf-8",
+]
+
[[package]]
name = "typenum"
version = "1.17.0"
diff --git a/client/src-tauri/Cargo.toml b/client/src-tauri/Cargo.toml
index fe4aa80..dcf8132 100644
--- a/client/src-tauri/Cargo.toml
+++ b/client/src-tauri/Cargo.toml
@@ -18,6 +18,10 @@ tauri-build = { version = "1.5.1", features = [] }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.6.0", features = [] }
+tokio = { version = "1.23.0", features = ["full"] }
+tracing = "0.1"
+tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
+network-tables = { version = "=0.1.3", features = ["client-v4"] }
[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
diff --git a/client/src-tauri/build.rs b/client/src-tauri/build.rs
index 795b9b7..d860e1e 100644
--- a/client/src-tauri/build.rs
+++ b/client/src-tauri/build.rs
@@ -1,3 +1,3 @@
fn main() {
- tauri_build::build()
+ tauri_build::build()
}
diff --git a/client/src-tauri/src/main.rs b/client/src-tauri/src/main.rs
index f5c5be2..a9aca44 100644
--- a/client/src-tauri/src/main.rs
+++ b/client/src-tauri/src/main.rs
@@ -1,8 +1,30 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
-fn main() {
- tauri::Builder::default()
- .run(tauri::generate_context!())
- .expect("error while running tauri application");
+use tauri::Manager;
+mod telemetry;
+
+#[derive(Clone, serde::Serialize)]
+struct Payload {
+ message: String,
+}
+
+fn main() {
+ let rt = tokio::runtime::Runtime::new().expect("Failed to create Tokio runtime");
+
+ rt.block_on(async {
+ tauri::Builder::default()
+ .setup(|app| {
+ // create app handle and send it to our event listeners
+ let app_handle = app.app_handle();
+
+ tokio::spawn(async move {
+ crate::telemetry::subscribe_topics(app_handle.clone()).await;
+ });
+
+ Ok(())
+ })
+ .run(tauri::generate_context!())
+ .expect("failed to run app")
+ })
}
diff --git a/client/src-tauri/src/telemetry.rs b/client/src-tauri/src/telemetry.rs
new file mode 100644
index 0000000..3be2175
--- /dev/null
+++ b/client/src-tauri/src/telemetry.rs
@@ -0,0 +1,75 @@
+use network_tables::v4::client_config::Config;
+use network_tables::v4::{Client, SubscriptionOptions};
+use serde_json::to_string;
+use std::net::{Ipv4Addr, SocketAddrV4};
+use tauri::{AppHandle, Manager};
+use tokio::time::{sleep, Duration};
+
+const NTABLE_IP: (u8, u8, u8, u8) = (10, 12, 80, 2);
+const NTABLE_PORT: u16 = 5810;
+
+pub async fn subscribe_topics(app_handle: AppHandle) {
+ loop {
+ // I hope this doesn't lead to a catastrophic infinite loop failure
+ let client = loop {
+ match Client::try_new_w_config(
+ SocketAddrV4::new(
+ Ipv4Addr::new(NTABLE_IP.0, NTABLE_IP.1, NTABLE_IP.2, NTABLE_IP.3),
+ NTABLE_PORT,
+ ),
+ Config {
+ ..Default::default()
+ },
+ )
+ .await
+ {
+ Ok(client) => {
+ println!("Client created");
+ app_handle
+ .emit_all("telemetry_connected", "connected")
+ .expect("Failed to emit telemetry_status connected event");
+ break client; // Exit the loop if the client is successfully created
+ }
+ Err(e) => {
+ println!("Failed to create client: {}. Retrying in 3 seconds...", e);
+ app_handle
+ .emit_all("telemetry_status", "disconnected")
+ .expect("Failed to emit telemetry_status disconnected event");
+
+ sleep(Duration::from_secs(3)).await; // Wait for 3 seconds before retrying
+ continue; // Continue the loop to retry
+ }
+ };
+ };
+
+ let mut subscription = client
+ .subscribe_w_options(
+ &["/SmartDashboard"],
+ Some(SubscriptionOptions {
+ all: Some(true),
+ prefix: Some(true),
+ ..Default::default()
+ }),
+ )
+ .await
+ .expect("Failed to subscribe");
+ while let Some(message) = subscription.next().await {
+ let mut modified_message = message.clone();
+
+ if let Some(stripped) = modified_message.topic_name.strip_prefix("/SmartDashboard/") {
+ modified_message.topic_name = stripped.to_string();
+ }
+
+ let json_message = to_string(&modified_message).expect("Failed to serialize message");
+ app_handle
+ .emit_all("telemetry_data", json_message.clone())
+ .expect("Failed to send telemetry message");
+
+ println!("{}", json_message);
+ }
+ println!("disconnected");
+ app_handle
+ .emit_all("telemetry_status", "disconnected")
+ .expect("Failed to emit telemetry_disconnected event");
+ }
+}
diff --git a/client/src/App.svelte b/client/src/App.svelte
index e534fa0..8c9aa48 100644
--- a/client/src/App.svelte
+++ b/client/src/App.svelte
@@ -6,13 +6,14 @@
import AppBar from './lib/Apps/AppBar.svelte'
import { appList } from './lib/Apps/appList'
import { initializeTelemetry } from './lib/utils/initializeTelemetry'
- import { onMount } from 'svelte'
+ import { onDestroy, onMount } from 'svelte'
import { Toaster } from 'svelte-french-toast'
import { initializationSequence } from './lib/Sequences/sequences'
import Loading from './lib/Loading/Loading.svelte'
import { settingsStore } from './lib/stores/settingsStore'
import getSettings from './lib/utils/getSettings'
import { Canvas } from '@threlte/core'
+ import { emit } from '@tauri-apps/api/event'
let activeApp: App = 'camera'
let topics: TelemetryTopics = {
@@ -32,6 +33,7 @@
}
let loading = $settingsStore.fastStartup ? false : true
+ let unlistenAll: () => void
onMount(() => {
let savedSettings = getSettings()
@@ -40,11 +42,21 @@
}
window.ResizeObserver = ResizeObserver
// disabled while migrating away from python
- initializeTelemetry(topics, 200)
+ initializeTelemetry(topics, 200).then((unsubFunction: () => void) => {
+ unlistenAll = unsubFunction
+ })
setTimeout(() => {
loading = false
initializationSequence()
}, 3000)
+
+ settingsStore.subscribe(value => {
+ localStorage.setItem('settings', JSON.stringify(value))
+ })
+ })
+
+ onDestroy(() => {
+ unlistenAll && unlistenAll()
})
diff --git a/client/src/app.css b/client/src/app.css
index f7782b4..2898b55 100644
--- a/client/src/app.css
+++ b/client/src/app.css
@@ -21,6 +21,8 @@
overflow: auto; /* or 'scroll' if you always want scrollability */
scrollbar-width: none; /* Hide scrollbar for Firefox */
-ms-overflow-style: none; /* Hide scrollbar for IE 10+ and Edge */
+
+ overscroll-behavior: none;
}
body::-webkit-scrollbar {
display: none;
diff --git a/client/src/globals.d.ts b/client/src/globals.d.ts
index 2a3f57e..444d7c6 100644
--- a/client/src/globals.d.ts
+++ b/client/src/globals.d.ts
@@ -49,11 +49,12 @@ interface TelemetryData {
'jerk-x': number
'jerk-y': number
'voltage': number
- 'acc-profile': Mode | '-999'
- 'gear': Gear | '-999'
+ 'acc-profile': Mode
+ 'gear': Gear
'ebrake': boolean
'reorient': boolean
'gpws': boolean
+ 'connected': boolean
}
type CardinalDirection =
diff --git a/client/src/lib/Apps/DevTools/DevTools.svelte b/client/src/lib/Apps/DevTools/DevTools.svelte
index f75c868..6ee8aec 100644
--- a/client/src/lib/Apps/DevTools/DevTools.svelte
+++ b/client/src/lib/Apps/DevTools/DevTools.svelte
@@ -1,4 +1,9 @@