Skip to content

Commit

Permalink
Isolated at least one issue to pickup interface
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay committed Aug 30, 2024
1 parent 43f9225 commit e6617c5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 49 deletions.
16 changes: 8 additions & 8 deletions fission/src/Synthesis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ import DriverStationPanel from "@/panels/simulation/DriverStationPanel"
import PokerPanel from "@/panels/PokerPanel.tsx"
import World from "@/systems/World.ts"
import ImportLocalMirabufModal from "@/modals/mirabuf/ImportLocalMirabufModal.tsx"
import ImportMirabufPanel from "@/ui/panels/mirabuf/ImportMirabufPanel.tsx"
// import ImportMirabufPanel from "@/ui/panels/mirabuf/ImportMirabufPanel.tsx"
import Skybox from "./ui/components/Skybox.tsx"
import ChooseInputSchemePanel from "./ui/panels/configuring/ChooseInputSchemePanel.tsx"
// import ChooseInputSchemePanel from "./ui/panels/configuring/ChooseInputSchemePanel.tsx"
import ProgressNotifications from "./ui/components/ProgressNotification.tsx"
import SceneOverlay from "./ui/components/SceneOverlay.tsx"

Expand All @@ -54,8 +54,8 @@ import Lazy from "./util/Lazy.ts"
import RCConfigPWMGroupModal from "@/modals/configuring/rio-config/RCConfigPWMGroupModal.tsx"
import RCConfigCANGroupModal from "@/modals/configuring/rio-config/RCConfigCANGroupModal.tsx"
import DebugPanel from "./ui/panels/DebugPanel.tsx"
import NewInputSchemeModal from "./ui/modals/configuring/theme-editor/NewInputSchemeModal.tsx"
import AssignNewSchemeModal from "./ui/modals/configuring/theme-editor/AssignNewSchemeModal.tsx"
// import NewInputSchemeModal from "./ui/modals/configuring/theme-editor/NewInputSchemeModal.tsx"
// import AssignNewSchemeModal from "./ui/modals/configuring/theme-editor/AssignNewSchemeModal.tsx"
import AnalyticsConsent from "./ui/components/AnalyticsConsent.tsx"
import PreferencesSystem from "./systems/preferences/PreferencesSystem.ts"
import APSManagementModal from "./ui/modals/APSManagementModal.tsx"
Expand Down Expand Up @@ -203,8 +203,8 @@ const initialModals = [
<ChooseSingleplayerModeModal key="singleplayer-mode" modalId="singleplayer-mode" />,
<PracticeSettingsModal key="practice-settings" modalId="practice-settings" />,
<DeleteThemeModal key="delete-theme" modalId="delete-theme" />,
<NewInputSchemeModal key="new-scheme" modalId="new-scheme" />,
<AssignNewSchemeModal key="assign-new-scheme" modalId="assign-new-scheme" />,
// <NewInputSchemeModal key="new-scheme" modalId="new-scheme" />,
// <AssignNewSchemeModal key="assign-new-scheme" modalId="assign-new-scheme" />,
<DeleteAllThemesModal key="delete-all-themes" modalId="delete-all-themes" />,
<NewThemeModal key="new-theme" modalId="new-theme" />,
<RCCreateDeviceModal key="create-device" modalId="create-device" />,
Expand All @@ -222,9 +222,9 @@ const initialPanels: ReactElement[] = [
<DriverStationPanel key="driver-station" panelId="driver-station" />,
<SpawnLocationsPanel key="spawn-locations" panelId="spawn-locations" />,
<ScoreboardPanel key="scoreboard" panelId="scoreboard" openLocation="top" sidePadding={8} />,
<ImportMirabufPanel key="import-mirabuf" panelId="import-mirabuf" />,
// <ImportMirabufPanel key="import-mirabuf" panelId="import-mirabuf" />,
<PokerPanel key="poker" panelId="poker" />,
<ChooseInputSchemePanel key="choose-scheme" panelId="choose-scheme" />,
// <ChooseInputSchemePanel key="choose-scheme" panelId="choose-scheme" />,
<WSViewPanel key="ws-view" panelId="ws-view" />,
<DebugPanel key="debug" panelId="debug" />,
<ConfigurePanel key="configure" panelId="configure" />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import Panel, { PanelPropsImpl } from "@/ui/components/Panel"
import SelectMenu, { SelectMenuOption } from "@/ui/components/SelectMenu"
import { ToggleButton, ToggleButtonGroup } from "@/ui/components/ToggleButtonGroup"
import { useEffect, useMemo, useReducer, useState } from "react"
import ConfigureScoringZonesInterface from "./interfaces/scoring/ConfigureScoringZonesInterface"
import ChangeInputsInterface from "./interfaces/inputs/ConfigureInputsInterface"
// import ConfigureScoringZonesInterface from "./interfaces/scoring/ConfigureScoringZonesInterface"
// import ChangeInputsInterface from "./interfaces/inputs/ConfigureInputsInterface"
import InputSystem from "@/systems/input/InputSystem"
import SynthesisBrain from "@/systems/simulation/synthesis_brain/SynthesisBrain"
import { usePanelControlContext } from "@/ui/PanelContext"
import Button from "@/ui/components/Button"
import { setSelectedBrainIndexGlobal } from "../ChooseInputSchemePanel"
import ConfigureSchemeInterface from "./interfaces/inputs/ConfigureSchemeInterface"
// import { setSelectedBrainIndexGlobal } from "../ChooseInputSchemePanel"
// import ConfigureSchemeInterface from "./interfaces/inputs/ConfigureSchemeInterface"
import { SynthesisIcons } from "@/ui/components/StyledComponents"
import ConfigureSubsystemsInterface from "./interfaces/ConfigureSubsystemsInterface"
import SequentialBehaviorsInterface from "./interfaces/SequentialBehaviorsInterface"
import ConfigureShotTrajectoryInterface from "./interfaces/ConfigureShotTrajectoryInterface"
// import ConfigureSubsystemsInterface from "./interfaces/ConfigureSubsystemsInterface"
// import SequentialBehaviorsInterface from "./interfaces/SequentialBehaviorsInterface"
// import ConfigureShotTrajectoryInterface from "./interfaces/ConfigureShotTrajectoryInterface"
import ConfigureGamepiecePickupInterface from "./interfaces/ConfigureGamepiecePickupInterface"

enum ConfigMode {
Expand Down Expand Up @@ -125,7 +125,7 @@ class ConfigModeSelectionOption extends SelectMenuOption {
}
}

const robotModes = [
const robotModes: ConfigModeSelectionOption[] = [
new ConfigModeSelectionOption("Intake", ConfigMode.INTAKE),
new ConfigModeSelectionOption("Ejector", ConfigMode.EJECTOR),
new ConfigModeSelectionOption(
Expand All @@ -140,7 +140,9 @@ const robotModes = [
),
new ConfigModeSelectionOption("Controls", ConfigMode.CONTROLS),
]
const fieldModes = [new ConfigModeSelectionOption("Scoring Zones", ConfigMode.SCORING_ZONES)]
const fieldModes: ConfigModeSelectionOption[] = [
new ConfigModeSelectionOption("Scoring Zones", ConfigMode.SCORING_ZONES)
]

interface ConfigModeSelectionProps {
configurationType: ConfigurationType
Expand Down Expand Up @@ -171,39 +173,40 @@ const ConfigInterface: React.FC<ConfigInterfaceProps> = ({ configMode, assembly,
switch (configMode) {
case ConfigMode.INTAKE:
return <ConfigureGamepiecePickupInterface selectedRobot={assembly} />
case ConfigMode.EJECTOR:
return <ConfigureShotTrajectoryInterface selectedRobot={assembly} />
case ConfigMode.SUBSYSTEMS:
return <ConfigureSubsystemsInterface selectedRobot={assembly} />
case ConfigMode.CONTROLS: {
const brainIndex = (assembly.brain as SynthesisBrain).brainIndex
const scheme = InputSystem.brainIndexSchemeMap.get(brainIndex)
// case ConfigMode.EJECTOR:
// return <ConfigureShotTrajectoryInterface selectedRobot={assembly} />
// case ConfigMode.SUBSYSTEMS:
// return <ConfigureSubsystemsInterface selectedRobot={assembly} />
// case ConfigMode.CONTROLS: {
// const brainIndex = (assembly.brain as SynthesisBrain).brainIndex
// const scheme = InputSystem.brainIndexSchemeMap.get(brainIndex)

return (
<>
<Button
value="Set Scheme"
onClick={() => {
setSelectedBrainIndexGlobal(brainIndex)
openPanel("choose-scheme")
}}
/>
{scheme && <ConfigureSchemeInterface selectedScheme={scheme} />}
</>
)
}
case ConfigMode.SEQUENTIAL:
return <SequentialBehaviorsInterface selectedRobot={assembly} />
case ConfigMode.SCORING_ZONES: {
const zones = assembly.fieldPreferences?.scoringZones
if (zones == undefined) {
console.error("Field does not contain scoring zone preferences!")
return <Label>ERROR: Field does not contain scoring zone configuration!</Label>
}
return <ConfigureScoringZonesInterface selectedField={assembly} initialZones={zones} />
}
// return (
// <>
// <Button
// value="Set Scheme"
// onClick={() => {
// setSelectedBrainIndexGlobal(brainIndex)
// openPanel("choose-scheme")
// }}
// />
// {scheme && <ConfigureSchemeInterface selectedScheme={scheme} />}
// </>
// )
// }
// case ConfigMode.SEQUENTIAL:
// return <SequentialBehaviorsInterface selectedRobot={assembly} />
// case ConfigMode.SCORING_ZONES: {
// const zones = assembly.fieldPreferences?.scoringZones
// if (zones == undefined) {
// console.error("Field does not contain scoring zone preferences!")
// return <Label>ERROR: Field does not contain scoring zone configuration!</Label>
// }
// return <ConfigureScoringZonesInterface selectedField={assembly} initialZones={zones} />
// }
default:
throw new Error(`Config mode ${configMode} has no associated interface`)
return <></>
// throw new Error(`Config mode ${configMode} has no associated interface`)
}
}

Expand Down Expand Up @@ -270,7 +273,8 @@ const ConfigurePanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
<ToggleButton value={ConfigurationType.INPUTS}>Inputs</ToggleButton>
</ToggleButtonGroup>
{configurationType == ConfigurationType.INPUTS ? (
<ChangeInputsInterface />
// <ChangeInputsInterface />
<></>
) : (
<>
{/** Select menu to pick a robot or field */}
Expand Down

0 comments on commit e6617c5

Please sign in to comment.