Skip to content

Commit

Permalink
Add missing active fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Sep 23, 2024
1 parent 5d5e50f commit 6d69f00
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/hub/controllers/OdometryController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 7 additions & 1 deletion src/hub/controllers/ThreeDimensionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
grabSwerveStates
} from "../../shared/geometry";
import {
ALLIANCE_KEYS,
DRIVER_STATION_KEYS,
MechanismState,
getDriverStation,
getIsRedAlliance,
Expand Down Expand Up @@ -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 {
Expand Down
18 changes: 14 additions & 4 deletions src/hub/dataSources/HistoricalDataSource.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
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",
".hoot": "hub$wpilogWorker.js", // Converted to WPILOG by main process
".dslog": "hub$dsLogWorker.js",
".dsevents": "hub$dsLogWorker.js"
};
private UUID = createUUID();

private path = "";
private keyPrefix = "";
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 6d69f00

Please sign in to comment.