Skip to content

Commit

Permalink
Use online owlet index for Hoot decoding (#232)
Browse files Browse the repository at this point in the history
* Add support for Hoot logs on all platforms

* Remove old Hoot utils

* Read compliancy without owlet

* Fix field parsing for merged Hoot logs

* Reword download status messages

* Fixes for owlet

* Switch Hoot compliancy to uint8

Better safe than sorry, since we can't confirm the actual format

* Add warning about Hoot on Windows for ARM

* Fix Hoot platform check

* Add popup for agreeing to CTRE license terms

* Update docs for Hoot decoding

* Allow agreement to placeholder CTRE license

* Remove check for owlet exit code

Can be non-zero when end of file is cut off, and compliancy checks are already handled in AdvantageScope

* Disable agreement to placeholder

* Don't bundle prelease owlet compliancies in stable AdvantageScope releases

* Fix filename

* Remove Hoot Windows on ARM warning

* Add CTRE license
  • Loading branch information
jwbonner authored Dec 14, 2024
1 parent 57d4eda commit 1130038
Show file tree
Hide file tree
Showing 23 changed files with 596 additions and 286 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/src/licenses.json
/ThirdPartyLicenses.txt
/eng.traineddata.gz
/runOwletDownload.js
/owlet

### Docs ###

Expand Down
4 changes: 2 additions & 2 deletions docsSite/docs/getting-started/manage-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import Image2 from './img/open-file-2.png';
- **Hoot (.hoot)** - Produced by CTRE's Phoenix 6 [signal logger](https://pro.docs.ctr-electronics.com/en/latest/docs/api-reference/api-usage/signal-logging.html).
- **RLOG (.rlog)** - Legacy, produced by AdvantageKit 2022.

:::warning
Hoot files can **only be opened on Windows** and require an installation of [Phoenix Tuner X](https://v6.docs.ctr-electronics.com/en/stable/docs/tuner/index.html).
:::info
Hoot log files can only be opened after agreeing to CTRE's [end user license agreement](https://raw.githubusercontent.com/CrossTheRoadElec/Phoenix-Releases/refs/heads/master/CTRE_LICENSE.txt). AdvantageScope displays a prompt to confirm agreement to these terms when opening a Hoot log file for the first time.
:::

## Opening Logs
Expand Down
141 changes: 57 additions & 84 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"build": "npm run compile && npm run wasm:compile && npm run docs:build-embed && electron-builder build",
"fast-build": "npm run compile && npm run wasm:compile && npm run docs:build-embed && electron-builder build --dir",
"watch": "rollup -c -w",
"download-owlet": "rollup -c --configRunOwletDownload && node runOwletDownload.js",
"format": "prettier --write .",
"check-format": "prettier --check .",
"test-ytdl": "node testYtdl.mjs",
Expand All @@ -25,7 +26,7 @@
"docs:build-embed": "cd docsSite && npm run build-embed && cd ..",
"docs:clear": "cd docsSite && npm run clear && cd ..",
"docs:serve": "cd docsSite && npm run serve && cd ..",
"postinstall": "cd docsSite && npm install && cd .. && node getLicenses.mjs && node ffmpegDownload.mjs && node tesseractLangDownload.mjs"
"postinstall": "cd docsSite && npm install && cd .. && node getLicenses.mjs && node tesseractLangDownload.mjs && node ffmpegDownload.mjs && npm run download-owlet"
},
"devDependencies": {
"@electron/notarize": "^2.1.0",
Expand All @@ -38,6 +39,7 @@
"@rollup/plugin-typescript": "12.1.1",
"@types/chart.js": "^2.9.38",
"@types/color-convert": "^2.0.3",
"@types/compare-versions": "^3.3.0",
"@types/download": "^8.0.2",
"@types/heatmap.js": "2.0.38",
"@types/jsonfile": "^6.1.2",
Expand All @@ -49,6 +51,7 @@
"camera-controls": "^2.9.0",
"chart.js": "^4.4.0",
"color-convert": "^2.0.1",
"compare-versions": "^6.1.1",
"electron": "^32.0.2",
"electron-builder": "^24.6.4",
"fuse.js": "^7.0.0",
Expand Down Expand Up @@ -99,6 +102,11 @@
"!icons/**/*.iconset",
"bundledAssets/**/*",
"docsSite/build/**/*",
{
"filter": [
"owlet/${os}-${arch}/*"
]
},
"!**/.*"
],
"extraResources": [
Expand Down
19 changes: 19 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,31 @@ const workerBundles = [
bundle("shared/renderers/threeDimension/workers/loadField.ts", "shared$loadField.js", false),
bundle("shared/renderers/threeDimension/workers/loadRobot.ts", "shared$loadRobot.js", false)
];
const runOwletDownload = {
input: "src/runOwletDownload.ts",
output: {
file: "runOwletDownload.js",
format: "cjs"
},
context: "this",
external: ["download"],
plugins: [
typescript(),
nodeResolve({
preferBuiltins: true
}),
commonjs(),
json()
],
onwarn() {}
};

export default (cliArgs) => {
if (cliArgs.configMain === true) return mainBundles;
if (cliArgs.configLargeRenderers === true) return largeRendererBundles;
if (cliArgs.configSmallRenderers === true) return smallRendererBundles;
if (cliArgs.configWorkers === true) return workerBundles;
if (cliArgs.configRunOwletDownload === true) return runOwletDownload;

return [...mainBundles, ...largeRendererBundles, ...smallRendererBundles, ...workerBundles];
};
5 changes: 0 additions & 5 deletions src/hub/dataSources/HistoricalDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ export class HistoricalDataSource {
this.refreshCallback = refreshCallback;

// Post message to start reading
if (window.platform !== "win32" && path.endsWith(".hoot")) {
this.customError = "Hoot log files cannot be decoded on macOS or Linux.";
this.setStatus(HistoricalDataSourceStatus.Error);
return;
}
if (this.path.endsWith(".dsevents")) {
this.path = this.path.slice(0, -8) + "dslog";
}
Expand Down
11 changes: 11 additions & 0 deletions src/hub/dataSources/wpilog/wpilogWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ async function start(data: Uint8Array) {

function parseField(key: string) {
// Parse records
if (!(key in entryTypes)) {
// Try removing leading slash, sometimes inserted
// when a key prefix is used in the main renderer
if (key.startsWith("/")) {
key = key.slice(1);
}
if (!(key in entryTypes)) {
console.warn("Unavailable key requested for parsing:", key);
return;
}
}
const type = entryTypes[key];
dataRecordPositions[key].forEach((position) => {
const [record, _] = decoder!.getRecordAtPosition(position);
Expand Down
2 changes: 2 additions & 0 deletions src/hub/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ declare global {
typeMemory: SourceListTypeMemory;
platform: string;
platformRelease: string;
platformArch: string;
appVersion: string;
isFullscreen: boolean;
isFocused: boolean;
Expand Down Expand Up @@ -565,6 +566,7 @@ async function handleMainMessage(message: NamedMessage) {
case "set-version":
window.platform = message.data.platform;
window.platformRelease = message.data.platformRelease;
window.platformArch = message.data.platformArch;
window.appVersion = message.data.appVersion;
updateFancyWindow();
break;
Expand Down
Loading

0 comments on commit 1130038

Please sign in to comment.