Work on adding custom pipeline

This commit is contained in:
astatin3
2024-12-09 08:25:41 -07:00
parent 9e4ab26005
commit e19463d624
3 changed files with 72 additions and 1 deletions
@@ -0,0 +1,39 @@
<script setup lang="ts">
import { PipelineType } from "@/types/PipelineTypes";
import PvSelect from "@/components/common/pv-select.vue";
import PvSlider from "@/components/common/pv-slider.vue";
import PvSwitch from "@/components/common/pv-switch.vue";
import { computed, getCurrentInstance } from "vue";
import { useStateStore } from "@/stores/StateStore";
import type { ActivePipelineSettings } from "@/types/PipelineTypes";
import { useCameraSettingsStore } from "@/stores/settings/CameraSettingsStore";
// TODO fix pipeline typing in order to fix this, the store settings call should be able to infer that only valid pipeline type settings are exposed based on pre-checks for the entire config section
// Defer reference to store access method
const currentPipelineSettings = computed<ActivePipelineSettings>(
() => useCameraSettingsStore().currentPipelineSettings
);
const interactiveCols = computed(() =>
(getCurrentInstance()?.proxy.$vuetify.breakpoint.mdAndDown || false) &&
(!useStateStore().sidebarFolded || useCameraSettingsStore().isDriverMode)
? 9
: 8
);
</script>
<template>
<div v-if="currentPipelineSettings.pipelineType === PipelineType.AprilTag">
<pv-slider
v-model="currentPipelineSettings.blur"
class="pt-2"
:slider-cols="interactiveCols"
label="Blur"
tooltip="Gaussian blur added to the image, high FPS cost for slightly decreased noise"
:min="0"
:max="5"
:step="0.1"
@input="(value) => useCameraSettingsStore().changeCurrentPipelineSetting({ blur: value }, false)"
/>
</div>
</template>
+27 -1
View File
@@ -6,7 +6,8 @@ export enum PipelineType {
ColoredShape = 3,
AprilTag = 4,
Aruco = 5,
ObjectDetection = 6
ObjectDetection = 6,
CustomTest = 7
}
export enum AprilTagFamily {
@@ -316,6 +317,29 @@ export const DefaultObjectDetectionPipelineSettings: ObjectDetectionPipelineSett
model: ""
};
export interface CustomTestPipelineSettings extends PipelineSettings {
pipelineType: PipelineType.AprilTag;
test1: number;
test2: number;
test3: number;
}
export type ConfigurableCustomTestPipelineSettings = Partial<
Omit<CustomTestPipelineSettings, "pipelineType" | "hammingDist" | "debug">
> &
ConfigurablePipelineSettings;
export const DefaultCustomTestPipelineSettings: CustomTestPipelineSettings = {
...DefaultPipelineSettings,
pipelineType: PipelineType.AprilTag,
cameraGain: 20,
targetModel: TargetModel.InfiniteRechargeHighGoalOuter,
ledMode: true,
outputShowMultipleTargets: false,
cameraExposureRaw: 6,
test1: 1,
test2: 2,
test3: 3
};
export interface Calibration3dPipelineSettings extends PipelineSettings {
drawAllSnapshots: boolean;
}
@@ -338,6 +362,7 @@ export type ActivePipelineSettings =
| AprilTagPipelineSettings
| ArucoPipelineSettings
| ObjectDetectionPipelineSettings
| CustomTestPipelineSettings
| Calibration3dPipelineSettings;
export type ActiveConfigurablePipelineSettings =
@@ -346,4 +371,5 @@ export type ActiveConfigurablePipelineSettings =
| ConfigurableAprilTagPipelineSettings
| ConfigurableArucoPipelineSettings
| ConfigurableObjectDetectionPipelineSettings
| ConfigurableCustomTestPipelineSettings
| ConfigurableCalibration3dPipelineSettings;
@@ -380,6 +380,12 @@ public class PipelineManager {
added.pipelineNickname = nickname;
return added;
}
case CustomTest:
{
var added = new CustomTestPipelineSettings();
added.pipelineNickname = nickname;
return added;
}
default:
{
logger.error("Got invalid pipeline type: " + type);