From 6d69f0093607590ea62bd5d322dd184b33416c6c Mon Sep 17 00:00:00 2001 From: Jonah <47046556+jwbonner@users.noreply.github.com> Date: Sun, 22 Sep 2024 22:30:40 -0400 Subject: [PATCH] Add missing active fields --- src/hub/controllers/OdometryController.ts | 8 ++++++-- .../controllers/ThreeDimensionController.ts | 8 +++++++- src/hub/dataSources/HistoricalDataSource.ts | 18 ++++++++++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/hub/controllers/OdometryController.ts b/src/hub/controllers/OdometryController.ts index 60221c4d..81096eeb 100644 --- a/src/hub/controllers/OdometryController.ts +++ b/src/hub/controllers/OdometryController.ts @@ -11,7 +11,7 @@ import { rotation3dTo2d, translation3dTo2d } from "../../shared/geometry"; -import { getIsRedAlliance } from "../../shared/log/LogUtil"; +import { ALLIANCE_KEYS, getIsRedAlliance } from "../../shared/log/LogUtil"; import { OdometryRendererCommand, OdometryRendererCommand_AnyObj, @@ -228,7 +228,11 @@ export default class OdometryController implements TabController { } getActiveFields(): string[] { - return this.sourceList.getActiveFields(); + let allianceKeys: string[] = []; + if (this.bumperSetting === "auto" || this.originSetting === "auto") { + allianceKeys = ALLIANCE_KEYS; + } + return [...this.sourceList.getActiveFields(), ...allianceKeys]; } showTimeline(): boolean { diff --git a/src/hub/controllers/ThreeDimensionController.ts b/src/hub/controllers/ThreeDimensionController.ts index a3e2d675..fb0bee92 100644 --- a/src/hub/controllers/ThreeDimensionController.ts +++ b/src/hub/controllers/ThreeDimensionController.ts @@ -9,6 +9,8 @@ import { grabSwerveStates } from "../../shared/geometry"; import { + ALLIANCE_KEYS, + DRIVER_STATION_KEYS, MechanismState, getDriverStation, getIsRedAlliance, @@ -184,7 +186,11 @@ export default class ThreeDimensionController implements TabController { } getActiveFields(): string[] { - return this.sourceList.getActiveFields(); + let allianceKeys: string[] = []; + if (this.originSetting === "auto") { + allianceKeys = ALLIANCE_KEYS; + } + return [...this.sourceList.getActiveFields(), ...allianceKeys, ...DRIVER_STATION_KEYS]; } showTimeline(): boolean { diff --git a/src/hub/dataSources/HistoricalDataSource.ts b/src/hub/dataSources/HistoricalDataSource.ts index 76170bb3..d5deeb17 100644 --- a/src/hub/dataSources/HistoricalDataSource.ts +++ b/src/hub/dataSources/HistoricalDataSource.ts @@ -1,11 +1,20 @@ import Log from "../../shared/log/Log"; import LogField from "../../shared/log/LogField"; -import { AKIT_TIMESTAMP_KEYS, applyKeyPrefix, getURCLKeys } from "../../shared/log/LogUtil"; +import { + AKIT_TIMESTAMP_KEYS, + EVENT_KEYS, + MATCH_NUMBER_KEYS, + MATCH_TYPE_KEYS, + SYSTEM_TIME_KEYS, + applyKeyPrefix, + getURCLKeys +} from "../../shared/log/LogUtil"; import LoggableType from "../../shared/log/LoggableType"; import { calcMockProgress, createUUID, scaleValue, setsEqual } from "../../shared/util"; /** A provider of historical log data (i.e. all the data is returned at once). */ export class HistoricalDataSource { + private UUID = createUUID(); private WORKER_NAMES = { ".rlog": "hub$rlogWorker.js", ".wpilog": "hub$wpilogWorker.js", @@ -13,7 +22,6 @@ export class HistoricalDataSource { ".dslog": "hub$dsLogWorker.js", ".dsevents": "hub$dsLogWorker.js" }; - private UUID = createUUID(); private path = ""; private keyPrefix = ""; @@ -221,13 +229,15 @@ export class HistoricalDataSource { if (!setsEqual(requestFields, this.lastRawRequestFields)) { this.lastRawRequestFields = new Set([...requestFields]); - // Always request schemas and AdvantageKit timestamp + // Add keys that are always requested this.log?.getFieldKeys().forEach((key) => { if (key.includes("/.schema/")) { requestFields.add(key); } }); - AKIT_TIMESTAMP_KEYS.forEach((key) => requestFields.add(key)); + [...SYSTEM_TIME_KEYS, ...AKIT_TIMESTAMP_KEYS, ...EVENT_KEYS, ...MATCH_TYPE_KEYS, ...MATCH_NUMBER_KEYS].forEach( + (key) => requestFields.add(key) + ); // Compare to existing fields requestFields.forEach((field) => {