From 55c691eee21d6ae104e942c922e0dc63f6ee4f3e Mon Sep 17 00:00:00 2001 From: Jonah <47046556+jwbonner@users.noreply.github.com> Date: Thu, 26 Dec 2024 22:20:22 -0500 Subject: [PATCH] Add visible range option to heatmap --- src/hub/controllers/OdometryController.ts | 5 +++-- src/hub/controllers/OdometryController_Config.ts | 6 ++++-- src/hub/controllers/ThreeDimensionController.ts | 5 +++-- src/hub/controllers/ThreeDimensionController_Config.ts | 6 ++++-- src/shared/geometry.ts | 5 ++++- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/hub/controllers/OdometryController.ts b/src/hub/controllers/OdometryController.ts index 81096eeb..c1bf4ac2 100644 --- a/src/hub/controllers/OdometryController.ts +++ b/src/hub/controllers/OdometryController.ts @@ -308,7 +308,7 @@ export default class OdometryController implements TabController { ); } } else { - let timeRange: "enabled" | "auto" | "teleop" | "teleop-no-endgame" | "full" = "enabled"; + let timeRange: "enabled" | "auto" | "teleop" | "teleop-no-endgame" | "full" | "visible" = "enabled"; if ("timeRange" in source.options) { let timeRangeRaw = source.options.timeRange; timeRange = @@ -316,7 +316,8 @@ export default class OdometryController implements TabController { timeRangeRaw === "auto" || timeRangeRaw === "teleop" || timeRangeRaw === "teleop-no-endgame" || - timeRangeRaw === "full" + timeRangeRaw === "full" || + timeRangeRaw === "visible" ? timeRangeRaw : "enabled"; } diff --git a/src/hub/controllers/OdometryController_Config.ts b/src/hub/controllers/OdometryController_Config.ts index f3df13e7..f8036702 100644 --- a/src/hub/controllers/OdometryController_Config.ts +++ b/src/hub/controllers/OdometryController_Config.ts @@ -443,7 +443,8 @@ const OdometryController_Config: SourceListConfig = { { key: "auto", display: "Auto" }, { key: "teleop", display: "Teleop" }, { key: "teleop-no-endgame", display: "Teleop (No Endgame)" }, - { key: "full", display: "Full Log" } + { key: "full", display: "Full Log" }, + { key: "visible", display: "Visible Range" } ] } ], @@ -468,7 +469,8 @@ const OdometryController_Config: SourceListConfig = { { key: "auto", display: "Auto" }, { key: "teleop", display: "Teleop" }, { key: "teleop-no-endgame", display: "Teleop (No Endgame)" }, - { key: "full", display: "Full Log" } + { key: "full", display: "Full Log" }, + { key: "visible", display: "Visible Range" } ] }, { diff --git a/src/hub/controllers/ThreeDimensionController.ts b/src/hub/controllers/ThreeDimensionController.ts index cecb289a..0f56f59e 100644 --- a/src/hub/controllers/ThreeDimensionController.ts +++ b/src/hub/controllers/ThreeDimensionController.ts @@ -265,7 +265,7 @@ export default class ThreeDimensionController implements TabController { ); } } else { - let timeRange: "enabled" | "auto" | "teleop" | "teleop-no-endgame" | "full" = "enabled"; + let timeRange: "enabled" | "auto" | "teleop" | "teleop-no-endgame" | "full" | "visible" = "enabled"; if ("timeRange" in source.options) { let timeRangeRaw = source.options.timeRange; timeRange = @@ -273,7 +273,8 @@ export default class ThreeDimensionController implements TabController { timeRangeRaw === "auto" || timeRangeRaw === "teleop" || timeRangeRaw === "teleop-no-endgame" || - timeRangeRaw === "full" + timeRangeRaw === "full" || + timeRangeRaw === "visible" ? timeRangeRaw : "enabled"; } diff --git a/src/hub/controllers/ThreeDimensionController_Config.ts b/src/hub/controllers/ThreeDimensionController_Config.ts index 48d50314..2129ca92 100644 --- a/src/hub/controllers/ThreeDimensionController_Config.ts +++ b/src/hub/controllers/ThreeDimensionController_Config.ts @@ -541,7 +541,8 @@ const ThreeDimensionController_Config: SourceListConfig = { { key: "auto", display: "Auto" }, { key: "teleop", display: "Teleop" }, { key: "teleop-no-endgame", display: "Teleop (No Endgame)" }, - { key: "full", display: "No Filter" } + { key: "full", display: "Full Log" }, + { key: "visible", display: "Visible Range" } ] } ], @@ -566,7 +567,8 @@ const ThreeDimensionController_Config: SourceListConfig = { { key: "auto", display: "Auto" }, { key: "teleop", display: "Teleop" }, { key: "teleop-no-endgame", display: "Teleop (No Endgame)" }, - { key: "full", display: "Full Log" } + { key: "full", display: "Full Log" }, + { key: "visible", display: "Visible Range" } ] }, { diff --git a/src/shared/geometry.ts b/src/shared/geometry.ts index c4649a4d..3097a628 100644 --- a/src/shared/geometry.ts +++ b/src/shared/geometry.ts @@ -600,7 +600,7 @@ export function grabHeatmapData( log: Log, key: string, logType: string, - timeRange: "enabled" | "auto" | "teleop" | "teleop-no-endgame" | "full", + timeRange: "enabled" | "auto" | "teleop" | "teleop-no-endgame" | "full" | "visible", uuid?: string, numberArrayFormat?: "Translation2d" | "Translation3d" | "Pose2d" | "Pose3d", numberArrayUnits?: "radians" | "degrees", @@ -624,6 +624,9 @@ export function grabHeatmapData( return currentRange?.mode === "teleop"; case "teleop-no-endgame": return currentRange?.mode === "teleop" && currentRange?.end !== undefined && currentRange?.end - timestamp > 30; + case "visible": + const timelineRange = window.selection.getTimelineRange(); + return timestamp >= timelineRange[0] && timestamp <= timelineRange[1]; } }; for (let sampleTime = log.getTimestampRange()[0]; sampleTime < log.getTimestampRange()[1]; sampleTime += HEATMAP_DT) {