Skip to content

Commit

Permalink
Add visible range option to heatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Dec 27, 2024
1 parent 1b41679 commit 55c691e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/hub/controllers/OdometryController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,16 @@ 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 =
timeRangeRaw === "enabled" ||
timeRangeRaw === "auto" ||
timeRangeRaw === "teleop" ||
timeRangeRaw === "teleop-no-endgame" ||
timeRangeRaw === "full"
timeRangeRaw === "full" ||
timeRangeRaw === "visible"
? timeRangeRaw
: "enabled";
}
Expand Down
6 changes: 4 additions & 2 deletions src/hub/controllers/OdometryController_Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
]
}
],
Expand All @@ -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" }
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions src/hub/controllers/ThreeDimensionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,16 @@ 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 =
timeRangeRaw === "enabled" ||
timeRangeRaw === "auto" ||
timeRangeRaw === "teleop" ||
timeRangeRaw === "teleop-no-endgame" ||
timeRangeRaw === "full"
timeRangeRaw === "full" ||
timeRangeRaw === "visible"
? timeRangeRaw
: "enabled";
}
Expand Down
6 changes: 4 additions & 2 deletions src/hub/controllers/ThreeDimensionController_Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
]
}
],
Expand All @@ -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" }
]
},
{
Expand Down
5 changes: 4 additions & 1 deletion src/shared/geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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) {
Expand Down

0 comments on commit 55c691e

Please sign in to comment.