Convert to user selected camera matching (#1556)

This commit is contained in:
oh-yes-0-fps
2025-01-01 03:04:20 -05:00
committed by GitHub
parent b2e70a7257
commit 418eada0b5
67 changed files with 2710 additions and 1948 deletions

View File

@@ -67,6 +67,7 @@ export interface MultitagResult {
}
export interface PipelineResult {
sequenceID: number;
fps: number;
latency: number;
targets: PhotonTarget[];

View File

@@ -1,5 +1,6 @@
import { type ActivePipelineSettings, DefaultAprilTagPipelineSettings } from "@/types/PipelineTypes";
import type { Pose3d } from "@/types/PhotonTrackingTypes";
import type { WebsocketCameraSettingsUpdate } from "./WebsocketDataTypes";
export interface GeneralSettings {
version?: string;
@@ -56,6 +57,52 @@ export type ConfigurableNetworkSettings = Omit<
"canManage" | "networkInterfaceNames" | "networkingDisabled"
>;
export interface PVCameraInfoBase {
/*
Huge hack. In Jackson, this is set based on the underlying type -- this
then maps to one of the 3 subclasses here below. Not sure how to best deal with this.
*/
cameraTypename: "PVUsbCameraInfo" | "PVCSICameraInfo" | "PVFileCameraInfo";
}
export interface PVUsbCameraInfo {
dev: number;
name: string;
otherPaths: string[];
path: string;
vendorId: number;
productId: number;
// In Java, PVCameraInfo provides a uniquePath property so we can have one Source of Truth here
uniquePath: string;
}
export interface PVCSICameraInfo {
baseName: string;
path: string;
// In Java, PVCameraInfo provides a uniquePath property so we can have one Source of Truth here
uniquePath: string;
}
export interface PVFileCameraInfo {
path: string;
name: string;
// In Java, PVCameraInfo provides a uniquePath property so we can have one Source of Truth here
uniquePath: string;
}
// This camera info will only ever hold one of its members - the others should be undefined.
export class PVCameraInfo {
PVUsbCameraInfo: PVUsbCameraInfo | undefined;
PVCSICameraInfo: PVCSICameraInfo | undefined;
PVFileCameraInfo: PVFileCameraInfo | undefined;
}
export interface VsmState {
disabledConfigs: WebsocketCameraSettingsUpdate[];
allConnectedCameras: PVCameraInfo[];
}
export interface LightingSettings {
supported: boolean;
brightness: number;
@@ -172,7 +219,9 @@ export interface QuirkyCamera {
quirks: Record<ValidQuirks, boolean>;
}
export interface CameraSettings {
export interface UiCameraConfiguration {
cameraPath: string;
nickname: string;
uniqueName: string;
@@ -201,6 +250,10 @@ export interface CameraSettings {
minWhiteBalanceTemp: number;
maxWhiteBalanceTemp: number;
matchedCameraInfo: PVCameraInfo;
isConnected: boolean;
hasConnected: boolean;
}
export interface CameraSettingsChangeRequest {
@@ -208,7 +261,9 @@ export interface CameraSettingsChangeRequest {
quirksToChange: Record<ValidQuirks, boolean>;
}
export const PlaceholderCameraSettings: CameraSettings = {
export const PlaceholderCameraSettings: UiCameraConfiguration = {
cameraPath: "/dev/null",
nickname: "Placeholder Camera",
uniqueName: "Placeholder Name",
fov: {
@@ -307,7 +362,18 @@ export const PlaceholderCameraSettings: CameraSettings = {
minExposureRaw: 1,
maxExposureRaw: 100,
minWhiteBalanceTemp: 2000,
maxWhiteBalanceTemp: 10000
maxWhiteBalanceTemp: 10000,
matchedCameraInfo: {
PVFileCameraInfo: {
name: "Foobar",
path: "/dev/foobar",
uniquePath: "/dev/foobar2"
},
PVCSICameraInfo: undefined,
PVUsbCameraInfo: undefined
},
isConnected: true,
hasConnected: true
};
export enum CalibrationBoardTypes {

View File

@@ -5,7 +5,9 @@ import type {
LogLevel,
MetricData,
NetworkSettings,
QuirkyCamera
PVCameraInfo,
QuirkyCamera,
VsmState
} from "@/types/SettingTypes";
import type { ActivePipelineSettings } from "@/types/PipelineTypes";
import type { AprilTagFieldLayout, PipelineResult } from "@/types/PhotonTrackingTypes";
@@ -44,7 +46,9 @@ export type WebsocketVideoFormat = Record<
}
>;
// Companion to UICameraConfiguration in Java
export interface WebsocketCameraSettingsUpdate {
cameraPath: string;
calibrations: CameraCalibrationResult[];
currentPipelineIndex: number;
currentPipelineSettings: ActivePipelineSettings;
@@ -62,6 +66,9 @@ export interface WebsocketCameraSettingsUpdate {
maxExposureRaw: number;
minWhiteBalanceTemp: number;
maxWhiteBalanceTemp: number;
matchedCameraInfo: PVCameraInfo;
isConnected: boolean;
hasConnected: boolean;
}
export interface WebsocketNTUpdate {
connected: boolean;
@@ -98,6 +105,7 @@ export interface IncomingWebsocketData {
mutatePipelineSettings?: Partial<ActivePipelineSettings>;
cameraIndex?: number; // Sent when mutating pipeline settings to check against currently active
calibrationData?: WebsocketCalibrationData;
visionSourceManager?: VsmState;
}
export enum WebsocketPipelineType {